From 0d6b248f768c4d6bb8e722948c645f41ece4703f Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 4 Apr 2023 14:59:33 +0200 Subject: [PATCH 001/311] feat(2fa): email 2fa Refs #5475 --- db/changes/231401/00-user.sql | 3 ++ front/salix/components/index.js | 1 + .../components/validate-email/index.html | 19 ++++++++ .../salix/components/validate-email/index.js | 48 +++++++++++++++++++ .../components/validate-email/locale/en.yml | 4 ++ .../components/validate-email/locale/es.yml | 8 ++++ .../components/validate-email/style.scss | 24 ++++++++++ front/salix/routes.js | 6 +++ 8 files changed, 113 insertions(+) create mode 100644 db/changes/231401/00-user.sql create mode 100644 front/salix/components/validate-email/index.html create mode 100644 front/salix/components/validate-email/index.js create mode 100644 front/salix/components/validate-email/locale/en.yml create mode 100644 front/salix/components/validate-email/locale/es.yml create mode 100644 front/salix/components/validate-email/style.scss diff --git a/db/changes/231401/00-user.sql b/db/changes/231401/00-user.sql new file mode 100644 index 000000000..2c457c14e --- /dev/null +++ b/db/changes/231401/00-user.sql @@ -0,0 +1,3 @@ +alter table `account`.`user` + add `2FA` ENUM ('email') null comment 'Two factor auth type'; + diff --git a/front/salix/components/index.js b/front/salix/components/index.js index 8f5724862..5851f9e94 100644 --- a/front/salix/components/index.js +++ b/front/salix/components/index.js @@ -9,6 +9,7 @@ import './login'; import './outLayout'; import './recover-password'; import './reset-password'; +import './validate-email'; import './module-card'; import './module-main'; import './side-menu/side-menu'; diff --git a/front/salix/components/validate-email/index.html b/front/salix/components/validate-email/index.html new file mode 100644 index 000000000..bdbdc113e --- /dev/null +++ b/front/salix/components/validate-email/index.html @@ -0,0 +1,19 @@ +
Reset password
+ + + + + diff --git a/front/salix/components/validate-email/index.js b/front/salix/components/validate-email/index.js new file mode 100644 index 000000000..c10e1b2b0 --- /dev/null +++ b/front/salix/components/validate-email/index.js @@ -0,0 +1,48 @@ +import ngModule from '../../module'; +import './style.scss'; + +export default class Controller { + constructor($scope, $element, $http, vnApp, $translate, $state, $location) { + Object.assign(this, { + $scope, + $element, + $http, + vnApp, + $translate, + $state, + $location + }); + } + + $onInit() { + this.$http.get('UserPasswords/findOne') + .then(res => { + this.passRequirements = res.data; + }); + } + + submit() { + if (!this.newPassword) + throw new UserError(`You must enter a new password`); + if (this.newPassword != this.repeatPassword) + throw new UserError(`Passwords don't match`); + + const headers = { + Authorization: this.$location.$$search.access_token + }; + + const newPassword = this.newPassword; + + this.$http.post('users/reset-password', {newPassword}, {headers}) + .then(() => { + this.vnApp.showSuccess(this.$translate.instant('Password changed!')); + this.$state.go('login'); + }); + } +} +Controller.$inject = ['$scope', '$element', '$http', 'vnApp', '$translate', '$state', '$location']; + +ngModule.vnComponent('vnValidateEmail', { + template: require('./index.html'), + controller: Controller +}); diff --git a/front/salix/components/validate-email/locale/en.yml b/front/salix/components/validate-email/locale/en.yml new file mode 100644 index 000000000..e5419e1c8 --- /dev/null +++ b/front/salix/components/validate-email/locale/en.yml @@ -0,0 +1,4 @@ +Password requirements: > + The password must have at least {{ length }} length characters, + {{nAlpha}} alphabetic characters, {{nUpper}} capital letters, {{nDigits}} + digits and {{nPunct}} symbols (Ex: $%&.) diff --git a/front/salix/components/validate-email/locale/es.yml b/front/salix/components/validate-email/locale/es.yml new file mode 100644 index 000000000..30893a152 --- /dev/null +++ b/front/salix/components/validate-email/locale/es.yml @@ -0,0 +1,8 @@ +Reset password: Restrablecer contraseña +New password: Nueva contraseña +Repeat password: Repetir contraseña +Password changed!: ¡Contraseña cambiada! +Password requirements: > + La contraseña debe tener al menos {{ length }} caracteres de longitud, + {{nAlpha}} caracteres alfabéticos, {{nUpper}} letras mayúsculas, {{nDigits}} + dígitos y {{nPunct}} símbolos (Ej: $%&.) diff --git a/front/salix/components/validate-email/style.scss b/front/salix/components/validate-email/style.scss new file mode 100644 index 000000000..87e4adc8c --- /dev/null +++ b/front/salix/components/validate-email/style.scss @@ -0,0 +1,24 @@ +@import "variables"; + +vn-reset-password{ + .footer { + margin-top: 32px; + text-align: center; + position: relative; + & > .vn-submit { + display: block; + + & > input { + display: block; + width: 100%; + } + } + & > .spinner-wrapper { + position: absolute; + width: 0; + top: 3px; + right: -8px; + overflow: visible; + } + } +} diff --git a/front/salix/routes.js b/front/salix/routes.js index f32c143ef..9498e84d9 100644 --- a/front/salix/routes.js +++ b/front/salix/routes.js @@ -33,6 +33,12 @@ function config($stateProvider, $urlRouterProvider) { description: 'Reset password', template: '' }) + .state('validate-email', { + parent: 'outLayout', + url: '/validate-email', + description: 'Validate email auth', + template: '' + }) .state('home', { parent: 'layout', url: '/', From 902709d61b0b9309a72419c1cec274c4f49bb39b Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 5 Apr 2023 15:22:09 +0200 Subject: [PATCH 002/311] Added authCode table --- db/changes/231401/00-authCode.sql | 13 +++++++++++++ front/core/services/auth.js | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 db/changes/231401/00-authCode.sql diff --git a/db/changes/231401/00-authCode.sql b/db/changes/231401/00-authCode.sql new file mode 100644 index 000000000..8d1b48f12 --- /dev/null +++ b/db/changes/231401/00-authCode.sql @@ -0,0 +1,13 @@ +create table `salix`.`authCode` +( + userFk int UNSIGNED not null, + code int not null, + constraint authCode_pk + primary key (userFk), + constraint authCode_unique + unique (code), + constraint authCode_user_id_fk + foreign key (userFk) references account.user (id) + on update cascade on delete cascade +); + diff --git a/front/core/services/auth.js b/front/core/services/auth.js index c15a34d94..5755f8f34 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -24,7 +24,7 @@ export default class Auth { initialize() { let criteria = { to: state => { - const outLayout = ['login', 'recover-password', 'reset-password']; + const outLayout = ['login', 'recover-password', 'reset-password', 'validate-email']; return !outLayout.some(ol => ol == state.name); } }; From 2e0325e567ef5a9a83a4fa29aba6f6fe2e48212f Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 6 Apr 2023 14:59:25 +0200 Subject: [PATCH 003/311] Validate code --- back/methods/account/login.js | 30 +++++++- back/methods/account/validate-auth.js | 73 +++++++++++++++++++ back/model-config.json | 6 ++ back/models/account.js | 1 + back/models/account.json | 10 +++ back/models/auth-code.json | 31 ++++++++ back/models/user-access.json | 36 +++++++++ db/changes/231401/00-authCode.sql | 14 ++++ db/changes/231401/00-user.sql | 2 +- front/core/services/auth.js | 17 +++++ front/salix/components/login/index.js | 26 +++++-- .../components/validate-email/index.html | 19 ++--- .../salix/components/validate-email/index.js | 47 ++++++------ loopback/locale/es.json | 8 +- loopback/util/forbiddenError.js | 9 +++ .../email/auth-code/assets/css/import.js | 13 ++++ .../email/auth-code/assets/css/style.css | 5 ++ .../templates/email/auth-code/auth-code.html | 17 +++++ print/templates/email/auth-code/auth-code.js | 15 ++++ print/templates/email/auth-code/locale/es.yml | 5 ++ 20 files changed, 331 insertions(+), 53 deletions(-) create mode 100644 back/methods/account/validate-auth.js create mode 100644 back/models/auth-code.json create mode 100644 back/models/user-access.json create mode 100644 loopback/util/forbiddenError.js create mode 100644 print/templates/email/auth-code/assets/css/import.js create mode 100644 print/templates/email/auth-code/assets/css/style.css create mode 100644 print/templates/email/auth-code/auth-code.html create mode 100755 print/templates/email/auth-code/auth-code.js create mode 100644 print/templates/email/auth-code/locale/es.yml diff --git a/back/methods/account/login.js b/back/methods/account/login.js index 7393e8374..47d4d629a 100644 --- a/back/methods/account/login.js +++ b/back/methods/account/login.js @@ -1,8 +1,9 @@ const md5 = require('md5'); const UserError = require('vn-loopback/util/user-error'); +const ForbiddenError = require('vn-loopback/util/forbiddenError'); module.exports = Self => { - Self.remoteMethod('login', { + Self.remoteMethodCtx('login', { description: 'Login a user with username/email and password', accepts: [ { @@ -26,7 +27,7 @@ module.exports = Self => { } }); - Self.login = async function(user, password) { + Self.login = async function(ctx, user, password) { let $ = Self.app.models; let token; let usesEmail = user.indexOf('@') !== -1; @@ -43,7 +44,7 @@ module.exports = Self => { ? {email: user} : {name: user}; let account = await Self.findOne({ - fields: ['active', 'password'], + fields: ['id', 'active', 'password', 'twoFactor'], where }); @@ -63,6 +64,29 @@ module.exports = Self => { } } + if (account.twoFactor === 'email') { + const authAccess = await $.UserAccess.findOne({ + where: { + userFk: account.id, + ip: ctx.req.connection.remoteAddress + } + }); + if (!authAccess) { + const code = String(Math.floor(Math.random() * 999999)); + const maxTTL = ((60 * 1000) * 5); // 5 min + await $.AuthCode.upsertWithWhere({userFk: account.id}, { + userFk: account.id, + code: code, + expires: Date.now() + maxTTL + }); + + ctx.args.code = code; + await Self.sendTemplate(ctx, 'auth-code'); + + throw new ForbiddenError(); + } + } + let loginInfo = Object.assign({password}, userInfo); token = await $.User.login(loginInfo, 'user'); return {token: token.id}; diff --git a/back/methods/account/validate-auth.js b/back/methods/account/validate-auth.js new file mode 100644 index 000000000..ba1c6a3bb --- /dev/null +++ b/back/methods/account/validate-auth.js @@ -0,0 +1,73 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('validateAuth', { + description: 'Login a user with username/email and password', + accepts: [ + { + arg: 'user', + type: 'String', + description: 'The user name or email', + required: true + }, + { + arg: 'password', + type: 'String', + description: 'The password' + }, + { + arg: 'code', + type: 'String', + description: 'The auth code' + } + ], + returns: { + type: 'object', + root: true + }, + http: { + path: `/validate-auth`, + verb: 'POST' + } + }); + + Self.validateAuth = async function(ctx, username, password, code) { + const {AuthCode, UserAccess} = Self.app.models; + + const authCode = await AuthCode.findOne({ + where: { + code: code + } + }); + + const expired = Date.now() > authCode.expires; + if (!authCode || expired) + throw new UserError('Invalid or expired verification code'); + + const user = await Self.findById(authCode.userFk, { + fields: ['name', 'twoFactor'] + }); + + if (user.name !== username) + throw new UserError('Authentication failed'); + + const headers = ctx.req.headers; + let platform = headers['sec-ch-ua-platform']; + let browser = headers['sec-ch-ua']; + + if (platform) platform = platform.replace(/['"]+/g, ''); + if (browser) browser = browser.split(';')[0].replace(/['"]+/g, ''); + + await UserAccess.upsertWithWhere({userFk: authCode.userFk}, { + userFk: authCode.userFk, + ip: ctx.req.connection.remoteAddress, + agent: headers['user-agent'], + platform: platform, + browser: browser + }); + + await authCode.destroy(); + + return Self.login(ctx, username, password); + }; +}; diff --git a/back/model-config.json b/back/model-config.json index 29676e979..91061eb32 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -5,6 +5,9 @@ "AccountingType": { "dataSource": "vn" }, + "AuthCode": { + "dataSource": "vn" + }, "Bank": { "dataSource": "vn" }, @@ -116,6 +119,9 @@ "Town": { "dataSource": "vn" }, + "UserAccess": { + "dataSource": "vn" + }, "Url": { "dataSource": "vn" }, diff --git a/back/models/account.js b/back/models/account.js index 6d71a4e52..fb9c95005 100644 --- a/back/models/account.js +++ b/back/models/account.js @@ -11,6 +11,7 @@ module.exports = Self => { require('../methods/account/set-password')(Self); require('../methods/account/recover-password')(Self); require('../methods/account/validate-token')(Self); + require('../methods/account/validate-auth')(Self); require('../methods/account/privileges')(Self); // Validations diff --git a/back/models/account.json b/back/models/account.json index 5e35c711a..3b3e2cca5 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -54,6 +54,9 @@ }, "hasGrant": { "type": "boolean" + }, + "twoFactor": { + "type": "string" } }, "relations": { @@ -113,6 +116,13 @@ "principalId": "$authenticated", "permission": "ALLOW" }, + { + "property": "validateAuth", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }, { "property": "privileges", "accessType": "*", diff --git a/back/models/auth-code.json b/back/models/auth-code.json new file mode 100644 index 000000000..b6a89115f --- /dev/null +++ b/back/models/auth-code.json @@ -0,0 +1,31 @@ +{ + "name": "AuthCode", + "base": "VnModel", + "options": { + "mysql": { + "table": "salix.authCode" + } + }, + "properties": { + "userFk": { + "type": "number", + "required": true, + "id": true + }, + "code": { + "type": "string", + "required": true + }, + "expires": { + "type": "number", + "required": true + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + } +} diff --git a/back/models/user-access.json b/back/models/user-access.json new file mode 100644 index 000000000..f60d70251 --- /dev/null +++ b/back/models/user-access.json @@ -0,0 +1,36 @@ +{ + "name": "UserAccess", + "base": "VnModel", + "options": { + "mysql": { + "table": "salix.userAccess" + } + }, + "properties": { + "userFk": { + "type": "number", + "required": true, + "id": true + }, + "ip": { + "type": "string", + "required": true + }, + "agent": { + "type": "string" + }, + "platform": { + "type": "string" + }, + "browser": { + "type": "string" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + } +} diff --git a/db/changes/231401/00-authCode.sql b/db/changes/231401/00-authCode.sql index 8d1b48f12..7f742d4af 100644 --- a/db/changes/231401/00-authCode.sql +++ b/db/changes/231401/00-authCode.sql @@ -2,6 +2,7 @@ create table `salix`.`authCode` ( userFk int UNSIGNED not null, code int not null, + expires TIMESTAMP not null, constraint authCode_pk primary key (userFk), constraint authCode_unique @@ -11,3 +12,16 @@ create table `salix`.`authCode` on update cascade on delete cascade ); +create table `salix`.`userAccess` +( + userFk int UNSIGNED not null, + ip VARCHAR(25) not null, + agent text null, + platform VARCHAR(25) null, + browser VARCHAR(25) null, + constraint userAccess_pk + primary key (userFk), + constraint userAccess_user_null_fk + foreign key (userFk) references account.user (id) +) + auto_increment = 0; \ No newline at end of file diff --git a/db/changes/231401/00-user.sql b/db/changes/231401/00-user.sql index 2c457c14e..1427d0460 100644 --- a/db/changes/231401/00-user.sql +++ b/db/changes/231401/00-user.sql @@ -1,3 +1,3 @@ alter table `account`.`user` - add `2FA` ENUM ('email') null comment 'Two factor auth type'; + add `twoFactor` ENUM ('email') null comment 'Two factor auth type'; diff --git a/front/core/services/auth.js b/front/core/services/auth.js index 5755f8f34..479696931 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -63,6 +63,23 @@ export default class Auth { json => this.onLoginOk(json, remember)); } + validateCode(user, password, code, remember) { + if (!user) { + let err = new UserError('Please enter your username'); + err.code = 'EmptyLogin'; + return this.$q.reject(err); + } + + let params = { + user: user, + password: password || undefined, + code: code + }; + + return this.$http.post('Accounts/validate-auth', params).then( + json => this.onLoginOk(json, remember)); + } + onLoginOk(json, remember) { this.vnToken.set(json.data.token, remember); diff --git a/front/salix/components/login/index.js b/front/salix/components/login/index.js index 150e896a1..78632aa99 100644 --- a/front/salix/components/login/index.js +++ b/front/salix/components/login/index.js @@ -5,13 +5,14 @@ import './style.scss'; * A simple login form. */ export default class Controller { - constructor($, $element, vnAuth) { + constructor($, $element, vnAuth, $state) { Object.assign(this, { $, $element, vnAuth, user: localStorage.getItem('lastUser'), - remember: true + remember: true, + $state }); } @@ -22,11 +23,21 @@ export default class Controller { localStorage.setItem('lastUser', this.user); this.loading = false; }) - .catch(err => { + .catch(error => { + if (error.message === 'Forbidden') { + this.outLayout.login = { + user: this.user, + password: this.password, + remember: this.remember + }; + this.$state.go('validate-email'); + return; + } + this.loading = false; this.password = ''; this.focusUser(); - throw err; + throw error; }); } @@ -35,9 +46,12 @@ export default class Controller { this.$.userField.focus(); } } -Controller.$inject = ['$scope', '$element', 'vnAuth']; +Controller.$inject = ['$scope', '$element', 'vnAuth', '$state']; ngModule.vnComponent('vnLogin', { template: require('./index.html'), - controller: Controller + controller: Controller, + require: { + outLayout: '^vnOutLayout' + } }); diff --git a/front/salix/components/validate-email/index.html b/front/salix/components/validate-email/index.html index bdbdc113e..e03cb9dcb 100644 --- a/front/salix/components/validate-email/index.html +++ b/front/salix/components/validate-email/index.html @@ -1,19 +1,10 @@ -
Reset password
- - - +
Enter verification code
+Please enter the verification code that we have sent to your email address within 5 minutes. + + \ No newline at end of file diff --git a/front/salix/components/validate-email/index.js b/front/salix/components/validate-email/index.js index c10e1b2b0..f337ab8af 100644 --- a/front/salix/components/validate-email/index.js +++ b/front/salix/components/validate-email/index.js @@ -2,47 +2,42 @@ import ngModule from '../../module'; import './style.scss'; export default class Controller { - constructor($scope, $element, $http, vnApp, $translate, $state, $location) { + constructor($scope, $element, vnAuth, $state) { Object.assign(this, { $scope, $element, - $http, - vnApp, - $translate, - $state, - $location + vnAuth, + user: localStorage.getItem('lastUser'), + remember: true, + $state }); } $onInit() { - this.$http.get('UserPasswords/findOne') - .then(res => { - this.passRequirements = res.data; - }); + this.loginData = this.outLayout.login; + if (!this.loginData) + this.$state.go('login'); } submit() { - if (!this.newPassword) - throw new UserError(`You must enter a new password`); - if (this.newPassword != this.repeatPassword) - throw new UserError(`Passwords don't match`); - - const headers = { - Authorization: this.$location.$$search.access_token - }; - - const newPassword = this.newPassword; - - this.$http.post('users/reset-password', {newPassword}, {headers}) + this.loading = true; + this.vnAuth.validateCode(this.loginData.user, this.loginData.password, this.code, this.loginData.remember) .then(() => { - this.vnApp.showSuccess(this.$translate.instant('Password changed!')); - this.$state.go('login'); + localStorage.setItem('lastUser', this.user); + this.loading = false; + }) + .catch(error => { + this.loading = false; + throw error; }); } } -Controller.$inject = ['$scope', '$element', '$http', 'vnApp', '$translate', '$state', '$location']; +Controller.$inject = ['$scope', '$element', 'vnAuth', '$state']; ngModule.vnComponent('vnValidateEmail', { template: require('./index.html'), - controller: Controller + controller: Controller, + require: { + outLayout: '^vnOutLayout' + } }); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 42276efe7..70ba15098 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -273,6 +273,8 @@ "Not exist this branch": "La rama no existe", "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado", "Insert a date range": "Inserte un rango de fechas", - "Added observation": "{{user}} añadió esta observacion: {{text}}", - "Comment added to client": "Observación añadida al cliente {{clientFk}}" -} + "Added observation": "{{user}} añadió esta observacion: {{text}}", + "Comment added to client": "Observación añadida al cliente {{clientFk}}", + "Invalid auth code": "Invalid auth code", + "Invalid or expired verification code": "Invalid or expired verification code" +} \ No newline at end of file diff --git a/loopback/util/forbiddenError.js b/loopback/util/forbiddenError.js new file mode 100644 index 000000000..998cb4593 --- /dev/null +++ b/loopback/util/forbiddenError.js @@ -0,0 +1,9 @@ +module.exports = class ForbiddenError extends Error { + constructor(message, code, ...translateArgs) { + super(message); + this.name = 'ForbiddenError'; + this.statusCode = 403; + this.code = code; + this.translateArgs = translateArgs; + } +}; diff --git a/print/templates/email/auth-code/assets/css/import.js b/print/templates/email/auth-code/assets/css/import.js new file mode 100644 index 000000000..7360587f7 --- /dev/null +++ b/print/templates/email/auth-code/assets/css/import.js @@ -0,0 +1,13 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, + `${__dirname}/style.css`]) + .mergeStyles(); + diff --git a/print/templates/email/auth-code/assets/css/style.css b/print/templates/email/auth-code/assets/css/style.css new file mode 100644 index 000000000..d3bfa2aea --- /dev/null +++ b/print/templates/email/auth-code/assets/css/style.css @@ -0,0 +1,5 @@ +.code { + border: 2px dashed #8dba25; + border-radius: 3px; + text-align: center +} \ No newline at end of file diff --git a/print/templates/email/auth-code/auth-code.html b/print/templates/email/auth-code/auth-code.html new file mode 100644 index 000000000..ea87e6c66 --- /dev/null +++ b/print/templates/email/auth-code/auth-code.html @@ -0,0 +1,17 @@ + +
+
+

{{ $t('title') }}

+

+
+
+
+
+

{{$t('Enter the following code to continue to your account')}}

+
+ {{ code }} +
+

{{$t('It expires in 5 minutes.')}}

+
+
+
\ No newline at end of file diff --git a/print/templates/email/auth-code/auth-code.js b/print/templates/email/auth-code/auth-code.js new file mode 100755 index 000000000..7ddd1c2db --- /dev/null +++ b/print/templates/email/auth-code/auth-code.js @@ -0,0 +1,15 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); + +module.exports = { + name: 'auth-code', + components: { + 'email-body': emailBody.build(), + }, + props: { + code: { + type: String, + required: true + } + } +}; diff --git a/print/templates/email/auth-code/locale/es.yml b/print/templates/email/auth-code/locale/es.yml new file mode 100644 index 000000000..b77937468 --- /dev/null +++ b/print/templates/email/auth-code/locale/es.yml @@ -0,0 +1,5 @@ +subject: Código de verificación +title: Código de verificación +description: Alguien ha solicitado un código de verificación para poder iniciar sesión. Si no lo has solicitado tu, ignora este email. +Enter the following code to continue to your account: Introduce el siguiente código para poder continuar con tu cuenta +It expires in 5 minutes.: Expira en 5 minutos From b9e48f2102e3e4214f910e9f402bf977d0e04c77 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 11 Apr 2023 07:39:43 +0200 Subject: [PATCH 004/311] Added translations & enable through departments --- db/changes/231401/00-authCode.sql | 4 ++-- db/changes/231401/00-department.sql | 24 +++++++++++++++++++ db/changes/231401/00-user.sql | 3 +-- .../components/validate-email/index.html | 2 +- .../components/validate-email/locale/en.yml | 4 ---- .../components/validate-email/locale/es.yml | 12 ++++------ .../components/validate-email/style.scss | 2 +- print/templates/email/auth-code/locale/fr.yml | 5 ++++ print/templates/email/auth-code/locale/pt.yml | 5 ++++ 9 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 db/changes/231401/00-department.sql delete mode 100644 front/salix/components/validate-email/locale/en.yml create mode 100644 print/templates/email/auth-code/locale/fr.yml create mode 100644 print/templates/email/auth-code/locale/pt.yml diff --git a/db/changes/231401/00-authCode.sql b/db/changes/231401/00-authCode.sql index 7f742d4af..0415c90f0 100644 --- a/db/changes/231401/00-authCode.sql +++ b/db/changes/231401/00-authCode.sql @@ -8,7 +8,7 @@ create table `salix`.`authCode` constraint authCode_unique unique (code), constraint authCode_user_id_fk - foreign key (userFk) references account.user (id) + foreign key (userFk) references `account`.`user` (id) on update cascade on delete cascade ); @@ -22,6 +22,6 @@ create table `salix`.`userAccess` constraint userAccess_pk primary key (userFk), constraint userAccess_user_null_fk - foreign key (userFk) references account.user (id) + foreign key (userFk) references `account`.`user` (id) ) auto_increment = 0; \ No newline at end of file diff --git a/db/changes/231401/00-department.sql b/db/changes/231401/00-department.sql new file mode 100644 index 000000000..ffc3a1622 --- /dev/null +++ b/db/changes/231401/00-department.sql @@ -0,0 +1,24 @@ +alter table `vn`.`department` + add `twoFactor` ENUM ('email') null comment 'Default user tow-factor auth type'; + +drop trigger `vn`.`department_afterUpdate`; + +DELIMITER $$ +$$ +create definer = root@localhost trigger department_afterUpdate + after update + on department + for each row +BEGIN + IF !(OLD.parentFk <=> NEW.parentFk) THEN + UPDATE vn.department_recalc SET isChanged = TRUE; + END IF; + + IF !(OLD.twoFactor <=> NEW.twoFactor) THEN + UPDATE account.user u + JOIN vn.workerDepartment wd ON wd.workerFk = u.id + SET u.twoFactor = NEW.twoFactor + WHERE wd.departmentFk = NEW.id; + END IF; +END;$$ +DELIMITER ; diff --git a/db/changes/231401/00-user.sql b/db/changes/231401/00-user.sql index 1427d0460..2a2a522c5 100644 --- a/db/changes/231401/00-user.sql +++ b/db/changes/231401/00-user.sql @@ -1,3 +1,2 @@ alter table `account`.`user` - add `twoFactor` ENUM ('email') null comment 'Two factor auth type'; - + add `twoFactor` ENUM ('email') null comment 'Two-factor auth type'; \ No newline at end of file diff --git a/front/salix/components/validate-email/index.html b/front/salix/components/validate-email/index.html index e03cb9dcb..3607e1a76 100644 --- a/front/salix/components/validate-email/index.html +++ b/front/salix/components/validate-email/index.html @@ -1,5 +1,5 @@
Enter verification code
-Please enter the verification code that we have sent to your email address within 5 minutes. +Please enter the verification code that we have sent to your email address within 5 minutes \ No newline at end of file diff --git a/print/templates/email/auth-code/locale/en.yml b/print/templates/email/auth-code/locale/en.yml new file mode 100644 index 000000000..5f63d280f --- /dev/null +++ b/print/templates/email/auth-code/locale/en.yml @@ -0,0 +1,5 @@ +subject: Verification code +title: Verification code +description: Somebody did request a verification code for login. If you didn't request it, please ignore this email. +Enter the following code to continue to your account: Enter the following code to continue to your account +It expires in 5 minutes: It expires in 5 minutes diff --git a/print/templates/email/auth-code/locale/es.yml b/print/templates/email/auth-code/locale/es.yml index b77937468..31952891b 100644 --- a/print/templates/email/auth-code/locale/es.yml +++ b/print/templates/email/auth-code/locale/es.yml @@ -2,4 +2,4 @@ subject: Código de verificación title: Código de verificación description: Alguien ha solicitado un código de verificación para poder iniciar sesión. Si no lo has solicitado tu, ignora este email. Enter the following code to continue to your account: Introduce el siguiente código para poder continuar con tu cuenta -It expires in 5 minutes.: Expira en 5 minutos +It expires in 5 minutes: Expira en 5 minutos diff --git a/print/templates/email/auth-code/locale/fr.yml b/print/templates/email/auth-code/locale/fr.yml index 34fee9d1e..e435a2487 100644 --- a/print/templates/email/auth-code/locale/fr.yml +++ b/print/templates/email/auth-code/locale/fr.yml @@ -2,4 +2,4 @@ subject: Code de vérification title: Code de vérification description: Quelqu'un a demandé un code de vérification pour se connecter. Si ce n'était pas toi, ignore cet email. Enter the following code to continue to your account: Entrez le code suivant pour continuer avec votre compte -It expires in 5 minutes.: Il expire dans 5 minutes. +It expires in 5 minutes: Il expire dans 5 minutes. diff --git a/print/templates/email/auth-code/locale/pt.yml b/print/templates/email/auth-code/locale/pt.yml index 9ffa1b2f6..940b03c4d 100644 --- a/print/templates/email/auth-code/locale/pt.yml +++ b/print/templates/email/auth-code/locale/pt.yml @@ -2,4 +2,4 @@ subject: Código de verificação title: Código de verificação description: Alguém solicitou um código de verificação para entrar. Se você não fez essa solicitação, ignore este e-mail. Enter the following code to continue to your account: Insira o seguinte código para continuar com sua conta. -It expires in 5 minutes.: Expira em 5 minutos. +It expires in 5 minutes: Expira em 5 minutos. From 4807fcb394327905ff82ca36aa8151e52dfe6a83 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 11 Apr 2023 09:01:59 +0200 Subject: [PATCH 007/311] Removed focus --- back/methods/account/specs/login.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/account/specs/login.spec.js b/back/methods/account/specs/login.spec.js index 9f6c0c17d..074d74789 100644 --- a/back/methods/account/specs/login.spec.js +++ b/back/methods/account/specs/login.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('account login()', () => { +describe('account login()', () => { const employeeId = 1; const unauthCtx = { req: { From b5f2cf3711ffcca96603273aec2fdd29595531b3 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 13 Apr 2023 11:54:56 +0200 Subject: [PATCH 008/311] Added unit test & translation fixes --- .../account/specs/validate-auth.spec.js | 41 +++++++++++++++++++ back/methods/account/validate-auth.js | 2 +- db/changes/231401/00-department.sql | 2 +- loopback/locale/es.json | 2 +- 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 back/methods/account/specs/validate-auth.spec.js diff --git a/back/methods/account/specs/validate-auth.spec.js b/back/methods/account/specs/validate-auth.spec.js new file mode 100644 index 000000000..44ea96320 --- /dev/null +++ b/back/methods/account/specs/validate-auth.spec.js @@ -0,0 +1,41 @@ +const {models} = require('vn-loopback/server/server'); + +fdescribe('account validateAuth()', () => { + const developerId = 9; + + it('should throw an error for a non existent code', async() => { + const ctx = {req: {accessToken: {userId: developerId}}}; + + let error; + try { + await models.Account.validateAuth(ctx, 'developer', 'nightmare', '123456'); + } catch (e) { + error = e; + } + + expect(error).toBeDefined(); + expect(error.statusCode).toBe(400); + expect(error.message).toEqual('Invalid or expired verification code'); + }); + + it('should throw an error when a code doesn`t match the login username', async() => { + const ctx = {req: {accessToken: {userId: developerId}}}; + + let error; + try { + const authCode = await models.AuthCode.create({ + userFk: 1, + code: '555555', + expires: Date.vnNow() + (60 * 1000) + }); + await models.Account.validateAuth(ctx, 'developer', 'nightmare', '555555'); + await authCode.destroy(); + } catch (e) { + error = e; + } + + expect(error).toBeDefined(); + expect(error.statusCode).toBe(400); + expect(error.message).toEqual('Authentication failed'); + }); +}); diff --git a/back/methods/account/validate-auth.js b/back/methods/account/validate-auth.js index ba1c6a3bb..6745b8838 100644 --- a/back/methods/account/validate-auth.js +++ b/back/methods/account/validate-auth.js @@ -40,7 +40,7 @@ module.exports = Self => { } }); - const expired = Date.now() > authCode.expires; + const expired = authCode && Date.vnNow() > authCode.expires; if (!authCode || expired) throw new UserError('Invalid or expired verification code'); diff --git a/db/changes/231401/00-department.sql b/db/changes/231401/00-department.sql index ffc3a1622..d9a91ee30 100644 --- a/db/changes/231401/00-department.sql +++ b/db/changes/231401/00-department.sql @@ -1,5 +1,5 @@ alter table `vn`.`department` - add `twoFactor` ENUM ('email') null comment 'Default user tow-factor auth type'; + add `twoFactor` ENUM ('email') null comment 'Default user two-factor auth type'; drop trigger `vn`.`department_afterUpdate`; diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 70ba15098..be9b0036a 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -275,6 +275,6 @@ "Insert a date range": "Inserte un rango de fechas", "Added observation": "{{user}} añadió esta observacion: {{text}}", "Comment added to client": "Observación añadida al cliente {{clientFk}}", - "Invalid auth code": "Invalid auth code", + "Invalid auth code": "Código de verificación incorrecto", "Invalid or expired verification code": "Invalid or expired verification code" } \ No newline at end of file From 9aaea7e8ed75499d285ac3e0754d1271dbc4cb50 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 13 Apr 2023 12:01:51 +0200 Subject: [PATCH 009/311] Changed to new SQL version --- back/methods/account/specs/validate-auth.spec.js | 2 +- db/changes/{231401 => 231601}/00-authCode.sql | 0 db/changes/{231401 => 231601}/00-department.sql | 0 db/changes/{231401 => 231601}/00-user.sql | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename db/changes/{231401 => 231601}/00-authCode.sql (100%) rename db/changes/{231401 => 231601}/00-department.sql (100%) rename db/changes/{231401 => 231601}/00-user.sql (100%) diff --git a/back/methods/account/specs/validate-auth.spec.js b/back/methods/account/specs/validate-auth.spec.js index 44ea96320..cc2eea092 100644 --- a/back/methods/account/specs/validate-auth.spec.js +++ b/back/methods/account/specs/validate-auth.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('account validateAuth()', () => { +describe('account validateAuth()', () => { const developerId = 9; it('should throw an error for a non existent code', async() => { diff --git a/db/changes/231401/00-authCode.sql b/db/changes/231601/00-authCode.sql similarity index 100% rename from db/changes/231401/00-authCode.sql rename to db/changes/231601/00-authCode.sql diff --git a/db/changes/231401/00-department.sql b/db/changes/231601/00-department.sql similarity index 100% rename from db/changes/231401/00-department.sql rename to db/changes/231601/00-department.sql diff --git a/db/changes/231401/00-user.sql b/db/changes/231601/00-user.sql similarity index 100% rename from db/changes/231401/00-user.sql rename to db/changes/231601/00-user.sql From ef87dcc0f5e0f58cb05bb8679f625c016ff2140b Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 18 Apr 2023 07:38:40 +0200 Subject: [PATCH 010/311] require authentication on every login --- back/methods/account/login.js | 37 +++------------- back/methods/account/sign-in.js | 63 +++++++++++++++++++++++++++ back/methods/account/validate-auth.js | 2 +- back/models/account.js | 1 + back/models/account.json | 2 +- front/core/services/auth.js | 2 +- 6 files changed, 72 insertions(+), 35 deletions(-) create mode 100644 back/methods/account/sign-in.js diff --git a/back/methods/account/login.js b/back/methods/account/login.js index 2eeb5a1c4..116836068 100644 --- a/back/methods/account/login.js +++ b/back/methods/account/login.js @@ -1,9 +1,8 @@ const md5 = require('md5'); const UserError = require('vn-loopback/util/user-error'); -const ForbiddenError = require('vn-loopback/util/forbiddenError'); module.exports = Self => { - Self.remoteMethodCtx('login', { + Self.remoteMethod('login', { description: 'Login a user with username/email and password', accepts: [ { @@ -27,11 +26,13 @@ module.exports = Self => { } }); - Self.login = async function(ctx, user, password) { + Self.login = async function(user, password) { let $ = Self.app.models; let token; let usesEmail = user.indexOf('@') !== -1; + console.log(user, password); + let userInfo = usesEmail ? {email: user} : {username: user}; @@ -44,7 +45,7 @@ module.exports = Self => { ? {email: user} : {name: user}; let account = await Self.findOne({ - fields: ['id', 'active', 'email', 'password', 'twoFactor'], + fields: ['id', 'active', 'password'], where }); @@ -64,34 +65,6 @@ module.exports = Self => { } } - if (account && account.twoFactor === 'email') { - const authAccess = await $.UserAccess.findOne({ - where: { - userFk: account.id, - ip: ctx.req.connection.remoteAddress - } - }); - if (!authAccess) { - const code = String(Math.floor(Math.random() * 999999)); - const maxTTL = ((60 * 1000) * 5); // 5 min - await $.AuthCode.upsertWithWhere({userFk: account.id}, { - userFk: account.id, - code: code, - expires: Date.now() + maxTTL - }); - - const params = { - recipientId: account.id, - recipient: account.email, - code: code - }; - ctx.args = {...ctx.args, ...params}; - await Self.sendTemplate(ctx, 'auth-code'); - - throw new ForbiddenError('REQUIRES_2FA'); - } - } - let loginInfo = Object.assign({password}, userInfo); token = await $.User.login(loginInfo, 'user'); return {token: token.id}; diff --git a/back/methods/account/sign-in.js b/back/methods/account/sign-in.js new file mode 100644 index 000000000..9a4f30cd4 --- /dev/null +++ b/back/methods/account/sign-in.js @@ -0,0 +1,63 @@ +const ForbiddenError = require('vn-loopback/util/forbiddenError'); + +module.exports = Self => { + Self.remoteMethodCtx('signin', { + description: 'Login a user with username/email and password', + accepts: [ + { + arg: 'user', + type: 'String', + description: 'The user name or email', + required: true + }, { + arg: 'password', + type: 'String', + description: 'The password' + } + ], + returns: { + type: 'object', + root: true + }, + http: { + path: `/signin`, + verb: 'POST' + } + }); + + Self.signin = async function(ctx, user, password) { + const $ = Self.app.models; + const usesEmail = user.indexOf('@') !== -1; + + const where = usesEmail + ? {email: user} + : {name: user}; + + const account = await Self.findOne({ + fields: ['id', 'active', 'email', 'password', 'twoFactor'], + where + }); + + if (account && account.twoFactor === 'email') { + const code = String(Math.floor(Math.random() * 999999)); + const maxTTL = ((60 * 1000) * 5); // 5 min + await $.AuthCode.upsertWithWhere({userFk: account.id}, { + userFk: account.id, + code: code, + expires: Date.now() + maxTTL + }); + + const params = { + recipientId: account.id, + recipient: account.email, + code: code + }; + ctx.args = {...ctx.args, ...params}; + await Self.sendTemplate(ctx, 'auth-code'); + + throw new ForbiddenError('REQUIRES_2FA'); + } + + return $.models.login(user, password); + }; +}; diff --git a/back/methods/account/validate-auth.js b/back/methods/account/validate-auth.js index 6745b8838..1f906f4a6 100644 --- a/back/methods/account/validate-auth.js +++ b/back/methods/account/validate-auth.js @@ -68,6 +68,6 @@ module.exports = Self => { await authCode.destroy(); - return Self.login(ctx, username, password); + return Self.login(username, password); }; }; diff --git a/back/models/account.js b/back/models/account.js index fb9c95005..28f7c467f 100644 --- a/back/models/account.js +++ b/back/models/account.js @@ -4,6 +4,7 @@ const LoopBackContext = require('loopback-context'); const {Email} = require('vn-print'); module.exports = Self => { + require('../methods/account/sign-in')(Self); require('../methods/account/login')(Self); require('../methods/account/logout')(Self); require('../methods/account/acl')(Self); diff --git a/back/models/account.json b/back/models/account.json index 3b3e2cca5..30f8acab1 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -89,7 +89,7 @@ }, "acls": [ { - "property": "login", + "property": "signin", "accessType": "EXECUTE", "principalType": "ROLE", "principalId": "$everyone", diff --git a/front/core/services/auth.js b/front/core/services/auth.js index 479696931..b90b52112 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -59,7 +59,7 @@ export default class Auth { password: password || undefined }; - return this.$http.post('Accounts/login', params).then( + return this.$http.post('Accounts/signin', params).then( json => this.onLoginOk(json, remember)); } From c2af40edb5309f37b2c46a6e4a260e40b9ac75de Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 18 Apr 2023 13:15:04 +0200 Subject: [PATCH 011/311] changes --- back/methods/vn-user/sign-in.js | 14 +++--- back/methods/vn-user/signIn.js | 68 --------------------------- back/methods/vn-user/specs/signIn.js | 2 +- back/methods/vn-user/specs/signOut.js | 4 +- back/methods/vn-user/validate-auth.js | 2 +- back/models/vn-user.js | 44 ++++++++++++++++- db/changes/231601/00-userAcl.sql | 3 +- 7 files changed, 55 insertions(+), 82 deletions(-) delete mode 100644 back/methods/vn-user/signIn.js diff --git a/back/methods/vn-user/sign-in.js b/back/methods/vn-user/sign-in.js index 9a4f30cd4..0a0133b82 100644 --- a/back/methods/vn-user/sign-in.js +++ b/back/methods/vn-user/sign-in.js @@ -33,23 +33,23 @@ module.exports = Self => { ? {email: user} : {name: user}; - const account = await Self.findOne({ + const vnUser = await Self.findOne({ fields: ['id', 'active', 'email', 'password', 'twoFactor'], where }); - if (account && account.twoFactor === 'email') { + if (vnUser && vnUser.twoFactor === 'email') { const code = String(Math.floor(Math.random() * 999999)); const maxTTL = ((60 * 1000) * 5); // 5 min - await $.AuthCode.upsertWithWhere({userFk: account.id}, { - userFk: account.id, + await $.AuthCode.upsertWithWhere({userFk: vnUser.id}, { + userFk: vnUser.id, code: code, expires: Date.now() + maxTTL }); const params = { - recipientId: account.id, - recipient: account.email, + recipientId: vnUser.id, + recipient: vnUser.email, code: code }; ctx.args = {...ctx.args, ...params}; @@ -58,6 +58,6 @@ module.exports = Self => { throw new ForbiddenError('REQUIRES_2FA'); } - return $.models.login(user, password); + return Self.validateLogin(user, password); }; }; diff --git a/back/methods/vn-user/signIn.js b/back/methods/vn-user/signIn.js deleted file mode 100644 index 5f6c7f699..000000000 --- a/back/methods/vn-user/signIn.js +++ /dev/null @@ -1,68 +0,0 @@ -const UserError = require('vn-loopback/util/user-error'); - -module.exports = Self => { - Self.remoteMethod('signIn', { - description: 'Login a user with username/email and password', - accepts: [ - { - arg: 'user', - type: 'String', - description: 'The user name or email', - http: {source: 'form'}, - required: true - }, { - arg: 'password', - type: 'String', - description: 'The password' - } - ], - returns: { - type: 'object', - root: true - }, - http: { - path: `/signIn`, - verb: 'POST' - } - }); - - Self.signIn = async function(user, password) { - let models = Self.app.models; - let token; - let usesEmail = user.indexOf('@') !== -1; - - let userInfo = usesEmail - ? {email: user} - : {username: user}; - let instance = await Self.findOne({ - fields: ['username', 'password'], - where: userInfo - }); - - let where = usesEmail - ? {email: user} - : {name: user}; - const vnUser = await Self.findOne({ - fields: ['active'], - where - }); - - let validCredentials = instance - && await instance.hasPassword(password); - - if (validCredentials) { - if (!vnUser.active) - throw new UserError('User disabled'); - - try { - await models.Account.sync(instance.username, password); - } catch (err) { - console.warn(err); - } - } - - let loginInfo = Object.assign({password}, userInfo); - token = await Self.login(loginInfo, 'user'); - return {token: token.id}; - }; -}; diff --git a/back/methods/vn-user/specs/signIn.js b/back/methods/vn-user/specs/signIn.js index 64e4d55f5..b4d619ced 100644 --- a/back/methods/vn-user/specs/signIn.js +++ b/back/methods/vn-user/specs/signIn.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('account login()', () => { +describe('account login()', () => { const employeeId = 1; const unauthCtx = { req: { diff --git a/back/methods/vn-user/specs/signOut.js b/back/methods/vn-user/specs/signOut.js index 3f224b2ff..e6ca1f156 100644 --- a/back/methods/vn-user/specs/signOut.js +++ b/back/methods/vn-user/specs/signOut.js @@ -1,12 +1,12 @@ const {models} = require('vn-loopback/server/server'); -describe('VnUser signOut()', () => { +fdescribe('VnUser signOut()', () => { it('should logout and remove token after valid login', async() => { let loginResponse = await app.models.VnUser.validateLogin('buyer', 'nightmare'); let accessToken = await app.models.AccessToken.findById(loginResponse.token); let ctx = {req: {accessToken: accessToken}}; - let logoutResponse = await models.VnUser.signOut(ctx); + let logoutResponse = await models.VnUser.logout(ctx); let tokenAfterLogout = await models.AccessToken.findById(loginResponse.token); expect(logoutResponse).toBeTrue(); diff --git a/back/methods/vn-user/validate-auth.js b/back/methods/vn-user/validate-auth.js index 1f906f4a6..312f1347a 100644 --- a/back/methods/vn-user/validate-auth.js +++ b/back/methods/vn-user/validate-auth.js @@ -68,6 +68,6 @@ module.exports = Self => { await authCode.destroy(); - return Self.login(username, password); + return Self.validateLogin(username, password); }; }; diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 84ba11794..e59c99fd1 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -5,11 +5,12 @@ const {Email} = require('vn-print'); module.exports = function(Self) { vnModel(Self); - require('../methods/vn-user/signIn')(Self); + require('../methods/vn-user/sign-in')(Self); require('../methods/vn-user/acl')(Self); require('../methods/vn-user/recover-password')(Self); require('../methods/vn-user/validate-token')(Self); require('../methods/vn-user/privileges')(Self); + require('../methods/vn-user/validate-auth')(Self); // Validations @@ -107,4 +108,45 @@ module.exports = function(Self) { return email.send(); }); + + Self.validateLogin = async function(user, password) { + let $ = Self.app.models; + let token; + let usesEmail = user.indexOf('@') !== -1; + + let userInfo = usesEmail + ? {email: user} + : {username: user}; + let instance = await $.VnUser.findOne({ + fields: ['username', 'password'], + where: userInfo + }); + + let where = usesEmail + ? {email: user} + : {name: user}; + let vnUser = await $.VnUser.findOne({ + fields: ['active'], + where + }); + + let validCredentials = instance && ( + await instance.hasPassword(password) + ); + + if (validCredentials) { + if (!vnUser.active) + throw new UserError('User disabled'); + + try { + await $.Account.sync(instance.username, password); + } catch (err) { + console.warn(err); + } + } + + let loginInfo = Object.assign({password}, userInfo); + token = await $.VnUser.login(loginInfo, 'user'); + return {token: token.id}; + }; }; diff --git a/db/changes/231601/00-userAcl.sql b/db/changes/231601/00-userAcl.sql index 64803bf18..b75a22315 100644 --- a/db/changes/231601/00-userAcl.sql +++ b/db/changes/231601/00-userAcl.sql @@ -3,8 +3,7 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('VnUser', '*', '*', 'ALLOW', 'ROLE', 'employee'), ('VnUser','acl','READ','ALLOW','ROLE','account'), ('VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'), - ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'), - ('Account','exists','READ','ALLOW','ROLE','account'); + ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'); INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES From c3443ecc7cef98304bb894244a51d5e838c417f6 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 18 Apr 2023 14:37:20 +0200 Subject: [PATCH 012/311] Updated e2e --- back/methods/vn-user/specs/signOut.js | 42 ------------------- .../vn-user/specs/validate-auth.spec.js | 4 +- ..._smartTable_searchBar_integrations.spec.js | 5 ++- front/core/services/auth.js | 2 +- modules/account/back/methods/account/login.js | 2 +- 5 files changed, 7 insertions(+), 48 deletions(-) delete mode 100644 back/methods/vn-user/specs/signOut.js diff --git a/back/methods/vn-user/specs/signOut.js b/back/methods/vn-user/specs/signOut.js deleted file mode 100644 index e6ca1f156..000000000 --- a/back/methods/vn-user/specs/signOut.js +++ /dev/null @@ -1,42 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -fdescribe('VnUser signOut()', () => { - it('should logout and remove token after valid login', async() => { - let loginResponse = await app.models.VnUser.validateLogin('buyer', 'nightmare'); - let accessToken = await app.models.AccessToken.findById(loginResponse.token); - let ctx = {req: {accessToken: accessToken}}; - - let logoutResponse = await models.VnUser.logout(ctx); - let tokenAfterLogout = await models.AccessToken.findById(loginResponse.token); - - expect(logoutResponse).toBeTrue(); - expect(tokenAfterLogout).toBeNull(); - }); - - it('should throw a 401 error when token is invalid', async() => { - let error; - let ctx = {req: {accessToken: {id: 'invalidToken'}}}; - - try { - response = await models.VnUser.signOut(ctx); - } catch (e) { - error = e; - } - - expect(error).toBeDefined(); - expect(error.statusCode).toBe(401); - }); - - it('should throw an error when no token is passed', async() => { - let error; - let ctx = {req: {accessToken: null}}; - - try { - response = await models.VnUser.signOut(ctx); - } catch (e) { - error = e; - } - - expect(error).toBeDefined(); - }); -}); diff --git a/back/methods/vn-user/specs/validate-auth.spec.js b/back/methods/vn-user/specs/validate-auth.spec.js index cc2eea092..958770b4b 100644 --- a/back/methods/vn-user/specs/validate-auth.spec.js +++ b/back/methods/vn-user/specs/validate-auth.spec.js @@ -8,7 +8,7 @@ describe('account validateAuth()', () => { let error; try { - await models.Account.validateAuth(ctx, 'developer', 'nightmare', '123456'); + await models.VnUser.validateAuth(ctx, 'developer', 'nightmare', '123456'); } catch (e) { error = e; } @@ -28,7 +28,7 @@ describe('account validateAuth()', () => { code: '555555', expires: Date.vnNow() + (60 * 1000) }); - await models.Account.validateAuth(ctx, 'developer', 'nightmare', '555555'); + await models.VnUser.validateAuth(ctx, 'developer', 'nightmare', '555555'); await authCode.destroy(); } catch (e) { error = e; diff --git a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js index a3d747f1c..b2c2291c6 100644 --- a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js +++ b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js @@ -75,11 +75,12 @@ describe('SmartTable SearchBar integration', () => { }); }); - describe('as orders', () => { + // #5573 - The amount of rows differs when loading from side menu + // https://redmine.verdnatura.es/issues/5573 + xdescribe('as orders', () => { it('should order by first id', async() => { await page.loginAndModule('developer', 'item'); await page.accessToSection('item.fixedPrice'); - await page.doSearch(); const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); diff --git a/front/core/services/auth.js b/front/core/services/auth.js index 2ab2caa62..c1242209e 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -59,7 +59,7 @@ export default class Auth { password: password || undefined }; - return this.$http.post('VnUsers/signin', params).then( + return this.$http.post('Accounts/login', params).then( json => this.onLoginOk(json, remember)); } diff --git a/modules/account/back/methods/account/login.js b/modules/account/back/methods/account/login.js index c3218172c..a512b5330 100644 --- a/modules/account/back/methods/account/login.js +++ b/modules/account/back/methods/account/login.js @@ -23,5 +23,5 @@ module.exports = Self => { } }); - Self.login = async(user, password) => Self.app.models.VnUser.signIn(user, password); + Self.login = async(user, password) => Self.app.models.VnUser.validateLogin(user, password); }; From b45b0ff8260ee221da6902cd7cff4e557fd33533 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 20 Apr 2023 08:23:46 +0200 Subject: [PATCH 013/311] refs #5066 copy project from the other --- db/changes/231601/00-ACLgetVehiclesSorted.sql | 3 ++ .../back/methods/vehicle/getVehiclesSorted.js | 28 +++++++++++++++++++ modules/route/back/models/vehicle.js | 3 ++ modules/route/front/basic-data/index.html | 5 +++- modules/route/front/basic-data/index.js | 13 +++++++++ 5 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 db/changes/231601/00-ACLgetVehiclesSorted.sql create mode 100644 modules/route/back/methods/vehicle/getVehiclesSorted.js create mode 100644 modules/route/back/models/vehicle.js diff --git a/db/changes/231601/00-ACLgetVehiclesSorted.sql b/db/changes/231601/00-ACLgetVehiclesSorted.sql new file mode 100644 index 000000000..5d3ec454d --- /dev/null +++ b/db/changes/231601/00-ACLgetVehiclesSorted.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) + VALUES + ('Vehicle','getVehiclesSorted','WRITE','ALLOW','employee'); \ No newline at end of file diff --git a/modules/route/back/methods/vehicle/getVehiclesSorted.js b/modules/route/back/methods/vehicle/getVehiclesSorted.js new file mode 100644 index 000000000..b785e5dc8 --- /dev/null +++ b/modules/route/back/methods/vehicle/getVehiclesSorted.js @@ -0,0 +1,28 @@ +module.exports = Self => { + Self.remoteMethod('getVehiclesSorted', { + description: 'Sort the vehicles by a warehouse', + accessType: 'WRITE', + accepts: [{ + arg: 'warehouseFk', + type: 'number' + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getVehiclesSorted`, + verb: `POST` + } + }); + + Self.getVehiclesSorted = async warehouseFk => { + const vehicles = await Self.rawSql(` + SELECT v.id, v.numberPlate, w.name + FROM vehicle v + JOIN warehouse w ON w.id = v.warehouseFk + ORDER BY v.warehouseFk = ? DESC, v.numberPlate ASC`, [warehouseFk]); + + return vehicles; + }; +}; diff --git a/modules/route/back/models/vehicle.js b/modules/route/back/models/vehicle.js new file mode 100644 index 000000000..459afe1c2 --- /dev/null +++ b/modules/route/back/models/vehicle.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/vehicle/getVehiclesSorted')(Self); +}; diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index 831599ae8..9888a6859 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -24,10 +24,13 @@ + + {{numberPlate}} - {{name}} + diff --git a/modules/route/front/basic-data/index.js b/modules/route/front/basic-data/index.js index b8602ed12..80626e97e 100644 --- a/modules/route/front/basic-data/index.js +++ b/modules/route/front/basic-data/index.js @@ -7,6 +7,19 @@ class Controller extends Section { this.card.reload() ); } + constructor($element, $) { + super($element, $); + this.$http.get(`UserConfigs/getUserConfig`) + .then(res => { + if (res && res.data) { + this.$http.post(`Vehicles/getVehiclesSorted`, {warehouseFk: res.data.warehouseFk}) + .then(res => { + if (res && res.data) + this.vehicles = res.data; + }); + } + }); + } } ngModule.vnComponent('vnRouteBasicData', { From 16fdfa00fda86e5fe2cba3f57ec581f36d18152b Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 20 Apr 2023 09:09:48 +0200 Subject: [PATCH 014/311] refs #5066 e2e solve --- e2e/paths/08-route/02_basic_data.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/08-route/02_basic_data.spec.js b/e2e/paths/08-route/02_basic_data.spec.js index ff8361499..6132d5e23 100644 --- a/e2e/paths/08-route/02_basic_data.spec.js +++ b/e2e/paths/08-route/02_basic_data.spec.js @@ -46,7 +46,7 @@ describe('Route basic Data path', () => { it('should confirm the vehicle was edited', async() => { const vehicle = await page.waitToGetProperty(selectors.routeBasicData.vehicle, 'value'); - expect(vehicle).toEqual('1111-IMK'); + expect(vehicle).toEqual('1111-IMK - Warehouse One'); }); it('should confirm the km start was edited', async() => { From 237c83c6f551d7b8d188a0045c9be108eee3b2fa Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 20 Apr 2023 10:20:15 +0200 Subject: [PATCH 015/311] refs #5066 getVehicleSorted small mod --- modules/route/back/methods/vehicle/getVehiclesSorted.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/route/back/methods/vehicle/getVehiclesSorted.js b/modules/route/back/methods/vehicle/getVehiclesSorted.js index b785e5dc8..9dad8b80a 100644 --- a/modules/route/back/methods/vehicle/getVehiclesSorted.js +++ b/modules/route/back/methods/vehicle/getVehiclesSorted.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethod('getVehiclesSorted', { - description: 'Sort the vehicles by a warehouse', + description: 'Sort the vehicles by warehouse', accessType: 'WRITE', accepts: [{ arg: 'warehouseFk', From c1ea1acc8c5147fbbc161cb6726b730e4607b4a0 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 26 Apr 2023 13:49:08 +0200 Subject: [PATCH 016/311] refs #4614 fear(ticket): add 'set weight' funcionality --- db/changes/231601/00-ticketWeight.sql | 7 ++ db/dump/fixtures.sql | 66 +++++++++---------- modules/ticket/back/models/ticket.json | 3 + .../ticket/front/descriptor-menu/index.html | 23 +++++++ modules/ticket/front/descriptor-menu/index.js | 9 +++ modules/ticket/front/summary/index.html | 5 ++ .../invoice-incoterms/sql/incoterms.sql | 53 +++++++-------- 7 files changed, 104 insertions(+), 62 deletions(-) create mode 100644 db/changes/231601/00-ticketWeight.sql diff --git a/db/changes/231601/00-ticketWeight.sql b/db/changes/231601/00-ticketWeight.sql new file mode 100644 index 000000000..188804348 --- /dev/null +++ b/db/changes/231601/00-ticketWeight.sql @@ -0,0 +1,7 @@ +UPDATE vn.ticket t + JOIN vn.ticketObservation o ON o.ticketFk = t.id + SET t.weight = cast(REPLACE(o.description, ',', '.') as decimal(10,2)) + WHERE o.observationTypeFk = 6; + +DELETE FROM vn.ticketObservation WHERE observationTypeFk = 6; +DELETE FROM vn.observationType WHERE id = 6; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 15ccece35..dc109e4c4 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -688,40 +688,40 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen (6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3), (7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5); -INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`) +INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`) VALUES - (1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, 'T1111111', 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T1111111', 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T2222222', 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), - (4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T3333333', 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)), - (5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T4444444', 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)), - (6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, 'A1111111', 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE()), - (8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE()), - (9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE()), - (10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE()), - (12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE()), - (14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE()), - (15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE()), - (16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE()), - (17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE()), - (18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, util.VN_CURDATE()), - (19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE()), - (20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), - (21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), - (22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), - (23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE()), - (24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE()), - (25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()); + (1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, 'T1111111', 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1), + (2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T1111111', 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2), + (3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T2222222', 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL), + (4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T3333333', 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL), + (5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T4444444', 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL), + (6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, 'A1111111', 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL), + (7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), + (8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), + (9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), + (10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL), + (11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), + (12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL), + (13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), + (14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL), + (15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), + (16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), + (17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), + (18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, util.VN_CURDATE(), NULL), + (19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL), + (20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL), + (21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL), + (22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL), + (23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL), + (24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL), + (25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL), + (26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL), + (27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL), + (28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL), + (29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL), + (30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL), + (31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL), + (32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL); INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index b2e87362f..ec4193bed 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -60,6 +60,9 @@ }, "totalWithoutVat": { "type": "number" + }, + "weight": { + "type": "number" } }, "relations": { diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index c2ebc3e3a..64204feb7 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -148,6 +148,12 @@ translate> Refund all + + Set ticket weight + @@ -341,3 +347,20 @@ question="Are you sure you want to replace this delivery note?" message="Already exist signed delivery note"> + + + + + + + + + + + diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 1a88b00d5..c9cad9bd2 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -335,6 +335,15 @@ class Controller extends Section { this.vnApp.showSuccess(this.$t('PDF sent!')); }); } + + setTicketWeight(weight) { + return this.$http.patch(`Tickets/${this.ticket.id}`, {weight}) + .then(() => { + this.$.setTicketWeight.hide(); + this.vnApp.showSuccess(this.$t('Data saved!')); + this.reload(); + }); + } } Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail']; diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 97055208b..dd0e94f42 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -65,6 +65,11 @@ {{$ctrl.summary.refFk | dashIfEmpty}} + + + {{$ctrl.summary.weight | dashIfEmpty}} + + Date: Tue, 9 May 2023 07:11:21 +0200 Subject: [PATCH 017/311] correct folder --- db/changes/232001/00-authCode.sql | 27 +++++++++++++++++++++++ db/changes/232001/00-department.sql | 24 ++++++++++++++++++++ db/changes/{231801 => 232001}/00-user.sql | 0 3 files changed, 51 insertions(+) create mode 100644 db/changes/232001/00-authCode.sql create mode 100644 db/changes/232001/00-department.sql rename db/changes/{231801 => 232001}/00-user.sql (100%) diff --git a/db/changes/232001/00-authCode.sql b/db/changes/232001/00-authCode.sql new file mode 100644 index 000000000..0415c90f0 --- /dev/null +++ b/db/changes/232001/00-authCode.sql @@ -0,0 +1,27 @@ +create table `salix`.`authCode` +( + userFk int UNSIGNED not null, + code int not null, + expires TIMESTAMP not null, + constraint authCode_pk + primary key (userFk), + constraint authCode_unique + unique (code), + constraint authCode_user_id_fk + foreign key (userFk) references `account`.`user` (id) + on update cascade on delete cascade +); + +create table `salix`.`userAccess` +( + userFk int UNSIGNED not null, + ip VARCHAR(25) not null, + agent text null, + platform VARCHAR(25) null, + browser VARCHAR(25) null, + constraint userAccess_pk + primary key (userFk), + constraint userAccess_user_null_fk + foreign key (userFk) references `account`.`user` (id) +) + auto_increment = 0; \ No newline at end of file diff --git a/db/changes/232001/00-department.sql b/db/changes/232001/00-department.sql new file mode 100644 index 000000000..d9a91ee30 --- /dev/null +++ b/db/changes/232001/00-department.sql @@ -0,0 +1,24 @@ +alter table `vn`.`department` + add `twoFactor` ENUM ('email') null comment 'Default user two-factor auth type'; + +drop trigger `vn`.`department_afterUpdate`; + +DELIMITER $$ +$$ +create definer = root@localhost trigger department_afterUpdate + after update + on department + for each row +BEGIN + IF !(OLD.parentFk <=> NEW.parentFk) THEN + UPDATE vn.department_recalc SET isChanged = TRUE; + END IF; + + IF !(OLD.twoFactor <=> NEW.twoFactor) THEN + UPDATE account.user u + JOIN vn.workerDepartment wd ON wd.workerFk = u.id + SET u.twoFactor = NEW.twoFactor + WHERE wd.departmentFk = NEW.id; + END IF; +END;$$ +DELIMITER ; diff --git a/db/changes/231801/00-user.sql b/db/changes/232001/00-user.sql similarity index 100% rename from db/changes/231801/00-user.sql rename to db/changes/232001/00-user.sql From 91edc09057b9660fada62e4d243fa8836be12820 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 29 May 2023 10:24:37 +0200 Subject: [PATCH 018/311] refs #5066 move sql --- db/changes/232401/00-ACLgetVehiclesSorted.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 db/changes/232401/00-ACLgetVehiclesSorted.sql diff --git a/db/changes/232401/00-ACLgetVehiclesSorted.sql b/db/changes/232401/00-ACLgetVehiclesSorted.sql new file mode 100644 index 000000000..5d3ec454d --- /dev/null +++ b/db/changes/232401/00-ACLgetVehiclesSorted.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) + VALUES + ('Vehicle','getVehiclesSorted','WRITE','ALLOW','employee'); \ No newline at end of file From d8e7c2700a110bde087ae5bee817fe6fc997acfb Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 29 May 2023 12:42:27 +0200 Subject: [PATCH 019/311] refs #5066 fix autocomplete --- e2e/paths/08-route/02_basic_data.spec.js | 2 +- front/core/components/autocomplete/index.js | 14 +++++++++++++- .../back/methods/vehicle/getVehiclesSorted.js | 10 ++++++---- modules/route/front/basic-data/index.html | 8 +++----- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/e2e/paths/08-route/02_basic_data.spec.js b/e2e/paths/08-route/02_basic_data.spec.js index 6008b0482..7ab7dda42 100644 --- a/e2e/paths/08-route/02_basic_data.spec.js +++ b/e2e/paths/08-route/02_basic_data.spec.js @@ -24,7 +24,7 @@ describe('Route basic Data path', () => { const form = 'vn-route-basic-data form'; const values = { worker: 'adminBossNick', - vehicle: '1111-IMK - Warehouse One', + vehicle: '1111-IMK', created: nextMonth, kmStart: 1, kmEnd: 2, diff --git a/front/core/components/autocomplete/index.js b/front/core/components/autocomplete/index.js index 2539c4ef4..52491f7e0 100755 --- a/front/core/components/autocomplete/index.js +++ b/front/core/components/autocomplete/index.js @@ -174,6 +174,7 @@ export default class Autocomplete extends Field { refreshDisplayed() { let display = ''; + let hasTemplate = this.$transclude && this.$transclude.isSlotFilled('tplItem'); if (this._selection && this.showField) { if (this.multiple && Array.isArray(this._selection)) { @@ -181,8 +182,19 @@ export default class Autocomplete extends Field { if (display.length > 0) display += ', '; display += item[this.showField]; } - } else + } else { display = this._selection[this.showField]; + if (hasTemplate) { + let template = this.$transclude(() => {}, null, 'tplItem'); + const element = template[0]; + const description = element.querySelector('.text-secondary'); + if (description) description.remove(); + + const displayElement = angular.element(element); + const displayText = displayElement.text(); + display = this.$interpolate(displayText)(this._selection); + } + } } this.input.value = display; diff --git a/modules/route/back/methods/vehicle/getVehiclesSorted.js b/modules/route/back/methods/vehicle/getVehiclesSorted.js index 9dad8b80a..384d89391 100644 --- a/modules/route/back/methods/vehicle/getVehiclesSorted.js +++ b/modules/route/back/methods/vehicle/getVehiclesSorted.js @@ -18,11 +18,13 @@ module.exports = Self => { Self.getVehiclesSorted = async warehouseFk => { const vehicles = await Self.rawSql(` - SELECT v.id, v.numberPlate, w.name + SELECT ROW_NUMBER() OVER (ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate) AS 'order', + v.id, + v.warehouseFk, + CONCAT(v.numberPlate, ' - ', w.name) as description FROM vehicle v - JOIN warehouse w ON w.id = v.warehouseFk - ORDER BY v.warehouseFk = ? DESC, v.numberPlate ASC`, [warehouseFk]); - + JOIN warehouse w ON w.id = v.warehouseFk + ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC`, [warehouseFk, warehouseFk]); return vehicles; }; }; diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index 0f62dc107..1ba84583f 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -25,19 +25,17 @@ - - {{numberPlate}} - {{name}} - + vn-name="created"> Date: Mon, 29 May 2023 13:49:32 +0200 Subject: [PATCH 020/311] refs #5066 e2e fixs, change name sorted --- db/changes/232401/00-ACLgetVehiclesSorted.sql | 2 +- e2e/paths/08-route/02_basic_data.spec.js | 2 +- front/core/components/autocomplete/index.js | 14 +------------- .../vehicle/{getVehiclesSorted.js => sorted.js} | 6 +++--- modules/route/back/models/vehicle.js | 2 +- modules/route/front/basic-data/index.html | 3 ++- modules/route/front/basic-data/index.js | 2 +- 7 files changed, 10 insertions(+), 21 deletions(-) rename modules/route/back/methods/vehicle/{getVehiclesSorted.js => sorted.js} (85%) diff --git a/db/changes/232401/00-ACLgetVehiclesSorted.sql b/db/changes/232401/00-ACLgetVehiclesSorted.sql index 5d3ec454d..6625f0d5c 100644 --- a/db/changes/232401/00-ACLgetVehiclesSorted.sql +++ b/db/changes/232401/00-ACLgetVehiclesSorted.sql @@ -1,3 +1,3 @@ INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) VALUES - ('Vehicle','getVehiclesSorted','WRITE','ALLOW','employee'); \ No newline at end of file + ('Vehicle','sorted','WRITE','ALLOW','employee'); \ No newline at end of file diff --git a/e2e/paths/08-route/02_basic_data.spec.js b/e2e/paths/08-route/02_basic_data.spec.js index 7ab7dda42..6008b0482 100644 --- a/e2e/paths/08-route/02_basic_data.spec.js +++ b/e2e/paths/08-route/02_basic_data.spec.js @@ -24,7 +24,7 @@ describe('Route basic Data path', () => { const form = 'vn-route-basic-data form'; const values = { worker: 'adminBossNick', - vehicle: '1111-IMK', + vehicle: '1111-IMK - Warehouse One', created: nextMonth, kmStart: 1, kmEnd: 2, diff --git a/front/core/components/autocomplete/index.js b/front/core/components/autocomplete/index.js index 52491f7e0..2539c4ef4 100755 --- a/front/core/components/autocomplete/index.js +++ b/front/core/components/autocomplete/index.js @@ -174,7 +174,6 @@ export default class Autocomplete extends Field { refreshDisplayed() { let display = ''; - let hasTemplate = this.$transclude && this.$transclude.isSlotFilled('tplItem'); if (this._selection && this.showField) { if (this.multiple && Array.isArray(this._selection)) { @@ -182,19 +181,8 @@ export default class Autocomplete extends Field { if (display.length > 0) display += ', '; display += item[this.showField]; } - } else { + } else display = this._selection[this.showField]; - if (hasTemplate) { - let template = this.$transclude(() => {}, null, 'tplItem'); - const element = template[0]; - const description = element.querySelector('.text-secondary'); - if (description) description.remove(); - - const displayElement = angular.element(element); - const displayText = displayElement.text(); - display = this.$interpolate(displayText)(this._selection); - } - } } this.input.value = display; diff --git a/modules/route/back/methods/vehicle/getVehiclesSorted.js b/modules/route/back/methods/vehicle/sorted.js similarity index 85% rename from modules/route/back/methods/vehicle/getVehiclesSorted.js rename to modules/route/back/methods/vehicle/sorted.js index 384d89391..4231b77cb 100644 --- a/modules/route/back/methods/vehicle/getVehiclesSorted.js +++ b/modules/route/back/methods/vehicle/sorted.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethod('getVehiclesSorted', { + Self.remoteMethod('sorted', { description: 'Sort the vehicles by warehouse', accessType: 'WRITE', accepts: [{ @@ -11,12 +11,12 @@ module.exports = Self => { root: true }, http: { - path: `/getVehiclesSorted`, + path: `/sorted`, verb: `POST` } }); - Self.getVehiclesSorted = async warehouseFk => { + Self.sorted = async warehouseFk => { const vehicles = await Self.rawSql(` SELECT ROW_NUMBER() OVER (ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate) AS 'order', v.id, diff --git a/modules/route/back/models/vehicle.js b/modules/route/back/models/vehicle.js index 459afe1c2..73e321443 100644 --- a/modules/route/back/models/vehicle.js +++ b/modules/route/back/models/vehicle.js @@ -1,3 +1,3 @@ module.exports = Self => { - require('../methods/vehicle/getVehiclesSorted')(Self); + require('../methods/vehicle/sorted')(Self); }; diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index 1ba84583f..1d6e260a9 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -28,7 +28,8 @@ show-field="description" order="order" value-field="id" - label="Vehicle"> + label="Vehicle" + vn-name="vehicle"> diff --git a/modules/route/front/basic-data/index.js b/modules/route/front/basic-data/index.js index 80626e97e..a147a451c 100644 --- a/modules/route/front/basic-data/index.js +++ b/modules/route/front/basic-data/index.js @@ -12,7 +12,7 @@ class Controller extends Section { this.$http.get(`UserConfigs/getUserConfig`) .then(res => { if (res && res.data) { - this.$http.post(`Vehicles/getVehiclesSorted`, {warehouseFk: res.data.warehouseFk}) + this.$http.post(`Vehicles/sorted`, {warehouseFk: res.data.warehouseFk}) .then(res => { if (res && res.data) this.vehicles = res.data; From b60cd2539a205433a24e41d38ae19d0ca81922e3 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 29 May 2023 15:21:37 +0200 Subject: [PATCH 021/311] refs #5712 feat(workerDms): docuware integration --- back/methods/docuware/checkFile.js | 50 ++++---- back/methods/docuware/core.js | 113 ++++++++++++++---- back/methods/docuware/download.js | 4 +- db/changes/232401/00-workerDocuware.sql | 3 + .../back/methods/worker-dms/docuware.js | 46 +++++++ .../worker/back/methods/worker-dms/filter.js | 39 +++++- modules/worker/back/models/worker-dms.js | 1 + modules/worker/front/dms/index/index.html | 12 +- modules/worker/front/dms/index/index.js | 3 +- 9 files changed, 219 insertions(+), 52 deletions(-) create mode 100644 db/changes/232401/00-workerDocuware.sql create mode 100644 modules/worker/back/methods/worker-dms/docuware.js diff --git a/back/methods/docuware/checkFile.js b/back/methods/docuware/checkFile.js index c0a4e8ef3..447efa760 100644 --- a/back/methods/docuware/checkFile.js +++ b/back/methods/docuware/checkFile.js @@ -1,7 +1,7 @@ const axios = require('axios'); module.exports = Self => { - Self.remoteMethodCtx('checkFile', { + Self.remoteMethod('checkFile', { description: 'Check if exist docuware file', accessType: 'READ', accepts: [ @@ -20,8 +20,14 @@ module.exports = Self => { { arg: 'signed', type: 'boolean', - required: true, + required: false, description: 'If pdf is necessary to be signed' + }, + { + arg: 'filter', + type: 'object', + required: false, + description: 'The filter' } ], returns: { @@ -34,7 +40,7 @@ module.exports = Self => { } }); - Self.checkFile = async function(ctx, id, fileCabinet, signed) { + Self.checkFile = async function(id, fileCabinet, signed, filter) { const models = Self.app.models; const action = 'find'; @@ -44,35 +50,39 @@ module.exports = Self => { action: action } }); - - const searchFilter = { - condition: [ - { - DBName: docuwareInfo.findById, - - Value: [id] - } - ], - sortOrder: [ - { - Field: 'FILENAME', - Direction: 'Desc' - } - ] - }; + console.log(id, fileCabinet, signed, filter); + if (!filter) { + filter = { + condition: [ + { + DBName: docuwareInfo.findById, + Value: [id] + } + ], + sortOrder: [ + { + Field: 'FILENAME', + Direction: 'Desc' + } + ] + }; + } try { const options = await Self.getOptions(); const fileCabinetId = await Self.getFileCabinet(fileCabinet); const dialogId = await Self.getDialog(fileCabinet, action, fileCabinetId); + console.log('FILTER', filter); const response = await axios.post( `${options.url}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, - searchFilter, + filter, options.headers ); const [documents] = response.data.Items; + console.log(response); + console.log(response.data); if (!documents) return false; const state = documents.Fields.find(field => field.FieldName == 'ESTADO'); diff --git a/back/methods/docuware/core.js b/back/methods/docuware/core.js index 2053ddf85..ac04c1958 100644 --- a/back/methods/docuware/core.js +++ b/back/methods/docuware/core.js @@ -1,6 +1,28 @@ const axios = require('axios'); module.exports = Self => { + /** + * Returns basic headers + * + * @param {string} cookie - The docuware cookie + * @return {object} - The headers + */ + Self.getOptions = async() => { + const docuwareConfig = await Self.app.models.DocuwareConfig.findOne(); + const headers = { + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Cookie': docuwareConfig.cookie + } + }; + + return { + url: docuwareConfig.url, + headers + }; + }; + /** * Returns the dialog id * @@ -20,9 +42,6 @@ module.exports = Self => { const options = await Self.getOptions(); - if (!process.env.NODE_ENV) - return Math.round(); - const response = await axios.get(`${options.url}/FileCabinets/${fileCabinetId}/dialogs`, options.headers); const dialogs = response.data.Dialog; const dialogId = dialogs.find(dialogs => dialogs.DisplayName === docuwareInfo.dialogName).Id; @@ -44,9 +63,6 @@ module.exports = Self => { } }); - if (!process.env.NODE_ENV) - return Math.round(); - const fileCabinetResponse = await axios.get(`${options.url}/FileCabinets`, options.headers); const fileCabinets = fileCabinetResponse.data.FileCabinet; const fileCabinetId = fileCabinets.find(fileCabinet => fileCabinet.Name === docuwareInfo.fileCabinetName).Id; @@ -55,24 +71,81 @@ module.exports = Self => { }; /** - * Returns basic headers + * Returns docuware data * - * @param {string} cookie - The docuware cookie - * @return {object} - The headers + * @param {string} code - The fileCabinet code + * @param {object} filter - The filter for docuware + * @param {object} parse - The fields parsed + * @return {object} - The data */ - Self.getOptions = async() => { - const docuwareConfig = await Self.app.models.DocuwareConfig.findOne(); - const headers = { - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Cookie': docuwareConfig.cookie + Self.get = async(code, filter, parse) => { + const options = await Self.getOptions(); + const fileCabinetId = await Self.getFileCabinet(code); + const dialogId = await Self.getDialog(code, 'find', fileCabinetId); + + const {data} = await axios.post( + `${options.url}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, + filter, + options.headers + ); + + return parser(data, parse); + }; + + /** + * Returns docuware data + * + * @param {string} code - The fileCabinet code + * @param {any} id - The id of docuware + * @param {object} parse - The fields parsed + * @return {object} - The data + */ + Self.getById = async(code, id, parse) => { + const docuwareInfo = await Self.app.models.Docuware.findOne({ + fields: ['findById'], + where: { + code: code, + action: 'find' } + }); + const filter = { + condition: [ + { + DBName: docuwareInfo.findById, + Value: [id] + } + ] }; - return { - url: docuwareConfig.url, - headers - }; + return Self.get(code, filter, parse); }; + + /** + * Returns docuware data filtered + * + * @param {array} data - The data + * @param {object} parse - The fields parsed + * @return {object} - The data parsed + */ + function parser(data, parse) { + if (!(data && data.Items)) return data; + + const parsed = []; + for (item of data.Items) { + const itemParsed = {}; + item.Fields.map(field => { + if (field.ItemElementName.includes('Date')) field.Item = toDate(field.Item); + if (!parse) return itemParsed[field.FieldLabel] = field.Item; + if (parse[field.FieldLabel]) + itemParsed[parse[field.FieldLabel]] = field.Item; + }); + parsed.push(itemParsed); + } + return parsed; + } + + function toDate(value) { + if (!value) return; + return new Date(Number(value.substring(6, 19))); + } }; diff --git a/back/methods/docuware/download.js b/back/methods/docuware/download.js index 56d006ee7..b9c646adb 100644 --- a/back/methods/docuware/download.js +++ b/back/methods/docuware/download.js @@ -41,8 +41,10 @@ module.exports = Self => { } }); - Self.download = async function(ctx, id, fileCabinet) { + Self.download = async function(ctx, id, fileCabinet, filter) { const models = Self.app.models; + + // REVIEW const docuwareFile = await models.Docuware.checkFile(ctx, id, fileCabinet, true); if (!docuwareFile) throw new UserError('The DOCUWARE PDF document does not exists'); diff --git a/db/changes/232401/00-workerDocuware.sql b/db/changes/232401/00-workerDocuware.sql new file mode 100644 index 000000000..45d64bd78 --- /dev/null +++ b/db/changes/232401/00-workerDocuware.sql @@ -0,0 +1,3 @@ +INSERT INTO `vn`.`docuware` +(code, fileCabinetName, `action`, dialogName, findById) +VALUES('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO'); diff --git a/modules/worker/back/methods/worker-dms/docuware.js b/modules/worker/back/methods/worker-dms/docuware.js new file mode 100644 index 000000000..ff5902e8f --- /dev/null +++ b/modules/worker/back/methods/worker-dms/docuware.js @@ -0,0 +1,46 @@ +module.exports = Self => { + Self.remoteMethodCtx('docuwareDownload', { + description: 'Download a worker document', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'Number', + description: 'The document id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: `/:id/docuwareDownload`, + verb: 'GET' + } + }); + + Self.docuwareDownload = async function(ctx, id) { + // CHECK ROLE? + const filter = { + condition: [ + { + DBName: 'FILENAME', + Value: [id] + } + ] + }; + return await Self.app.models.Docuware.download(ctx, id, 'hr', false, filter); + }; +}; diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index c16b2bbb1..7de838311 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -5,6 +5,12 @@ module.exports = Self => { description: 'Find all instances of the model matched by filter from the data source.', accessType: 'READ', accepts: [ + { + arg: 'id', + type: 'Number', + description: 'The worker id', + http: {source: 'path'} + }, { arg: 'filter', type: 'Object', @@ -17,16 +23,17 @@ module.exports = Self => { root: true }, http: { - path: `/filter`, + path: `/:id/filter`, verb: 'GET' } }); - Self.filter = async(ctx, filter) => { + Self.filter = async(ctx, id, filter) => { const conn = Self.dataSource.connector; const userId = ctx.req.accessToken.userId; + const models = Self.app.models; - const account = await Self.app.models.VnUser.findById(userId); + const account = await models.VnUser.findById(userId); const stmt = new ParameterizedSQL( `SELECT d.id dmsFk, d.reference, d.description, d.file, d.created, d.hardCopyNumber, d.hasFile FROM workerDocument wd @@ -47,7 +54,31 @@ module.exports = Self => { }] }, oldWhere]}; stmt.merge(conn.makeSuffix(filter)); + const workerDms = await conn.executeStmt(stmt); - return await conn.executeStmt(stmt); + // Get docuware info + const worker = await models.Worker.findById(id, {fields: ['fi', 'firstName', 'lastName']}); + const docuwareParse = { + 'Document ID': 'dmsFk', + 'Tipo Documento': 'description', + 'Stored on': 'created', + }; + const workerDocuware = await models.Docuware.getById('hr', 'BONO MOLA XAVIER', docuwareParse);// worker.lastName + worker.firstName); + + for (document of workerDocuware) { + const defaultData = { + file: document.dmsFk + '.png', + isDocuware: true, + hardCopyNumber: null, + hasFile: false, + reference: worker.fi + }; + + document = Object.assign(document, defaultData); + } + console.log(workerDocuware); + console.log(workerDms); + + return workerDms.concat(workerDocuware); }; }; diff --git a/modules/worker/back/models/worker-dms.js b/modules/worker/back/models/worker-dms.js index b9d6f9a77..1712383b3 100644 --- a/modules/worker/back/models/worker-dms.js +++ b/modules/worker/back/models/worker-dms.js @@ -2,6 +2,7 @@ module.exports = Self => { require('../methods/worker-dms/downloadFile')(Self); require('../methods/worker-dms/removeFile')(Self); require('../methods/worker-dms/filter')(Self); + require('../methods/worker-dms/docuware')(Self); Self.isMine = async function(ctx, dmsId) { const myUserId = ctx.req.accessToken.userId; diff --git a/modules/worker/front/dms/index/index.html b/modules/worker/front/dms/index/index.html index 1404336a2..6ed3a6f15 100644 --- a/modules/worker/front/dms/index/index.html +++ b/modules/worker/front/dms/index/index.html @@ -1,6 +1,6 @@ - + ng-click="$ctrl.downloadFile(document.dmsFk, document.isDocuware)"> {{::document.file}} @@ -63,7 +63,7 @@ + ng-click="$ctrl.downloadFile(document.dmsFk, document.isDocuware)"> @@ -91,9 +91,9 @@ fixed-bottom-right> - - \ No newline at end of file + diff --git a/modules/worker/front/dms/index/index.js b/modules/worker/front/dms/index/index.js index 9bb3c896a..ae2d51a17 100644 --- a/modules/worker/front/dms/index/index.js +++ b/modules/worker/front/dms/index/index.js @@ -17,7 +17,8 @@ class Controller extends Component { }); } - downloadFile(dmsId) { + downloadFile(dmsId, isDocuware) { + if (isDocuware) return this.vnFile.download(`api/workerDms/${dmsId}/docuwareDownload`); this.vnFile.download(`api/workerDms/${dmsId}/downloadFile`); } } From 0661bf8fa98cead2a07a4ee16b499520e771be0c Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 30 May 2023 12:21:44 +0200 Subject: [PATCH 022/311] refs #5066 remake sql without ROW_ORDER --- modules/route/back/methods/vehicle/sorted.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/route/back/methods/vehicle/sorted.js b/modules/route/back/methods/vehicle/sorted.js index 4231b77cb..5c4c305cc 100644 --- a/modules/route/back/methods/vehicle/sorted.js +++ b/modules/route/back/methods/vehicle/sorted.js @@ -17,14 +17,11 @@ module.exports = Self => { }); Self.sorted = async warehouseFk => { - const vehicles = await Self.rawSql(` - SELECT ROW_NUMBER() OVER (ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate) AS 'order', - v.id, - v.warehouseFk, - CONCAT(v.numberPlate, ' - ', w.name) as description - FROM vehicle v - JOIN warehouse w ON w.id = v.warehouseFk - ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC`, [warehouseFk, warehouseFk]); - return vehicles; + return Self.rawSql(` + SELECT v.id, v.warehouseFk, CONCAT(v.numberPlate, ' - ', w.name) as description + FROM vehicle v + JOIN warehouse w ON w.id = v.warehouseFk + ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC; + `, [warehouseFk]); }; }; From 6cf1e0953d447a0222969541258e615ae1978229 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 30 May 2023 14:49:28 +0200 Subject: [PATCH 023/311] refs #5244 feat: intento de crear el componente workerAutocomplete --- front/core/components/autocomplete/index.html | 4 +- front/core/components/drop-down/index.html | 6 +-- front/core/components/index.js | 1 + .../components/worker-autocomplete/index.html | 9 ++++ .../components/worker-autocomplete/index.js | 49 +++++++++++++++++ .../worker-autocomplete/index.spec.js | 54 +++++++++++++++++++ .../components/worker-autocomplete/style.scss | 30 +++++++++++ modules/ticket/front/tracking/edit/index.html | 17 ++---- 8 files changed, 152 insertions(+), 18 deletions(-) create mode 100755 front/core/components/worker-autocomplete/index.html create mode 100755 front/core/components/worker-autocomplete/index.js create mode 100644 front/core/components/worker-autocomplete/index.spec.js create mode 100755 front/core/components/worker-autocomplete/style.scss diff --git a/front/core/components/autocomplete/index.html b/front/core/components/autocomplete/index.html index 69aac4d43..527ca77e7 100755 --- a/front/core/components/autocomplete/index.html +++ b/front/core/components/autocomplete/index.html @@ -18,7 +18,7 @@ +
- \ No newline at end of file + diff --git a/front/core/components/drop-down/index.html b/front/core/components/drop-down/index.html index ab868f7b5..692b0c87c 100644 --- a/front/core/components/drop-down/index.html +++ b/front/core/components/drop-down/index.html @@ -13,12 +13,12 @@ class="dropdown" ng-click="$ctrl.onContainerClick($event)"> -
{{$ctrl.statusText}}
- \ No newline at end of file + diff --git a/front/core/components/index.js b/front/core/components/index.js index 45d182121..09e0345c7 100644 --- a/front/core/components/index.js +++ b/front/core/components/index.js @@ -51,6 +51,7 @@ import './textarea'; import './th'; import './treeview'; import './wday-picker'; +import './worker-autocomplete'; import './datalist'; import './contextmenu'; import './rating'; diff --git a/front/core/components/worker-autocomplete/index.html b/front/core/components/worker-autocomplete/index.html new file mode 100755 index 000000000..e7a022bc8 --- /dev/null +++ b/front/core/components/worker-autocomplete/index.html @@ -0,0 +1,9 @@ + + diff --git a/front/core/components/worker-autocomplete/index.js b/front/core/components/worker-autocomplete/index.js new file mode 100755 index 000000000..44ffd50e2 --- /dev/null +++ b/front/core/components/worker-autocomplete/index.js @@ -0,0 +1,49 @@ +import ngModule from '../../module'; +import Autocomplete from '../autocomplete'; +import assignProps from '../../lib/assign-props'; +import {mergeWhere} from 'vn-loopback/util/filter'; +import './style.scss'; + +/** + * Input with option selector. + * + * @property {String} showFiled The data field name that should be shown + * @property {String} valueField The data field name that should be used as value + * @property {Array} data Static data for the autocomplete + * @property {Object} intialData An initial data to avoid the server request used to get the selection + * @property {Boolean} multiple Whether to allow multiple selection + * @property {Object} selection Current object selected + * + * @event change Thrown when value is changed + */ +export default class WorkerAutocomplete extends Autocomplete { + constructor($element, $, $compile, $transclude) { + super($element, $, $compile, $transclude); + } + + // $postLink() { + // super.$postLink(); + // this.assignDropdownProps(); + // this.showField = this.$.dropDown.showField; + // this.valueField = this.$.dropDown.valueField; + // this.refreshSelection(); + // } + + // /** + // * @type {any} The autocomplete value. + // */ + // get field() { + // return super.field; + // } + + // set field(value) { + // super.field = value; + // this.refreshSelection(); + // } +} +WorkerAutocomplete.$inject = ['$element', '$scope', '$compile', '$transclude']; + +ngModule.vnComponent('vnWorkerAutocomplete', { + template: require('./index.html'), + controller: WorkerAutocomplete +}); diff --git a/front/core/components/worker-autocomplete/index.spec.js b/front/core/components/worker-autocomplete/index.spec.js new file mode 100644 index 000000000..847761179 --- /dev/null +++ b/front/core/components/worker-autocomplete/index.spec.js @@ -0,0 +1,54 @@ +describe('Component vnAutocomplete', () => { + let $element; + let controller; + let data = {id: 1, name: 'Bruce Wayne'}; + + beforeEach(ngModule('vnCore')); + + beforeEach(inject(($compile, $rootScope) => { + $element = $compile(``)($rootScope); + controller = $element.controller('vnAutocomplete'); + })); + + afterEach(() => { + $element.remove(); + }); + + describe('url() setter', () => { + it(`should set the url property`, () => { + controller.url = '/TestModels'; + + expect(controller.url).toEqual('/TestModels'); + }); + }); + + describe('field() setter/getter', () => { + it(`should set the field property`, () => { + controller.field = 'id'; + + expect(controller.field).toEqual('id'); + }); + }); + + describe('selection property', () => { + beforeEach(() => { + controller.field = data.id; + }); + + it(`should set selection finding an existing item in the initialData property`, () => { + controller.initialData = data; + + expect(controller.selection).toEqual(data); + }); + + it(`should set selection finding an existing item in the data property`, () => { + controller.data = [data]; + + expect(controller.selection).toEqual(data); + }); + + it(`should set selection to null when can't find an existing item in the data property`, () => { + expect(controller.selection).toEqual(null); + }); + }); +}); diff --git a/front/core/components/worker-autocomplete/style.scss b/front/core/components/worker-autocomplete/style.scss new file mode 100755 index 000000000..d76f84f85 --- /dev/null +++ b/front/core/components/worker-autocomplete/style.scss @@ -0,0 +1,30 @@ +@import "effects"; + +.vn-worker-autocomplete { + overflow: hidden; + + & > .container { + cursor: pointer; + + & > .infix > .control { + overflow: hidden; + + & > input { + cursor: pointer; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + text-align: left; + padding-left: 0; + padding-right: 0; + } + } + + & > .icons.pre { + min-width: 22px + } + } + &.readonly > .container > .icons.post { + display: none; + } +} diff --git a/modules/ticket/front/tracking/edit/index.html b/modules/ticket/front/tracking/edit/index.html index c522536b3..18b898012 100644 --- a/modules/ticket/front/tracking/edit/index.html +++ b/modules/ticket/front/tracking/edit/index.html @@ -14,22 +14,13 @@ - - + + @@ -43,4 +34,4 @@ ui-sref="ticket.card.tracking.index"> - \ No newline at end of file + From daeed312d0e403ad7eb00439e01903fcf623e10e Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 30 May 2023 15:16:15 +0200 Subject: [PATCH 024/311] =?UTF-8?q?refs=20#5244=20fix:=20a=C3=B1adido=20vn?= =?UTF-8?q?-drop-down=20em=20html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/components/worker-autocomplete/index.html | 14 +++++++++++++- modules/ticket/front/tracking/edit/index.html | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/front/core/components/worker-autocomplete/index.html b/front/core/components/worker-autocomplete/index.html index e7a022bc8..fc8ddf640 100755 --- a/front/core/components/worker-autocomplete/index.html +++ b/front/core/components/worker-autocomplete/index.html @@ -2,8 +2,20 @@ vn-one url="Workers/activeWithInheritedRole" ng-model="$ctrl.workerFk" - show-field="nickname" search-function="{firstName: $search}" value-field="id" label="Worker"> + +
+ {{firstName}} {{lastName}} +
+
+ {{nickname}}, {{code}} +
+ + diff --git a/modules/ticket/front/tracking/edit/index.html b/modules/ticket/front/tracking/edit/index.html index 18b898012..3eafed8db 100644 --- a/modules/ticket/front/tracking/edit/index.html +++ b/modules/ticket/front/tracking/edit/index.html @@ -19,7 +19,8 @@ label="State" vn-focus> - +
From c23d8282ebf9433d69e75ad45c12323128349f9f Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 30 May 2023 15:34:11 +0200 Subject: [PATCH 025/311] refs #5712 feat(workerDms): docuware download --- back/methods/docuware/checkFile.js | 31 +++++------ back/methods/docuware/core.js | 6 +- back/methods/docuware/download.js | 17 +++--- back/methods/docuware/upload.js | 5 -- db/changes/232401/00-workerDocuware.sql | 6 +- .../back/methods/ticket/docuwareDownload.js | 55 +++++++++++++++++++ .../ticket/front/descriptor-menu/index.html | 7 +-- modules/ticket/front/descriptor-menu/index.js | 4 ++ .../back/methods/worker-dms/docuware.js | 3 +- .../worker/back/methods/worker-dms/filter.js | 3 +- modules/worker/front/dms/index/index.html | 20 +++++-- 11 files changed, 111 insertions(+), 46 deletions(-) create mode 100644 modules/ticket/back/methods/ticket/docuwareDownload.js diff --git a/back/methods/docuware/checkFile.js b/back/methods/docuware/checkFile.js index 447efa760..803755d09 100644 --- a/back/methods/docuware/checkFile.js +++ b/back/methods/docuware/checkFile.js @@ -17,18 +17,16 @@ module.exports = Self => { required: true, description: 'The fileCabinet name' }, - { - arg: 'signed', - type: 'boolean', - required: false, - description: 'If pdf is necessary to be signed' - }, { arg: 'filter', type: 'object', - required: false, description: 'The filter' - } + }, + { + arg: 'signed', + type: 'boolean', + description: 'If pdf is necessary to be signed' + }, ], returns: { type: 'object', @@ -40,7 +38,7 @@ module.exports = Self => { } }); - Self.checkFile = async function(id, fileCabinet, signed, filter) { + Self.checkFile = async function(id, fileCabinet, filter, signed) { const models = Self.app.models; const action = 'find'; @@ -50,7 +48,8 @@ module.exports = Self => { action: action } }); - console.log(id, fileCabinet, signed, filter); + console.log('ENTRY'); + console.log(filter, signed); if (!filter) { filter = { condition: [ @@ -67,13 +66,18 @@ module.exports = Self => { ] }; } + if (signed) { + filter.condition.push({ + DBName: 'ESTADO', + Value: ['Firmado'] + }); + } try { const options = await Self.getOptions(); const fileCabinetId = await Self.getFileCabinet(fileCabinet); const dialogId = await Self.getDialog(fileCabinet, action, fileCabinetId); - console.log('FILTER', filter); const response = await axios.post( `${options.url}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, @@ -81,13 +85,8 @@ module.exports = Self => { options.headers ); const [documents] = response.data.Items; - console.log(response); - console.log(response.data); if (!documents) return false; - const state = documents.Fields.find(field => field.FieldName == 'ESTADO'); - if (signed && state.Item != 'Firmado') return false; - return {id: documents.Id}; } catch (error) { return false; diff --git a/back/methods/docuware/core.js b/back/methods/docuware/core.js index ac04c1958..f13b69b13 100644 --- a/back/methods/docuware/core.js +++ b/back/methods/docuware/core.js @@ -83,13 +83,13 @@ module.exports = Self => { const fileCabinetId = await Self.getFileCabinet(code); const dialogId = await Self.getDialog(code, 'find', fileCabinetId); - const {data} = await axios.post( + const data = await axios.post( `${options.url}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, filter, options.headers ); - - return parser(data, parse); + console.log(data.data); + return parser(data.data, parse); }; /** diff --git a/back/methods/docuware/download.js b/back/methods/docuware/download.js index b9c646adb..a0d72ce01 100644 --- a/back/methods/docuware/download.js +++ b/back/methods/docuware/download.js @@ -3,7 +3,7 @@ const axios = require('axios'); const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('download', { + Self.remoteMethod('download', { description: 'Download an docuware PDF', accessType: 'READ', accepts: [ @@ -16,8 +16,12 @@ module.exports = Self => { { arg: 'fileCabinet', type: 'string', - description: 'The file cabinet', - http: {source: 'path'} + description: 'The file cabinet' + }, + { + arg: 'filter', + type: 'object', + description: 'The filter' } ], returns: [ @@ -36,16 +40,15 @@ module.exports = Self => { } ], http: { - path: `/:id/download/:fileCabinet`, + path: `/:id/download`, verb: 'GET' } }); - Self.download = async function(ctx, id, fileCabinet, filter) { + Self.download = async function(id, fileCabinet, filter) { const models = Self.app.models; - // REVIEW - const docuwareFile = await models.Docuware.checkFile(ctx, id, fileCabinet, true); + const docuwareFile = await models.Docuware.checkFile(id, fileCabinet, filter); if (!docuwareFile) throw new UserError('The DOCUWARE PDF document does not exists'); const fileCabinetId = await Self.getFileCabinet(fileCabinet); diff --git a/back/methods/docuware/upload.js b/back/methods/docuware/upload.js index ea9ee3622..9dd1f2103 100644 --- a/back/methods/docuware/upload.js +++ b/back/methods/docuware/upload.js @@ -16,11 +16,6 @@ module.exports = Self => { arg: 'fileCabinet', type: 'string', description: 'The file cabinet' - }, - { - arg: 'dialog', - type: 'string', - description: 'The dialog' } ], returns: [], diff --git a/db/changes/232401/00-workerDocuware.sql b/db/changes/232401/00-workerDocuware.sql index 45d64bd78..fbacb23f9 100644 --- a/db/changes/232401/00-workerDocuware.sql +++ b/db/changes/232401/00-workerDocuware.sql @@ -1,3 +1,3 @@ -INSERT INTO `vn`.`docuware` -(code, fileCabinetName, `action`, dialogName, findById) -VALUES('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO'); +INSERT INTO `vn`.`docuware` (code, fileCabinetName, `action`, dialogName, findById) + VALUES + ('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO'); diff --git a/modules/ticket/back/methods/ticket/docuwareDownload.js b/modules/ticket/back/methods/ticket/docuwareDownload.js new file mode 100644 index 000000000..bc74e0d21 --- /dev/null +++ b/modules/ticket/back/methods/ticket/docuwareDownload.js @@ -0,0 +1,55 @@ +module.exports = Self => { + Self.remoteMethodCtx('docuwareDownload', { + description: 'Download a ticket delivery note document', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'Number', + description: 'The document id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: `/:id/docuwareDownload`, + verb: 'GET' + } + }); + + Self.docuwareDownload = async function(ctx, id) { + const filter = { + condition: [ + { + DBName: docuwareInfo.findById, + Value: [id] + }, + { + DBName: 'ESTADO', + Value: ['Firmado'] + } + ], + sortOrder: [ + { + Field: 'FILENAME', + Direction: 'Desc' + } + ] + }; + return await Self.app.models.Docuware.download(id, 'deliveryNote', filter); + }; +}; diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index c2ebc3e3a..b645005be 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -36,13 +36,12 @@ translate> as PDF without prices - as PDF signed - + diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 987d6a3f1..bcb08c565 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -336,6 +336,10 @@ class Controller extends Section { this.vnApp.showSuccess(this.$t('PDF sent!')); }); } + + docuwareDownload() { + this.vnFile.download(`api/Ticket/${this.ticket.id}/docuwareDownload`); + } } Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail']; diff --git a/modules/worker/back/methods/worker-dms/docuware.js b/modules/worker/back/methods/worker-dms/docuware.js index ff5902e8f..764b7633c 100644 --- a/modules/worker/back/methods/worker-dms/docuware.js +++ b/modules/worker/back/methods/worker-dms/docuware.js @@ -32,7 +32,6 @@ module.exports = Self => { }); Self.docuwareDownload = async function(ctx, id) { - // CHECK ROLE? const filter = { condition: [ { @@ -41,6 +40,6 @@ module.exports = Self => { } ] }; - return await Self.app.models.Docuware.download(ctx, id, 'hr', false, filter); + return await Self.app.models.Docuware.download(id, 'hr', filter); }; }; diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index 7de838311..eaefe67d3 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -59,12 +59,11 @@ module.exports = Self => { // Get docuware info const worker = await models.Worker.findById(id, {fields: ['fi', 'firstName', 'lastName']}); const docuwareParse = { - 'Document ID': 'dmsFk', + 'Filename': 'dmsFk', 'Tipo Documento': 'description', 'Stored on': 'created', }; const workerDocuware = await models.Docuware.getById('hr', 'BONO MOLA XAVIER', docuwareParse);// worker.lastName + worker.firstName); - for (document of workerDocuware) { const defaultData = { file: document.dmsFk + '.png', diff --git a/modules/worker/front/dms/index/index.html b/modules/worker/front/dms/index/index.html index 6ed3a6f15..9d2d5b25d 100644 --- a/modules/worker/front/dms/index/index.html +++ b/modules/worker/front/dms/index/index.html @@ -60,19 +60,31 @@ {{::document.created | date:'dd/MM/yyyy HH:mm'}} - + - - + + - + + + + + Date: Wed, 31 May 2023 10:04:34 +0200 Subject: [PATCH 026/311] refs #5066 sorted without CONCAT, order=false --- modules/route/back/methods/vehicle/sorted.js | 2 +- modules/route/front/basic-data/index.html | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/route/back/methods/vehicle/sorted.js b/modules/route/back/methods/vehicle/sorted.js index 5c4c305cc..b379743bc 100644 --- a/modules/route/back/methods/vehicle/sorted.js +++ b/modules/route/back/methods/vehicle/sorted.js @@ -18,7 +18,7 @@ module.exports = Self => { Self.sorted = async warehouseFk => { return Self.rawSql(` - SELECT v.id, v.warehouseFk, CONCAT(v.numberPlate, ' - ', w.name) as description + SELECT v.id, v.warehouseFk, v.numberPlate, w.name FROM vehicle v JOIN warehouse w ON w.id = v.warehouseFk ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate ASC; diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index 1d6e260a9..bf7bf672c 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -22,14 +22,14 @@
{{::name}}
- + order="false"> + {{::numberPlate}} - {{::name}} From a539abf3d8bdb959a9cf647deb171278bfd4c6ef Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 31 May 2023 10:15:16 +0200 Subject: [PATCH 027/311] refs #5244 feat: creado back para buscar trabjadores por name. nickname y code --- .../components/worker-autocomplete/index.html | 11 ++-- .../components/worker-autocomplete/index.js | 23 ------- .../components/worker-autocomplete/style.scss | 30 --------- modules/worker/back/methods/worker/search.js | 61 +++++++++++++++++++ modules/worker/back/models/worker.js | 1 + 5 files changed, 69 insertions(+), 57 deletions(-) delete mode 100755 front/core/components/worker-autocomplete/style.scss create mode 100644 modules/worker/back/methods/worker/search.js diff --git a/front/core/components/worker-autocomplete/index.html b/front/core/components/worker-autocomplete/index.html index fc8ddf640..65418aee0 100755 --- a/front/core/components/worker-autocomplete/index.html +++ b/front/core/components/worker-autocomplete/index.html @@ -1,13 +1,16 @@
- {{firstName}} {{lastName}} + {{name}}
{{nickname}}, {{code}} diff --git a/front/core/components/worker-autocomplete/index.js b/front/core/components/worker-autocomplete/index.js index 44ffd50e2..7983f53a5 100755 --- a/front/core/components/worker-autocomplete/index.js +++ b/front/core/components/worker-autocomplete/index.js @@ -1,8 +1,5 @@ import ngModule from '../../module'; import Autocomplete from '../autocomplete'; -import assignProps from '../../lib/assign-props'; -import {mergeWhere} from 'vn-loopback/util/filter'; -import './style.scss'; /** * Input with option selector. @@ -20,26 +17,6 @@ export default class WorkerAutocomplete extends Autocomplete { constructor($element, $, $compile, $transclude) { super($element, $, $compile, $transclude); } - - // $postLink() { - // super.$postLink(); - // this.assignDropdownProps(); - // this.showField = this.$.dropDown.showField; - // this.valueField = this.$.dropDown.valueField; - // this.refreshSelection(); - // } - - // /** - // * @type {any} The autocomplete value. - // */ - // get field() { - // return super.field; - // } - - // set field(value) { - // super.field = value; - // this.refreshSelection(); - // } } WorkerAutocomplete.$inject = ['$element', '$scope', '$compile', '$transclude']; diff --git a/front/core/components/worker-autocomplete/style.scss b/front/core/components/worker-autocomplete/style.scss deleted file mode 100755 index d76f84f85..000000000 --- a/front/core/components/worker-autocomplete/style.scss +++ /dev/null @@ -1,30 +0,0 @@ -@import "effects"; - -.vn-worker-autocomplete { - overflow: hidden; - - & > .container { - cursor: pointer; - - & > .infix > .control { - overflow: hidden; - - & > input { - cursor: pointer; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - text-align: left; - padding-left: 0; - padding-right: 0; - } - } - - & > .icons.pre { - min-width: 22px - } - } - &.readonly > .container > .icons.post { - display: none; - } -} diff --git a/modules/worker/back/methods/worker/search.js b/modules/worker/back/methods/worker/search.js new file mode 100644 index 000000000..1d1742595 --- /dev/null +++ b/modules/worker/back/methods/worker/search.js @@ -0,0 +1,61 @@ +module.exports = Self => { + Self.remoteMethod('search', { + description: 'Returns an array of search from an specified worker', + accepts: [{ + arg: 'filter', + type: 'Object', + description: 'Filter defining where and paginated data', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/search`, + verb: 'GET' + } + }); + + Self.search = async filter => { + const models = Self.app.models; + + delete filter.order; + delete filter.fields; + const users = await models.VnUser.find(filter); + + if (filter.where) { + const indexToDelete = 2; + const filterByCode = filter.where.or.splice(indexToDelete, 1)[0]; + + const ids = users.map(user => parseInt(user.id)); + filter.where.or = [ + {id: {inq: ids}}, + filterByCode + ]; + } + + filter.include = { + relation: 'user', + scope: { + fields: ['name', 'nickname'] + } + }; + + const workers = await models.Worker.find(filter); + + const result = workers.map(worker => { + return { + id: worker.id, + code: worker.code, + name: worker.user().name, + nickname: worker.user().nickname + }; + }); + result.sort((a, b) => { + return a.name.localeCompare(b.name); + }); + + return result; + }; +}; diff --git a/modules/worker/back/models/worker.js b/modules/worker/back/models/worker.js index fa17640a8..16e4055bc 100644 --- a/modules/worker/back/models/worker.js +++ b/modules/worker/back/models/worker.js @@ -16,6 +16,7 @@ module.exports = Self => { require('../methods/worker/new')(Self); require('../methods/worker/deallocatePDA')(Self); require('../methods/worker/allocatePDA')(Self); + require('../methods/worker/search')(Self); Self.validatesUniquenessOf('locker', { message: 'This locker has already been assigned' From d18137bce0c97552ab8628d4458d5f346678ce9e Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 31 May 2023 10:20:13 +0200 Subject: [PATCH 028/311] refs #5066 not dense --- modules/route/front/basic-data/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index bf7bf672c..514c535a2 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -22,7 +22,7 @@
{{::name}}
- Date: Wed, 31 May 2023 11:32:37 +0200 Subject: [PATCH 029/311] refs #5712 openDocuware --- back/methods/docuware/checkFile.js | 3 +-- back/methods/docuware/core.js | 1 - db/changes/232401/00-workerDocuware.sql | 4 ++++ front/core/services/app.js | 6 +++++- front/core/services/locale/es.yml | 3 ++- .../worker/back/methods/worker-dms/filter.js | 4 +--- modules/worker/front/dms/index/index.html | 20 +++++++------------ modules/worker/front/dms/index/index.js | 5 +++++ 8 files changed, 25 insertions(+), 21 deletions(-) diff --git a/back/methods/docuware/checkFile.js b/back/methods/docuware/checkFile.js index 803755d09..18d169085 100644 --- a/back/methods/docuware/checkFile.js +++ b/back/methods/docuware/checkFile.js @@ -48,8 +48,7 @@ module.exports = Self => { action: action } }); - console.log('ENTRY'); - console.log(filter, signed); + if (!filter) { filter = { condition: [ diff --git a/back/methods/docuware/core.js b/back/methods/docuware/core.js index f13b69b13..7bb3e617a 100644 --- a/back/methods/docuware/core.js +++ b/back/methods/docuware/core.js @@ -88,7 +88,6 @@ module.exports = Self => { filter, options.headers ); - console.log(data.data); return parser(data.data, parse); }; diff --git a/db/changes/232401/00-workerDocuware.sql b/db/changes/232401/00-workerDocuware.sql index fbacb23f9..c8d4e4f23 100644 --- a/db/changes/232401/00-workerDocuware.sql +++ b/db/changes/232401/00-workerDocuware.sql @@ -1,3 +1,7 @@ INSERT INTO `vn`.`docuware` (code, fileCabinetName, `action`, dialogName, findById) VALUES ('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO'); + +INSERT INTO `salix`.`url` (appName, environment, url) + VALUES + ('docuware', 'production', 'https://verdnatura.docuware.cloud/DocuWare/Platform/'); diff --git a/front/core/services/app.js b/front/core/services/app.js index fb0a08777..6c80fafcc 100644 --- a/front/core/services/app.js +++ b/front/core/services/app.js @@ -66,7 +66,11 @@ export default class App { return this.logger.$http.get('Urls/findOne', {filter}) .then(res => { - return res.data.url + route; + if (res && res.data) + return res.data.url + route; + }) + .catch(() => { + this.showError('Direction not found'); }); } } diff --git a/front/core/services/locale/es.yml b/front/core/services/locale/es.yml index cf8801b52..e9811e38f 100644 --- a/front/core/services/locale/es.yml +++ b/front/core/services/locale/es.yml @@ -3,4 +3,5 @@ Could not contact the server: No se ha podido contactar con el servidor, asegura Please enter your username: Por favor introduce tu nombre de usuario It seems that the server has fall down: Parece que el servidor se ha caído, espera unos minutos e inténtalo de nuevo Session has expired: Tu sesión ha expirado, por favor vuelve a iniciar sesión -Access denied: Acción no permitida \ No newline at end of file +Access denied: Acción no permitida +Direction not found: Dirección no encontrada diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index eaefe67d3..0b89cc883 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -63,7 +63,7 @@ module.exports = Self => { 'Tipo Documento': 'description', 'Stored on': 'created', }; - const workerDocuware = await models.Docuware.getById('hr', 'BONO MOLA XAVIER', docuwareParse);// worker.lastName + worker.firstName); + const workerDocuware = await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse); for (document of workerDocuware) { const defaultData = { file: document.dmsFk + '.png', @@ -75,8 +75,6 @@ module.exports = Self => { document = Object.assign(document, defaultData); } - console.log(workerDocuware); - console.log(workerDms); return workerDms.concat(workerDocuware); }; diff --git a/modules/worker/front/dms/index/index.html b/modules/worker/front/dms/index/index.html index 9d2d5b25d..aefbbcf34 100644 --- a/modules/worker/front/dms/index/index.html +++ b/modules/worker/front/dms/index/index.html @@ -60,11 +60,13 @@ {{::document.created | date:'dd/MM/yyyy HH:mm'}} - + + + @@ -76,19 +78,11 @@ tabindex="-1"> - - - - - + diff --git a/modules/worker/front/dms/index/index.js b/modules/worker/front/dms/index/index.js index ae2d51a17..489fe1732 100644 --- a/modules/worker/front/dms/index/index.js +++ b/modules/worker/front/dms/index/index.js @@ -21,6 +21,11 @@ class Controller extends Component { if (isDocuware) return this.vnFile.download(`api/workerDms/${dmsId}/docuwareDownload`); this.vnFile.download(`api/workerDms/${dmsId}/downloadFile`); } + + async openDocuware() { + const url = await this.vnApp.getUrl(`WebClient`, 'docuware'); + if (url) window.open(url).focus(); + } } Controller.$inject = ['$element', '$scope', 'vnFile']; From 3b4626ee7436d0cef4df6fa241cef43d951345c7 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 31 May 2023 13:01:16 +0200 Subject: [PATCH 030/311] a --- front/core/components/worker-autocomplete/index.html | 1 - modules/ticket/front/tracking/edit/index.html | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/front/core/components/worker-autocomplete/index.html b/front/core/components/worker-autocomplete/index.html index 65418aee0..c48a6f8d3 100755 --- a/front/core/components/worker-autocomplete/index.html +++ b/front/core/components/worker-autocomplete/index.html @@ -1,7 +1,6 @@ + vn-one + ng-model="$ctrl.workerFk" + where="{role: 'employee'}"> + + From 0d85069e0fc50f636c9a80f412afedcb79eeccaa Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 1 Jun 2023 15:01:38 +0200 Subject: [PATCH 031/311] refs #5561 feat: permite colorear --- .../back/methods/sale-tracking/delete.js | 53 ++++++++++++++ .../back/methods/sale-tracking/replace.js | 69 +++++++++++++++++++ modules/ticket/back/models/sale-tracking.js | 2 + modules/ticket/front/sale-tracking/index.html | 69 ++++++++++--------- modules/ticket/front/sale-tracking/index.js | 47 ++++++++++--- 5 files changed, 200 insertions(+), 40 deletions(-) create mode 100644 modules/ticket/back/methods/sale-tracking/delete.js create mode 100644 modules/ticket/back/methods/sale-tracking/replace.js diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js new file mode 100644 index 000000000..50f7ff396 --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -0,0 +1,53 @@ + +module.exports = Self => { + Self.remoteMethod('delete', { + description: 'Elimina el registro (si se cumple la condición) y inserta uno nuevo', + accessType: 'READ', + accepts: [ + { + arg: 'saleFk', + type: 'number', + description: 'The sale id' + }, + { + arg: 'stateCode', + type: 'string' + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/delete`, + verb: 'POST' + } + }); + + Self.delete = async(saleFk, stateCode, options) => { + const models = Self.app.models; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + // const [itemShelvingSale] = await models.ItemShelvingSale.find({saleFk: saleFk}, myOptions); + // if (itemShelvingSale) await itemShelvingSale.destroy(myOptions); + + // const filter = { + // where: { + // saleFk: saleFk, + // code: stateCode + // } + // }; + // const [saleTracking] = await models.SaleTracking.find(filter, myOptions); + // return saleTracking.destroy(myOptions); + + query = `CALL vn.saleTracking_del(?, ?)`; + return Self.rawSql(query, + [ + saleFk, + stateCode, + ], myOptions); + }; +}; diff --git a/modules/ticket/back/methods/sale-tracking/replace.js b/modules/ticket/back/methods/sale-tracking/replace.js new file mode 100644 index 000000000..886ca4bfa --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/replace.js @@ -0,0 +1,69 @@ + +module.exports = Self => { + Self.remoteMethodCtx('replace', { + description: 'Remplaza el registro o lo crea si no existe', + accessType: 'READ', + accepts: [ + { + arg: 'saleFk', + type: 'number', + description: 'The sale id' + }, + { + arg: 'isChecked', + type: 'boolean' + }, + { + arg: 'quantity', + type: 'number' + }, + { + arg: 'stateCode', + type: 'string' + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/replace`, + verb: 'POST' + } + }); + + Self.replace = async(ctx, saleFk, isChecked, quantity, stateCode, options) => { + const models = Self.app.models; + const myOptions = {}; + const userId = ctx.req.accessToken.userId; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + // const state = await models.State.findOne({ + // where: {code: stateCode} + // }, myOptions); + + // if (!state) return; + + // const data = { + // saleFk: saleFk, + // isChecked: isChecked, + // originalQuantity: quantity, + // workerFk: userId, + // stateFk: state.id + // }; + // return models.SaleTracking.replaceOrCreate(data, myOptions); + + query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?)`; + return Self.rawSql(query, + [ + saleFk, + isChecked, + quantity, + userId, + stateCode, + null + ], myOptions); + }; +}; diff --git a/modules/ticket/back/models/sale-tracking.js b/modules/ticket/back/models/sale-tracking.js index 4a46dd6b7..446bdf37b 100644 --- a/modules/ticket/back/models/sale-tracking.js +++ b/modules/ticket/back/models/sale-tracking.js @@ -1,3 +1,5 @@ module.exports = Self => { require('../methods/sale-tracking/listSaleTracking')(Self); + require('../methods/sale-tracking/replace')(Self); + require('../methods/sale-tracking/delete')(Self); }; diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 0309dde13..8d3fa65af 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -1,6 +1,6 @@ - + - + - + - + - + { - this.salePreparingList = res.data; - for (const salePreparing of this.salePreparingList) { - for (const sale of this.sales) { - if (salePreparing.saleFk == sale.id) - sale.preparingList = salePreparing; - } - } + res.data.forEach(salePreparing => { + const sale = this.sales.find(sale => salePreparing.saleFk === sale.id); + if (sale) sale.preparingList = salePreparing; + }); }); } } @@ -83,12 +80,46 @@ class Controller extends Section { this.saleId = sale.id; this.$.itemShelvingSale.show(); } + + clickPreviousSelected(index) { + const sale = this.sales[index]; + if (!sale.preparingList.isPreviousSelected) { + this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); + sale.preparingList.isPreviousSelected = true; + } else { + this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION'); + sale.preparingList.isPreviousSelected = false; + } + } + + saleTrackingNew(sale, stateCode, isChecked) { + const params = { + saleFk: sale.id, + isChecked: isChecked, + quantity: sale.quantity, + stateCode: stateCode + }; + this.$http.post(`SaleTrackings/replace`, params).then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } + + saleTrackingDel(sale, stateCode) { + const params = { + saleFk: sale.id, + stateCode: stateCode + }; + this.$http.post(`SaleTrackings/delete`, params).then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } } ngModule.vnComponent('vnTicketSaleTracking', { template: require('./index.html'), controller: Controller, bindings: { - ticket: '<' + ticket: '<', + model: ' Date: Thu, 1 Jun 2023 15:31:16 +0200 Subject: [PATCH 032/311] refs # 5561 feat: cambiar url del crud-model --- .../back/methods/sale-tracking/delete.js | 34 ++++--- .../back/methods/sale-tracking/replace.js | 45 ++++----- .../sale-tracking/salePreparingList.js | 99 +++++++++++++++++++ .../back/methods/sale/salePreparingList.js | 33 ------- modules/ticket/back/models/sale-tracking.js | 1 + modules/ticket/back/models/sale.js | 1 - modules/ticket/front/sale-tracking/index.html | 38 ++++--- modules/ticket/front/sale-tracking/index.js | 32 ++---- 8 files changed, 166 insertions(+), 117 deletions(-) create mode 100644 modules/ticket/back/methods/sale-tracking/salePreparingList.js delete mode 100644 modules/ticket/back/methods/sale/salePreparingList.js diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index 50f7ff396..e2869c89a 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -31,23 +31,25 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - // const [itemShelvingSale] = await models.ItemShelvingSale.find({saleFk: saleFk}, myOptions); - // if (itemShelvingSale) await itemShelvingSale.destroy(myOptions); + const itemShelvingSales = await models.ItemShelvingSale.find({saleFk: saleFk}, myOptions); + for (let itemShelvingSale of itemShelvingSales) + await itemShelvingSale.destroy(myOptions); - // const filter = { - // where: { - // saleFk: saleFk, - // code: stateCode - // } - // }; - // const [saleTracking] = await models.SaleTracking.find(filter, myOptions); - // return saleTracking.destroy(myOptions); + const filter = { + where: { + saleFk: saleFk, + code: stateCode + } + }; + const saleTrackings = await models.SaleTracking.find(filter, myOptions); + for (let saleTracking of saleTrackings) + await saleTracking.destroy(myOptions); - query = `CALL vn.saleTracking_del(?, ?)`; - return Self.rawSql(query, - [ - saleFk, - stateCode, - ], myOptions); + // query = `CALL vn.saleTracking_del(?, ?)`; + // return Self.rawSql(query, + // [ + // saleFk, + // stateCode, + // ], myOptions); }; }; diff --git a/modules/ticket/back/methods/sale-tracking/replace.js b/modules/ticket/back/methods/sale-tracking/replace.js index 886ca4bfa..a2f9d6c08 100644 --- a/modules/ticket/back/methods/sale-tracking/replace.js +++ b/modules/ticket/back/methods/sale-tracking/replace.js @@ -40,30 +40,31 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - // const state = await models.State.findOne({ - // where: {code: stateCode} - // }, myOptions); + const state = await models.State.findOne({ + where: {code: stateCode} + }, myOptions); - // if (!state) return; + if (!state) return; - // const data = { - // saleFk: saleFk, - // isChecked: isChecked, - // originalQuantity: quantity, - // workerFk: userId, - // stateFk: state.id - // }; - // return models.SaleTracking.replaceOrCreate(data, myOptions); + const data = { + saleFk: saleFk, + isChecked: isChecked, + originalQuantity: quantity, + workerFk: userId, + stateFk: state.id + }; + return models.SaleTracking.replaceOrCreate(data, myOptions); - query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?)`; - return Self.rawSql(query, - [ - saleFk, - isChecked, - quantity, - userId, - stateCode, - null - ], myOptions); + // query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?, ?)`; + // return Self.rawSql(query, + // [ + // saleFk, + // isChecked, + // quantity, + // userId, + // stateCode, + // 'parameterToDelete', + // null + // ], myOptions); }; }; diff --git a/modules/ticket/back/methods/sale-tracking/salePreparingList.js b/modules/ticket/back/methods/sale-tracking/salePreparingList.js new file mode 100644 index 000000000..063730fde --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/salePreparingList.js @@ -0,0 +1,99 @@ + +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; + +module.exports = Self => { + Self.remoteMethod('salePreparingList', { + description: 'Returns a list with the lines of a ticket and its different states of preparation', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }, + { + arg: 'filter', + type: 'object', + description: 'Filter defining where and paginated data' + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/:id/salePreparingList`, + verb: 'GET' + } + }); + + Self.salePreparingList = async(id, filter, options) => { + const conn = Self.dataSource.connector; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const stmts = []; + let stmt; + + stmts.push('CALL cache.last_buy_refresh(FALSE)'); + + stmt = new ParameterizedSQL( + `SELECT t.clientFk, + t.shipped, + a.nickname, + s.ticketFk, + s.itemFk, + s.quantity, + s.concept, + s.reserved, + s.id saleFk, + i.size, + i.inkFk, + i.stems, + i.image, + i.subName, + b.grouping, + IF(stPrevious.saleFk,TRUE,FALSE) as isPreviousSelected, + stPrevious.isChecked as isPrevious, + stPrepared.isChecked as isPrepared, + stControled.isChecked as isControled, + ib.code as barcode, + (MAX(sgd.id) IS NOT NULL) AS hasSaleGroupDetail, + p.code AS parkingCode, + i.value5, + i.value6, + i.value7, + i.value8, + i.value9, + i.value10 + FROM vn.ticket t + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id AND stPrevious.stateFk = 26 + LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id AND stPrepared.stateFk = 14 + LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id AND stControled.stateFk = 8 + LEFT JOIN vn.itemBarcode ib ON ib.itemFk = i.id + LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + LEFT JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk + LEFT JOIN vn.parking p ON p.id = sg.parkingFk + WHERE t.id = ? + GROUP BY s.id`, [id]); + + stmts.push(stmt); + + stmt.merge(Self.makeSuffix(filter)); + + const index = stmts.push(stmt) - 1; + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql, myOptions); + + return result[index]; + }; +}; diff --git a/modules/ticket/back/methods/sale/salePreparingList.js b/modules/ticket/back/methods/sale/salePreparingList.js deleted file mode 100644 index e6e7d5164..000000000 --- a/modules/ticket/back/methods/sale/salePreparingList.js +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('salePreparingList', { - description: 'Returns a list with the lines of a ticket and its different states of preparation', - accessType: 'READ', - accepts: [{ - arg: 'id', - type: 'number', - required: true, - description: 'The ticket id', - http: {source: 'path'} - }], - returns: { - type: ['object'], - root: true - }, - http: { - path: `/:id/salePreparingList`, - verb: 'GET' - } - }); - - Self.salePreparingList = async(ctx, id, options) => { - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - query = `CALL vn.salePreparingList(?)`; - const [sales] = await Self.rawSql(query, [id], myOptions); - - return sales; - }; -}; diff --git a/modules/ticket/back/models/sale-tracking.js b/modules/ticket/back/models/sale-tracking.js index 446bdf37b..76efff4c7 100644 --- a/modules/ticket/back/models/sale-tracking.js +++ b/modules/ticket/back/models/sale-tracking.js @@ -1,4 +1,5 @@ module.exports = Self => { + require('../methods/sale-tracking/salePreparingList')(Self); require('../methods/sale-tracking/listSaleTracking')(Self); require('../methods/sale-tracking/replace')(Self); require('../methods/sale-tracking/delete')(Self); diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index bab201fdd..ae247fc24 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -1,6 +1,5 @@ module.exports = Self => { require('../methods/sale/getClaimableFromTicket')(Self); - require('../methods/sale/salePreparingList')(Self); require('../methods/sale/reserve')(Self); require('../methods/sale/deleteSales')(Self); require('../methods/sale/updatePrice')(Self); diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 8d3fa65af..193f87622 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -1,8 +1,6 @@ @@ -69,26 +67,26 @@ - {{::sale.item.id}} + {{::sale.itemFk}}
- {{::sale.item.name}} - -

{{::sale.item.subName}}

+ {{::sale.concept}} + +

{{::sale.subName}}

{{::sale.quantity}} - {{::sale.saleGroupDetail.saleGroup.parking.code | dashIfEmpty}} + {{::sale.parkingCode | dashIfEmpty}} { - res.data.forEach(salePreparing => { - const sale = this.sales.find(sale => salePreparing.saleFk === sale.id); - if (sale) sale.preparingList = salePreparing; - }); - }); - } - } - showItemDescriptor(event, sale) { this.quicklinks = { btnThree: { @@ -72,29 +54,29 @@ class Controller extends Section { } showSaleTracking(sale) { - this.saleId = sale.id; + this.saleId = sale.saleFk; this.$.saleTracking.show(); } showItemShelvingSale(sale) { - this.saleId = sale.id; + this.saleId = sale.saleFk; this.$.itemShelvingSale.show(); } clickPreviousSelected(index) { const sale = this.sales[index]; - if (!sale.preparingList.isPreviousSelected) { + if (!sale.isPreviousSelected) { this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); - sale.preparingList.isPreviousSelected = true; + sale.isPreviousSelected = true; } else { this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION'); - sale.preparingList.isPreviousSelected = false; + sale.isPreviousSelected = false; } } saleTrackingNew(sale, stateCode, isChecked) { const params = { - saleFk: sale.id, + saleFk: sale.saleFk, isChecked: isChecked, quantity: sale.quantity, stateCode: stateCode @@ -106,7 +88,7 @@ class Controller extends Section { saleTrackingDel(sale, stateCode) { const params = { - saleFk: sale.id, + saleFk: sale.saleFk, stateCode: stateCode }; this.$http.post(`SaleTrackings/delete`, params).then(() => { From cf2bf0a17ba611e2d19e4e3f38dfc7f9364b0275 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 2 Jun 2023 08:23:44 +0200 Subject: [PATCH 033/311] refs #5561 delete: codigo obsoleto --- modules/ticket/front/sale-tracking/index.js | 35 --------------------- 1 file changed, 35 deletions(-) diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index c40892a52..62174860b 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -3,41 +3,6 @@ import Section from 'salix/components/section'; import './style.scss'; class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - include: [ - { - relation: 'item' - }, - { - relation: 'saleTracking', - scope: { - fields: ['isChecked'] - } - }, - { - relation: 'saleGroupDetail', - scope: { - fields: ['saleGroupFk'], - include: { - relation: 'saleGroup', - scope: { - fields: ['parkingFk'], - include: { - relation: 'parking', - scope: { - fields: ['code'] - } - } - } - } - } - } - ] - }; - } - showItemDescriptor(event, sale) { this.quicklinks = { btnThree: { From 02d2afcb8ba9724eb30e3c4e8527651c3b6171cb Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 2 Jun 2023 10:57:28 +0200 Subject: [PATCH 034/311] refs #5561 feat: permite coloear todos los circulos --- .../back/methods/sale-tracking/delete.js | 36 +++++++-------- .../back/methods/sale-tracking/replace.js | 46 +++++++++---------- modules/ticket/front/sale-tracking/index.html | 11 +++-- modules/ticket/front/sale-tracking/index.js | 39 +++++++++++++++- 4 files changed, 85 insertions(+), 47 deletions(-) diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index e2869c89a..23fc9f01d 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -31,25 +31,25 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const itemShelvingSales = await models.ItemShelvingSale.find({saleFk: saleFk}, myOptions); - for (let itemShelvingSale of itemShelvingSales) - await itemShelvingSale.destroy(myOptions); + // const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions); + // for (let itemShelvingSale of itemShelvingSales) + // await itemShelvingSale.destroy(myOptions); - const filter = { - where: { - saleFk: saleFk, - code: stateCode - } - }; - const saleTrackings = await models.SaleTracking.find(filter, myOptions); - for (let saleTracking of saleTrackings) - await saleTracking.destroy(myOptions); + // const filter = { + // where: { + // saleFk: saleFk, + // code: stateCode + // } + // }; + // const saleTrackings = await models.SaleTracking.find(filter, myOptions); + // for (let saleTracking of saleTrackings) + // await saleTracking.destroy(myOptions); - // query = `CALL vn.saleTracking_del(?, ?)`; - // return Self.rawSql(query, - // [ - // saleFk, - // stateCode, - // ], myOptions); + query = `CALL vn.saleTracking_del(?, ?)`; + return Self.rawSql(query, + [ + saleFk, + stateCode, + ], myOptions); }; }; diff --git a/modules/ticket/back/methods/sale-tracking/replace.js b/modules/ticket/back/methods/sale-tracking/replace.js index a2f9d6c08..140d0fc00 100644 --- a/modules/ticket/back/methods/sale-tracking/replace.js +++ b/modules/ticket/back/methods/sale-tracking/replace.js @@ -40,31 +40,31 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const state = await models.State.findOne({ - where: {code: stateCode} - }, myOptions); + // const state = await models.State.findOne({ + // where: {code: stateCode} + // }, myOptions); - if (!state) return; + // if (!state) return; - const data = { - saleFk: saleFk, - isChecked: isChecked, - originalQuantity: quantity, - workerFk: userId, - stateFk: state.id - }; - return models.SaleTracking.replaceOrCreate(data, myOptions); + // const data = { + // saleFk: saleFk, + // isChecked: isChecked, + // originalQuantity: quantity, + // workerFk: userId, + // stateFk: state.id + // }; + // return models.SaleTracking.replaceOrCreate(data, myOptions); - // query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?, ?)`; - // return Self.rawSql(query, - // [ - // saleFk, - // isChecked, - // quantity, - // userId, - // stateCode, - // 'parameterToDelete', - // null - // ], myOptions); + query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?, ?)`; + return Self.rawSql(query, + [ + saleFk, + isChecked, + quantity, + userId, + 'parameterToDelete', + stateCode, + null + ], myOptions); }; }; diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 193f87622..1bd79642f 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -3,7 +3,7 @@ url="SaleTrackings/{{$ctrl.$params.id}}/salePreparingList" limit="20" data="$ctrl.sales" - order="concept ASC" + order="concept ASC, quantity DESC" auto-load="true"> @@ -46,7 +46,8 @@ 'none': !sale.isPrevious, }" class="circleState" - vn-tooltip="is previous"> + vn-tooltip="is previous" + vn-click-stop="$ctrl.clickPrevious($index)"> + vn-tooltip="is prepared" + vn-click-stop="$ctrl.clickPrepared($index)"> + vn-tooltip="is controled" + vn-click-stop="$ctrl.clickControled($index)"> diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index 62174860b..3016043d6 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -31,11 +31,46 @@ class Controller extends Section { clickPreviousSelected(index) { const sale = this.sales[index]; if (!sale.isPreviousSelected) { - this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); sale.isPreviousSelected = true; + this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); } else { - this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION'); sale.isPreviousSelected = false; + sale.isPrevious = false; + this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION'); + } + } + + clickPrevious(index) { + const sale = this.sales[index]; + if (!sale.isPrevious) { + sale.isPrevious = true; + sale.isPreviousSelected = true; + this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', true); + } else { + sale.isPrevious = false; + this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); + } + } + + clickPrepared(index) { + const sale = this.sales[index]; + if (!sale.isPrepared) { + sale.isPrepared = true; + this.saleTrackingNew(sale, 'PREPARED', true); + } else { + sale.isPrepared = false; + this.saleTrackingDel(sale, 'PREPARED'); + } + } + + clickControled(index) { + const sale = this.sales[index]; + if (!sale.isControled) { + sale.isControled = true; + this.saleTrackingNew(sale, 'CHECKED', true); + } else { + sale.isControled = false; + this.saleTrackingDel(sale, 'CHECKED'); } } From ba64dbbe46699b3a69b6fce6c85f60814b815aed Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 2 Jun 2023 12:20:29 +0200 Subject: [PATCH 035/311] refs #5561 refactor: actualizados nombres --- .../{salePreparingList.js => filter.js} | 16 +++------------- modules/ticket/back/models/sale-tracking.js | 2 +- modules/ticket/front/sale-tracking/index.html | 16 ++++++++-------- modules/ticket/front/sale-tracking/locale/es.yml | 13 +++++++------ 4 files changed, 19 insertions(+), 28 deletions(-) rename modules/ticket/back/methods/sale-tracking/{salePreparingList.js => filter.js} (84%) diff --git a/modules/ticket/back/methods/sale-tracking/salePreparingList.js b/modules/ticket/back/methods/sale-tracking/filter.js similarity index 84% rename from modules/ticket/back/methods/sale-tracking/salePreparingList.js rename to modules/ticket/back/methods/sale-tracking/filter.js index 063730fde..ee074a852 100644 --- a/modules/ticket/back/methods/sale-tracking/salePreparingList.js +++ b/modules/ticket/back/methods/sale-tracking/filter.js @@ -2,7 +2,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { - Self.remoteMethod('salePreparingList', { + Self.remoteMethod('filter', { description: 'Returns a list with the lines of a ticket and its different states of preparation', accessType: 'READ', accepts: [ @@ -24,12 +24,12 @@ module.exports = Self => { root: true }, http: { - path: `/:id/salePreparingList`, + path: `/:id/filter`, verb: 'GET' } }); - Self.salePreparingList = async(id, filter, options) => { + Self.filter = async(id, filter, options) => { const conn = Self.dataSource.connector; const myOptions = {}; @@ -44,24 +44,17 @@ module.exports = Self => { stmt = new ParameterizedSQL( `SELECT t.clientFk, t.shipped, - a.nickname, s.ticketFk, s.itemFk, s.quantity, s.concept, - s.reserved, s.id saleFk, - i.size, - i.inkFk, - i.stems, i.image, i.subName, - b.grouping, IF(stPrevious.saleFk,TRUE,FALSE) as isPreviousSelected, stPrevious.isChecked as isPrevious, stPrepared.isChecked as isPrepared, stControled.isChecked as isControled, - ib.code as barcode, (MAX(sgd.id) IS NOT NULL) AS hasSaleGroupDetail, p.code AS parkingCode, i.value5, @@ -71,15 +64,12 @@ module.exports = Self => { i.value9, i.value10 FROM vn.ticket t - JOIN vn.address a ON a.id = t.addressFk JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id AND stPrevious.stateFk = 26 LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id AND stPrepared.stateFk = 14 LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id AND stControled.stateFk = 8 - LEFT JOIN vn.itemBarcode ib ON ib.itemFk = i.id LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id LEFT JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk LEFT JOIN vn.parking p ON p.id = sg.parkingFk diff --git a/modules/ticket/back/models/sale-tracking.js b/modules/ticket/back/models/sale-tracking.js index 76efff4c7..86a5ea4ca 100644 --- a/modules/ticket/back/models/sale-tracking.js +++ b/modules/ticket/back/models/sale-tracking.js @@ -1,5 +1,5 @@ module.exports = Self => { - require('../methods/sale-tracking/salePreparingList')(Self); + require('../methods/sale-tracking/filter')(Self); require('../methods/sale-tracking/listSaleTracking')(Self); require('../methods/sale-tracking/replace')(Self); require('../methods/sale-tracking/delete')(Self); diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 1bd79642f..76b178c26 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -1,6 +1,6 @@ @@ -93,12 +93,12 @@ diff --git a/modules/ticket/front/sale-tracking/locale/es.yml b/modules/ticket/front/sale-tracking/locale/es.yml index eabc0a04d..559321dd6 100644 --- a/modules/ticket/front/sale-tracking/locale/es.yml +++ b/modules/ticket/front/sale-tracking/locale/es.yml @@ -1,6 +1,7 @@ -ItemShelvings sale: Carros línea -has saleGroupDetail: tiene detalle grupo lineas -is previousSelected: es previa seleccionada -is previous: es previa -is prepared: esta preparado -is controled: esta controlado +Shelvings sale: Carros línea +Log states: Historial estados +sale group detail: detalle grupo lineas +previous selected: previa seleccionado +previous: previa +prepared: preparado +checked: revisado From 67413360c654794bf519e4fca07a42cf51340a9a Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 2 Jun 2023 13:31:41 +0200 Subject: [PATCH 036/311] =?UTF-8?q?refs=20#5561=20feat:=20utilizar=20m?= =?UTF-8?q?=C3=A9todos=20bd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/232401/00-saleTracking_new.sql | 38 +++++++++++++++++++ .../back/methods/sale-tracking/delete.js | 15 -------- .../sale-tracking/{replace.js => new.js} | 23 ++--------- modules/ticket/back/models/sale-tracking.js | 2 +- 4 files changed, 42 insertions(+), 36 deletions(-) create mode 100644 db/changes/232401/00-saleTracking_new.sql rename modules/ticket/back/methods/sale-tracking/{replace.js => new.js} (63%) diff --git a/db/changes/232401/00-saleTracking_new.sql b/db/changes/232401/00-saleTracking_new.sql new file mode 100644 index 000000000..d5fa569fd --- /dev/null +++ b/db/changes/232401/00-saleTracking_new.sql @@ -0,0 +1,38 @@ +DELIMITER $$ +$$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_new`( + vSaleFK INT, + vIsChecked BOOLEAN, + vOriginalQuantity INT, + vWorkerFk INT, + vState VARCHAR(50), + vIsScanned BOOLEAN) +BEGIN +/** + * Modifica registro de saleTracking + * + * @param vSaleFK Identificador del registro a modificar + * @param vIsChecked Indica si la línea ha sido pulsada + * @param vOriginalQuantity Cantidad original + * @param vWorkerFk Identificador del trabajador + * @param vAction Identificador de la acción realizada + * @param vState Identificador del estado a modificar + * @param vIsScanned Identificador si se ha escaneado automáticamente o manual + */ + + REPLACE vn.saleTracking(saleFk, + isChecked, + originalQuantity, + workerFk, + stateFk, + isScanned) + SELECT vSaleFK, + vIsChecked, + vOriginalQuantity, + IFNULL(vWorkerFk, vn.getUser()), + s.id, + vIsScanned + FROM vn.state s + WHERE s.code = vState COLLATE utf8_unicode_ci; +END$$ +DELIMITER ; diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index 23fc9f01d..68b8b8ddc 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -25,26 +25,11 @@ module.exports = Self => { }); Self.delete = async(saleFk, stateCode, options) => { - const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - // const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions); - // for (let itemShelvingSale of itemShelvingSales) - // await itemShelvingSale.destroy(myOptions); - - // const filter = { - // where: { - // saleFk: saleFk, - // code: stateCode - // } - // }; - // const saleTrackings = await models.SaleTracking.find(filter, myOptions); - // for (let saleTracking of saleTrackings) - // await saleTracking.destroy(myOptions); - query = `CALL vn.saleTracking_del(?, ?)`; return Self.rawSql(query, [ diff --git a/modules/ticket/back/methods/sale-tracking/replace.js b/modules/ticket/back/methods/sale-tracking/new.js similarity index 63% rename from modules/ticket/back/methods/sale-tracking/replace.js rename to modules/ticket/back/methods/sale-tracking/new.js index 140d0fc00..d946fc40c 100644 --- a/modules/ticket/back/methods/sale-tracking/replace.js +++ b/modules/ticket/back/methods/sale-tracking/new.js @@ -1,6 +1,6 @@ module.exports = Self => { - Self.remoteMethodCtx('replace', { + Self.remoteMethodCtx('new', { description: 'Remplaza el registro o lo crea si no existe', accessType: 'READ', accepts: [ @@ -27,34 +27,18 @@ module.exports = Self => { root: true }, http: { - path: `/replace`, + path: `/new`, verb: 'POST' } }); - Self.replace = async(ctx, saleFk, isChecked, quantity, stateCode, options) => { - const models = Self.app.models; + Self.new = async(ctx, saleFk, isChecked, quantity, stateCode, options) => { const myOptions = {}; const userId = ctx.req.accessToken.userId; if (typeof options == 'object') Object.assign(myOptions, options); - // const state = await models.State.findOne({ - // where: {code: stateCode} - // }, myOptions); - - // if (!state) return; - - // const data = { - // saleFk: saleFk, - // isChecked: isChecked, - // originalQuantity: quantity, - // workerFk: userId, - // stateFk: state.id - // }; - // return models.SaleTracking.replaceOrCreate(data, myOptions); - query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?, ?)`; return Self.rawSql(query, [ @@ -62,7 +46,6 @@ module.exports = Self => { isChecked, quantity, userId, - 'parameterToDelete', stateCode, null ], myOptions); diff --git a/modules/ticket/back/models/sale-tracking.js b/modules/ticket/back/models/sale-tracking.js index 86a5ea4ca..54a2b5a1a 100644 --- a/modules/ticket/back/models/sale-tracking.js +++ b/modules/ticket/back/models/sale-tracking.js @@ -1,6 +1,6 @@ module.exports = Self => { require('../methods/sale-tracking/filter')(Self); require('../methods/sale-tracking/listSaleTracking')(Self); - require('../methods/sale-tracking/replace')(Self); + require('../methods/sale-tracking/new')(Self); require('../methods/sale-tracking/delete')(Self); }; From 5eac9d20dcc9d6047f96aed759e3ca46662a7c61 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 5 Jun 2023 09:43:39 +0200 Subject: [PATCH 037/311] a --- modules/ticket/front/sale-tracking/index.html | 79 +++++++++++++++++-- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 76b178c26..e51bc7499 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -158,7 +158,8 @@ - + + - - - + + Quantity @@ -181,7 +181,15 @@ - {{::itemShelvingSale.quantity}} + + {{itemShelvingSale.quantity}} + + + + + + + + From 024cb1e3f4ec1f02b20e52101d4fe17c33cb3807 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 6 Jun 2023 11:56:14 +0200 Subject: [PATCH 038/311] refs #5561 feat: permite modificar registros --- db/changes/232401/00-aclSaleTracking.sql | 3 + .../back/methods/item-shelving-sale/filter.js | 6 +- modules/item/back/models/item-shelving.json | 5 - modules/monitor/front/index/orders/index.html | 22 ++-- .../back/methods/sale-tracking/delete.js | 26 ++++- .../sale-tracking/deleteSaleGroupDetail.js | 49 ++++++++ .../ticket/back/methods/sale-tracking/new.js | 35 ++++-- modules/ticket/back/models/sale-tracking.js | 1 + modules/ticket/front/sale-tracking/index.html | 106 ++++++------------ modules/ticket/front/sale-tracking/index.js | 80 +++++++++++-- modules/ticket/front/sale-tracking/style.scss | 9 -- 11 files changed, 219 insertions(+), 123 deletions(-) create mode 100644 db/changes/232401/00-aclSaleTracking.sql create mode 100644 modules/ticket/back/methods/sale-tracking/deleteSaleGroupDetail.js diff --git a/db/changes/232401/00-aclSaleTracking.sql b/db/changes/232401/00-aclSaleTracking.sql new file mode 100644 index 000000000..441945fe2 --- /dev/null +++ b/db/changes/232401/00-aclSaleTracking.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('SaleTracking', 'deleteSaleGroupDetail', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/modules/item/back/methods/item-shelving-sale/filter.js b/modules/item/back/methods/item-shelving-sale/filter.js index 12029d33d..01a9f1856 100644 --- a/modules/item/back/methods/item-shelving-sale/filter.js +++ b/modules/item/back/methods/item-shelving-sale/filter.js @@ -28,11 +28,15 @@ module.exports = Self => { Object.assign(myOptions, options); const stmt = new ParameterizedSQL(` - SELECT iss.created, + SELECT + iss.id, + iss.created, iss.saleFk, iss.quantity, iss.userFk, + ish.id itemShelvingFk, ish.shelvingFk, + s.parkingFk, p.code, u.name FROM itemShelvingSale iss diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index 49bebcb6b..0b1d0eceb 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -35,11 +35,6 @@ "type": "belongsTo", "model": "VnUser", "foreignKey": "userFk" - }, - "shelving": { - "type": "belongsTo", - "model": "Shelving", - "foreignKey": "shelvingFk" } } } diff --git a/modules/monitor/front/index/orders/index.html b/modules/monitor/front/index/orders/index.html index 74e80e40e..4d1171185 100644 --- a/modules/monitor/front/index/orders/index.html +++ b/modules/monitor/front/index/orders/index.html @@ -32,7 +32,7 @@ - @@ -46,7 +46,7 @@ ui-sref="order.card.summary({id: {{::order.id}}})" target="_blank"> - @@ -98,7 +98,7 @@ scroll-offset="100"> - Filter by selection - Exclude selection - Remove filter - Remove all filters - Copy value @@ -138,4 +138,4 @@ on-accept="$ctrl.onDelete()" question="All the selected elements will be deleted. Are you sure you want to continue?" message="Delete selected elements"> - \ No newline at end of file + diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index 68b8b8ddc..000c52621 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -26,15 +26,29 @@ module.exports = Self => { Self.delete = async(saleFk, stateCode, options) => { const myOptions = {}; + let tx; if (typeof options == 'object') Object.assign(myOptions, options); - query = `CALL vn.saleTracking_del(?, ?)`; - return Self.rawSql(query, - [ - saleFk, - stateCode, - ], myOptions); + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const result = await Self.rawSql(`CALL vn.saleTracking_del(?, ?)`, + [ + saleFk, + stateCode, + ], myOptions); + + if (tx) await tx.commit(); + + return result; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } }; }; diff --git a/modules/ticket/back/methods/sale-tracking/deleteSaleGroupDetail.js b/modules/ticket/back/methods/sale-tracking/deleteSaleGroupDetail.js new file mode 100644 index 000000000..13806edf0 --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/deleteSaleGroupDetail.js @@ -0,0 +1,49 @@ + +module.exports = Self => { + Self.remoteMethod('deleteSaleGroupDetail', { + description: 'Elimina los registros de saleGroupDetail', + accessType: 'WRITE', + accepts: [ + { + arg: 'saleFk', + type: 'number', + description: 'The sale id' + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/deleteSaleGroupDetail`, + verb: 'POST' + } + }); + + Self.deleteSaleGroupDetail = async(saleFk, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const deletes = await models.SaleGroupDetail.destroyAll({ + saleFk: saleFk + }, myOptions); + + if (tx) await tx.commit(); + + return deletes; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/ticket/back/methods/sale-tracking/new.js b/modules/ticket/back/methods/sale-tracking/new.js index d946fc40c..ec5951d7d 100644 --- a/modules/ticket/back/methods/sale-tracking/new.js +++ b/modules/ticket/back/methods/sale-tracking/new.js @@ -33,21 +33,34 @@ module.exports = Self => { }); Self.new = async(ctx, saleFk, isChecked, quantity, stateCode, options) => { - const myOptions = {}; const userId = ctx.req.accessToken.userId; + const myOptions = {}; + let tx; if (typeof options == 'object') Object.assign(myOptions, options); - query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?, ?)`; - return Self.rawSql(query, - [ - saleFk, - isChecked, - quantity, - userId, - stateCode, - null - ], myOptions); + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + try { + const result = await Self.rawSql(`CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?)`, + [ + saleFk, + isChecked, + quantity, + userId, + stateCode, + null + ], myOptions); + + if (tx) await tx.commit(); + + return result; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } }; }; diff --git a/modules/ticket/back/models/sale-tracking.js b/modules/ticket/back/models/sale-tracking.js index 54a2b5a1a..38de256be 100644 --- a/modules/ticket/back/models/sale-tracking.js +++ b/modules/ticket/back/models/sale-tracking.js @@ -3,4 +3,5 @@ module.exports = Self => { require('../methods/sale-tracking/listSaleTracking')(Self); require('../methods/sale-tracking/new')(Self); require('../methods/sale-tracking/delete')(Self); + require('../methods/sale-tracking/deleteSaleGroupDetail')(Self); }; diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index e51bc7499..1ae845a74 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -6,6 +6,16 @@ order="concept ASC, quantity DESC" auto-load="true"> + + + + @@ -29,7 +39,7 @@ }" class="circleState" vn-tooltip="sale group detail" - > + vn-click-stop="$ctrl.clickSaleGroupDetail($index)"> + - + Quantity Worker - Shelving - Parking + Shelving + Parking Created @@ -186,7 +195,7 @@ + on-change="$ctrl.updateQuantity(itemShelvingSale)"> @@ -197,8 +206,24 @@ {{::itemShelvingSale.name | dashIfEmpty}} - {{::itemShelvingSale.shelvingFk}} - {{::itemShelvingSale.code}} + + + + + + + + {{::itemShelvingSale.created | date: 'dd/MM/yyyy HH:mm'}} @@ -209,64 +234,3 @@ vn-id="worker-descriptor"> - - - diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index 3016043d6..8521a03af 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -28,49 +28,61 @@ class Controller extends Section { this.$.itemShelvingSale.show(); } + clickSaleGroupDetail(index) { + const sale = this.sales[index]; + const params = { + saleFk: sale.saleFk + }; + return this.$http.post('SaleTrackings/deleteSaleGroupDetail', params) + .then(() => { + sale.hasSaleGroupDetail = false; + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } + clickPreviousSelected(index) { const sale = this.sales[index]; if (!sale.isPreviousSelected) { - sale.isPreviousSelected = true; this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); + sale.isPreviousSelected = true; } else { + this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION'); sale.isPreviousSelected = false; sale.isPrevious = false; - this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION'); } } clickPrevious(index) { const sale = this.sales[index]; if (!sale.isPrevious) { + this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', true); sale.isPrevious = true; sale.isPreviousSelected = true; - this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', true); } else { - sale.isPrevious = false; this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); + sale.isPrevious = false; } } clickPrepared(index) { const sale = this.sales[index]; if (!sale.isPrepared) { - sale.isPrepared = true; this.saleTrackingNew(sale, 'PREPARED', true); + sale.isPrepared = true; } else { - sale.isPrepared = false; this.saleTrackingDel(sale, 'PREPARED'); + sale.isPrepared = false; } } clickControled(index) { const sale = this.sales[index]; if (!sale.isControled) { - sale.isControled = true; this.saleTrackingNew(sale, 'CHECKED', true); + sale.isControled = true; } else { - sale.isControled = false; this.saleTrackingDel(sale, 'CHECKED'); + sale.isControled = false; } } @@ -81,7 +93,7 @@ class Controller extends Section { quantity: sale.quantity, stateCode: stateCode }; - this.$http.post(`SaleTrackings/replace`, params).then(() => { + this.$http.post(`SaleTrackings/new`, params).then(() => { this.vnApp.showSuccess(this.$t('Data saved!')); }); } @@ -95,6 +107,56 @@ class Controller extends Section { this.vnApp.showSuccess(this.$t('Data saved!')); }); } + + updateQuantity(itemShelvingSale) { + const params = { + quantity: itemShelvingSale.quantity + }; + this.$http.patch(`ItemShelvingSales/${itemShelvingSale.id}`, params) + .then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } + + updateShelving(itemShelvingSale) { + const params = { + shelvingFk: itemShelvingSale.shelvingFk + }; + this.$http.patch(`ItemShelvings/${itemShelvingSale.itemShelvingFk}`, params) + .then(res => { + const filter = { + fields: ['parkingFk'], + where: { + code: res.data.shelvingFk + } + }; + this.$http.get(`Shelvings/findOne`, {filter}) + .then(res => { + itemShelvingSale.parkingFk = res.data.parkingFk; + }); + + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } + + updateParking(itemShelvingSale) { + const filter = { + fields: ['id'], + where: { + code: itemShelvingSale.shelvingFk + } + }; + this.$http.get(`Shelvings/findOne`, {filter}) + .then(res => { + const params = { + parkingFk: itemShelvingSale.parkingFk + }; + this.$http.patch(`Shelvings/${res.data.id}`, params) + .then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + }); + } } ngModule.vnComponent('vnTicketSaleTracking', { diff --git a/modules/ticket/front/sale-tracking/style.scss b/modules/ticket/front/sale-tracking/style.scss index 78a0bda1d..f0807d75d 100644 --- a/modules/ticket/front/sale-tracking/style.scss +++ b/modules/ticket/front/sale-tracking/style.scss @@ -1,14 +1,5 @@ @import "variables"; -vn-sale-tracking { - .chip { - display: inline-block; - min-width: 15px; - min-height: 25px; - } - -} - .circleState { display: inline-block; justify-content: center; From 391dba6d2cb92614b11cc6ac581a379c8fc06ccc Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 6 Jun 2023 12:15:39 +0200 Subject: [PATCH 039/311] refs #5561 feat: add async functions --- modules/ticket/front/sale-tracking/index.html | 4 +- modules/ticket/front/sale-tracking/index.js | 43 ++++++++----------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 1ae845a74..f05cf15fb 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -21,7 +21,7 @@ - Is checked + Is checked Item Description Quantity @@ -31,7 +31,7 @@ - + - -
- {{name}} -
-
- {{nickname}}, {{code}} -
-
- - + +
+ {{name}} +
+
+ {{nickname}}, {{code}} +
+
diff --git a/front/core/components/worker-autocomplete/index.js b/front/core/components/worker-autocomplete/index.js index 7983f53a5..59a46cc46 100755 --- a/front/core/components/worker-autocomplete/index.js +++ b/front/core/components/worker-autocomplete/index.js @@ -1,26 +1,28 @@ import ngModule from '../../module'; import Autocomplete from '../autocomplete'; -/** - * Input with option selector. - * - * @property {String} showFiled The data field name that should be shown - * @property {String} valueField The data field name that should be used as value - * @property {Array} data Static data for the autocomplete - * @property {Object} intialData An initial data to avoid the server request used to get the selection - * @property {Boolean} multiple Whether to allow multiple selection - * @property {Object} selection Current object selected - * - * @event change Thrown when value is changed - */ export default class WorkerAutocomplete extends Autocomplete { - constructor($element, $, $compile, $transclude) { - super($element, $, $compile, $transclude); + constructor(...args) { + super(...args); + Object.assign(this, { + label: 'Worker', + url: 'Workers/search', + fields: ['id', 'name', 'nickname'], + searchFunction: function($search) { + return {and: [ + {active: {neq: false}}, + {or: [ + {name: $search}, + {nickname: {like: '%' + $search + '%'}}, + {code: {like: $search + '%'}} + ]} + ]}; + } + }); } } -WorkerAutocomplete.$inject = ['$element', '$scope', '$compile', '$transclude']; ngModule.vnComponent('vnWorkerAutocomplete', { - template: require('./index.html'), + slotTemplate: require('./index.html'), controller: WorkerAutocomplete }); diff --git a/modules/worker/back/methods/worker/search.js b/modules/worker/back/methods/worker/search.js index 1d1742595..39bcef4c1 100644 --- a/modules/worker/back/methods/worker/search.js +++ b/modules/worker/back/methods/worker/search.js @@ -18,44 +18,7 @@ module.exports = Self => { }); Self.search = async filter => { - const models = Self.app.models; - - delete filter.order; - delete filter.fields; - const users = await models.VnUser.find(filter); - - if (filter.where) { - const indexToDelete = 2; - const filterByCode = filter.where.or.splice(indexToDelete, 1)[0]; - - const ids = users.map(user => parseInt(user.id)); - filter.where.or = [ - {id: {inq: ids}}, - filterByCode - ]; - } - - filter.include = { - relation: 'user', - scope: { - fields: ['name', 'nickname'] - } - }; - - const workers = await models.Worker.find(filter); - - const result = workers.map(worker => { - return { - id: worker.id, - code: worker.code, - name: worker.user().name, - nickname: worker.user().nickname - }; - }); - result.sort((a, b) => { - return a.name.localeCompare(b.name); - }); - - return result; + const $ = Self.app.models; + return await $.VnUser.find(filter); }; }; From 7dd5a5ac8e0d60dc0c581baf3a3fd6a472949f1b Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 8 Jun 2023 13:12:30 +0200 Subject: [PATCH 042/311] refs #5244 feat: hereda correctamente --- db/changes/232601/00-aclWorker.sql | 3 +++ front/core/components/autocomplete/index.js | 7 +++---- front/core/components/field/index.js | 6 +++--- .../components/worker-autocomplete/index.js | 2 +- front/core/lib/component.js | 7 +++---- front/core/lib/event-emitter.js | 1 - modules/worker/back/methods/worker/search.js | 18 +++++++++++++++++- 7 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 db/changes/232601/00-aclWorker.sql diff --git a/db/changes/232601/00-aclWorker.sql b/db/changes/232601/00-aclWorker.sql new file mode 100644 index 000000000..7e5081530 --- /dev/null +++ b/db/changes/232601/00-aclWorker.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (id, model, property, accessType, permission, principalType, principalId) + VALUES + ('Worker', 'search', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/front/core/components/autocomplete/index.js b/front/core/components/autocomplete/index.js index 2539c4ef4..b8a0617b3 100755 --- a/front/core/components/autocomplete/index.js +++ b/front/core/components/autocomplete/index.js @@ -17,10 +17,9 @@ import './style.scss'; * @event change Thrown when value is changed */ export default class Autocomplete extends Field { - constructor($element, $, $compile, $transclude) { - super($element, $, $compile); + constructor($element, $, $transclude) { + super($element, $, $transclude); this.$transclude = $transclude; - this.$compile = $compile; this._selection = null; this.input = this.element.querySelector('input'); } @@ -282,7 +281,7 @@ export default class Autocomplete extends Field { this.refreshSelection(); } } -Autocomplete.$inject = ['$element', '$scope', '$compile', '$transclude']; +Autocomplete.$inject = ['$element', '$scope', '$transclude']; ngModule.vnComponent('vnAutocomplete', { template: require('./index.html'), diff --git a/front/core/components/field/index.js b/front/core/components/field/index.js index 7ce840555..ff92b6b87 100644 --- a/front/core/components/field/index.js +++ b/front/core/components/field/index.js @@ -3,8 +3,8 @@ import FormInput from '../form-input'; import './style.scss'; export default class Field extends FormInput { - constructor($element, $scope) { - super($element, $scope); + constructor($element, $scope, $transclude) { + super($element, $scope, $transclude); this.prefix = null; this.suffix = null; @@ -197,7 +197,7 @@ export default class Field extends FormInput { }); } } -Field.$inject = ['$element', '$scope']; +Field.$inject = ['$element', '$scope', '$transclude']; ngModule.vnComponent('vnField', { template: require('./index.html'), diff --git a/front/core/components/worker-autocomplete/index.js b/front/core/components/worker-autocomplete/index.js index 59a46cc46..efaa6a4a9 100755 --- a/front/core/components/worker-autocomplete/index.js +++ b/front/core/components/worker-autocomplete/index.js @@ -8,7 +8,7 @@ export default class WorkerAutocomplete extends Autocomplete { label: 'Worker', url: 'Workers/search', fields: ['id', 'name', 'nickname'], - searchFunction: function($search) { + searchFunction: function({$search}) { return {and: [ {active: {neq: false}}, {or: [ diff --git a/front/core/lib/component.js b/front/core/lib/component.js index 5695d9449..6bb83e55a 100644 --- a/front/core/lib/component.js +++ b/front/core/lib/component.js @@ -12,10 +12,9 @@ export default class Component extends EventEmitter { * @param {HTMLElement} $element The main component element * @param {$rootScope.Scope} $scope The element scope * @param {Function} $transclude The transclusion function - * @param {Function} $location The location function */ - constructor($element, $scope, $transclude, $location) { - super($element, $scope, $transclude, $location); + constructor($element, $scope, $transclude) { + super(); this.$ = $scope; if (!$element) return; @@ -165,7 +164,7 @@ export default class Component extends EventEmitter { $transclude.$$boundTransclude.$$slots[slot]; } } -Component.$inject = ['$element', '$scope', '$location', '$state']; +Component.$inject = ['$element', '$scope', '$transclude']; /* * Automatically adds the most used services to the prototype, so they are diff --git a/front/core/lib/event-emitter.js b/front/core/lib/event-emitter.js index 83e361253..0e0ce1872 100644 --- a/front/core/lib/event-emitter.js +++ b/front/core/lib/event-emitter.js @@ -83,4 +83,3 @@ export default class EventEmitter { } } } -EventEmitter.$inject = ['$element', '$scope']; diff --git a/modules/worker/back/methods/worker/search.js b/modules/worker/back/methods/worker/search.js index 39bcef4c1..1e8343fac 100644 --- a/modules/worker/back/methods/worker/search.js +++ b/modules/worker/back/methods/worker/search.js @@ -19,6 +19,22 @@ module.exports = Self => { Self.search = async filter => { const $ = Self.app.models; - return await $.VnUser.find(filter); + + let {where} = filter; + const users = where && await $.VnUser.find({ + fields: ['id'], + where + }); + + const workers = await Self.find({ + fields: ['id'], + where: { + businessFk: {neq: null}, + id: users ? {inq: users.map(u => u.id)} : undefined + } + }); + + where = {id: {inq: workers.map(w => w.id)}}; + return await $.VnUser.find(Object.assign({}, filter, {where})); }; }; From f47a049d7ab55ea7d2baa6574bbbddc5f134fe84 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 8 Jun 2023 13:39:21 +0200 Subject: [PATCH 043/311] =?UTF-8?q?refs=20#5244=20fix:=20cambiada=20descri?= =?UTF-8?q?pci=C3=B3n=20erronea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/worker/back/methods/worker/activeWithInheritedRole.js | 4 ++-- modules/worker/back/methods/worker/activeWithRole.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/worker/back/methods/worker/activeWithInheritedRole.js b/modules/worker/back/methods/worker/activeWithInheritedRole.js index 9536b0f29..19038405b 100644 --- a/modules/worker/back/methods/worker/activeWithInheritedRole.js +++ b/modules/worker/back/methods/worker/activeWithInheritedRole.js @@ -1,7 +1,7 @@ module.exports = Self => { Self.remoteMethod('activeWithInheritedRole', { - description: 'Returns active workers with a role', + description: 'Returns active workers with an inherited role', accessType: 'READ', accepts: [{ arg: 'filter', @@ -24,7 +24,7 @@ module.exports = Self => { `SELECT DISTINCT w.id, w.firstName, w.lastName, u.name, u.nickname FROM worker w JOIN account.user u ON u.id = w.userFk - JOIN account.roleRole i ON i.role = u.role + JOIN account.roleRole i ON i.role = u.role JOIN account.role r ON r.id = i.inheritsFrom`; return Self.activeWorkers(query, filter); diff --git a/modules/worker/back/methods/worker/activeWithRole.js b/modules/worker/back/methods/worker/activeWithRole.js index 392416458..c7f96e151 100644 --- a/modules/worker/back/methods/worker/activeWithRole.js +++ b/modules/worker/back/methods/worker/activeWithRole.js @@ -1,7 +1,7 @@ module.exports = Self => { Self.remoteMethod('activeWithRole', { - description: 'Returns active workers with an inherited role', + description: 'Returns active workers with a role', accessType: 'READ', accepts: [{ arg: 'filter', From 5195c0100b0536c8b5b550eadf58af40718d3bba Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 8 Jun 2023 14:49:28 +0200 Subject: [PATCH 044/311] refs #5244 fix: sql --- db/changes/232601/00-aclWorker.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/232601/00-aclWorker.sql b/db/changes/232601/00-aclWorker.sql index 7e5081530..e79d8f738 100644 --- a/db/changes/232601/00-aclWorker.sql +++ b/db/changes/232601/00-aclWorker.sql @@ -1,3 +1,3 @@ -INSERT INTO `salix`.`ACL` (id, model, property, accessType, permission, principalType, principalId) +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES ('Worker', 'search', 'READ', 'ALLOW', 'ROLE', 'employee'); From 0cc5781f3fc2b562ee1fd617a40f35402be2fd6d Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 13 Jun 2023 15:05:37 +0200 Subject: [PATCH 045/311] =?UTF-8?q?refs=20#4734=20feat:=20a=C3=B1adido=20m?= =?UTF-8?q?=C3=A9todo=20putExpedicionInternacional=20de=20viaexpress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../putExpedicionInternacional.js | 135 ++++++++++++++++++ back/model-config.json | 3 + back/models/viaexpress-config.js | 3 + back/models/viaexpress-config.json | 34 +++++ db/changes/232601/00-acl_viaexpressConfig.sql | 3 + db/changes/232601/00-viaexpress.sql | 13 ++ db/dump/fixtures.sql | 12 +- 7 files changed, 197 insertions(+), 6 deletions(-) create mode 100644 back/methods/viaexpress-config/putExpedicionInternacional.js create mode 100644 back/models/viaexpress-config.js create mode 100644 back/models/viaexpress-config.json create mode 100644 db/changes/232601/00-acl_viaexpressConfig.sql create mode 100644 db/changes/232601/00-viaexpress.sql diff --git a/back/methods/viaexpress-config/putExpedicionInternacional.js b/back/methods/viaexpress-config/putExpedicionInternacional.js new file mode 100644 index 000000000..dc1df3218 --- /dev/null +++ b/back/methods/viaexpress-config/putExpedicionInternacional.js @@ -0,0 +1,135 @@ +const axios = require('axios'); + +module.exports = Self => { + Self.remoteMethod('putExpedicionInternacional', { + description: 'Returns the lastest campaigns', + accessType: 'WRITE', + accepts: [{ + arg: 'expeditionFk', + type: 'number', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/putExpedicionInternacional`, + verb: 'POST' + } + }); + + Self.putExpedicionInternacional = async(expeditionFk, options) => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const [data] = await Self.rawSql(` + SELECT urlAccess, + clientViaexpress, + userViaexpress, + passwordViaexpress, + defaultWeight, + DATE_FORMAT(t.shipped, '%Y-%m-%d') shipped, + deliveryType, + cv.socialName senderName, + av.street senderStreet, + av.postalCode senderPostalCode, + av.city senderCity, + pv.name senderProvince, + IFNULL(av.mobile, IFNULL(av.phone, IFNULL(cv.mobile, cv.phone))) senderPhone, + SUBSTRING_INDEX(cv.email, ',', 1) senderEmail, + a.nickname receiverName, + a.street receiverStreet, + a.postalCode receiverPostalCode, + a.city receiverCity, + p.name receiverProvince, + IFNULL(a.mobile, IFNULL(a.phone, IFNULL(c.mobile, c.phone))) receiverPhone, + SUBSTRING_INDEX(c.email, ',', 1) receiverEmail, + c2.code receiverCountry + FROM vn.viaexpressConfig + JOIN vn.expedition e ON e.id = ? + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.company co ON co.id = t.companyFk + JOIN vn.client cv ON cv.id = co.clientFk + JOIN vn.address av ON av.id = cv.defaultAddressFk + JOIN vn.province pv ON pv.id = av.provinceFk + JOIN vn.country c2 ON c2.id = p.countryFk`, [expeditionFk], myOptions); + + const xmlData = ` + + + + + ${data.defaultWeight} + 1 + 0 + ${data.shipped} + 0 + ${data.deliveryType} + 0 + 0 + 0 + 0 + 0 + + + 0 + + + + ${data.senderName} + ${data.senderStreet} + ${data.senderPostalCode} + ${data.senderCity} + ${data.senderProvince} + + ${data.senderPhone} + ${data.senderEmail} + + + ${data.receiverName} + ${data.receiverStreet} + ${data.receiverPostalCode} + ${data.receiverCity} + + ${data.receiverProvince} + + ${data.receiverPhone} + ${data.receiverEmail} + ${data.receiverCountry} + + + ${data.clientViaexpress} + ${data.userViaexpress} + ${data.passwordViaexpress} + + + + + `; + + const url = 'http://82.223.6.71:82/ServicioVxClientes.asmx'; + try { + const response = await axios.post(url, xmlData, { + headers: { + 'Content-Type': 'application/soap+xml; charset=utf-8' + } + }); + + const startTag = ''; + const endTag = ''; + const startIndex = response.data.indexOf(startTag) + startTag.length; + const endIndex = response.data.indexOf(endTag); + const referenciaVx = response.data.substring(startIndex, endIndex); + + return referenciaVx; + } catch (error) { + throw Error(error.response.data); + } + }; +}; diff --git a/back/model-config.json b/back/model-config.json index ff2bf5850..ec126455b 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -139,6 +139,9 @@ }, "PrintConfig": { "dataSource": "vn" + }, + "ViaexpressConfig": { + "dataSource": "vn" } } diff --git a/back/models/viaexpress-config.js b/back/models/viaexpress-config.js new file mode 100644 index 000000000..712bde60d --- /dev/null +++ b/back/models/viaexpress-config.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/viaexpress-config/putExpedicionInternacional')(Self); +}; diff --git a/back/models/viaexpress-config.json b/back/models/viaexpress-config.json new file mode 100644 index 000000000..ed150a448 --- /dev/null +++ b/back/models/viaexpress-config.json @@ -0,0 +1,34 @@ +{ + "name": "ViaexpressConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "viaexpressConfig" + } + }, + "properties": { + "id": { + "type": "number", + "required": true + }, + "urlAccess": { + "type": "string", + "required": true + }, + "clientViaexpress": { + "type": "date" + }, + "userViaexpress": { + "type": "number" + }, + "passwordViaexpress": { + "type": "number" + }, + "defaultWeight": { + "type": "number" + }, + "deliveryType": { + "type": "number" + } + } +} diff --git a/db/changes/232601/00-acl_viaexpressConfig.sql b/db/changes/232601/00-acl_viaexpressConfig.sql new file mode 100644 index 000000000..837185262 --- /dev/null +++ b/db/changes/232601/00-acl_viaexpressConfig.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('ViaexpressConfig', 'putExpedicionInternacional', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/232601/00-viaexpress.sql b/db/changes/232601/00-viaexpress.sql new file mode 100644 index 000000000..1313135f9 --- /dev/null +++ b/db/changes/232601/00-viaexpress.sql @@ -0,0 +1,13 @@ +CREATE TABLE `vn`.`viaexpressConfig` ( + id int auto_increment NOT NULL, + urlAccess varchar(100) NOT NULL, + clientViaexpress varchar(100) NOT NULL, + userViaexpress varchar(100) NOT NULL, + passwordViaexpress varchar(100) NOT NULL, + defaultWeight decimal(10,2) NOT NULL, + deliveryType varchar(5) NOT NULL, + CONSTRAINT viaexpressConfig_PK PRIMARY KEY (id) +) +ENGINE=InnoDB +DEFAULT CHARSET=utf8mb3 +COLLATE=utf8mb3_unicode_ci; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index a6557ff89..eddb1f6a9 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -566,13 +566,13 @@ INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`) VALUES (241, 442, 'ES111122333344111122221111', 128); -INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`, `companyGroupFk`, `phytosanitary`) +INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`, `companyGroupFk`, `phytosanitary` , `clientFk`) VALUES - (69 , 'CCs', NULL, 30, NULL, 0, NULL, 1, NULL), - (442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport'), - (567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport'), - (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL), - (1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport'); + (69 , 'CCs', NULL, 30, NULL, 0, NULL, 1, NULL , NULL), + (442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport' , 1101), + (567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport' , NULL), + (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL , NULL), + (1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport' , NULL); INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`) VALUES From 3a5e591cf0183e5726158e8ccfdc4b45d95186de Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 14 Jun 2023 15:15:00 +0200 Subject: [PATCH 046/311] refs #5475 feat(signin): use twoFactor and passExpired --- back/methods/vn-user/sign-in.js | 66 +++++++++++--- back/methods/vn-user/validate-auth.js | 30 ++----- back/model-config.json | 3 - back/models/user-access.json | 36 -------- back/models/vn-user.js | 87 ++++++++++--------- db/changes/{232001 => 232601}/00-authCode.sql | 14 --- .../{232001 => 232601}/00-department.sql | 0 db/changes/{232001 => 232601}/00-user.sql | 0 db/dump/fixtures.sql | 4 +- .../components/change-password/index.html | 8 ++ .../salix/components/change-password/index.js | 20 +++-- .../components/change-password/locale/es.yml | 3 + front/salix/routes.js | 2 +- loopback/locale/es.json | 4 +- modules/account/back/methods/account/login.js | 4 +- .../templates/email/auth-code/auth-code.html | 4 +- print/templates/email/auth-code/auth-code.js | 6 ++ print/templates/email/auth-code/locale/en.yml | 2 + print/templates/email/auth-code/locale/es.yml | 2 + print/templates/email/auth-code/locale/fr.yml | 2 + print/templates/email/auth-code/locale/pt.yml | 2 + 21 files changed, 158 insertions(+), 141 deletions(-) delete mode 100644 back/models/user-access.json rename db/changes/{232001 => 232601}/00-authCode.sql (50%) rename db/changes/{232001 => 232601}/00-department.sql (100%) rename db/changes/{232001 => 232601}/00-user.sql (100%) diff --git a/back/methods/vn-user/sign-in.js b/back/methods/vn-user/sign-in.js index 0a0133b82..e4cb00623 100644 --- a/back/methods/vn-user/sign-in.js +++ b/back/methods/vn-user/sign-in.js @@ -1,4 +1,5 @@ const ForbiddenError = require('vn-loopback/util/forbiddenError'); +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('signin', { @@ -26,7 +27,6 @@ module.exports = Self => { }); Self.signin = async function(ctx, user, password) { - const $ = Self.app.models; const usesEmail = user.indexOf('@') !== -1; const where = usesEmail @@ -34,30 +34,70 @@ module.exports = Self => { : {name: user}; const vnUser = await Self.findOne({ - fields: ['id', 'active', 'email', 'password', 'twoFactor'], + fields: ['id', 'name', 'password', 'active', 'email', 'passExpired', 'twoFactor'], where }); - if (vnUser && vnUser.twoFactor === 'email') { + const validCredentials = vnUser + && await vnUser.hasPassword(password); + + if (validCredentials) { + if (!vnUser.active) + throw new UserError('User disabled'); + await Self.sendTwoFactor(ctx, vnUser); + await Self.passExpired(vnUser); + + if (vnUser.twoFactor) + throw new ForbiddenError('REQUIRES_2FA'); + } + + return Self.validateLogin(user, password); + }; + + Self.passExpired = async vnUser => { + const today = Date.vnNew(); + today.setHours(0, 0, 0, 0); + + if (vnUser.passExpired && vnUser.passExpired.getTime() <= today.getTime()) { + const $ = Self.app.models; + const changePasswordToken = await $.AccessToken.create({ + scopes: ['change-password'], + userId: vnUser.id + }); + throw new UserError('Pass expired', 'passExpired', { + id: vnUser.id, + token: changePasswordToken.id, + twoFactor: vnUser.twoFactor ? true : false + }); + } + }; + + Self.sendTwoFactor = async(ctx, vnUser) => { + if (vnUser.twoFactor === 'email') { + const $ = Self.app.models; + const code = String(Math.floor(Math.random() * 999999)); const maxTTL = ((60 * 1000) * 5); // 5 min await $.AuthCode.upsertWithWhere({userFk: vnUser.id}, { userFk: vnUser.id, code: code, - expires: Date.now() + maxTTL + expires: Date.vnNow() + maxTTL }); + const headers = ctx.req.headers; + let platform = headers['sec-ch-ua-platform']?.replace(/['"=]+/g, ''); + let browser = headers['sec-ch-ua']?.replace(/['"=]+/g, ''); const params = { - recipientId: vnUser.id, - recipient: vnUser.email, - code: code + args: { + recipientId: vnUser.id, + recipient: vnUser.email, + code: code, + ip: ctx.req?.connection?.remoteAddress, + device: platform && browser ? platform + ', ' + browser : headers['user-agent'], + }, + req: {getLocale: ctx.req.getLocale} }; - ctx.args = {...ctx.args, ...params}; - await Self.sendTemplate(ctx, 'auth-code'); - - throw new ForbiddenError('REQUIRES_2FA'); + await Self.sendTemplate(params, 'auth-code'); } - - return Self.validateLogin(user, password); }; }; diff --git a/back/methods/vn-user/validate-auth.js b/back/methods/vn-user/validate-auth.js index 312f1347a..cc78e983e 100644 --- a/back/methods/vn-user/validate-auth.js +++ b/back/methods/vn-user/validate-auth.js @@ -1,7 +1,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('validateAuth', { + Self.remoteMethod('validateAuth', { description: 'Login a user with username/email and password', accepts: [ { @@ -31,8 +31,13 @@ module.exports = Self => { } }); - Self.validateAuth = async function(ctx, username, password, code) { - const {AuthCode, UserAccess} = Self.app.models; + Self.validateAuth = async function(username, password, code) { + await Self.validateCode(code); + return Self.validateLogin(username, password); + }; + + Self.validateCode = async(username, code) => { + const {AuthCode} = Self.app.models; const authCode = await AuthCode.findOne({ where: { @@ -47,27 +52,10 @@ module.exports = Self => { const user = await Self.findById(authCode.userFk, { fields: ['name', 'twoFactor'] }); - + console.log(username, code); if (user.name !== username) throw new UserError('Authentication failed'); - const headers = ctx.req.headers; - let platform = headers['sec-ch-ua-platform']; - let browser = headers['sec-ch-ua']; - - if (platform) platform = platform.replace(/['"]+/g, ''); - if (browser) browser = browser.split(';')[0].replace(/['"]+/g, ''); - - await UserAccess.upsertWithWhere({userFk: authCode.userFk}, { - userFk: authCode.userFk, - ip: ctx.req.connection.remoteAddress, - agent: headers['user-agent'], - platform: platform, - browser: browser - }); - await authCode.destroy(); - - return Self.validateLogin(username, password); }; }; diff --git a/back/model-config.json b/back/model-config.json index 504107f89..fd8ff2f20 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -116,9 +116,6 @@ "Town": { "dataSource": "vn" }, - "UserAccess": { - "dataSource": "vn" - }, "Url": { "dataSource": "vn" }, diff --git a/back/models/user-access.json b/back/models/user-access.json deleted file mode 100644 index f60d70251..000000000 --- a/back/models/user-access.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "UserAccess", - "base": "VnModel", - "options": { - "mysql": { - "table": "salix.userAccess" - } - }, - "properties": { - "userFk": { - "type": "number", - "required": true, - "id": true - }, - "ip": { - "type": "string", - "required": true - }, - "agent": { - "type": "string" - }, - "platform": { - "type": "string" - }, - "browser": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "Account", - "foreignKey": "userFk" - } - } -} diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 139ac3320..75490ccf8 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -1,6 +1,7 @@ const vnModel = require('vn-loopback/common/models/vn-model'); const LoopBackContext = require('loopback-context'); const {Email} = require('vn-print'); +const UserError = require('vn-loopback/util/user-error'); module.exports = function(Self) { vnModel(Self); @@ -110,53 +111,11 @@ module.exports = function(Self) { }); Self.validateLogin = async function(user, password) { - const models = Self.app.models; const usesEmail = user.indexOf('@') !== -1; - let token; const userInfo = usesEmail ? {email: user} : {username: user}; - const instance = await Self.findOne({ - fields: ['username', 'password'], - where: userInfo - }); - - const where = usesEmail - ? {email: user} - : {name: user}; - const vnUser = await Self.findOne({ - fields: ['id', 'active', 'passExpired'], - where - }); - - const today = Date.vnNew(); - today.setHours(0, 0, 0, 0); - - const validCredentials = instance - && await instance.hasPassword(password); - - if (validCredentials) { - if (!vnUser.active) - throw new UserError('User disabled'); - - if (vnUser.passExpired && vnUser.passExpired.getTime() <= today.getTime()) { - const changePasswordToken = await models.AccessToken.create({ - scopes: ['change-password'], - userId: vnUser.id - }); - throw new UserError('Pass expired', 'passExpired', { - id: vnUser.id, - token: changePasswordToken.id - }); - } - - try { - await models.Account.sync(instance.username, password); - } catch (err) { - console.warn(err); - } - } let loginInfo = Object.assign({password}, userInfo); token = await Self.login(loginInfo, 'user'); @@ -197,6 +156,50 @@ module.exports = function(Self) { Self.sharedClass._methods.find(method => method.name == 'changePassword') .accessScopes = ['change-password']; + Self.sharedClass._methods.find(method => method.name == 'changePassword').accepts.splice(3, 0, { + arg: 'verificationCode', + type: 'string' + }); + const _changePassword = Self.changePassword; + Self.changePassword = async(userId, oldPassword, newPassword, verificationCode, options, cb) => { + if (oldPassword == newPassword) + throw new UserError(`You can't use the same password`); + + const user = await this.findById(userId, {fields: ['name', 'twoFactor']}); + if (user.twoFactor) + await Self.validateCode(user.name, verificationCode); + + await _changePassword.call(this, userId, oldPassword, newPassword, options, cb); + }; + + const _prototypeChangePassword = Self.prototype.ChangePassword; + Self.prototype.changePassword = async function(oldPassword, newPassword, options, cb) { + if (cb === undefined && typeof options === 'function') { + cb = options; + options = undefined; + } + + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + options = myOptions; + + try { + await _prototypeChangePassword.call(this, oldPassword, newPassword, options); + tx && await tx.commit(); + cb && cb(); + } catch (err) { + tx && await tx.rollback(); + if (cb) cb(err); else throw err; + } + }; // FIXME: https://redmine.verdnatura.es/issues/5761 // Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => { diff --git a/db/changes/232001/00-authCode.sql b/db/changes/232601/00-authCode.sql similarity index 50% rename from db/changes/232001/00-authCode.sql rename to db/changes/232601/00-authCode.sql index 0415c90f0..3a85ce58f 100644 --- a/db/changes/232001/00-authCode.sql +++ b/db/changes/232601/00-authCode.sql @@ -11,17 +11,3 @@ create table `salix`.`authCode` foreign key (userFk) references `account`.`user` (id) on update cascade on delete cascade ); - -create table `salix`.`userAccess` -( - userFk int UNSIGNED not null, - ip VARCHAR(25) not null, - agent text null, - platform VARCHAR(25) null, - browser VARCHAR(25) null, - constraint userAccess_pk - primary key (userFk), - constraint userAccess_user_null_fk - foreign key (userFk) references `account`.`user` (id) -) - auto_increment = 0; \ No newline at end of file diff --git a/db/changes/232001/00-department.sql b/db/changes/232601/00-department.sql similarity index 100% rename from db/changes/232001/00-department.sql rename to db/changes/232601/00-department.sql diff --git a/db/changes/232001/00-user.sql b/db/changes/232601/00-user.sql similarity index 100% rename from db/changes/232001/00-user.sql rename to db/changes/232601/00-user.sql diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index a6557ff89..4c41c5a06 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2821,8 +2821,8 @@ INSERT INTO `vn`.`profileType` (`id`, `name`) INSERT INTO `salix`.`url` (`appName`, `environment`, `url`) VALUES - ('lilium', 'dev', 'http://localhost:9000/#/'), - ('salix', 'dev', 'http://localhost:5000/#!/'); + ('lilium', 'development', 'http://localhost:9000/#/'), + ('salix', 'development', 'http://localhost:5000/#!/'); INSERT INTO `vn`.`report` (`id`, `name`, `paperSizeFk`, `method`) VALUES diff --git a/front/salix/components/change-password/index.html b/front/salix/components/change-password/index.html index 8d338d411..026374bca 100644 --- a/front/salix/components/change-password/index.html +++ b/front/salix/components/change-password/index.html @@ -21,6 +21,14 @@ type="password" autocomplete="false"> + + - \ No newline at end of file + diff --git a/print/templates/email/auth-code/auth-code.js b/print/templates/email/auth-code/auth-code.js index 7ddd1c2db..1606241be 100755 --- a/print/templates/email/auth-code/auth-code.js +++ b/print/templates/email/auth-code/auth-code.js @@ -10,6 +10,12 @@ module.exports = { code: { type: String, required: true + }, + device: { + type: String + }, + ip: { + type: Number } } }; diff --git a/print/templates/email/auth-code/locale/en.yml b/print/templates/email/auth-code/locale/en.yml index 5f63d280f..b52a73e93 100644 --- a/print/templates/email/auth-code/locale/en.yml +++ b/print/templates/email/auth-code/locale/en.yml @@ -1,5 +1,7 @@ subject: Verification code title: Verification code description: Somebody did request a verification code for login. If you didn't request it, please ignore this email. +device: 'Device: {0}' +ip: 'IP: {0}' Enter the following code to continue to your account: Enter the following code to continue to your account It expires in 5 minutes: It expires in 5 minutes diff --git a/print/templates/email/auth-code/locale/es.yml b/print/templates/email/auth-code/locale/es.yml index 31952891b..f49b2511f 100644 --- a/print/templates/email/auth-code/locale/es.yml +++ b/print/templates/email/auth-code/locale/es.yml @@ -1,5 +1,7 @@ subject: Código de verificación title: Código de verificación description: Alguien ha solicitado un código de verificación para poder iniciar sesión. Si no lo has solicitado tu, ignora este email. +device: 'Dispositivo: {0}' +ip: 'IP: {0}' Enter the following code to continue to your account: Introduce el siguiente código para poder continuar con tu cuenta It expires in 5 minutes: Expira en 5 minutos diff --git a/print/templates/email/auth-code/locale/fr.yml b/print/templates/email/auth-code/locale/fr.yml index e435a2487..12606fcda 100644 --- a/print/templates/email/auth-code/locale/fr.yml +++ b/print/templates/email/auth-code/locale/fr.yml @@ -1,5 +1,7 @@ subject: Code de vérification title: Code de vérification description: Quelqu'un a demandé un code de vérification pour se connecter. Si ce n'était pas toi, ignore cet email. +device: 'Appareil: {0}' +ip: 'IP: {0}' Enter the following code to continue to your account: Entrez le code suivant pour continuer avec votre compte It expires in 5 minutes: Il expire dans 5 minutes. diff --git a/print/templates/email/auth-code/locale/pt.yml b/print/templates/email/auth-code/locale/pt.yml index 940b03c4d..e73f5e39a 100644 --- a/print/templates/email/auth-code/locale/pt.yml +++ b/print/templates/email/auth-code/locale/pt.yml @@ -1,5 +1,7 @@ subject: Código de verificação title: Código de verificação description: Alguém solicitou um código de verificação para entrar. Se você não fez essa solicitação, ignore este e-mail. +device: 'Dispositivo: {0}' +ip: 'IP: {0}' Enter the following code to continue to your account: Insira o seguinte código para continuar com sua conta. It expires in 5 minutes: Expira em 5 minutos. From b96f0f22b5b17a27d9ed84d494a904ea26d4746d Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 15 Jun 2023 15:16:51 +0200 Subject: [PATCH 047/311] refs #5475 feat(account_changePassword) --- back/models/vn-user.js | 27 +++++++++---------- .../back/methods/account/change-password.js | 16 +++++++++-- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 75490ccf8..e282fe97e 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -1,7 +1,6 @@ const vnModel = require('vn-loopback/common/models/vn-model'); const LoopBackContext = require('loopback-context'); const {Email} = require('vn-print'); -const UserError = require('vn-loopback/util/user-error'); module.exports = function(Self) { vnModel(Self); @@ -156,21 +155,21 @@ module.exports = function(Self) { Self.sharedClass._methods.find(method => method.name == 'changePassword') .accessScopes = ['change-password']; - Self.sharedClass._methods.find(method => method.name == 'changePassword').accepts.splice(3, 0, { - arg: 'verificationCode', - type: 'string' - }); - const _changePassword = Self.changePassword; - Self.changePassword = async(userId, oldPassword, newPassword, verificationCode, options, cb) => { - if (oldPassword == newPassword) - throw new UserError(`You can't use the same password`); + // Self.sharedClass._methods.find(method => method.name == 'changePassword').accepts.splice(3, 0, { + // arg: 'verificationCode', + // type: 'string' + // }); + // const _changePassword = Self.changePassword; + // Self.changePassword = async(userId, oldPassword, newPassword, verificationCode, options, cb) => { + // if (oldPassword == newPassword) + // throw new UserError(`You can't use the same password`); - const user = await this.findById(userId, {fields: ['name', 'twoFactor']}); - if (user.twoFactor) - await Self.validateCode(user.name, verificationCode); + // const user = await this.findById(userId, {fields: ['name', 'twoFactor']}); + // if (user.twoFactor) + // await Self.validateCode(user.name, verificationCode); - await _changePassword.call(this, userId, oldPassword, newPassword, options, cb); - }; + // await _changePassword.call(this, userId, oldPassword, newPassword, options, cb); + // }; const _prototypeChangePassword = Self.prototype.ChangePassword; Self.prototype.changePassword = async function(oldPassword, newPassword, options, cb) { diff --git a/modules/account/back/methods/account/change-password.js b/modules/account/back/methods/account/change-password.js index c6f08a232..b8c1c3d48 100644 --- a/modules/account/back/methods/account/change-password.js +++ b/modules/account/back/methods/account/change-password.js @@ -19,6 +19,10 @@ module.exports = Self => { type: 'string', description: 'The new password', required: true + }, { + arg: 'verificationCode', + type: 'string', + description: 'The 2FA code' } ], http: { @@ -27,7 +31,15 @@ module.exports = Self => { } }); - Self.changePassword = async function(id, oldPassword, newPassword) { - await Self.app.models.VnUser.changePassword(id, oldPassword, newPassword); + Self.changePassword = async function(id, oldPassword, newPassword, verificationCode) { + const {vnUser} = Self.app.models; + if (oldPassword == newPassword) + throw new UserError(`You can't use the same password`); + + const user = await vnUser.findById(id, {fields: ['name', 'twoFactor']}); + if (user.twoFactor) + await vnUser.validateCode(user.name, verificationCode); + + await vnUser.changePassword(id, oldPassword, newPassword); }; }; From cf01c8d46eacc93384969eb03e733c600370da91 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 16 Jun 2023 09:35:20 +0200 Subject: [PATCH 048/311] refs #5475 feat(account_changePassword) --- back/models/vn-user.js | 26 +++++-------------- .../salix/components/change-password/index.js | 8 ++++-- .../back/methods/account/change-password.js | 17 +++++------- modules/account/back/models/account.json | 9 ++++++- 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/back/models/vn-user.js b/back/models/vn-user.js index e282fe97e..0448d70ea 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -153,25 +153,13 @@ module.exports = function(Self) { } }; - Self.sharedClass._methods.find(method => method.name == 'changePassword') - .accessScopes = ['change-password']; - // Self.sharedClass._methods.find(method => method.name == 'changePassword').accepts.splice(3, 0, { - // arg: 'verificationCode', - // type: 'string' - // }); - // const _changePassword = Self.changePassword; - // Self.changePassword = async(userId, oldPassword, newPassword, verificationCode, options, cb) => { - // if (oldPassword == newPassword) - // throw new UserError(`You can't use the same password`); + // Self.sharedClass._methods.find(method => method.name == 'changePassword') + // .accessScopes = ['change-password']; + Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls = + Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls + .filter(acl => acl.property != 'changePassword'); - // const user = await this.findById(userId, {fields: ['name', 'twoFactor']}); - // if (user.twoFactor) - // await Self.validateCode(user.name, verificationCode); - - // await _changePassword.call(this, userId, oldPassword, newPassword, options, cb); - // }; - - const _prototypeChangePassword = Self.prototype.ChangePassword; + const _changePassword = Self.prototype.ChangePassword; Self.prototype.changePassword = async function(oldPassword, newPassword, options, cb) { if (cb === undefined && typeof options === 'function') { cb = options; @@ -191,7 +179,7 @@ module.exports = function(Self) { options = myOptions; try { - await _prototypeChangePassword.call(this, oldPassword, newPassword, options); + await _changePassword.call(this, oldPassword, newPassword, options); tx && await tx.commit(); cb && cb(); } catch (err) { diff --git a/front/salix/components/change-password/index.js b/front/salix/components/change-password/index.js index d8ed8ec60..97afb3c72 100644 --- a/front/salix/components/change-password/index.js +++ b/front/salix/components/change-password/index.js @@ -15,6 +15,11 @@ export default class Controller { } $onInit() { + this.oldPassword = 'nightmare'; + this.repeatPassword = 'test.1234'; + this.newPassword = 'test.1234'; + this.verificationCode = '1234'; + if (!this.$state.params || !this.$state.params.id || !this.$state.params.token) this.$state.go('login'); @@ -47,9 +52,8 @@ export default class Controller { newPassword, verificationCode }); - this.$http.post('VnUsers/change-password', + this.$http.patch('Accounts/change-password', { - id, oldPassword, newPassword, verificationCode diff --git a/modules/account/back/methods/account/change-password.js b/modules/account/back/methods/account/change-password.js index b8c1c3d48..794195947 100644 --- a/modules/account/back/methods/account/change-password.js +++ b/modules/account/back/methods/account/change-password.js @@ -1,15 +1,11 @@ module.exports = Self => { - Self.remoteMethod('changePassword', { + Self.remoteMethodCtx('changePassword', { description: 'Changes the user password', accessType: 'WRITE', + accessScopes: 'change-password', accepts: [ { - arg: 'id', - type: 'number', - description: 'The user id', - http: {source: 'path'} - }, { arg: 'oldPassword', type: 'string', description: 'The old password', @@ -26,20 +22,21 @@ module.exports = Self => { } ], http: { - path: `/:id/changePassword`, + path: `/changePassword`, verb: 'PATCH' } }); - Self.changePassword = async function(id, oldPassword, newPassword, verificationCode) { + Self.changePassword = async function(ctx, oldPassword, newPassword, verificationCode) { + const userId = ctx.req.accessToken.userId; const {vnUser} = Self.app.models; if (oldPassword == newPassword) throw new UserError(`You can't use the same password`); - const user = await vnUser.findById(id, {fields: ['name', 'twoFactor']}); + const user = await vnUser.findById(userId, {fields: ['name', 'twoFactor']}); if (user.twoFactor) await vnUser.validateCode(user.name, verificationCode); - await vnUser.changePassword(id, oldPassword, newPassword); + await vnUser.changePassword(userId, oldPassword, newPassword); }; }; diff --git a/modules/account/back/models/account.json b/modules/account/back/models/account.json index 8fe3e88f9..b2cbd213b 100644 --- a/modules/account/back/models/account.json +++ b/modules/account/back/models/account.json @@ -37,6 +37,13 @@ "principalType": "ROLE", "principalId": "$authenticated", "permission": "ALLOW" - } + }, + { + "property": "changePassword", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } ] } From 0a9bdc6f891b050c95f1806857681c4119dd5ff8 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 16 Jun 2023 13:25:45 +0200 Subject: [PATCH 049/311] test: jenkins test secuenciales --- Jenkinsfile | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cf9b8cd67..1fe2cfc9b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,19 +54,17 @@ pipeline { NODE_ENV = "" TZ = 'Europe/Madrid' } - parallel { - stage('Frontend') { - steps { - nodejs('node-v20') { - sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' - } + stage('Frontend') { + steps { + nodejs('node-v20') { + sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' } } - stage('Backend') { - steps { - nodejs('node-v20') { - sh 'npm run test:back:ci' - } + } + stage('Backend') { + steps { + nodejs('node-v20') { + sh 'npm run test:back:ci' } } } From 1f4e98075cfa5d36ed309246870b8e6572e97f6b Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 16 Jun 2023 13:27:35 +0200 Subject: [PATCH 050/311] fix: test secuendiales --- Jenkinsfile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1fe2cfc9b..72d70dc97 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,17 +54,19 @@ pipeline { NODE_ENV = "" TZ = 'Europe/Madrid' } - stage('Frontend') { - steps { - nodejs('node-v20') { - sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' + steps { + stage('Frontend') { + steps { + nodejs('node-v20') { + sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' + } } } - } - stage('Backend') { - steps { - nodejs('node-v20') { - sh 'npm run test:back:ci' + stage('Backend') { + steps { + nodejs('node-v20') { + sh 'npm run test:back:ci' + } } } } From a31b735d3cef087646a8d7ea1d498741cfb942cd Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 16 Jun 2023 13:29:00 +0200 Subject: [PATCH 051/311] fix --- Jenkinsfile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 72d70dc97..5345b6dfe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,17 +55,18 @@ pipeline { TZ = 'Europe/Madrid' } steps { - stage('Frontend') { - steps { - nodejs('node-v20') { - sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' + script { + if (!env.BRANCH_NAME.equals('test') && !env.BRANCH_NAME.equals('master')) { + stage('Frontend') { + nodejs('node-v20') { + sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' + } } - } - } - stage('Backend') { - steps { - nodejs('node-v20') { - sh 'npm run test:back:ci' + + stage('Backend') { + nodejs('node-v20') { + sh 'npm run test:back:ci' + } } } } From 2da54ac3d72175c28cb7b11972dcba43fa0e6cc7 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 16 Jun 2023 13:39:05 +0200 Subject: [PATCH 052/311] test secuenciales --- Jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5345b6dfe..897bf4f3e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,17 +57,17 @@ pipeline { steps { script { if (!env.BRANCH_NAME.equals('test') && !env.BRANCH_NAME.equals('master')) { - stage('Frontend') { - nodejs('node-v20') { - sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' - } - } - stage('Backend') { nodejs('node-v20') { sh 'npm run test:back:ci' } } + + stage('Frontend') { + nodejs('node-v20') { + sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' + } + } } } } From 998597dfcc53f90f4fe5bc4334f87045c2d5f05b Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 16 Jun 2023 13:49:21 +0200 Subject: [PATCH 053/311] refs #4734 recator: cambiado nombre ruta --- ...onInternacional.js => internationalExpedition.js} | 12 ++++++------ back/models/viaexpress-config.js | 2 +- back/models/viaexpress-config.json | 2 +- db/changes/232601/00-acl_viaexpressConfig.sql | 2 +- db/changes/232601/00-viaexpress.sql | 7 ++----- 5 files changed, 11 insertions(+), 14 deletions(-) rename back/methods/viaexpress-config/{putExpedicionInternacional.js => internationalExpedition.js} (94%) diff --git a/back/methods/viaexpress-config/putExpedicionInternacional.js b/back/methods/viaexpress-config/internationalExpedition.js similarity index 94% rename from back/methods/viaexpress-config/putExpedicionInternacional.js rename to back/methods/viaexpress-config/internationalExpedition.js index dc1df3218..99a4197c7 100644 --- a/back/methods/viaexpress-config/putExpedicionInternacional.js +++ b/back/methods/viaexpress-config/internationalExpedition.js @@ -1,7 +1,7 @@ const axios = require('axios'); module.exports = Self => { - Self.remoteMethod('putExpedicionInternacional', { + Self.remoteMethod('internationalExpedition', { description: 'Returns the lastest campaigns', accessType: 'WRITE', accepts: [{ @@ -14,19 +14,20 @@ module.exports = Self => { root: true }, http: { - path: `/putExpedicionInternacional`, + path: `/internationalExpedition`, verb: 'POST' } }); - Self.putExpedicionInternacional = async(expeditionFk, options) => { + Self.internationalExpedition = async(expeditionFk, options) => { const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); const [data] = await Self.rawSql(` - SELECT urlAccess, + SELECT + url, clientViaexpress, userViaexpress, passwordViaexpress, @@ -113,9 +114,8 @@ module.exports = Self => { `; - const url = 'http://82.223.6.71:82/ServicioVxClientes.asmx'; try { - const response = await axios.post(url, xmlData, { + const response = await axios.post(`${data.url}ServicioVxClientes.asmx`, xmlData, { headers: { 'Content-Type': 'application/soap+xml; charset=utf-8' } diff --git a/back/models/viaexpress-config.js b/back/models/viaexpress-config.js index 712bde60d..72424f806 100644 --- a/back/models/viaexpress-config.js +++ b/back/models/viaexpress-config.js @@ -1,3 +1,3 @@ module.exports = Self => { - require('../methods/viaexpress-config/putExpedicionInternacional')(Self); + require('../methods/viaexpress-config/internationalExpedition')(Self); }; diff --git a/back/models/viaexpress-config.json b/back/models/viaexpress-config.json index ed150a448..5927cee3f 100644 --- a/back/models/viaexpress-config.json +++ b/back/models/viaexpress-config.json @@ -11,7 +11,7 @@ "type": "number", "required": true }, - "urlAccess": { + "url": { "type": "string", "required": true }, diff --git a/db/changes/232601/00-acl_viaexpressConfig.sql b/db/changes/232601/00-acl_viaexpressConfig.sql index 837185262..91a7e3c5b 100644 --- a/db/changes/232601/00-acl_viaexpressConfig.sql +++ b/db/changes/232601/00-acl_viaexpressConfig.sql @@ -1,3 +1,3 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES - ('ViaexpressConfig', 'putExpedicionInternacional', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + ('ViaexpressConfig', 'internationalExpedition', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/232601/00-viaexpress.sql b/db/changes/232601/00-viaexpress.sql index 1313135f9..9e3baa9fd 100644 --- a/db/changes/232601/00-viaexpress.sql +++ b/db/changes/232601/00-viaexpress.sql @@ -1,13 +1,10 @@ CREATE TABLE `vn`.`viaexpressConfig` ( id int auto_increment NOT NULL, - urlAccess varchar(100) NOT NULL, + url varchar(100) NOT NULL, clientViaexpress varchar(100) NOT NULL, userViaexpress varchar(100) NOT NULL, passwordViaexpress varchar(100) NOT NULL, defaultWeight decimal(10,2) NOT NULL, deliveryType varchar(5) NOT NULL, CONSTRAINT viaexpressConfig_PK PRIMARY KEY (id) -) -ENGINE=InnoDB -DEFAULT CHARSET=utf8mb3 -COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; From 1027e0753e399e4e7ed39d35468c1c5197945623 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 16 Jun 2023 14:06:36 +0200 Subject: [PATCH 054/311] test in paralel --- Jenkinsfile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 897bf4f3e..cf9b8cd67 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,19 +54,18 @@ pipeline { NODE_ENV = "" TZ = 'Europe/Madrid' } - steps { - script { - if (!env.BRANCH_NAME.equals('test') && !env.BRANCH_NAME.equals('master')) { - stage('Backend') { - nodejs('node-v20') { - sh 'npm run test:back:ci' - } + parallel { + stage('Frontend') { + steps { + nodejs('node-v20') { + sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' } - - stage('Frontend') { - nodejs('node-v20') { - sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' - } + } + } + stage('Backend') { + steps { + nodejs('node-v20') { + sh 'npm run test:back:ci' } } } From 90ce0d1c275e1f508bceb8a13224aef97262ada4 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 16 Jun 2023 14:24:47 +0200 Subject: [PATCH 055/311] refs #4734 refactor: consulta con loopback --- .../internationalExpedition.js | 95 +++++++++++++++++-- back/models/company.json | 7 ++ 2 files changed, 96 insertions(+), 6 deletions(-) diff --git a/back/methods/viaexpress-config/internationalExpedition.js b/back/methods/viaexpress-config/internationalExpedition.js index 99a4197c7..fd8d69e6d 100644 --- a/back/methods/viaexpress-config/internationalExpedition.js +++ b/back/methods/viaexpress-config/internationalExpedition.js @@ -20,6 +20,7 @@ module.exports = Self => { }); Self.internationalExpedition = async(expeditionFk, options) => { + const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') @@ -27,13 +28,13 @@ module.exports = Self => { const [data] = await Self.rawSql(` SELECT - url, - clientViaexpress, - userViaexpress, - passwordViaexpress, - defaultWeight, + -- url, + -- clientViaexpress, + -- userViaexpress, + -- passwordViaexpress, + -- defaultWeight, + -- deliveryType, DATE_FORMAT(t.shipped, '%Y-%m-%d') shipped, - deliveryType, cv.socialName senderName, av.street senderStreet, av.postalCode senderPostalCode, @@ -61,6 +62,88 @@ module.exports = Self => { JOIN vn.province pv ON pv.id = av.provinceFk JOIN vn.country c2 ON c2.id = p.countryFk`, [expeditionFk], myOptions); + const expedition = await models.Expedition.findOne({ + fields: ['id', 'ticketFk'], + where: {id: expeditionFk}, + include: [ + { + relation: 'ticket', + scope: { + fields: ['shipped', 'addressFk', 'clientFk', 'companyFk'], + include: [ + { + relation: 'client', + scope: { + fields: ['mobile', 'phone', 'email'] + } + }, + { + relation: 'address', + scope: { + fields: [ + 'nickname', + 'street', + 'postalCode', + 'city', + 'mobile', + 'phone', + 'provinceFk' + ], + include: { + relation: 'province', + scope: { + fields: ['name', 'countryFk'], + include: { + relation: 'country', + scope: { + fields: ['code'], + } + } + + } + } + } + }, + { + relation: 'company', + scope: { + fields: ['clientFk'], + include: { + relation: 'client', + scope: { + fields: ['socialName', 'mobile', 'phone', 'email', 'defaultAddressFk'], + include: { + relation: 'defaultAddress', + scope: { + fields: [ + 'street', + 'postalCode', + 'city', + 'mobile', + 'phone', + 'provinceFk' + ], + include: { + relation: 'province', + scope: { + fields: ['name'] + } + } + } + } + } + } + } + } + ] + } + + } + ] + }, myOptions); + console.log(data); + console.log(expedition); + const xmlData = ` diff --git a/back/models/company.json b/back/models/company.json index f16c5762f..53266e38a 100644 --- a/back/models/company.json +++ b/back/models/company.json @@ -24,5 +24,12 @@ "where" :{ "expired": null } + }, + "relations": { + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + } } } From ab68cb7165a0ae7a34074c6699f716a1476600e1 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 16 Jun 2023 14:27:29 +0200 Subject: [PATCH 056/311] refs #4734 fix: manejo errores --- back/methods/viaexpress-config/internationalExpedition.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/back/methods/viaexpress-config/internationalExpedition.js b/back/methods/viaexpress-config/internationalExpedition.js index fd8d69e6d..dd46ff794 100644 --- a/back/methods/viaexpress-config/internationalExpedition.js +++ b/back/methods/viaexpress-config/internationalExpedition.js @@ -212,7 +212,8 @@ module.exports = Self => { return referenciaVx; } catch (error) { - throw Error(error.response.data); + if (error?.response?.data) throw Error(error.response.data); + throw Error(error); } }; }; From 219ad75172ad57a6e76fa4ae84c718f249f0f3b6 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 16 Jun 2023 14:30:33 +0200 Subject: [PATCH 057/311] a --- .../viaexpress-config/internationalExpedition.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/back/methods/viaexpress-config/internationalExpedition.js b/back/methods/viaexpress-config/internationalExpedition.js index dd46ff794..23b62e845 100644 --- a/back/methods/viaexpress-config/internationalExpedition.js +++ b/back/methods/viaexpress-config/internationalExpedition.js @@ -28,12 +28,12 @@ module.exports = Self => { const [data] = await Self.rawSql(` SELECT - -- url, - -- clientViaexpress, - -- userViaexpress, - -- passwordViaexpress, - -- defaultWeight, - -- deliveryType, + url, + clientViaexpress, + userViaexpress, + passwordViaexpress, + defaultWeight, + deliveryType, DATE_FORMAT(t.shipped, '%Y-%m-%d') shipped, cv.socialName senderName, av.street senderStreet, From ee1b901dea69bcb30e972023e07b1e1e405a288c Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 16 Jun 2023 14:31:14 +0200 Subject: [PATCH 058/311] refs #5475 feat(account_changePassword): accessScope --- back/methods/vn-user/sign-in.js | 5 +++-- front/salix/components/change-password/index.js | 3 ++- modules/account/back/methods/account/change-password.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/back/methods/vn-user/sign-in.js b/back/methods/vn-user/sign-in.js index 9963719c3..f27d40e0a 100644 --- a/back/methods/vn-user/sign-in.js +++ b/back/methods/vn-user/sign-in.js @@ -61,11 +61,12 @@ module.exports = Self => { if (vnUser.passExpired && vnUser.passExpired.getTime() <= today.getTime()) { const $ = Self.app.models; const changePasswordToken = await $.AccessToken.create({ - scopes: ['change-password'], + scopes: ['changePassword'], userId: vnUser.id }); const err = new UserError('Pass expired', 'passExpired'); - err.details = {token: changePasswordToken, twoFactor: vnUser.twoFactor ? true : false}; + changePasswordToken.twoFactor = vnUser.twoFactor ? true : false; + err.details = {token: changePasswordToken}; throw err; } }; diff --git a/front/salix/components/change-password/index.js b/front/salix/components/change-password/index.js index 3c300ba4b..81a44d9d5 100644 --- a/front/salix/components/change-password/index.js +++ b/front/salix/components/change-password/index.js @@ -19,6 +19,7 @@ export default class Controller { this.repeatPassword = 'test.1234'; this.newPassword = 'test.1234'; this.verificationCode = '1234'; + console.log(this.$state.params); if (!this.$state.params.id) this.$state.go('login'); @@ -46,7 +47,7 @@ export default class Controller { Authorization: this.$state.params.id }; console.log({ - id, + id: userId, oldPassword, newPassword, verificationCode diff --git a/modules/account/back/methods/account/change-password.js b/modules/account/back/methods/account/change-password.js index 794195947..9fbb5dd17 100644 --- a/modules/account/back/methods/account/change-password.js +++ b/modules/account/back/methods/account/change-password.js @@ -3,7 +3,7 @@ module.exports = Self => { Self.remoteMethodCtx('changePassword', { description: 'Changes the user password', accessType: 'WRITE', - accessScopes: 'change-password', + accessScopes: ['changePassword'], accepts: [ { arg: 'oldPassword', From 303be74382a9bc38f931e994db15027df9e890f7 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 19 Jun 2023 11:55:07 +0200 Subject: [PATCH 059/311] refs #4734 refactor: use loopback instead of --- .../internationalExpedition.js | 92 +++++++------------ back/models/viaexpress-config.json | 8 +- 2 files changed, 36 insertions(+), 64 deletions(-) diff --git a/back/methods/viaexpress-config/internationalExpedition.js b/back/methods/viaexpress-config/internationalExpedition.js index 23b62e845..70a68acd6 100644 --- a/back/methods/viaexpress-config/internationalExpedition.js +++ b/back/methods/viaexpress-config/internationalExpedition.js @@ -26,42 +26,6 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const [data] = await Self.rawSql(` - SELECT - url, - clientViaexpress, - userViaexpress, - passwordViaexpress, - defaultWeight, - deliveryType, - DATE_FORMAT(t.shipped, '%Y-%m-%d') shipped, - cv.socialName senderName, - av.street senderStreet, - av.postalCode senderPostalCode, - av.city senderCity, - pv.name senderProvince, - IFNULL(av.mobile, IFNULL(av.phone, IFNULL(cv.mobile, cv.phone))) senderPhone, - SUBSTRING_INDEX(cv.email, ',', 1) senderEmail, - a.nickname receiverName, - a.street receiverStreet, - a.postalCode receiverPostalCode, - a.city receiverCity, - p.name receiverProvince, - IFNULL(a.mobile, IFNULL(a.phone, IFNULL(c.mobile, c.phone))) receiverPhone, - SUBSTRING_INDEX(c.email, ',', 1) receiverEmail, - c2.code receiverCountry - FROM vn.viaexpressConfig - JOIN vn.expedition e ON e.id = ? - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.company co ON co.id = t.companyFk - JOIN vn.client cv ON cv.id = co.clientFk - JOIN vn.address av ON av.id = cv.defaultAddressFk - JOIN vn.province pv ON pv.id = av.provinceFk - JOIN vn.country c2 ON c2.id = p.countryFk`, [expeditionFk], myOptions); - const expedition = await models.Expedition.findOne({ fields: ['id', 'ticketFk'], where: {id: expeditionFk}, @@ -141,20 +105,28 @@ module.exports = Self => { } ] }, myOptions); - console.log(data); - console.log(expedition); + + const viaexpressConfig = await models.ViaexpressConfig.findOne({ + fields: ['url', 'clientViaexpress', 'userViaexpress', 'passwordViaexpress', 'defaultWeight', 'deliveryType'] + }, myOptions); + + const shipped = expedition.ticket().shipped; + const year = shipped.getFullYear(); + const month = shipped.getMonth() + 1; + const day = shipped.getDate(); + const date = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`; const xmlData = ` - ${data.defaultWeight} + ${viaexpressConfig.defaultWeight} 1 0 - ${data.shipped} + ${date} 0 - ${data.deliveryType} + ${viaexpressConfig.deliveryType} 0 0 0 @@ -166,31 +138,31 @@ module.exports = Self => { - ${data.senderName} - ${data.senderStreet} - ${data.senderPostalCode} - ${data.senderCity} - ${data.senderProvince} + ${expedition.ticket().company().client().socialName} + ${expedition.ticket().company().client().defaultAddress().street} + ${expedition.ticket().company().client().defaultAddress().postalCode} + ${expedition.ticket().company().client().defaultAddress().city} + ${expedition.ticket().company().client().defaultAddress().province().name} - ${data.senderPhone} - ${data.senderEmail} + ${expedition.ticket().company().client().defaultAddress().mobile || expedition.ticket().company().client().defaultAddress().phone || expedition.ticket().company().client().mobile || expedition.ticket().company().client().phone} + ${expedition.ticket().company().client().email} - ${data.receiverName} - ${data.receiverStreet} - ${data.receiverPostalCode} - ${data.receiverCity} + ${expedition.ticket().address().nickname} + ${expedition.ticket().address().street} + ${expedition.ticket().address().postalCode} + ${expedition.ticket().address().city} - ${data.receiverProvince} + ${expedition.ticket().address().province().name} - ${data.receiverPhone} - ${data.receiverEmail} - ${data.receiverCountry} + ${expedition.ticket().address().mobile || expedition.ticket().address().phone || expedition.ticket().client().mobile || expedition.ticket().client().phone} + ${expedition.ticket().client().email} + ${expedition.ticket().address().province().country().code} - ${data.clientViaexpress} - ${data.userViaexpress} - ${data.passwordViaexpress} + ${viaexpressConfig.clientViaexpress} + ${viaexpressConfig.userViaexpress} + ${viaexpressConfig.passwordViaexpress} @@ -198,7 +170,7 @@ module.exports = Self => { `; try { - const response = await axios.post(`${data.url}ServicioVxClientes.asmx`, xmlData, { + const response = await axios.post(`${viaexpressConfig.url}ServicioVxClientes.asmx`, xmlData, { headers: { 'Content-Type': 'application/soap+xml; charset=utf-8' } diff --git a/back/models/viaexpress-config.json b/back/models/viaexpress-config.json index 5927cee3f..26d6c8e37 100644 --- a/back/models/viaexpress-config.json +++ b/back/models/viaexpress-config.json @@ -16,19 +16,19 @@ "required": true }, "clientViaexpress": { - "type": "date" + "type": "string" }, "userViaexpress": { - "type": "number" + "type": "string" }, "passwordViaexpress": { - "type": "number" + "type": "string" }, "defaultWeight": { "type": "number" }, "deliveryType": { - "type": "number" + "type": "string" } } } From cfe340eeff471d70d188e5f1b5573179b38941b1 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 19 Jun 2023 14:27:24 +0200 Subject: [PATCH 060/311] refs #4734 feat: xml en otro archivo --- .../internationalExpedition.js | 232 ++++++------------ back/methods/viaexpress-config/renderer.js | 162 ++++++++++++ back/methods/viaexpress-config/template.xml | 52 ++++ back/models/viaexpress-config.js | 1 + package.json | 1 + 5 files changed, 285 insertions(+), 163 deletions(-) create mode 100644 back/methods/viaexpress-config/renderer.js create mode 100644 back/methods/viaexpress-config/template.xml diff --git a/back/methods/viaexpress-config/internationalExpedition.js b/back/methods/viaexpress-config/internationalExpedition.js index 70a68acd6..cbb1c2c67 100644 --- a/back/methods/viaexpress-config/internationalExpedition.js +++ b/back/methods/viaexpress-config/internationalExpedition.js @@ -1,4 +1,5 @@ const axios = require('axios'); +const fs = require('fs'); module.exports = Self => { Self.remoteMethod('internationalExpedition', { @@ -19,173 +20,78 @@ module.exports = Self => { } }); - Self.internationalExpedition = async(expeditionFk, options) => { + Self.internationalExpedition = async expeditionFk => { const models = Self.app.models; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - const expedition = await models.Expedition.findOne({ - fields: ['id', 'ticketFk'], - where: {id: expeditionFk}, - include: [ - { - relation: 'ticket', - scope: { - fields: ['shipped', 'addressFk', 'clientFk', 'companyFk'], - include: [ - { - relation: 'client', - scope: { - fields: ['mobile', 'phone', 'email'] - } - }, - { - relation: 'address', - scope: { - fields: [ - 'nickname', - 'street', - 'postalCode', - 'city', - 'mobile', - 'phone', - 'provinceFk' - ], - include: { - relation: 'province', - scope: { - fields: ['name', 'countryFk'], - include: { - relation: 'country', - scope: { - fields: ['code'], - } - } - - } - } - } - }, - { - relation: 'company', - scope: { - fields: ['clientFk'], - include: { - relation: 'client', - scope: { - fields: ['socialName', 'mobile', 'phone', 'email', 'defaultAddressFk'], - include: { - relation: 'defaultAddress', - scope: { - fields: [ - 'street', - 'postalCode', - 'city', - 'mobile', - 'phone', - 'provinceFk' - ], - include: { - relation: 'province', - scope: { - fields: ['name'] - } - } - } - } - } - } - } - } - ] - } - - } - ] - }, myOptions); const viaexpressConfig = await models.ViaexpressConfig.findOne({ - fields: ['url', 'clientViaexpress', 'userViaexpress', 'passwordViaexpress', 'defaultWeight', 'deliveryType'] - }, myOptions); + fields: ['url'] + }); - const shipped = expedition.ticket().shipped; - const year = shipped.getFullYear(); - const month = shipped.getMonth() + 1; - const day = shipped.getDate(); - const date = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`; + const renderedXml = await models.ViaexpressConfig.renderer(expeditionFk); + // const renderedXml = ` + // + // + // + // + // 10 + // 1 + // 0 + // 2023-06-12 + // 0 + // E + // 0 + // 0 + // 0 + // 0 + // 0 + // + // + // 0 + // + // + // + // VERDNATURA LEVANTE SL + // FENOLLARS, 2 + // 46680 + // Algemesi + // Valencia + // + // 963677177 + // pako.natek@gmail.com + // + // + // ROSAMARY FLORISTERIA + // C SANTA ROSA,25 + // 03802 + // ALCOY + // ALCOY + // Alicante + // + // 653967489 + // correo@floristeriarosamary.com + // ES + // + // + // 16092 + // B97367486 + // VERDNA22 + // + // + // + // + // `; + const response = await axios.post(`${viaexpressConfig.url}ServicioVxClientes.asmx`, renderedXml, { + headers: { + 'Content-Type': 'application/soap+xml; charset=utf-8' + } + }); + console.log(response); + const startTag = ''; + const endTag = ''; + const startIndex = response.data.indexOf(startTag) + startTag.length; + const endIndex = response.data.indexOf(endTag); + const referenciaVx = response.data.substring(startIndex, endIndex); - const xmlData = ` - - - - - ${viaexpressConfig.defaultWeight} - 1 - 0 - ${date} - 0 - ${viaexpressConfig.deliveryType} - 0 - 0 - 0 - 0 - 0 - - - 0 - - - - ${expedition.ticket().company().client().socialName} - ${expedition.ticket().company().client().defaultAddress().street} - ${expedition.ticket().company().client().defaultAddress().postalCode} - ${expedition.ticket().company().client().defaultAddress().city} - ${expedition.ticket().company().client().defaultAddress().province().name} - - ${expedition.ticket().company().client().defaultAddress().mobile || expedition.ticket().company().client().defaultAddress().phone || expedition.ticket().company().client().mobile || expedition.ticket().company().client().phone} - ${expedition.ticket().company().client().email} - - - ${expedition.ticket().address().nickname} - ${expedition.ticket().address().street} - ${expedition.ticket().address().postalCode} - ${expedition.ticket().address().city} - - ${expedition.ticket().address().province().name} - - ${expedition.ticket().address().mobile || expedition.ticket().address().phone || expedition.ticket().client().mobile || expedition.ticket().client().phone} - ${expedition.ticket().client().email} - ${expedition.ticket().address().province().country().code} - - - ${viaexpressConfig.clientViaexpress} - ${viaexpressConfig.userViaexpress} - ${viaexpressConfig.passwordViaexpress} - - - - - `; - - try { - const response = await axios.post(`${viaexpressConfig.url}ServicioVxClientes.asmx`, xmlData, { - headers: { - 'Content-Type': 'application/soap+xml; charset=utf-8' - } - }); - - const startTag = ''; - const endTag = ''; - const startIndex = response.data.indexOf(startTag) + startTag.length; - const endIndex = response.data.indexOf(endTag); - const referenciaVx = response.data.substring(startIndex, endIndex); - - return referenciaVx; - } catch (error) { - if (error?.response?.data) throw Error(error.response.data); - throw Error(error); - } + return referenciaVx; }; }; diff --git a/back/methods/viaexpress-config/renderer.js b/back/methods/viaexpress-config/renderer.js new file mode 100644 index 000000000..79dab21c9 --- /dev/null +++ b/back/methods/viaexpress-config/renderer.js @@ -0,0 +1,162 @@ +const fs = require('fs'); +const handlebars = require('handlebars'); + +module.exports = Self => { + Self.remoteMethod('renderer', { + description: 'Returns the lastest campaigns', + accessType: 'READ', + accepts: [{ + arg: 'expeditionFk', + type: 'number', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/renderer`, + verb: 'GET' + } + }); + + Self.renderer = async expeditionFk => { + const models = Self.app.models; + + const viaexpressConfig = await models.ViaexpressConfig.findOne({ + fields: ['clientViaexpress', 'userViaexpress', 'passwordViaexpress', 'defaultWeight', 'deliveryType'] + }); + + const expedition = await models.Expedition.findOne({ + fields: ['id', 'ticketFk'], + where: {id: expeditionFk}, + include: [ + { + relation: 'ticket', + scope: { + fields: ['shipped', 'addressFk', 'clientFk', 'companyFk'], + include: [ + { + relation: 'client', + scope: { + fields: ['mobile', 'phone', 'email'] + } + }, + { + relation: 'address', + scope: { + fields: [ + 'nickname', + 'street', + 'postalCode', + 'city', + 'mobile', + 'phone', + 'provinceFk' + ], + include: { + relation: 'province', + scope: { + fields: ['name', 'countryFk'], + include: { + relation: 'country', + scope: { + fields: ['code'], + } + } + + } + } + } + }, + { + relation: 'company', + scope: { + fields: ['clientFk'], + include: { + relation: 'client', + scope: { + fields: ['socialName', 'mobile', 'phone', 'email', 'defaultAddressFk'], + include: { + relation: 'defaultAddress', + scope: { + fields: [ + 'street', + 'postalCode', + 'city', + 'mobile', + 'phone', + 'provinceFk' + ], + include: { + relation: 'province', + scope: { + fields: ['name'] + } + } + } + } + } + } + } + } + ] + } + + } + ] + }); + + const shipped = expedition.ticket().shipped; + const year = shipped.getFullYear(); + const month = shipped.getMonth() + 1; + const day = shipped.getDate(); + const date = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`; + + const data = { + defaultWeight: viaexpressConfig.defaultWeight, + date: date, // const date = new Date().toISOString(); + deliveryType: viaexpressConfig.deliveryType, + senderName: expedition.ticket().company().client().socialName, + senderStreet: expedition.ticket().company().client().defaultAddress().street, + senderPostalCode: expedition.ticket().company().client().defaultAddress().postalCode, + senderCity: expedition.ticket().company().client().defaultAddress().city, + senderProvince: expedition.ticket().company().client().defaultAddress().province().name, + senderPhone: expedition.ticket().company().client().defaultAddress().mobile + || expedition.ticket().company().client().defaultAddress().phone + || expedition.ticket().company().client().mobile + || expedition.ticket().company().client().phone, + senderEmail: expedition.ticket().company().client().email, + receiverName: expedition.ticket().address().nickname, + receiverStreet: expedition.ticket().address().street, + receiverPostalCode: expedition.ticket().address().postalCode, + receiverCity: expedition.ticket().address().city, + receiverProvince: expedition.ticket().address().province().name, + receiverPhone: expedition.ticket().address().mobile + || expedition.ticket().address().phone + || expedition.ticket().client().mobile + || expedition.ticket().client().phone, + receiverEmail: expedition.ticket().client().email, + receiverCountry: expedition.ticket().address().province().country().code, + clientViaexpress: viaexpressConfig.clientViaexpress, + userViaexpress: viaexpressConfig.userViaexpress, + passwordViaexpress: viaexpressConfig.passwordViaexpress + }; + + const templateXml = fs.readFileSync(__dirname + '/template.xml', 'utf-8'); + + // // Crea una instancia de Vue con los datos + // const vueInstance = new Vue({ + // data: data, + // template: templateXml, + // }); + + // // Renderiza la plantilla con los datos utilizando vue-server-renderer + // const renderer = createRenderer(); + // return renderer.renderToString(vueInstance); + + const compiledTemplate = handlebars.compile(templateXml); + const renderedHtml = compiledTemplate(data); + return renderedHtml; + }; +}; diff --git a/back/methods/viaexpress-config/template.xml b/back/methods/viaexpress-config/template.xml new file mode 100644 index 000000000..141fb939a --- /dev/null +++ b/back/methods/viaexpress-config/template.xml @@ -0,0 +1,52 @@ + + + + + + {{ defaultWeight }} + 1 + 0 + {{ date }} + 0 + {{ deliveryType }} + 0 + 0 + 0 + 0 + 0 + + + 0 + + + + {{ senderName }} + {{ senderStreet }} + {{ senderPostalCode }} + {{ senderCity }} + {{ senderProvince }} + + {{ senderPhone }} + {{ senderEmail }} + + + {{ receiverName }} + {{ receiverStreet }} + {{ receiverPostalCode }} + {{ receiverCity }} + + {{ receiverProvince }} + + {{ receiverPhone }} + {{ receiverEmail }} + {{ receiverCountry }} + + + {{ clientViaexpress }} + {{ userViaexpress }} + {{ passwordViaexpress }} + + + + + diff --git a/back/models/viaexpress-config.js b/back/models/viaexpress-config.js index 72424f806..d0335b28b 100644 --- a/back/models/viaexpress-config.js +++ b/back/models/viaexpress-config.js @@ -1,3 +1,4 @@ module.exports = Self => { require('../methods/viaexpress-config/internationalExpedition')(Self); + require('../methods/viaexpress-config/renderer')(Self); }; diff --git a/package.json b/package.json index 4358c86a7..857a7c172 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "ftps": "^1.2.0", "gm": "^1.25.0", "got": "^10.7.0", + "handlebars": "^4.7.7", "helmet": "^3.21.2", "i18n": "^0.8.4", "image-type": "^4.1.0", From 092471f74ec5cf1afbabc4d430cc9a6d026c80cf Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 19 Jun 2023 15:06:06 +0200 Subject: [PATCH 061/311] refs #5475 feat(account_changePassword): accessScope and backTest --- back/methods/vn-user/validate-auth.js | 4 +- back/models/vn-user.js | 31 ------- .../components/change-password/index.html | 4 +- .../salix/components/change-password/index.js | 16 +--- .../components/change-password/locale/es.yml | 1 + .../back/methods/account/change-password.js | 17 ++-- .../account/specs/change-password.spec.js | 89 +++++++++++++++---- modules/account/back/models/account.json | 9 +- .../client/back/methods/client/setPassword.js | 2 +- package-lock.json | 2 +- print/templates/email/auth-code/auth-code.js | 2 +- 11 files changed, 96 insertions(+), 81 deletions(-) diff --git a/back/methods/vn-user/validate-auth.js b/back/methods/vn-user/validate-auth.js index cc78e983e..8065932f9 100644 --- a/back/methods/vn-user/validate-auth.js +++ b/back/methods/vn-user/validate-auth.js @@ -32,7 +32,7 @@ module.exports = Self => { }); Self.validateAuth = async function(username, password, code) { - await Self.validateCode(code); + await Self.validateCode(username, code); return Self.validateLogin(username, password); }; @@ -52,7 +52,7 @@ module.exports = Self => { const user = await Self.findById(authCode.userFk, { fields: ['name', 'twoFactor'] }); - console.log(username, code); + if (user.name !== username) throw new UserError('Authentication failed'); diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 0448d70ea..da08a2a29 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -153,41 +153,10 @@ module.exports = function(Self) { } }; - // Self.sharedClass._methods.find(method => method.name == 'changePassword') - // .accessScopes = ['change-password']; Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls = Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls .filter(acl => acl.property != 'changePassword'); - const _changePassword = Self.prototype.ChangePassword; - Self.prototype.changePassword = async function(oldPassword, newPassword, options, cb) { - if (cb === undefined && typeof options === 'function') { - cb = options; - options = undefined; - } - - const myOptions = {}; - let tx; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - options = myOptions; - - try { - await _changePassword.call(this, oldPassword, newPassword, options); - tx && await tx.commit(); - cb && cb(); - } catch (err) { - tx && await tx.rollback(); - if (cb) cb(err); else throw err; - } - }; - // FIXME: https://redmine.verdnatura.es/issues/5761 // Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => { // if (!ctx.args || !ctx.args.data.email) return; diff --git a/front/salix/components/change-password/index.html b/front/salix/components/change-password/index.html index 026374bca..c22c261f5 100644 --- a/front/salix/components/change-password/index.html +++ b/front/salix/components/change-password/index.html @@ -24,8 +24,8 @@ diff --git a/front/salix/components/change-password/index.js b/front/salix/components/change-password/index.js index 81a44d9d5..0067cbe8f 100644 --- a/front/salix/components/change-password/index.js +++ b/front/salix/components/change-password/index.js @@ -15,11 +15,6 @@ export default class Controller { } $onInit() { - this.oldPassword = 'nightmare'; - this.repeatPassword = 'test.1234'; - this.newPassword = 'test.1234'; - this.verificationCode = '1234'; - console.log(this.$state.params); if (!this.$state.params.id) this.$state.go('login'); @@ -34,7 +29,7 @@ export default class Controller { const oldPassword = this.oldPassword; const newPassword = this.newPassword; const repeatPassword = this.repeatPassword; - const verificationCode = this.verificationCode; + const code = this.code; if (!oldPassword || !newPassword || !repeatPassword) throw new UserError(`You must fill all the fields`); @@ -46,18 +41,13 @@ export default class Controller { const headers = { Authorization: this.$state.params.id }; - console.log({ - id: userId, - oldPassword, - newPassword, - verificationCode - }); + this.$http.patch('Accounts/change-password', { id: userId, oldPassword, newPassword, - verificationCode + code }, {headers} ).then(() => { diff --git a/front/salix/components/change-password/locale/es.yml b/front/salix/components/change-password/locale/es.yml index b0f183ce6..147966272 100644 --- a/front/salix/components/change-password/locale/es.yml +++ b/front/salix/components/change-password/locale/es.yml @@ -5,6 +5,7 @@ Repeat password: Repetir contraseña Passwords don't match: Las contraseñas no coinciden You must fill all the fields: Debes rellenar todos los campos You can't use the same password: No puedes usar la misma contraseña +Verification code: Código de verificación Password updated!: ¡Contraseña actualizada! Password requirements: > La contraseña debe tener al menos {{ length }} caracteres de longitud, diff --git a/modules/account/back/methods/account/change-password.js b/modules/account/back/methods/account/change-password.js index 9fbb5dd17..7ea38a221 100644 --- a/modules/account/back/methods/account/change-password.js +++ b/modules/account/back/methods/account/change-password.js @@ -16,27 +16,30 @@ module.exports = Self => { description: 'The new password', required: true }, { - arg: 'verificationCode', + arg: 'code', type: 'string', description: 'The 2FA code' } ], http: { - path: `/changePassword`, + path: `/change-password`, verb: 'PATCH' } }); - Self.changePassword = async function(ctx, oldPassword, newPassword, verificationCode) { + Self.changePassword = async function(ctx, oldPassword, newPassword, code, options) { const userId = ctx.req.accessToken.userId; - const {vnUser} = Self.app.models; + + const myOptions = {...(options || {})}; + + const {VnUser} = Self.app.models; if (oldPassword == newPassword) throw new UserError(`You can't use the same password`); - const user = await vnUser.findById(userId, {fields: ['name', 'twoFactor']}); + const user = await VnUser.findById(userId, {fields: ['name', 'twoFactor']}, myOptions); if (user.twoFactor) - await vnUser.validateCode(user.name, verificationCode); + await VnUser.validateCode(user.name, code, myOptions); - await vnUser.changePassword(userId, oldPassword, newPassword); + await VnUser.changePassword(userId, oldPassword, newPassword, myOptions); }; }; diff --git a/modules/account/back/methods/account/specs/change-password.spec.js b/modules/account/back/methods/account/specs/change-password.spec.js index 0fd6ecbd5..3c2166672 100644 --- a/modules/account/back/methods/account/specs/change-password.spec.js +++ b/modules/account/back/methods/account/specs/change-password.spec.js @@ -1,22 +1,81 @@ const {models} = require('vn-loopback/server/server'); -describe('account changePassword()', () => { - it('should throw an error when old password is wrong', async() => { - let error; - try { - await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999'); - } catch (e) { - error = e.message; - } +fdescribe('account changePassword()', () => { + let ctx = {req: {accessToken: {userId: 70}}}; - expect(error).toContain('Invalid current password'); + describe('Without 2FA', () => { + it('should throw an error when old password is wrong', async() => { + const tx = await models.Account.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + + await models.Account.changePassword(ctx, 'wrongPassword', 'nightmare.9999', null, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e.message; + } + + expect(error).toContain('Invalid current password'); + }); + + it('should change password', async() => { + const tx = await models.Account.beginTransaction({}); + + try { + const options = {transaction: tx}; + + await models.Account.changePassword(ctx, 'nightmare', 'nightmare.9999', null, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + + expect(e).toBeUndefined(); + } + }); }); - it('should change password', async() => { - try { - await models.Account.changePassword(70, 'nightmare', 'nightmare.9999'); - } catch (e) { - expect(e).toBeUndefined(); - } + describe('With 2FA', () => { + it('should throw an error when code is incorrect', async() => { + const tx = await models.Account.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + await models.VnUser.updateAll( + {id: 70}, + {twoFactor: 'email'} + , options); + await models.Account.changePassword(ctx, 'wrongPassword', 'nightmare.9999', null, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e.message; + } + + expect(error).toContain('Invalid current password'); + }); + + it('should change password when code is correct', async() => { + const tx = await models.Account.beginTransaction({}); + + try { + const options = {transaction: tx}; + await models.VnUser.updateAll( + {id: 70}, + {twoFactor: 'email'} + , options); + await models.VnUser.signin('trainee', 'nightmare', options); + const authCode = await models.AuthCode.findOne({where: {userFk: 70}}, options); + await models.Account.changePassword(ctx, 'nightmare', 'nightmare.9999', authCode.code, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + + expect(e).toBeUndefined(); + } + }); }); }); diff --git a/modules/account/back/models/account.json b/modules/account/back/models/account.json index b2cbd213b..8fe3e88f9 100644 --- a/modules/account/back/models/account.json +++ b/modules/account/back/models/account.json @@ -37,13 +37,6 @@ "principalType": "ROLE", "principalId": "$authenticated", "permission": "ALLOW" - }, - { - "property": "changePassword", - "accessType": "EXECUTE", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - } + } ] } diff --git a/modules/client/back/methods/client/setPassword.js b/modules/client/back/methods/client/setPassword.js index e5b8949e7..68c11406d 100644 --- a/modules/client/back/methods/client/setPassword.js +++ b/modules/client/back/methods/client/setPassword.js @@ -28,7 +28,7 @@ module.exports = Self => { const isAccount = await models.Account.findById(id); if (isClient && !isAccount) - await models.Account.setPassword(id, newPassword); + await models.VnUser.setPassword(id, newPassword); else throw new UserError(`Modifiable password only via recovery or by an administrator`); }; diff --git a/package-lock.json b/package-lock.json index c190065b0..e8176bebf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "salix-back", - "version": "23.24.01", + "version": "23.26.01", "license": "GPL-3.0", "dependencies": { "axios": "^1.2.2", diff --git a/print/templates/email/auth-code/auth-code.js b/print/templates/email/auth-code/auth-code.js index 1606241be..362b307d8 100755 --- a/print/templates/email/auth-code/auth-code.js +++ b/print/templates/email/auth-code/auth-code.js @@ -15,7 +15,7 @@ module.exports = { type: String }, ip: { - type: Number + type: String } } }; From 1ba19714da1d8c14d5ee54ca4cbe044cae8a86d5 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 20 Jun 2023 07:11:45 +0200 Subject: [PATCH 062/311] refs #4734 feat: add acl --- db/changes/232601/00-acl_viaexpressConfig.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/changes/232601/00-acl_viaexpressConfig.sql b/db/changes/232601/00-acl_viaexpressConfig.sql index 91a7e3c5b..d4c186dd4 100644 --- a/db/changes/232601/00-acl_viaexpressConfig.sql +++ b/db/changes/232601/00-acl_viaexpressConfig.sql @@ -1,3 +1,4 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES - ('ViaexpressConfig', 'internationalExpedition', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + ('ViaexpressConfig', 'internationalExpedition', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('ViaexpressConfig', 'renderer', 'READ', 'ALLOW', 'ROLE', 'employee'); From c3af2e3c925186e56f31a0f80f33b4095604770b Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 20 Jun 2023 07:19:32 +0200 Subject: [PATCH 063/311] refs #4734 refactor: actualizada descripcion --- back/methods/viaexpress-config/internationalExpedition.js | 3 +-- back/methods/viaexpress-config/renderer.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/back/methods/viaexpress-config/internationalExpedition.js b/back/methods/viaexpress-config/internationalExpedition.js index cbb1c2c67..75f44401f 100644 --- a/back/methods/viaexpress-config/internationalExpedition.js +++ b/back/methods/viaexpress-config/internationalExpedition.js @@ -1,9 +1,8 @@ const axios = require('axios'); -const fs = require('fs'); module.exports = Self => { Self.remoteMethod('internationalExpedition', { - description: 'Returns the lastest campaigns', + description: 'Create an expedition and return a label', accessType: 'WRITE', accepts: [{ arg: 'expeditionFk', diff --git a/back/methods/viaexpress-config/renderer.js b/back/methods/viaexpress-config/renderer.js index 79dab21c9..7308b482e 100644 --- a/back/methods/viaexpress-config/renderer.js +++ b/back/methods/viaexpress-config/renderer.js @@ -3,7 +3,7 @@ const handlebars = require('handlebars'); module.exports = Self => { Self.remoteMethod('renderer', { - description: 'Returns the lastest campaigns', + description: 'Renders the data from an XML', accessType: 'READ', accepts: [{ arg: 'expeditionFk', From 13e95bcd35920d28fa170b97b2d317cf4cee918d Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 20 Jun 2023 11:25:47 +0200 Subject: [PATCH 064/311] add vue commented code --- back/methods/viaexpress-config/renderer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/back/methods/viaexpress-config/renderer.js b/back/methods/viaexpress-config/renderer.js index 7308b482e..588733174 100644 --- a/back/methods/viaexpress-config/renderer.js +++ b/back/methods/viaexpress-config/renderer.js @@ -1,5 +1,7 @@ const fs = require('fs'); const handlebars = require('handlebars'); +// const Vue = require('vue'); +// const renderer = require('vue-server-renderer').createRenderer(); module.exports = Self => { Self.remoteMethod('renderer', { From 4444b45b08e5e5427408d15f57b7ff80b87bce1e Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 20 Jun 2023 14:07:36 +0200 Subject: [PATCH 065/311] refs #4734 feat: se utiliza la libreria ejs y xmldom --- .../internationalExpedition.js | 65 ++----------------- back/methods/viaexpress-config/renderer.js | 28 ++------ back/methods/viaexpress-config/template.ejs | 52 +++++++++++++++ back/methods/viaexpress-config/template.xml | 52 --------------- 4 files changed, 64 insertions(+), 133 deletions(-) create mode 100644 back/methods/viaexpress-config/template.ejs delete mode 100644 back/methods/viaexpress-config/template.xml diff --git a/back/methods/viaexpress-config/internationalExpedition.js b/back/methods/viaexpress-config/internationalExpedition.js index 75f44401f..698bb1dac 100644 --- a/back/methods/viaexpress-config/internationalExpedition.js +++ b/back/methods/viaexpress-config/internationalExpedition.js @@ -1,4 +1,5 @@ const axios = require('axios'); +const {DOMParser} = require('xmldom'); module.exports = Self => { Self.remoteMethod('internationalExpedition', { @@ -27,69 +28,17 @@ module.exports = Self => { }); const renderedXml = await models.ViaexpressConfig.renderer(expeditionFk); - // const renderedXml = ` - // - // - // - // - // 10 - // 1 - // 0 - // 2023-06-12 - // 0 - // E - // 0 - // 0 - // 0 - // 0 - // 0 - // - // - // 0 - // - // - // - // VERDNATURA LEVANTE SL - // FENOLLARS, 2 - // 46680 - // Algemesi - // Valencia - // - // 963677177 - // pako.natek@gmail.com - // - // - // ROSAMARY FLORISTERIA - // C SANTA ROSA,25 - // 03802 - // ALCOY - // ALCOY - // Alicante - // - // 653967489 - // correo@floristeriarosamary.com - // ES - // - // - // 16092 - // B97367486 - // VERDNA22 - // - // - // - // - // `; const response = await axios.post(`${viaexpressConfig.url}ServicioVxClientes.asmx`, renderedXml, { headers: { 'Content-Type': 'application/soap+xml; charset=utf-8' } }); - console.log(response); - const startTag = ''; - const endTag = ''; - const startIndex = response.data.indexOf(startTag) + startTag.length; - const endIndex = response.data.indexOf(endTag); - const referenciaVx = response.data.substring(startIndex, endIndex); + + const xmlString = response.data; + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); + const referenciaVxElement = xmlDoc.getElementsByTagName('ReferenciaVx')[0]; + const referenciaVx = referenciaVxElement.textContent; return referenciaVx; }; diff --git a/back/methods/viaexpress-config/renderer.js b/back/methods/viaexpress-config/renderer.js index 588733174..4014dd42d 100644 --- a/back/methods/viaexpress-config/renderer.js +++ b/back/methods/viaexpress-config/renderer.js @@ -1,7 +1,5 @@ const fs = require('fs'); -const handlebars = require('handlebars'); -// const Vue = require('vue'); -// const renderer = require('vue-server-renderer').createRenderer(); +const ejs = require('ejs'); module.exports = Self => { Self.remoteMethod('renderer', { @@ -110,14 +108,10 @@ module.exports = Self => { }); const shipped = expedition.ticket().shipped; - const year = shipped.getFullYear(); - const month = shipped.getMonth() + 1; - const day = shipped.getDate(); - const date = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`; const data = { defaultWeight: viaexpressConfig.defaultWeight, - date: date, // const date = new Date().toISOString(); + date: shipped.toISOString(), // const date = new Date().toISOString(); deliveryType: viaexpressConfig.deliveryType, senderName: expedition.ticket().company().client().socialName, senderStreet: expedition.ticket().company().client().defaultAddress().street, @@ -145,20 +139,8 @@ module.exports = Self => { passwordViaexpress: viaexpressConfig.passwordViaexpress }; - const templateXml = fs.readFileSync(__dirname + '/template.xml', 'utf-8'); - - // // Crea una instancia de Vue con los datos - // const vueInstance = new Vue({ - // data: data, - // template: templateXml, - // }); - - // // Renderiza la plantilla con los datos utilizando vue-server-renderer - // const renderer = createRenderer(); - // return renderer.renderToString(vueInstance); - - const compiledTemplate = handlebars.compile(templateXml); - const renderedHtml = compiledTemplate(data); - return renderedHtml; + const template = fs.readFileSync(__dirname + '/template.ejs', 'utf-8'); + const renderedXml = ejs.render(template, data); + return renderedXml; }; }; diff --git a/back/methods/viaexpress-config/template.ejs b/back/methods/viaexpress-config/template.ejs new file mode 100644 index 000000000..e8b1f1977 --- /dev/null +++ b/back/methods/viaexpress-config/template.ejs @@ -0,0 +1,52 @@ + + + + + + <%= defaultWeight %> + 1 + 0 + <%= date %> + 0 + <%= deliveryType %> + 0 + 0 + 0 + 0 + 0 + + + 0 + + + + <%= senderName %> + <%= senderStreet %> + <%= senderPostalCode %> + <%= senderCity %> + <%= senderProvince %> + + <%= senderPhone %> + <%= senderEmail %> + + + <%= receiverName %> + <%= receiverStreet %> + <%= receiverPostalCode %> + <%= receiverCity %> + + <%= receiverProvince %> + + <%= receiverPhone %> + <%= receiverEmail %> + <%= receiverCountry %> + + + <%= clientViaexpress %> + <%= userViaexpress %> + <%= passwordViaexpress %> + + + + + diff --git a/back/methods/viaexpress-config/template.xml b/back/methods/viaexpress-config/template.xml deleted file mode 100644 index 141fb939a..000000000 --- a/back/methods/viaexpress-config/template.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - {{ defaultWeight }} - 1 - 0 - {{ date }} - 0 - {{ deliveryType }} - 0 - 0 - 0 - 0 - 0 - - - 0 - - - - {{ senderName }} - {{ senderStreet }} - {{ senderPostalCode }} - {{ senderCity }} - {{ senderProvince }} - - {{ senderPhone }} - {{ senderEmail }} - - - {{ receiverName }} - {{ receiverStreet }} - {{ receiverPostalCode }} - {{ receiverCity }} - - {{ receiverProvince }} - - {{ receiverPhone }} - {{ receiverEmail }} - {{ receiverCountry }} - - - {{ clientViaexpress }} - {{ userViaexpress }} - {{ passwordViaexpress }} - - - - - From a8fafacb828bdbed02007b768f47ac585d02f9c2 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 20 Jun 2023 15:06:02 +0200 Subject: [PATCH 066/311] refs #5475 send email force --- loopback/common/methods/vn-model/printService.js | 2 +- print/core/email.js | 7 ++++--- print/core/smtp.js | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/loopback/common/methods/vn-model/printService.js b/loopback/common/methods/vn-model/printService.js index 5cd571d4c..807613653 100644 --- a/loopback/common/methods/vn-model/printService.js +++ b/loopback/common/methods/vn-model/printService.js @@ -52,6 +52,6 @@ module.exports = Self => { const email = new Email(templateName, params); - return email.send(); + return email.send({force: true}); }; }; diff --git a/print/core/email.js b/print/core/email.js index 6e96f5c2e..2d1ee42cf 100644 --- a/print/core/email.js +++ b/print/core/email.js @@ -63,12 +63,12 @@ class Email extends Component { await getAttachments(componentPath, component.attachments); if (component.components) - await getSubcomponentAttachments(component) + await getSubcomponentAttachments(component); } } } - await getSubcomponentAttachments(instance) + await getSubcomponentAttachments(instance); if (this.attachments) await getAttachments(this.path, this.attachments); @@ -84,7 +84,8 @@ class Email extends Component { replyTo: this.args.replyTo || '', subject: localeSubject, html: rendered, - attachments: attachments + attachments: attachments, + force: options.force }; return smtp.send(mailOptions); diff --git a/print/core/smtp.js b/print/core/smtp.js index 61b115b5a..50fe55986 100644 --- a/print/core/smtp.js +++ b/print/core/smtp.js @@ -10,7 +10,8 @@ module.exports = { async send(options) { options.from = `${config.app.senderName} <${config.app.senderEmail}>`; - + console.log(process.env.NODE_ENV !== 'production' && !options.force); + console.log(process.env.NODE_ENV !== 'production', !options.force); if (process.env.NODE_ENV !== 'production') { const notProductionError = {message: 'This not production, this email not sended'}; await this.mailLog(options, notProductionError); @@ -19,7 +20,6 @@ module.exports = { options.to = config.app.senderEmail; } - let error; return this.transporter.sendMail(options).catch(err => { error = err; From a699e2d8748ce295193620f324500481c4668a40 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 21 Jun 2023 14:07:36 +0200 Subject: [PATCH 067/311] =?UTF-8?q?refs=20#5244=20feat:=20a=C3=B1adido=20'?= =?UTF-8?q?depatments'=20como=20binding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/worker-autocomplete/index.js | 26 ++++++--- modules/ticket/front/tracking/edit/index.html | 2 +- modules/worker/back/methods/worker/search.js | 57 +++++++++++++------ 3 files changed, 59 insertions(+), 26 deletions(-) diff --git a/front/core/components/worker-autocomplete/index.js b/front/core/components/worker-autocomplete/index.js index efaa6a4a9..436959c5d 100755 --- a/front/core/components/worker-autocomplete/index.js +++ b/front/core/components/worker-autocomplete/index.js @@ -4,25 +4,35 @@ import Autocomplete from '../autocomplete'; export default class WorkerAutocomplete extends Autocomplete { constructor(...args) { super(...args); + } + + $onInit() { + let url = 'Workers/search'; + if (this.departments) { + const parameter = encodeURIComponent(JSON.stringify(this.departments)); + url = `Workers/search?departmentCodes=${parameter}`; + } Object.assign(this, { label: 'Worker', - url: 'Workers/search', - fields: ['id', 'name', 'nickname'], + url: url, searchFunction: function({$search}) { return {and: [ - {active: {neq: false}}, + {'u.active': {neq: false}}, {or: [ - {name: $search}, - {nickname: {like: '%' + $search + '%'}}, - {code: {like: $search + '%'}} + {'u.name': $search}, + {'u.nickname': {like: '%' + $search + '%'}}, + {'w.code': {like: $search + '%'}} ]} ]}; - } + }, }); } } ngModule.vnComponent('vnWorkerAutocomplete', { slotTemplate: require('./index.html'), - controller: WorkerAutocomplete + controller: WorkerAutocomplete, + bindings: { + departments: ' + departments="['VN']"> { - Self.remoteMethod('search', { + Self.remoteMethodCtx('search', { description: 'Returns an array of search from an specified worker', accepts: [{ arg: 'filter', - type: 'Object', + type: 'object', description: 'Filter defining where and paginated data', required: true + }, + { + arg: 'departmentCodes', + type: ['string'], + description: 'Department codes to search workers', }], returns: { type: ['object'], @@ -17,24 +25,39 @@ module.exports = Self => { } }); - Self.search = async filter => { - const $ = Self.app.models; + Self.search = async(ctx, filter, departmentCodes) => { + const models = Self.app.models; + const conn = Self.dataSource.connector; - let {where} = filter; - const users = where && await $.VnUser.find({ - fields: ['id'], - where - }); + let allDepartments = []; + if (departmentCodes) { + const departments = await models.Department.find({ + fields: ['id'], + where: {code: {inq: departmentCodes}} + }); + const departmentIds = departments.map(department => department.id); - const workers = await Self.find({ - fields: ['id'], - where: { - businessFk: {neq: null}, - id: users ? {inq: users.map(u => u.id)} : undefined + let departmentLeaves = []; + for (let id of departmentIds) { + const leaves = await models.Department.getLeaves(ctx, id, null); + console.log(leaves); + for (let leave of leaves) departmentLeaves.push(leave.id); } - }); - where = {id: {inq: workers.map(w => w.id)}}; - return await $.VnUser.find(Object.assign({}, filter, {where})); + allDepartments = departmentIds.concat(departmentLeaves); + console.log(allDepartments); + const where = {'d.id': {inq: allDepartments}}; + filter = mergeFilters(filter, {where}); + } + + const stmt = new ParameterizedSQL( + `SELECT DISTINCT w.code, u.name, u.nickname + FROM worker w + JOIN account.user u ON u.id = w.id + JOIN business b ON b.workerFk = w.id + JOIN department d ON d.id = b.departmentFk`); + + stmt.merge(conn.makeSuffix(filter)); + return conn.executeStmt(stmt); }; }; From 6ab431f8efec6e80495451332064c6eeb8b6684f Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 21 Jun 2023 14:17:25 +0200 Subject: [PATCH 068/311] refs #5475 tests --- back/methods/vn-user/sign-in.js | 23 ++-- back/methods/vn-user/specs/sign-in.spec.js | 101 ++++++++++++++++++ back/methods/vn-user/specs/signIn.spec.js | 74 ------------- .../vn-user/specs/validate-auth.spec.js | 77 +++++++------ back/methods/vn-user/validate-auth.js | 14 +-- db/changes/231801/00-userAcl.sql | 3 +- db/changes/232601/00-authCode.sql | 2 +- db/dump/fixtures.sql | 4 +- front/core/services/auth.js | 2 +- .../salix/components/change-password/index.js | 2 +- .../components/change-password/locale/es.yml | 2 +- .../components/validate-email/locale/es.yml | 3 +- .../common/methods/vn-model/printService.js | 4 +- .../back/methods/account/change-password.js | 3 +- modules/account/back/methods/account/login.js | 2 +- .../account/specs/change-password.spec.js | 68 +++++++----- print/core/smtp.js | 15 +-- 17 files changed, 233 insertions(+), 166 deletions(-) create mode 100644 back/methods/vn-user/specs/sign-in.spec.js delete mode 100644 back/methods/vn-user/specs/signIn.spec.js diff --git a/back/methods/vn-user/sign-in.js b/back/methods/vn-user/sign-in.js index f27d40e0a..eaf17a900 100644 --- a/back/methods/vn-user/sign-in.js +++ b/back/methods/vn-user/sign-in.js @@ -26,9 +26,11 @@ module.exports = Self => { } }); - Self.signin = async function(ctx, user, password) { + Self.signin = async function(ctx, user, password, options) { const usesEmail = user.indexOf('@') !== -1; + const myOptions = {...(options || {})}; + const where = usesEmail ? {email: user} : {name: user}; @@ -36,7 +38,7 @@ module.exports = Self => { const vnUser = await Self.findOne({ fields: ['id', 'name', 'password', 'active', 'email', 'passExpired', 'twoFactor'], where - }); + }, myOptions); const validCredentials = vnUser && await vnUser.hasPassword(password); @@ -44,8 +46,8 @@ module.exports = Self => { if (validCredentials) { if (!vnUser.active) throw new UserError('User disabled'); - await Self.sendTwoFactor(ctx, vnUser); - await Self.passExpired(vnUser); + await Self.sendTwoFactor(ctx, vnUser, myOptions); + await Self.passExpired(vnUser, myOptions); if (vnUser.twoFactor) throw new ForbiddenError('REQUIRES_2FA'); @@ -54,7 +56,7 @@ module.exports = Self => { return Self.validateLogin(user, password); }; - Self.passExpired = async vnUser => { + Self.passExpired = async(vnUser, myOptions) => { const today = Date.vnNew(); today.setHours(0, 0, 0, 0); @@ -63,7 +65,7 @@ module.exports = Self => { const changePasswordToken = await $.AccessToken.create({ scopes: ['changePassword'], userId: vnUser.id - }); + }, myOptions); const err = new UserError('Pass expired', 'passExpired'); changePasswordToken.twoFactor = vnUser.twoFactor ? true : false; err.details = {token: changePasswordToken}; @@ -71,7 +73,7 @@ module.exports = Self => { } }; - Self.sendTwoFactor = async(ctx, vnUser) => { + Self.sendTwoFactor = async(ctx, vnUser, myOptions) => { if (vnUser.twoFactor === 'email') { const $ = Self.app.models; @@ -81,7 +83,7 @@ module.exports = Self => { userFk: vnUser.id, code: code, expires: Date.vnNow() + maxTTL - }); + }, myOptions); const headers = ctx.req.headers; let platform = headers['sec-ch-ua-platform']?.replace(/['"=]+/g, ''); @@ -94,9 +96,10 @@ module.exports = Self => { ip: ctx.req?.connection?.remoteAddress, device: platform && browser ? platform + ', ' + browser : headers['user-agent'], }, - req: {getLocale: ctx.req.getLocale} + req: {getLocale: ctx.req.getLocale}, }; - await Self.sendTemplate(params, 'auth-code'); + + await Self.sendTemplate(params, 'auth-code', true); } }; }; diff --git a/back/methods/vn-user/specs/sign-in.spec.js b/back/methods/vn-user/specs/sign-in.spec.js new file mode 100644 index 000000000..a6e89d528 --- /dev/null +++ b/back/methods/vn-user/specs/sign-in.spec.js @@ -0,0 +1,101 @@ +const {models} = require('vn-loopback/server/server'); + +fdescribe('VnUser Sign-in()', () => { + const employeeId = 1; + const unauthCtx = { + req: { + headers: {}, + connection: { + remoteAddress: '127.0.0.1' + }, + getLocale: () => 'en' + }, + args: {} + }; + const {VnUser, AccessToken} = models; + describe('when credentials are correct', () => { + it('should return the token', async() => { + let login = await VnUser.signin(unauthCtx, 'salesAssistant', 'nightmare'); + let accessToken = await AccessToken.findById(login.token); + let ctx = {req: {accessToken: accessToken}}; + + expect(login.token).toBeDefined(); + + await VnUser.logout(ctx.req.accessToken.id); + }); + + it('should return the token if the user doesnt exist but the client does', async() => { + let login = await VnUser.signin(unauthCtx, 'PetterParker', 'nightmare'); + let accessToken = await AccessToken.findById(login.token); + let ctx = {req: {accessToken: accessToken}}; + + expect(login.token).toBeDefined(); + + await VnUser.logout(ctx.req.accessToken.id); + }); + }); + + describe('when credentials are incorrect', () => { + it('should throw a 401 error', async() => { + let error; + + try { + await VnUser.signin(unauthCtx, 'IDontExist', 'TotallyWrongPassword'); + } catch (e) { + error = e; + } + + expect(error).toBeDefined(); + expect(error.statusCode).toBe(401); + expect(error.code).toBe('LOGIN_FAILED'); + }); + }); + + describe('when two-factor auth is required', () => { + it('should throw a 403 error', async() => { + const employee = await VnUser.findById(employeeId); + const tx = await VnUser.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + await employee.updateAttribute('twoFactor', 'email', options); + + await VnUser.signin(unauthCtx, 'employee', 'nightmare', options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error).toBeDefined(); + expect(error.statusCode).toBe(403); + expect(error.message).toBe('REQUIRES_2FA'); + + await employee.updateAttribute('twoFactor', null); + }); + }); + + describe('when passExpired', () => { + it('should throw a passExpired error', async() => { + let error; + const employee = await VnUser.findById(employeeId); + const yesterday = Date.vnNew(); + yesterday.setDate(yesterday.getDate() - 1); + + try { + await employee.updateAttribute('passExpired', yesterday); + + await VnUser.signin(unauthCtx, 'employee', 'nightmare'); + } catch (e) { + error = e; + } + + expect(error).toBeDefined(); + expect(error.statusCode).toBe(400); + expect(error.message).toBe('Pass expired'); + + await employee.updateAttribute('passExpired', null); + }); + }); +}); diff --git a/back/methods/vn-user/specs/signIn.spec.js b/back/methods/vn-user/specs/signIn.spec.js deleted file mode 100644 index 5a28a4d12..000000000 --- a/back/methods/vn-user/specs/signIn.spec.js +++ /dev/null @@ -1,74 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -describe('account login()', () => { - const employeeId = 1; - const unauthCtx = { - req: { - connection: { - remoteAddress: '127.0.0.1' - }, - getLocale: () => 'en' - }, - args: {} - }; - describe('when credentials are correct', () => { - it('should return the token', async() => { - let login = await models.VnUser.signin(unauthCtx, 'salesAssistant', 'nightmare'); - let accessToken = await models.AccessToken.findById(login.token); - let ctx = {req: {accessToken: accessToken}}; - - expect(login.token).toBeDefined(); - - await models.VnUser.logout(ctx.req.accessToken.id); - }); - - it('should return the token if the user doesnt exist but the client does', async() => { - let login = await models.VnUser.signin(unauthCtx, 'PetterParker', 'nightmare'); - let accessToken = await models.AccessToken.findById(login.token); - let ctx = {req: {accessToken: accessToken}}; - - expect(login.token).toBeDefined(); - - await models.VnUser.logout(ctx.req.accessToken.id); - }); - }); - - describe('when credentials are incorrect', () => { - it('should throw a 401 error', async() => { - let error; - - try { - await models.Account.login(unauthCtx, 'IDontExist', 'TotallyWrongPassword'); - } catch (e) { - error = e; - } - - expect(error).toBeDefined(); - expect(error.statusCode).toBe(401); - expect(error.code).toBe('LOGIN_FAILED'); - }); - }); - - describe('when two-factor auth is required', () => { - it('should throw a 403 error', async() => { - let error; - const Account = models.Account; - - const employee = await Account.findById(employeeId); - - try { - await employee.updateAttribute('twoFactor', 'email'); - - await Account.login(unauthCtx, 'employee', 'nightmare'); - } catch (e) { - error = e; - } - - expect(error).toBeDefined(); - expect(error.statusCode).toBe(403); - expect(error.message).toBe('REQUIRES_2FA'); - - await employee.updateAttribute('twoFactor', null); - }); - }); -}); diff --git a/back/methods/vn-user/specs/validate-auth.spec.js b/back/methods/vn-user/specs/validate-auth.spec.js index 958770b4b..a58837e7b 100644 --- a/back/methods/vn-user/specs/validate-auth.spec.js +++ b/back/methods/vn-user/specs/validate-auth.spec.js @@ -1,41 +1,52 @@ const {models} = require('vn-loopback/server/server'); -describe('account validateAuth()', () => { - const developerId = 9; - - it('should throw an error for a non existent code', async() => { - const ctx = {req: {accessToken: {userId: developerId}}}; - - let error; - try { - await models.VnUser.validateAuth(ctx, 'developer', 'nightmare', '123456'); - } catch (e) { - error = e; - } - - expect(error).toBeDefined(); - expect(error.statusCode).toBe(400); - expect(error.message).toEqual('Invalid or expired verification code'); - }); - - it('should throw an error when a code doesn`t match the login username', async() => { - const ctx = {req: {accessToken: {userId: developerId}}}; - - let error; - try { - const authCode = await models.AuthCode.create({ - userFk: 1, +fdescribe('VnUser validate-auth()', () => { + describe('validateAuth', () => { + it('should signin if data is correct', async() => { + await models.AuthCode.create({ + userFk: 9, code: '555555', expires: Date.vnNow() + (60 * 1000) }); - await models.VnUser.validateAuth(ctx, 'developer', 'nightmare', '555555'); - await authCode.destroy(); - } catch (e) { - error = e; - } + const token = await models.VnUser.validateAuth('developer', 'nightmare', '555555'); - expect(error).toBeDefined(); - expect(error.statusCode).toBe(400); - expect(error.message).toEqual('Authentication failed'); + expect(token.token).toBeDefined(); + }); + }); + + describe('validateCode', () => { + it('should throw an error for a non existent code', async() => { + let error; + try { + await models.VnUser.validateCode('developer', '123456'); + } catch (e) { + error = e; + } + + expect(error).toBeDefined(); + expect(error.statusCode).toBe(400); + expect(error.message).toEqual('Invalid or expired verification code'); + }); + + it('should throw an error when a code doesn`t match the login username', async() => { + let error; + let authCode; + try { + authCode = await models.AuthCode.create({ + userFk: 1, + code: '555555', + expires: Date.vnNow() + (60 * 1000) + }); + + await models.VnUser.validateCode('developer', '555555'); + } catch (e) { + authCode && await authCode.destroy(); + error = e; + } + + expect(error).toBeDefined(); + expect(error.statusCode).toBe(400); + expect(error.message).toEqual('Authentication failed'); + }); }); }); diff --git a/back/methods/vn-user/validate-auth.js b/back/methods/vn-user/validate-auth.js index 8065932f9..0fb1cf884 100644 --- a/back/methods/vn-user/validate-auth.js +++ b/back/methods/vn-user/validate-auth.js @@ -31,19 +31,21 @@ module.exports = Self => { } }); - Self.validateAuth = async function(username, password, code) { - await Self.validateCode(username, code); + Self.validateAuth = async(username, password, code, options) => { + const myOptions = {...(options || {})}; + + await Self.validateCode(username, code, myOptions); return Self.validateLogin(username, password); }; - Self.validateCode = async(username, code) => { + Self.validateCode = async(username, code, myOptions) => { const {AuthCode} = Self.app.models; const authCode = await AuthCode.findOne({ where: { code: code } - }); + }, myOptions); const expired = authCode && Date.vnNow() > authCode.expires; if (!authCode || expired) @@ -51,11 +53,11 @@ module.exports = Self => { const user = await Self.findById(authCode.userFk, { fields: ['name', 'twoFactor'] - }); + }, myOptions); if (user.name !== username) throw new UserError('Authentication failed'); - await authCode.destroy(); + await authCode.destroy(myOptions); }; }; diff --git a/db/changes/231801/00-userAcl.sql b/db/changes/231801/00-userAcl.sql index 3935792f9..f84a4d7c3 100644 --- a/db/changes/231801/00-userAcl.sql +++ b/db/changes/231801/00-userAcl.sql @@ -2,7 +2,8 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp VALUES ('VnUser','acl','READ','ALLOW','ROLE','account'), ('VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'), - ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'); + ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'), ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'); + ('Account','exists','READ','ALLOW','ROLE','account'); INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES diff --git a/db/changes/232601/00-authCode.sql b/db/changes/232601/00-authCode.sql index 3a85ce58f..a256db43f 100644 --- a/db/changes/232601/00-authCode.sql +++ b/db/changes/232601/00-authCode.sql @@ -2,7 +2,7 @@ create table `salix`.`authCode` ( userFk int UNSIGNED not null, code int not null, - expires TIMESTAMP not null, + expires bigint not null, constraint authCode_pk primary key (userFk), constraint authCode_unique diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 150f12a0e..82edf896f 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -77,7 +77,9 @@ INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `role`,`active`,`email`, ` ORDER BY id; INSERT INTO `account`.`account`(`id`) - SELECT id FROM `account`.`user`; + SELECT id + FROM `account`.`user` + WHERE role <> 2; INSERT INTO `vn`.`educationLevel` (`id`, `name`) VALUES diff --git a/front/core/services/auth.js b/front/core/services/auth.js index 40bee44ba..d3e590a74 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -59,7 +59,7 @@ export default class Auth { password: password || undefined }; - return this.$http.post('Accounts/login', params).then( + return this.$http.post('VnUsers/signin', params).then( json => this.onLoginOk(json, remember)); } diff --git a/front/salix/components/change-password/index.js b/front/salix/components/change-password/index.js index 0067cbe8f..80784e5d0 100644 --- a/front/salix/components/change-password/index.js +++ b/front/salix/components/change-password/index.js @@ -36,7 +36,7 @@ export default class Controller { if (newPassword != this.repeatPassword) throw new UserError(`Passwords don't match`); if (newPassword == oldPassword) - throw new UserError(`You can't use the same password`); + throw new UserError(`You can not use the same password`); const headers = { Authorization: this.$state.params.id diff --git a/front/salix/components/change-password/locale/es.yml b/front/salix/components/change-password/locale/es.yml index 147966272..5bae9f696 100644 --- a/front/salix/components/change-password/locale/es.yml +++ b/front/salix/components/change-password/locale/es.yml @@ -4,7 +4,7 @@ New password: Nueva contraseña Repeat password: Repetir contraseña Passwords don't match: Las contraseñas no coinciden You must fill all the fields: Debes rellenar todos los campos -You can't use the same password: No puedes usar la misma contraseña +You can not use the same password: No puedes usar la misma contraseña Verification code: Código de verificación Password updated!: ¡Contraseña actualizada! Password requirements: > diff --git a/front/salix/components/validate-email/locale/es.yml b/front/salix/components/validate-email/locale/es.yml index aae564330..9c7635a40 100644 --- a/front/salix/components/validate-email/locale/es.yml +++ b/front/salix/components/validate-email/locale/es.yml @@ -1,4 +1,5 @@ Validate email auth: Autenticar email Enter verification code: Introduce código de verificación Code: Código -Please enter the verification code that we have sent to your email address within 5 minutes: Por favor, introduce el código de verificación que te hemos enviado a tu email en los próximos 5 minutos \ No newline at end of file +Please enter the verification code that we have sent to your email address within 5 minutes: Por favor, introduce el código de verificación que te hemos enviado a tu email en los próximos 5 minutos +Validate: Validar diff --git a/loopback/common/methods/vn-model/printService.js b/loopback/common/methods/vn-model/printService.js index 807613653..12a6a67cc 100644 --- a/loopback/common/methods/vn-model/printService.js +++ b/loopback/common/methods/vn-model/printService.js @@ -39,7 +39,7 @@ module.exports = Self => { return [html, 'text/html', `filename=${fileName}.pdf"`]; }; - Self.sendTemplate = async function(ctx, templateName) { + Self.sendTemplate = async function(ctx, templateName, force) { const args = Object.assign({}, ctx.args); const params = { recipient: args.recipient, @@ -52,6 +52,6 @@ module.exports = Self => { const email = new Email(templateName, params); - return email.send({force: true}); + return email.send({force: force}); }; }; diff --git a/modules/account/back/methods/account/change-password.js b/modules/account/back/methods/account/change-password.js index 7ea38a221..be795b704 100644 --- a/modules/account/back/methods/account/change-password.js +++ b/modules/account/back/methods/account/change-password.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('changePassword', { @@ -34,7 +35,7 @@ module.exports = Self => { const {VnUser} = Self.app.models; if (oldPassword == newPassword) - throw new UserError(`You can't use the same password`); + throw new UserError(`You can not use the same password`); const user = await VnUser.findById(userId, {fields: ['name', 'twoFactor']}, myOptions); if (user.twoFactor) diff --git a/modules/account/back/methods/account/login.js b/modules/account/back/methods/account/login.js index 9ff55d8ad..5178f9caf 100644 --- a/modules/account/back/methods/account/login.js +++ b/modules/account/back/methods/account/login.js @@ -23,5 +23,5 @@ module.exports = Self => { } }); - Self.login = async(ctx, user, password) => Self.app.models.VnUser.signin(ctx, user, password); + Self.login = async(ctx, user, password, options) => Self.app.models.VnUser.signin(ctx, user, password, options); }; diff --git a/modules/account/back/methods/account/specs/change-password.spec.js b/modules/account/back/methods/account/specs/change-password.spec.js index 3c2166672..84685fac2 100644 --- a/modules/account/back/methods/account/specs/change-password.spec.js +++ b/modules/account/back/methods/account/specs/change-password.spec.js @@ -1,8 +1,17 @@ const {models} = require('vn-loopback/server/server'); fdescribe('account changePassword()', () => { - let ctx = {req: {accessToken: {userId: 70}}}; - + const ctx = {req: {accessToken: {userId: 70}}}; + const unauthCtx = { + req: { + headers: {}, + connection: { + remoteAddress: '127.0.0.1' + }, + getLocale: () => 'en' + }, + args: {} + }; describe('Without 2FA', () => { it('should throw an error when old password is wrong', async() => { const tx = await models.Account.beginTransaction({}); @@ -21,6 +30,24 @@ fdescribe('account changePassword()', () => { expect(error).toContain('Invalid current password'); }); + it('should throw an error when old and new password are the same', async() => { + const tx = await models.Account.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + + await models.Account.changePassword(ctx, 'nightmare', 'nightmare.9999', null, options); + await models.Account.changePassword(ctx, 'nightmare.9999', 'nightmare.9999', null, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e.message; + } + + expect(error).toContain('You can not use the same password'); + }); + it('should change password', async() => { const tx = await models.Account.beginTransaction({}); @@ -38,36 +65,27 @@ fdescribe('account changePassword()', () => { }); describe('With 2FA', () => { - it('should throw an error when code is incorrect', async() => { - const tx = await models.Account.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - await models.VnUser.updateAll( - {id: 70}, - {twoFactor: 'email'} - , options); - await models.Account.changePassword(ctx, 'wrongPassword', 'nightmare.9999', null, options); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - error = e.message; - } - - expect(error).toContain('Invalid current password'); - }); - it('should change password when code is correct', async() => { const tx = await models.Account.beginTransaction({}); + const yesterday = Date.vnNew(); + yesterday.setDate(yesterday.getDate() - 1); + const options = {transaction: tx}; try { - const options = {transaction: tx}; await models.VnUser.updateAll( {id: 70}, - {twoFactor: 'email'} + { + twoFactor: 'email', + passExpired: yesterday + } , options); - await models.VnUser.signin('trainee', 'nightmare', options); + await models.VnUser.signin(unauthCtx, 'trainee', 'nightmare', options); + } catch (e) { + if (e.message != 'Pass expired') + throw e; + } + + try { const authCode = await models.AuthCode.findOne({where: {userFk: 70}}, options); await models.Account.changePassword(ctx, 'nightmare', 'nightmare.9999', authCode.code, options); await tx.rollback(); diff --git a/print/core/smtp.js b/print/core/smtp.js index 50fe55986..e22108e16 100644 --- a/print/core/smtp.js +++ b/print/core/smtp.js @@ -10,16 +10,17 @@ module.exports = { async send(options) { options.from = `${config.app.senderName} <${config.app.senderEmail}>`; - console.log(process.env.NODE_ENV !== 'production' && !options.force); - console.log(process.env.NODE_ENV !== 'production', !options.force); - if (process.env.NODE_ENV !== 'production') { + if (!process.env.NODE_ENV) + options.to = config.app.senderEmail; + + if (process.env.NODE_ENV !== 'production' && !options.force) { const notProductionError = {message: 'This not production, this email not sended'}; await this.mailLog(options, notProductionError); - if (!config.smtp.auth.user) - return Promise.resolve(true); - - options.to = config.app.senderEmail; } + + if (!config.smtp.auth.user) + return Promise.resolve(true); + let error; return this.transporter.sendMail(options).catch(err => { error = err; From e9ef81f8d7b7640f802d0fc8b4ec4a1ac5ee29ed Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 21 Jun 2023 15:00:46 +0200 Subject: [PATCH 069/311] refs #5244 feat: coge todos los hijos recursivamente --- db/changes/232601/00-department.sql | 3 ++ modules/worker/back/methods/worker/search.js | 30 +++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 db/changes/232601/00-department.sql diff --git a/db/changes/232601/00-department.sql b/db/changes/232601/00-department.sql new file mode 100644 index 000000000..777d26b9f --- /dev/null +++ b/db/changes/232601/00-department.sql @@ -0,0 +1,3 @@ +UPDATE `vn`.`department` + SET code='VN' +WHERE name='VERDNATURA'; diff --git a/modules/worker/back/methods/worker/search.js b/modules/worker/back/methods/worker/search.js index 388b94e6b..c02053b0c 100644 --- a/modules/worker/back/methods/worker/search.js +++ b/modules/worker/back/methods/worker/search.js @@ -29,24 +29,14 @@ module.exports = Self => { const models = Self.app.models; const conn = Self.dataSource.connector; - let allDepartments = []; if (departmentCodes) { const departments = await models.Department.find({ - fields: ['id'], + fields: ['id', 'sons'], where: {code: {inq: departmentCodes}} }); - const departmentIds = departments.map(department => department.id); - let departmentLeaves = []; - for (let id of departmentIds) { - const leaves = await models.Department.getLeaves(ctx, id, null); - console.log(leaves); - for (let leave of leaves) departmentLeaves.push(leave.id); - } - - allDepartments = departmentIds.concat(departmentLeaves); - console.log(allDepartments); - const where = {'d.id': {inq: allDepartments}}; + const allLeaves = await getAllLeaves(ctx, departments); + const where = {'d.id': {inq: allLeaves}}; filter = mergeFilters(filter, {where}); } @@ -60,4 +50,18 @@ module.exports = Self => { stmt.merge(conn.makeSuffix(filter)); return conn.executeStmt(stmt); }; + + async function getAllLeaves(ctx, departments) { + const models = Self.app.models; + const leaves = []; + for (const department of departments) { + if (department.sons > 0) { + const subLeaves = await models.Department.getLeaves(ctx, department.id, null); + const grandLeaves = await getAllLeaves(ctx, subLeaves); + leaves.push(...grandLeaves); + } + leaves.push(department.id); + } + return leaves; + } }; From dcbe8c5f7a36c29ed985705c07f0a80a4c17556a Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 26 Jun 2023 06:28:35 +0200 Subject: [PATCH 070/311] refs #5066 quit if --- modules/route/front/basic-data/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/route/front/basic-data/index.js b/modules/route/front/basic-data/index.js index d7f178985..e6be796ce 100644 --- a/modules/route/front/basic-data/index.js +++ b/modules/route/front/basic-data/index.js @@ -14,8 +14,7 @@ class Controller extends Section { if (res.data) { this.$http.post(`Vehicles/sorted`, {warehouseFk: res.data.warehouseFk}) .then(res => { - if (res.data) - this.vehicles = res.data; + this.vehicles = res.data; }); } }); From eff46c1cec81cf0d12a6e775e4749098481025fc Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 26 Jun 2023 07:43:36 +0200 Subject: [PATCH 071/311] refs #5066 e2e fix, vnConfig --- e2e/paths/08-route/02_basic_data.spec.js | 2 +- modules/route/front/basic-data/index.html | 3 ++- modules/route/front/basic-data/index.js | 19 +++++++------------ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/e2e/paths/08-route/02_basic_data.spec.js b/e2e/paths/08-route/02_basic_data.spec.js index 6008b0482..7ab7dda42 100644 --- a/e2e/paths/08-route/02_basic_data.spec.js +++ b/e2e/paths/08-route/02_basic_data.spec.js @@ -24,7 +24,7 @@ describe('Route basic Data path', () => { const form = 'vn-route-basic-data form'; const values = { worker: 'adminBossNick', - vehicle: '1111-IMK - Warehouse One', + vehicle: '1111-IMK', created: nextMonth, kmStart: 1, kmEnd: 2, diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index 514c535a2..ade9230e8 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -28,7 +28,8 @@ data="$ctrl.vehicles" show-field="numberPlate" value-field="id" - order="false"> + order="false" + vn-name="vehicle"> {{::numberPlate}} - {{::name}} diff --git a/modules/route/front/basic-data/index.js b/modules/route/front/basic-data/index.js index e6be796ce..f051e23c5 100644 --- a/modules/route/front/basic-data/index.js +++ b/modules/route/front/basic-data/index.js @@ -2,23 +2,18 @@ import ngModule from '../module'; import Section from 'salix/components/section'; class Controller extends Section { + $onInit() { + this.$http.post(`Vehicles/sorted`, {warehouseFk: this.vnConfig.warehouseFk}) + .then(res => { + this.vehicles = res.data; + }); + } + onSubmit() { this.$.watcher.submit().then(() => this.card.reload() ); } - constructor($element, $) { - super($element, $); - this.$http.get(`UserConfigs/getUserConfig`) - .then(res => { - if (res.data) { - this.$http.post(`Vehicles/sorted`, {warehouseFk: res.data.warehouseFk}) - .then(res => { - this.vehicles = res.data; - }); - } - }); - } } ngModule.vnComponent('vnRouteBasicData', { From 549235429c06bfb12cd7fa9a67f7b91baa2da00e Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 27 Jun 2023 07:18:36 +0200 Subject: [PATCH 072/311] refs #5640 oldBranch --- e2e/paths/02-client/03_edit_fiscal_data.spec.js | 4 ++-- e2e/paths/02-client/12_lock_of_verified_data.spec.js | 6 +++--- modules/client/front/fiscal-data/index.html | 2 ++ modules/client/front/fiscal-data/index.js | 6 ++++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/e2e/paths/02-client/03_edit_fiscal_data.spec.js b/e2e/paths/02-client/03_edit_fiscal_data.spec.js index 0babb5396..9098e816f 100644 --- a/e2e/paths/02-client/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client/03_edit_fiscal_data.spec.js @@ -61,7 +61,7 @@ describe('Client Edit fiscalData path', () => { await page.clearInput(selectors.clientFiscalData.fiscalId); await page.write(selectors.clientFiscalData.fiscalId, 'INVALID!'); await page.clearInput(selectors.clientFiscalData.address); - await page.write(selectors.clientFiscalData.address, 'Somewhere edited'); + await page.write(selectors.clientFiscalData.address, 'SOMEWHERE EDITED'); await page.autocompleteSearch(selectors.clientFiscalData.country, 'España'); await page.autocompleteSearch(selectors.clientFiscalData.province, 'Province one'); await page.clearInput(selectors.clientFiscalData.city); @@ -190,7 +190,7 @@ describe('Client Edit fiscalData path', () => { const verifiedData = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox); expect(fiscalId).toEqual('94980061C'); - expect(address).toEqual('Somewhere edited'); + expect(address).toEqual('SOMEWHERE EDITED'); expect(postcode).toContain('46000'); expect(sageTax).toEqual('Operaciones no sujetas'); expect(sageTransaction).toEqual('Regularización de inversiones'); diff --git a/e2e/paths/02-client/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js index 139af0cea..7abe15460 100644 --- a/e2e/paths/02-client/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client/12_lock_of_verified_data.spec.js @@ -39,7 +39,7 @@ describe('Client lock verified data path', () => { await page.reloadSection('client.card.fiscalData'); const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); - expect(result).toEqual('Captain America Civil War'); + expect(result).toEqual('CAPTAIN AMERICA CIVIL WAR'); }); }); @@ -88,7 +88,7 @@ describe('Client lock verified data path', () => { await page.reloadSection('client.card.fiscalData'); const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); - expect(result).toEqual('Ant man and the Wasp'); + expect(result).toEqual('ANT MAN AND THE WASP'); }); }); @@ -142,7 +142,7 @@ describe('Client lock verified data path', () => { await page.reloadSection('client.card.fiscalData'); const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); - expect(result).toEqual('new social name edition'); + expect(result).toEqual('NEW SOCIAL NAME EDITION'); }); }); diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index d232d6dab..4d001e226 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -33,6 +33,7 @@ ng-model="$ctrl.client.socialName" info="Only letters, numbers and spaces can be used" required="true" + ng-keyup="$ctrl.mayus($event)" rule> diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index acad38185..1599c917b 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -177,6 +177,12 @@ export default class Controller extends Section { this.client.provinceFk = response.provinceFk; this.client.countryFk = response.countryFk; } + + mayus(event) { + let input = event.target; + let inputValue = input.value; + input.value = inputValue.toUpperCase(); + } } ngModule.vnComponent('vnClientFiscalData', { From 4b8b7a9d822592b3ec88f40f996ab48c1c031135 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 27 Jun 2023 15:30:54 +0200 Subject: [PATCH 073/311] refs #5475 fix accessScope --- back/methods/vn-user/specs/sign-in.spec.js | 2 -- back/methods/vn-user/specs/validate-auth.spec.js | 2 +- front/salix/components/change-password/index.html | 2 +- front/salix/components/change-password/index.js | 4 ++++ .../back/methods/account/specs/change-password.spec.js | 2 +- modules/account/back/models/account.json | 7 +++++++ 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/back/methods/vn-user/specs/sign-in.spec.js b/back/methods/vn-user/specs/sign-in.spec.js index a6e89d528..c3ff2d7db 100644 --- a/back/methods/vn-user/specs/sign-in.spec.js +++ b/back/methods/vn-user/specs/sign-in.spec.js @@ -71,8 +71,6 @@ fdescribe('VnUser Sign-in()', () => { expect(error).toBeDefined(); expect(error.statusCode).toBe(403); expect(error.message).toBe('REQUIRES_2FA'); - - await employee.updateAttribute('twoFactor', null); }); }); diff --git a/back/methods/vn-user/specs/validate-auth.spec.js b/back/methods/vn-user/specs/validate-auth.spec.js index a58837e7b..8018bd3e1 100644 --- a/back/methods/vn-user/specs/validate-auth.spec.js +++ b/back/methods/vn-user/specs/validate-auth.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('VnUser validate-auth()', () => { +describe('VnUser validate-auth()', () => { describe('validateAuth', () => { it('should signin if data is correct', async() => { await models.AuthCode.create({ diff --git a/front/salix/components/change-password/index.html b/front/salix/components/change-password/index.html index c22c261f5..04f66976e 100644 --- a/front/salix/components/change-password/index.html +++ b/front/salix/components/change-password/index.html @@ -22,7 +22,7 @@ autocomplete="false"> { +describe('account changePassword()', () => { const ctx = {req: {accessToken: {userId: 70}}}; const unauthCtx = { req: { diff --git a/modules/account/back/models/account.json b/modules/account/back/models/account.json index 8fe3e88f9..3c22521cb 100644 --- a/modules/account/back/models/account.json +++ b/modules/account/back/models/account.json @@ -37,6 +37,13 @@ "principalType": "ROLE", "principalId": "$authenticated", "permission": "ALLOW" + }, + { + "property": "changePassword", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" } ] } From 89c25c07b6d4a9e880cc7a43ea97481226ab4aa2 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 28 Jun 2023 09:59:55 +0200 Subject: [PATCH 074/311] refs #5475 fix e2e and back test --- back/methods/vn-user/specs/sign-in.spec.js | 14 ++++++++------ e2e/helpers/puppeteer.js | 2 +- e2e/paths/01-salix/05_changePassword.spec.js | 12 +++++++++++- .../02_alias_create_and_basic_data.spec.js | 2 +- front/salix/components/change-password/index.js | 4 ---- .../account/back/methods/account/set-password.js | 4 ++-- .../methods/account/specs/set-password.spec.js | 14 ++++++++++++-- 7 files changed, 35 insertions(+), 17 deletions(-) diff --git a/back/methods/vn-user/specs/sign-in.spec.js b/back/methods/vn-user/specs/sign-in.spec.js index c3ff2d7db..710320d09 100644 --- a/back/methods/vn-user/specs/sign-in.spec.js +++ b/back/methods/vn-user/specs/sign-in.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('VnUser Sign-in()', () => { +describe('VnUser Sign-in()', () => { const employeeId = 1; const unauthCtx = { req: { @@ -76,24 +76,26 @@ fdescribe('VnUser Sign-in()', () => { describe('when passExpired', () => { it('should throw a passExpired error', async() => { - let error; + const tx = await VnUser.beginTransaction({}); const employee = await VnUser.findById(employeeId); const yesterday = Date.vnNew(); yesterday.setDate(yesterday.getDate() - 1); + let error; try { - await employee.updateAttribute('passExpired', yesterday); + const options = {transaction: tx}; + await employee.updateAttribute('passExpired', yesterday, options); - await VnUser.signin(unauthCtx, 'employee', 'nightmare'); + await VnUser.signin(unauthCtx, 'employee', 'nightmare', options); + await tx.rollback(); } catch (e) { + await tx.rollback(); error = e; } expect(error).toBeDefined(); expect(error.statusCode).toBe(400); expect(error.message).toBe('Pass expired'); - - await employee.updateAttribute('passExpired', null); }); }); }); diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index ac4f6cc02..bd20346a3 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -28,7 +28,7 @@ export async function getBrowser() { args, defaultViewport: null, headless: headless, - slowMo: 1, // slow down by ms + slowMo: 20, // slow down by ms // ignoreDefaultArgs: ['--disable-extensions'], // executablePath: '/usr/bin/google-chrome-stable', // executablePath: '/usr/bin/firefox-developer-edition', diff --git a/e2e/paths/01-salix/05_changePassword.spec.js b/e2e/paths/01-salix/05_changePassword.spec.js index 6e4cfb7f3..950f773dd 100644 --- a/e2e/paths/01-salix/05_changePassword.spec.js +++ b/e2e/paths/01-salix/05_changePassword.spec.js @@ -16,6 +16,7 @@ describe('ChangePassword path', async() => { await browser.close(); }); + const badPassword = 'badpass'; const oldPassword = 'nightmare'; const newPassword = 'newPass.1234'; describe('Bad login', async() => { @@ -37,13 +38,22 @@ describe('ChangePassword path', async() => { expect(message.text).toContain('Invalid current password'); // Bad attempt: password not meet requirements + message = await page.sendForm($.form, { + oldPassword: oldPassword, + newPassword: badPassword, + repeatPassword: badPassword + }); + + expect(message.text).toContain('Password does not meet requirements'); + + // Bad attempt: same password message = await page.sendForm($.form, { oldPassword: oldPassword, newPassword: oldPassword, repeatPassword: oldPassword }); - expect(message.text).toContain('Password does not meet requirements'); + expect(message.text).toContain('You can not use the same password'); // Correct attempt: change password message = await page.sendForm($.form, { diff --git a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js index dd35dd740..78a17d353 100644 --- a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -describe('Account Alias create and basic data path', () => { +fdescribe('Account Alias create and basic data path', () => { let browser; let page; diff --git a/front/salix/components/change-password/index.js b/front/salix/components/change-password/index.js index c8b0a2efb..80784e5d0 100644 --- a/front/salix/components/change-password/index.js +++ b/front/salix/components/change-password/index.js @@ -15,10 +15,6 @@ export default class Controller { } $onInit() { - this.oldPassword = 'nightmare'; - this.repeatPassword = 'test.1234'; - this.newPassword = 'test.1234'; - this.verificationCode = '1234'; if (!this.$state.params.id) this.$state.go('login'); diff --git a/modules/account/back/methods/account/set-password.js b/modules/account/back/methods/account/set-password.js index 010197e0d..f6c820af9 100644 --- a/modules/account/back/methods/account/set-password.js +++ b/modules/account/back/methods/account/set-password.js @@ -21,7 +21,7 @@ module.exports = Self => { } }); - Self.setPassword = async function(id, newPassword) { - await Self.app.models.VnUser.setPassword(id, newPassword); + Self.setPassword = async function(id, newPassword, options) { + await Self.app.models.VnUser.setPassword(id, newPassword, options); }; }; diff --git a/modules/account/back/methods/account/specs/set-password.spec.js b/modules/account/back/methods/account/specs/set-password.spec.js index 5de2a7bad..48cfa595a 100644 --- a/modules/account/back/methods/account/specs/set-password.spec.js +++ b/modules/account/back/methods/account/specs/set-password.spec.js @@ -8,8 +8,18 @@ describe('Account setPassword()', () => { }); it('should update password when it passes requirements', async() => { - let req = models.Account.setPassword(1, 'Very$ecurePa22.'); + const tx = await models.Account.beginTransaction({}); - await expectAsync(req).toBeResolved(); + let error; + try { + const options = {transaction: tx}; + await models.Account.setPassword(1, 'Very$ecurePa22.', options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error).not.toBeDefined(); }); }); From 783d4c60c4d7e81e5cf99369944947fac7624502 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 28 Jun 2023 13:02:47 +0200 Subject: [PATCH 075/311] refs #4734 delete module handlebars from package.json --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 857a7c172..4358c86a7 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "ftps": "^1.2.0", "gm": "^1.25.0", "got": "^10.7.0", - "handlebars": "^4.7.7", "helmet": "^3.21.2", "i18n": "^0.8.4", "image-type": "^4.1.0", From b062cec747e9a65d0c23e0674d4c4e6130381251 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 29 Jun 2023 15:01:24 +0200 Subject: [PATCH 076/311] refs #5475 fix setPassword options/cb --- e2e/helpers/puppeteer.js | 2 +- .../14-account/02_alias_create_and_basic_data.spec.js | 2 +- loopback/locale/en.json | 7 ++++--- modules/account/back/methods/account/set-password.js | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index bd20346a3..ac4f6cc02 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -28,7 +28,7 @@ export async function getBrowser() { args, defaultViewport: null, headless: headless, - slowMo: 20, // slow down by ms + slowMo: 1, // slow down by ms // ignoreDefaultArgs: ['--disable-extensions'], // executablePath: '/usr/bin/google-chrome-stable', // executablePath: '/usr/bin/firefox-developer-edition', diff --git a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js index 78a17d353..dd35dd740 100644 --- a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Account Alias create and basic data path', () => { +describe('Account Alias create and basic data path', () => { let browser; let page; diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 40df9a712..09069bc5e 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -175,6 +175,7 @@ "Pass expired": "The password has expired, change it from Salix", "Can't transfer claimed sales": "Can't transfer claimed sales", "Invalid quantity": "Invalid quantity", - "Failed to upload delivery note": "Error to upload delivery note {{id}}", - "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address" -} + "Failed to upload delivery note": "Error to upload delivery note {{id}}", + "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", + "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 3": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 3" +} \ No newline at end of file diff --git a/modules/account/back/methods/account/set-password.js b/modules/account/back/methods/account/set-password.js index f6c820af9..c4d627cf0 100644 --- a/modules/account/back/methods/account/set-password.js +++ b/modules/account/back/methods/account/set-password.js @@ -22,6 +22,7 @@ module.exports = Self => { }); Self.setPassword = async function(id, newPassword, options) { + options = typeof options == 'object' ? options : {}; await Self.app.models.VnUser.setPassword(id, newPassword, options); }; }; From 3cedef6f1616dfb9bae0263f5654f142e3ddfb99 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 29 Jun 2023 15:22:53 +0200 Subject: [PATCH 077/311] refs #5244 fix: add id --- modules/worker/back/methods/worker/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/back/methods/worker/search.js b/modules/worker/back/methods/worker/search.js index c02053b0c..14916cbb6 100644 --- a/modules/worker/back/methods/worker/search.js +++ b/modules/worker/back/methods/worker/search.js @@ -41,7 +41,7 @@ module.exports = Self => { } const stmt = new ParameterizedSQL( - `SELECT DISTINCT w.code, u.name, u.nickname + `SELECT DISTINCT w.id, w.code, u.name, u.nickname FROM worker w JOIN account.user u ON u.id = w.id JOIN business b ON b.workerFk = w.id From 0441bc29b72de20837cc7a200542dc86dd5c3bcd Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 29 Jun 2023 15:24:41 +0200 Subject: [PATCH 078/311] refs #5475 correct SQL folder --- db/changes/231801/00-userAcl.sql | 2 +- db/changes/232601/00-user.sql | 2 -- db/changes/{232601 => 232801}/00-authCode.sql | 0 db/changes/{232601 => 232801}/00-department.sql | 0 db/changes/232801/00-user.sql | 5 +++++ 5 files changed, 6 insertions(+), 3 deletions(-) delete mode 100644 db/changes/232601/00-user.sql rename db/changes/{232601 => 232801}/00-authCode.sql (100%) rename db/changes/{232601 => 232801}/00-department.sql (100%) create mode 100644 db/changes/232801/00-user.sql diff --git a/db/changes/231801/00-userAcl.sql b/db/changes/231801/00-userAcl.sql index f84a4d7c3..9eb3ebf28 100644 --- a/db/changes/231801/00-userAcl.sql +++ b/db/changes/231801/00-userAcl.sql @@ -2,7 +2,7 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp VALUES ('VnUser','acl','READ','ALLOW','ROLE','account'), ('VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'), - ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'), ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'); + ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'), ('Account','exists','READ','ALLOW','ROLE','account'); INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) diff --git a/db/changes/232601/00-user.sql b/db/changes/232601/00-user.sql deleted file mode 100644 index 2a2a522c5..000000000 --- a/db/changes/232601/00-user.sql +++ /dev/null @@ -1,2 +0,0 @@ -alter table `account`.`user` - add `twoFactor` ENUM ('email') null comment 'Two-factor auth type'; \ No newline at end of file diff --git a/db/changes/232601/00-authCode.sql b/db/changes/232801/00-authCode.sql similarity index 100% rename from db/changes/232601/00-authCode.sql rename to db/changes/232801/00-authCode.sql diff --git a/db/changes/232601/00-department.sql b/db/changes/232801/00-department.sql similarity index 100% rename from db/changes/232601/00-department.sql rename to db/changes/232801/00-department.sql diff --git a/db/changes/232801/00-user.sql b/db/changes/232801/00-user.sql new file mode 100644 index 000000000..376b3dbb1 --- /dev/null +++ b/db/changes/232801/00-user.sql @@ -0,0 +1,5 @@ +alter table `account`.`user` + add `twoFactor` ENUM ('email') null comment 'Two-factor auth type'; + +DELETE FROM `salix`.`ACL` + WHERE model = 'VnUser' AND property = 'changePassword'; From f3e771747ae2d231d46bf643fa63d90c8f05bf37 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 29 Jun 2023 15:56:07 +0200 Subject: [PATCH 079/311] refs #5244 fix: getItemTypeWorker permite filtrar por id --- .../back/methods/worker/getItemTypeWorker.js | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 modules/worker/back/methods/worker/getItemTypeWorker.js diff --git a/modules/worker/back/methods/worker/getItemTypeWorker.js b/modules/worker/back/methods/worker/getItemTypeWorker.js new file mode 100644 index 000000000..b1f49ae99 --- /dev/null +++ b/modules/worker/back/methods/worker/getItemTypeWorker.js @@ -0,0 +1,65 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; + +module.exports = Self => { + Self.remoteMethod('getItemTypeWorker', { + description: 'Returns the workers that appear in itemType', + accessType: 'READ', + accepts: [{ + arg: 'filter', + type: 'Object', + description: 'Filter defining where and paginated data', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getItemTypeWorker`, + verb: 'GET' + } + }); + + Self.getItemTypeWorker = async(filter, options) => { + const myOptions = {}; + const conn = Self.dataSource.connector; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const query = + `SELECT DISTINCT u.id, w.firstName, w.lastName, u.nickname, u.name + FROM itemType it + JOIN worker w ON w.id = it.workerFk + JOIN account.user u ON u.id = w.id`; + + let stmt = new ParameterizedSQL(query); + + let clientFilter = Object.assign({}, filter); + clientFilter.where = buildFilter(filter.where, (param, value) => { + switch (param) { + case 'role': + return {'r.name': value}; + case 'firstName': + return {or: [ + {'w.firstName': {like: `%${value}%`}}, + {'w.lastName': {like: `%${value}%`}}, + {'u.name': {like: `%${value}%`}}, + {'u.nickname': {like: `%${value}%`}} + ]}; + case 'id': + return {'w.id': value}; + } + }); + + let myFilter = { + where: {'u.active': true} + }; + + myFilter = mergeFilters(myFilter, clientFilter); + stmt.merge(conn.makeSuffix(myFilter)); + return conn.executeStmt(stmt); + }; +}; From 7b4e8570aaf20597864cb2c4048fb965231d6ace Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 30 Jun 2023 12:03:26 +0200 Subject: [PATCH 080/311] refs #5244 refactor: se sustituyen los activeWithRole con where="{role: {inq: ['logistic', 'buyer']}}" por getItemTypeWorker --- .../front/consumption-search-panel/index.html | 5 ++- .../front/latest-buys-search-panel/index.html | 3 +- .../front/fixed-price-search-panel/index.html | 3 +- modules/item/front/index/index.js | 3 +- .../front/request-search-panel/index.html | 17 +++++----- .../front/consumption-search-panel/index.html | 5 ++- .../ticket-request/getItemTypeWorker.js | 33 +++++++++++-------- 7 files changed, 34 insertions(+), 35 deletions(-) diff --git a/modules/client/front/consumption-search-panel/index.html b/modules/client/front/consumption-search-panel/index.html index 4d23eb53a..c113ee601 100644 --- a/modules/client/front/consumption-search-panel/index.html +++ b/modules/client/front/consumption-search-panel/index.html @@ -17,12 +17,11 @@ - {{nickname}} diff --git a/modules/entry/front/latest-buys-search-panel/index.html b/modules/entry/front/latest-buys-search-panel/index.html index 075d6a8f7..c73bf7365 100644 --- a/modules/entry/front/latest-buys-search-panel/index.html +++ b/modules/entry/front/latest-buys-search-panel/index.html @@ -54,11 +54,10 @@ vn-id="salesPerson" disabled="false" ng-model="$ctrl.filter.salesPersonFk" - url="Workers/activeWithRole" + url="TicketRequests/getItemTypeWorker" show-field="nickname" search-function="{firstName: $search}" value-field="id" - where="{role: {inq: ['logistic', 'buyer']}}" label="Buyer" on-change="$ctrl.addFilters()"> diff --git a/modules/item/front/fixed-price-search-panel/index.html b/modules/item/front/fixed-price-search-panel/index.html index ebe210277..347e65571 100644 --- a/modules/item/front/fixed-price-search-panel/index.html +++ b/modules/item/front/fixed-price-search-panel/index.html @@ -54,11 +54,10 @@ vn-id="buyer" disabled="false" ng-model="$ctrl.filter.buyerFk" - url="Workers/activeWithRole" + url="TicketRequests/getItemTypeWorker" show-field="nickname" search-function="{firstName: $search}" value-field="id" - where="{role: {inq: ['logistic', 'buyer']}}" label="Buyer" on-change="$ctrl.addFilters()"> diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index 10bd4bbb7..2bcc2302a 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -44,8 +44,7 @@ class Controller extends Section { { field: 'buyerFk', autocomplete: { - url: 'Workers/activeWithRole', - where: `{role: {inq: ['logistic', 'buyer']}}`, + url: 'TicketRequests/getItemTypeWorker', searchFunction: '{firstName: $search}', showField: 'nickname', valueField: 'id', diff --git a/modules/item/front/request-search-panel/index.html b/modules/item/front/request-search-panel/index.html index a76684776..806ab79b1 100644 --- a/modules/item/front/request-search-panel/index.html +++ b/modules/item/front/request-search-panel/index.html @@ -1,7 +1,7 @@
@@ -22,12 +22,11 @@ - {{nickname}} @@ -57,7 +56,7 @@ {{firstName}} {{lastName}} - +
- - {{nickname}} diff --git a/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js b/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js index 0655c7bba..f160cfaac 100644 --- a/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js +++ b/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js @@ -1,7 +1,9 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; module.exports = Self => { - Self.remoteMethodCtx('getItemTypeWorker', { + Self.remoteMethod('getItemTypeWorker', { description: 'Returns the workers that appear in itemType', accessType: 'READ', accepts: [{ @@ -20,10 +22,9 @@ module.exports = Self => { } }); - Self.getItemTypeWorker = async(ctx, filter, options) => { + Self.getItemTypeWorker = async(filter, options) => { const myOptions = {}; const conn = Self.dataSource.connector; - let tx; if (typeof options == 'object') Object.assign(myOptions, options); @@ -33,25 +34,29 @@ module.exports = Self => { FROM itemType it JOIN worker w ON w.id = it.workerFk JOIN account.user u ON u.id = w.id`; + const stmt = new ParameterizedSQL(query); - let stmt = new ParameterizedSQL(query); - - if (filter.where) { - const value = filter.where.firstName; - const myFilter = { - where: {or: [ + filter.where = buildFilter(filter.where, (param, value) => { + switch (param) { + case 'firstName': + return {or: [ {'w.firstName': {like: `%${value}%`}}, {'w.lastName': {like: `%${value}%`}}, {'u.name': {like: `%${value}%`}}, {'u.nickname': {like: `%${value}%`}} - ]} - }; + ]}; + case 'id': + return {'w.id': value}; + } + }); - stmt.merge(conn.makeSuffix(myFilter)); - } + let myFilter = { + where: {'u.active': true} + }; - if (tx) await tx.commit(); + myFilter = mergeFilters(myFilter, filter); + stmt.merge(conn.makeSuffix(myFilter)); return conn.executeStmt(stmt); }; }; From 467c4e997c720a277da382ce6cebcac7c5f8dfcc Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 30 Jun 2023 14:24:50 +0200 Subject: [PATCH 081/311] refs #5941 feat: when error can send email to support --- back/methods/osticket/sendToSupport.js | 63 ++++++++++++++++++++ back/models/osticket.js | 1 + front/core/components/snackbar/snackbar.html | 36 ++++++++++- front/core/components/snackbar/snackbar.js | 31 +++++++++- front/core/components/snackbar/style.scss | 6 +- front/core/services/app.js | 4 +- front/salix/components/app/app.js | 8 +-- front/salix/module.js | 8 ++- modules/item/back/methods/item/filter.js | 4 +- 9 files changed, 148 insertions(+), 13 deletions(-) create mode 100644 back/methods/osticket/sendToSupport.js diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js new file mode 100644 index 000000000..516313ac6 --- /dev/null +++ b/back/methods/osticket/sendToSupport.js @@ -0,0 +1,63 @@ +const smtp = require('vn-print/core/smtp'); +const config = require('vn-print/core/config'); + +module.exports = Self => { + Self.remoteMethodCtx('sendToSupport', { + description: 'Send mail to support', + accessType: 'WRITE', + accepts: [ + { + arg: 'subject', + type: 'string', + required: true, + description: 'The subject' + }, + { + arg: 'reason', + type: 'string', + description: 'The reason' + }, + { + arg: 'additionalData', + type: 'object', + required: true, + description: 'The additional data' + } + ], + returns: { + type: 'object', + root: true + }, + http: { + path: `/send-to-support`, + verb: 'POST' + } + }); + + Self.sendToSupport = async(ctx, subject, reason, additionalData) => { + const emailUser = + await Self.app.models.EmailUser.findById(ctx.req.accessToken.userId, {fields: ['email']}); + + let html = `Motivo:
${reason}
`; + for (const data in additionalData) { + tryJson(additionalData[data]); + html += `${data}:
${tryJson(additionalData[data])}
`; + } + console.log(subject, reason, additionalData); + console.log(html); + smtp.send({ + to: config.app.reportEmail, + replyTo: emailUser.email, + subject: '[Support-Salix] ' + subject, + html + }); + }; + + function tryJson(value) { + try { + return JSON.parse(value); + } catch (e) { + return value; + } + } +}; diff --git a/back/models/osticket.js b/back/models/osticket.js index 50e429160..2a4b7bbb5 100644 --- a/back/models/osticket.js +++ b/back/models/osticket.js @@ -1,4 +1,5 @@ module.exports = Self => { require('../methods/osticket/osTicketReportEmail')(Self); require('../methods/osticket/closeTicket')(Self); + require('../methods/osticket/sendToSupport')(Self); }; diff --git a/front/core/components/snackbar/snackbar.html b/front/core/components/snackbar/snackbar.html index 8ef5891bc..41ae6ddbd 100644 --- a/front/core/components/snackbar/snackbar.html +++ b/front/core/components/snackbar/snackbar.html @@ -1 +1,35 @@ -
\ No newline at end of file +
+ + +
+
Open CAU
+ + + + + + + + + + + {{'Este cau contiene más información relevante para el equipo de informática' | translate}}: + + +
+
+ + + + +
diff --git a/front/core/components/snackbar/snackbar.js b/front/core/components/snackbar/snackbar.js index e68c22f3f..19ce4ea54 100644 --- a/front/core/components/snackbar/snackbar.js +++ b/front/core/components/snackbar/snackbar.js @@ -27,6 +27,18 @@ export default class Controller extends Component { setTimeout(() => element.classList.add('shown'), 30); shape.element = element; + if (data.additionalData) { + let supportButton = document.createElement('i'); + supportButton.setAttribute('class', 'material-icons'); + supportButton.addEventListener('click', () => this.onButtonClick(this.$.supportDialog.show())); + element.appendChild(supportButton); + + let buttonIcon = 'support_agent'; + buttonIcon = document.createTextNode(buttonIcon); + supportButton.appendChild(buttonIcon); + this.$.supportDialog.additionalData = data.additionalData; + } + if (shape.type) element.classList.add(shape.type); @@ -95,7 +107,7 @@ export default class Controller extends Component { clearTimeout(shape.hideTimeout); shape.hideTimeout = setTimeout( - () => this.hide(shape), shape.timeout || 3000); + () => this.hide(shape), shape.timeout || 5000); this.lastShape = shape; } @@ -142,6 +154,23 @@ export default class Controller extends Component { else this.hide(shape); } + + sendToSupport() { + const supportDialog = this.$.supportDialog; + console.log(this.$.supportDialog.subject); + console.log(this.$.supportDialog.reason); + console.log(this.$.supportDialog.additionalData); + console.log({ + subject: supportDialog.subject, + reason: supportDialog.reason, + additionalData: supportDialog.additionalData + }); + this.$http.post('Ostickets/send-to-support', { + subject: supportDialog.subject, + reason: supportDialog.reason, + additionalData: supportDialog.additionalData + }); + } } ngModule.vnComponent('vnSnackbar', { diff --git a/front/core/components/snackbar/style.scss b/front/core/components/snackbar/style.scss index 23e8223e5..d02886fd1 100644 --- a/front/core/components/snackbar/style.scss +++ b/front/core/components/snackbar/style.scss @@ -20,11 +20,11 @@ vn-snackbar .shape { margin-bottom: 15px; color: white; padding: 12px 25px 12px 12px; - + & > .text { text-align: center; - vn-chip { + vn-chip { position: absolute; left: -16px; top: -16px; @@ -64,4 +64,4 @@ vn-snackbar .shape { top: 0; right: 0 } -} \ No newline at end of file +} diff --git a/front/core/services/app.js b/front/core/services/app.js index fb0a08777..bffdad108 100644 --- a/front/core/services/app.js +++ b/front/core/services/app.js @@ -23,9 +23,9 @@ export default class App { this.logger.showSuccess(message); } - showError(message) { + showError(message, additionalData) { if (this.logger) - this.logger.showError(message); + this.logger.showError(message, additionalData); } pushLoader() { diff --git a/front/salix/components/app/app.js b/front/salix/components/app/app.js index 97384d1e1..ca8fac751 100644 --- a/front/salix/components/app/app.js +++ b/front/salix/components/app/app.js @@ -25,15 +25,15 @@ export default class App extends Component { } showMessage(message) { - this.$.snackbar.show({message: message}); + this.$.snackbar.show({message}); } showSuccess(message) { - this.$.snackbar.showSuccess({message: message}); + this.$.snackbar.showSuccess({message}); } - showError(message) { - this.$.snackbar.showError({message: message}); + showError(message, additionalData) { + this.$.snackbar.showError({message, additionalData}); } } diff --git a/front/salix/module.js b/front/salix/module.js index 01df01a67..422c2741e 100644 --- a/front/salix/module.js +++ b/front/salix/module.js @@ -148,7 +148,13 @@ function $exceptionHandler(vnApp, $window, $state, $injector) { if (messageT) message = $translate.instant(messageT); - vnApp.showError(message); + + const additonalData = { + frontPath: $state.current.name, + httpRequest: cause.replace('Possibly unhandled rejection: ', ''), + backError: JSON.stringify(exception) + }; + vnApp.showError(message, additonalData); }; } ngModule.factory('$exceptionHandler', $exceptionHandler); diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index c0b1cc0d9..9a60f6264 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -2,6 +2,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const buildFilter = require('vn-loopback/util/filter').buildFilter; const mergeFilters = require('vn-loopback/util/filter').mergeFilters; +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('filter', { @@ -88,6 +89,7 @@ module.exports = Self => { const conn = Self.dataSource.connector; const models = Self.app.models; const myOptions = {}; + throw new UserError(`You don't have enough privileges`); if (typeof options == 'object') Object.assign(myOptions, options); @@ -145,7 +147,7 @@ module.exports = Self => { const stmts = []; const stmt = new ParameterizedSQL( - `SELECT + `SELECT i.id, i.image, i.name, From d03df4c5ccd1821c9576ba8f708e4c3b1e4bad18 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 3 Jul 2023 11:38:38 +0200 Subject: [PATCH 082/311] refs #5690 ticketproblems --- modules/ticket/back/methods/ticket/filter.js | 3 ++- modules/ticket/back/methods/ticket/getTicketsFuture.js | 3 ++- modules/ticket/front/future/index.html | 5 +++++ modules/ticket/front/index/index.html | 5 +++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 262b3fd74..ea77b7677 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -339,7 +339,8 @@ module.exports = Self => { {'tp.isFreezed': hasProblem}, {'tp.risk': hasProblem}, {'tp.hasTicketRequest': hasProblem}, - {'tp.itemShortage': range} + {'tp.itemShortage': range}, + {'tp.hasRounding': hasProblem} ]}; if (hasWhere) diff --git a/modules/ticket/back/methods/ticket/getTicketsFuture.js b/modules/ticket/back/methods/ticket/getTicketsFuture.js index 901e546f7..fa24cc379 100644 --- a/modules/ticket/back/methods/ticket/getTicketsFuture.js +++ b/modules/ticket/back/methods/ticket/getTicketsFuture.js @@ -194,7 +194,8 @@ module.exports = Self => { {'tp.hasTicketRequest': hasProblem}, {'tp.itemShortage': range}, {'tp.hasComponentLack': hasProblem}, - {'tp.isTooLittle': hasProblem} + {'tp.isTooLittle': hasProblem}, + {'tp.hasRounding': hasProblem} ] }; diff --git a/modules/ticket/front/future/index.html b/modules/ticket/front/future/index.html index 78b0f9864..742143b27 100644 --- a/modules/ticket/front/future/index.html +++ b/modules/ticket/front/future/index.html @@ -123,6 +123,11 @@ class="bright" icon="icon-components"> + + + + {{::ticket.id}} From 461e1d4d5d18d83beb80256125ace14256c2af94 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 3 Jul 2023 13:33:48 +0200 Subject: [PATCH 083/311] refs #5475 feat: userUses, fix forbiddenError and merge in dev --- CHANGELOG.md | 1 + back/methods/vn-user/renew-token.js | 19 +- back/methods/vn-user/sign-in.js | 23 +- back/methods/vn-user/specs/sign-in.spec.js | 12 +- back/methods/vn-user/validate-auth.js | 7 +- back/models/access-token-config.json | 4 + back/models/vn-user.js | 12 +- back/models/vn-user.json | 2 +- db/changes/232601/00-salix.sql | 5 +- db/changes/232601/01-invoiceOutPdf.sql | 4 +- db/changes/232801/.gitkeep | 0 db/changes/232801/00-fix_editCredit.sql | 13 + db/dump/dumpedFixtures.sql | 100 +- db/dump/fixtures.sql | 72 +- db/dump/structure.sql | 4199 +++++++---------- e2e/helpers/selectors.js | 4 +- .../02-client/07_edit_web_access.spec.js | 10 +- e2e/paths/04-item/03_tax.spec.js | 8 - e2e/paths/10-travel/03_descriptor.spec.js | 4 +- .../03_role_create_and_basic_data.spec.js | 2 +- front/core/services/auth.js | 14 +- front/core/services/interceptor.js | 13 +- front/core/services/token.js | 130 +- .../salix/components/change-password/index.js | 2 - front/salix/components/layout/index.html | 4 +- front/salix/components/layout/index.js | 37 +- front/salix/components/layout/index.spec.js | 45 - front/salix/components/log/index.html | 4 +- front/salix/components/log/index.js | 10 +- front/salix/components/log/style.scss | 21 +- front/salix/components/login/index.js | 2 +- front/salix/routes.js | 3 +- loopback/locale/en.json | 3 +- loopback/locale/es.json | 1 - .../back/methods/account/change-password.js | 8 +- modules/account/back/methods/account/login.js | 2 +- .../account/specs/change-password.spec.js | 2 +- .../back/methods/claim/claimPickupEmail.js | 8 - .../back/methods/client/confirmTransaction.js | 24 - modules/client/back/methods/client/sendSms.js | 27 +- .../back/methods/client/specs/sendSms.spec.js | 5 +- .../back/methods/client/updateFiscalData.js | 13 - .../client/back/methods/defaulter/filter.js | 1 + modules/client/back/models/client.js | 35 +- .../client/back/models/specs/client.spec.js | 16 +- modules/client/front/defaulter/index.html | 15 +- modules/client/front/defaulter/index.js | 13 + .../methods/invoiceOut/specs/refund.spec.js | 1 + .../methods/item/specs/getBalance.spec.js | 2 +- modules/item/back/methods/item/updateTaxes.js | 5 +- .../route/back/methods/route/guessPriority.js | 11 - .../methods/route/specs/updateVolume.spec.js | 12 - .../route/back/methods/route/updateVolume.js | 15 - modules/ticket/back/methods/sale/refund.js | 2 +- .../ticket/back/methods/sale/updatePrice.js | 2 +- .../back/methods/ticket-request/confirm.js | 16 - modules/ticket/back/methods/ticket/addSale.js | 2 +- .../back/methods/ticket/componentUpdate.js | 10 - modules/ticket/back/methods/ticket/merge.js | 15 +- modules/ticket/back/methods/ticket/sendSms.js | 54 +- .../back/methods/ticket/specs/merge.spec.js | 2 - .../back/methods/ticket/specs/sendSms.spec.js | 11 +- .../back/methods/ticket/transferSales.js | 49 - .../back/methods/ticket/updateDiscount.js | 2 +- modules/ticket/back/models/ticket.js | 26 - modules/ticket/front/index/index.html | 2 +- modules/ticket/front/index/locale/es.yml | 4 +- .../back/methods/travel/cloneWithEntries.js | 14 - .../back/methods/travel/deleteThermograph.js | 16 - modules/travel/front/search-panel/index.js | 10 + modules/travel/front/summary/index.html | 2 +- .../updateWorkerTimeControlMail.js | 21 - package-lock.json | 2 +- .../templates/email/auth-code/auth-code.html | 14 +- print/templates/email/auth-code/locale/en.yml | 4 +- print/templates/email/auth-code/locale/es.yml | 4 +- print/templates/email/auth-code/locale/fr.yml | 4 +- print/templates/email/auth-code/locale/pt.yml | 4 +- 78 files changed, 2221 insertions(+), 3076 deletions(-) delete mode 100644 db/changes/232801/.gitkeep create mode 100644 db/changes/232801/00-fix_editCredit.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 36347bd19..cec86f478 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Entradas -> Correo) Al cambiar el tipo de cambio enviará un correo a las personas designadas - (General -> Históricos) Botón para ver el estado del registro en cada punto - (General -> Históricos) Al filtar por registro se muestra todo el histórial desde que fue creado +- (Tickets -> Índice) Permite enviar varios albaranes a Docuware ### Changed - (General -> Históricos) Los registros se muestran agrupados por usuario y entidad diff --git a/back/methods/vn-user/renew-token.js b/back/methods/vn-user/renew-token.js index 41470dfea..9850267d6 100644 --- a/back/methods/vn-user/renew-token.js +++ b/back/methods/vn-user/renew-token.js @@ -17,23 +17,22 @@ module.exports = Self => { Self.renewToken = async function(ctx) { const models = Self.app.models; - const userId = ctx.req.accessToken.userId; - const created = ctx.req.accessToken.created; - const tokenId = ctx.req.accessToken.id; + const token = ctx.req.accessToken; const now = new Date(); - const differenceMilliseconds = now - created; + const differenceMilliseconds = now - token.created; const differenceSeconds = Math.floor(differenceMilliseconds / 1000); - const accessTokenConfig = await models.AccessTokenConfig.findOne({fields: ['renewPeriod']}); + const fields = ['renewPeriod', 'courtesyTime']; + const accessTokenConfig = await models.AccessTokenConfig.findOne({fields}); - if (differenceSeconds <= accessTokenConfig.renewPeriod) - throw new UserError(`The renew period has not been exceeded`); + if (differenceSeconds < accessTokenConfig.renewPeriod - accessTokenConfig.courtesyTime) + throw new UserError(`The renew period has not been exceeded`, 'periodNotExceeded'); - await Self.logout(tokenId); - const user = await Self.findById(userId); + await Self.logout(token.id); + const user = await Self.findById(token.userId); const accessToken = await user.createAccessToken(); - return {token: accessToken.id, created: accessToken.created}; + return {id: accessToken.id, ttl: accessToken.ttl}; }; }; diff --git a/back/methods/vn-user/sign-in.js b/back/methods/vn-user/sign-in.js index eaf17a900..73cc705de 100644 --- a/back/methods/vn-user/sign-in.js +++ b/back/methods/vn-user/sign-in.js @@ -2,7 +2,7 @@ const ForbiddenError = require('vn-loopback/util/forbiddenError'); const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('signin', { + Self.remoteMethodCtx('signIn', { description: 'Login a user with username/email and password', accepts: [ { @@ -21,20 +21,17 @@ module.exports = Self => { root: true }, http: { - path: `/signin`, + path: `/sign-in`, verb: 'POST' } }); - Self.signin = async function(ctx, user, password, options) { - const usesEmail = user.indexOf('@') !== -1; - - const myOptions = {...(options || {})}; - - const where = usesEmail - ? {email: user} - : {name: user}; + Self.signIn = async function(ctx, user, password, options) { + const myOptions = {}; + if (typeof options == 'object') + Object.assign(myOptions, options); + const where = Self.userUses(user); const vnUser = await Self.findOne({ fields: ['id', 'name', 'password', 'active', 'email', 'passExpired', 'twoFactor'], where @@ -50,7 +47,7 @@ module.exports = Self => { await Self.passExpired(vnUser, myOptions); if (vnUser.twoFactor) - throw new ForbiddenError('REQUIRES_2FA'); + throw new ForbiddenError(null, 'REQUIRES_2FA'); } return Self.validateLogin(user, password); @@ -86,8 +83,8 @@ module.exports = Self => { }, myOptions); const headers = ctx.req.headers; - let platform = headers['sec-ch-ua-platform']?.replace(/['"=]+/g, ''); - let browser = headers['sec-ch-ua']?.replace(/['"=]+/g, ''); + const platform = headers['sec-ch-ua-platform']?.replace(/['"=]+/g, ''); + const browser = headers['sec-ch-ua']?.replace(/['"=]+/g, ''); const params = { args: { recipientId: vnUser.id, diff --git a/back/methods/vn-user/specs/sign-in.spec.js b/back/methods/vn-user/specs/sign-in.spec.js index 710320d09..f4cad88b9 100644 --- a/back/methods/vn-user/specs/sign-in.spec.js +++ b/back/methods/vn-user/specs/sign-in.spec.js @@ -15,7 +15,7 @@ describe('VnUser Sign-in()', () => { const {VnUser, AccessToken} = models; describe('when credentials are correct', () => { it('should return the token', async() => { - let login = await VnUser.signin(unauthCtx, 'salesAssistant', 'nightmare'); + let login = await VnUser.signIn(unauthCtx, 'salesAssistant', 'nightmare'); let accessToken = await AccessToken.findById(login.token); let ctx = {req: {accessToken: accessToken}}; @@ -25,7 +25,7 @@ describe('VnUser Sign-in()', () => { }); it('should return the token if the user doesnt exist but the client does', async() => { - let login = await VnUser.signin(unauthCtx, 'PetterParker', 'nightmare'); + let login = await VnUser.signIn(unauthCtx, 'PetterParker', 'nightmare'); let accessToken = await AccessToken.findById(login.token); let ctx = {req: {accessToken: accessToken}}; @@ -40,7 +40,7 @@ describe('VnUser Sign-in()', () => { let error; try { - await VnUser.signin(unauthCtx, 'IDontExist', 'TotallyWrongPassword'); + await VnUser.signIn(unauthCtx, 'IDontExist', 'TotallyWrongPassword'); } catch (e) { error = e; } @@ -61,7 +61,7 @@ describe('VnUser Sign-in()', () => { const options = {transaction: tx}; await employee.updateAttribute('twoFactor', 'email', options); - await VnUser.signin(unauthCtx, 'employee', 'nightmare', options); + await VnUser.signIn(unauthCtx, 'employee', 'nightmare', options); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -70,7 +70,7 @@ describe('VnUser Sign-in()', () => { expect(error).toBeDefined(); expect(error.statusCode).toBe(403); - expect(error.message).toBe('REQUIRES_2FA'); + expect(error.code).toBe('REQUIRES_2FA'); }); }); @@ -86,7 +86,7 @@ describe('VnUser Sign-in()', () => { const options = {transaction: tx}; await employee.updateAttribute('passExpired', yesterday, options); - await VnUser.signin(unauthCtx, 'employee', 'nightmare', options); + await VnUser.signIn(unauthCtx, 'employee', 'nightmare', options); await tx.rollback(); } catch (e) { await tx.rollback(); diff --git a/back/methods/vn-user/validate-auth.js b/back/methods/vn-user/validate-auth.js index 0fb1cf884..beab43417 100644 --- a/back/methods/vn-user/validate-auth.js +++ b/back/methods/vn-user/validate-auth.js @@ -32,10 +32,13 @@ module.exports = Self => { }); Self.validateAuth = async(username, password, code, options) => { - const myOptions = {...(options || {})}; + const myOptions = {}; + if (typeof options == 'object') + Object.assign(myOptions, options); + const token = Self.validateLogin(username, password); await Self.validateCode(username, code, myOptions); - return Self.validateLogin(username, password); + return token; }; Self.validateCode = async(username, code, myOptions) => { diff --git a/back/models/access-token-config.json b/back/models/access-token-config.json index 6d90a0f4d..d5838a158 100644 --- a/back/models/access-token-config.json +++ b/back/models/access-token-config.json @@ -16,6 +16,10 @@ "type": "number", "required": true }, + "courtesyTime": { + "type": "number", + "required": true + }, "renewInterval": { "type": "number", "required": true diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 9f7775315..a7ce12073 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -113,15 +113,15 @@ module.exports = function(Self) { }); Self.validateLogin = async function(user, password) { - const usesEmail = user.indexOf('@') !== -1; + let loginInfo = Object.assign({password}, Self.userUses(user)); + token = await Self.login(loginInfo, 'user'); + return {token: token.id, ttl: token.ttl}; + }; - const userInfo = usesEmail + Self.userUses = function(user) { + return user.indexOf('@') !== -1 ? {email: user} : {username: user}; - - let loginInfo = Object.assign({password}, userInfo); - token = await Self.login(loginInfo, 'user'); - return {token: token.id, created: token.created}; }; const _setPassword = Self.prototype.setPassword; diff --git a/back/models/vn-user.json b/back/models/vn-user.json index 9688e7890..9131c9134 100644 --- a/back/models/vn-user.json +++ b/back/models/vn-user.json @@ -94,7 +94,7 @@ }, "acls": [ { - "property": "signin", + "property": "signIn", "accessType": "EXECUTE", "principalType": "ROLE", "principalId": "$everyone", diff --git a/db/changes/232601/00-salix.sql b/db/changes/232601/00-salix.sql index dc1ed69be..44366abce 100644 --- a/db/changes/232601/00-salix.sql +++ b/db/changes/232601/00-salix.sql @@ -1,10 +1,11 @@ CREATE TABLE `salix`.`accessTokenConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `renewPeriod` int(10) unsigned DEFAULT NULL, + `courtesyTime` int(10) unsigned DEFAULT NULL, `renewInterval` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -INSERT IGNORE INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`) +INSERT IGNORE INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`) VALUES - (1, 21600, 300); + (1, 21600, 5, 300); diff --git a/db/changes/232601/01-invoiceOutPdf.sql b/db/changes/232601/01-invoiceOutPdf.sql index 38e0b8bbb..e013736df 100644 --- a/db/changes/232601/01-invoiceOutPdf.sql +++ b/db/changes/232601/01-invoiceOutPdf.sql @@ -1,9 +1,9 @@ -INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) +INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) VALUES ('InvoiceOut','makePdfAndNotify','WRITE','ALLOW','ROLE','invoicing'), ('InvoiceOutConfig','*','READ','ALLOW','ROLE','invoicing'); -CREATE OR REPLACE TABLE vn.invoiceOutConfig ( +CREATE OR REPLACE TABLE `vn`.`invoiceOutConfig` ( id INT UNSIGNED auto_increment NOT NULL, parallelism int UNSIGNED DEFAULT 1 NOT NULL, PRIMARY KEY (id) diff --git a/db/changes/232801/.gitkeep b/db/changes/232801/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/db/changes/232801/00-fix_editCredit.sql b/db/changes/232801/00-fix_editCredit.sql new file mode 100644 index 000000000..ff0d9e2b3 --- /dev/null +++ b/db/changes/232801/00-fix_editCredit.sql @@ -0,0 +1,13 @@ +UPDATE `salix`.`ACL` + SET principalId='financialBoss' + WHERE + model = 'Client' + AND property = 'editCredit'; + +UPDATE `salix`.`ACL` + SET property='zeroCreditEditor' + WHERE + model = 'Client' + AND property = 'isNotEditableCredit'; + + diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 2513972db..e9bbf9bb3 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -2,7 +2,7 @@ USE `util`; -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: util +-- Host: db1.static.verdnatura.es Database: util -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -22,7 +22,7 @@ USE `util`; LOCK TABLES `config` WRITE; /*!40000 ALTER TABLE `config` DISABLE KEYS */; -INSERT INTO `config` VALUES (1,'231801',0,'production',NULL,'2001-01-01 11:00:00',NULL,0); +INSERT INTO `config` VALUES (1,'232401',0,'production',NULL,'2001-01-01 11:00:00',NULL,0); /*!40000 ALTER TABLE `config` ENABLE KEYS */; UNLOCK TABLES; @@ -32,7 +32,7 @@ UNLOCK TABLES; LOCK TABLES `version` WRITE; /*!40000 ALTER TABLE `version` DISABLE KEYS */; -INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10598','11ac980456205f7851dc94367d04243d33ca3c0b','2023-05-16 08:20:30','10600'); +INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10649','4a8ae703b8ce8219887432ad1d1677a44e0cbdd8','2023-06-22 10:03:04','10654'); /*!40000 ALTER TABLE `version` ENABLE KEYS */; UNLOCK TABLES; @@ -42,7 +42,7 @@ UNLOCK TABLES; LOCK TABLES `versionLog` WRITE; /*!40000 ALTER TABLE `versionLog` DISABLE KEYS */; -INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL),('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL),('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL),('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL),('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL),('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL),('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL),('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL),('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL),('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL),('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL),('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL),('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL),('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL),('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL),('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL),('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL),('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL),('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL),('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL),('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL),('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL),('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL),('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL),('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL),('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL),('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL),('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL),('vn-database','10093','00-autoradioConfig.sql','jenkins@10.0.2.69','2022-05-03 09:16:47',NULL,NULL),('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL),('vn-database','10097','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL),('vn-database','10103','00-awbVolume.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10104','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10105','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL),('vn-database','10113','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10114','00-updateConfig.sql','jenkins@10.0.2.69','2022-04-27 13:37:25',NULL,NULL),('vn-database','10116','00-firstScript.sql','jenkins@10.0.2.69','2022-04-28 11:10:14',NULL,NULL),('vn-database','10118','00-firstScript.sql','jenkins@10.0.2.69','2022-04-29 08:10:15',NULL,NULL),('vn-database','10119','00-AfegirFKPart1.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10119','01-AfegirFkPart2.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10125','00-firstScript.sql','jenkins@10.0.2.68','2022-05-18 18:44:30',NULL,NULL),('vn-database','10127','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 11:04:46',NULL,NULL),('vn-database','10128','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 13:04:31',NULL,NULL),('vn-database','10129','00-firstScript.sql','jenkins@10.0.2.69','2022-05-03 08:21:01',NULL,NULL),('vn-database','10132','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10133','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 14:32:30',NULL,NULL),('vn-database','10134','00-firstScript.sql','jenkins@10.0.2.69','2022-05-06 07:45:25',NULL,NULL),('vn-database','10135','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10136','00-workerTimeControl.sql','jenkins@10.0.2.69','2022-05-09 13:51:12',NULL,NULL),('vn-database','10138','00-firstScript.sql','jenkins@10.0.2.69','2022-05-10 13:58:05',NULL,NULL),('vn-database','10139','00-firstScript.sql','jenkins@10.0.2.68','2022-05-16 14:32:37',NULL,NULL),('vn-database','10139','01-secondScript.sql','jenkins@10.0.2.68','2022-05-17 12:16:13',NULL,NULL),('vn-database','10141','00-firstScript.sql','jenkins@10.0.2.70','2022-05-12 08:27:31',NULL,NULL),('vn-database','10142','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10143','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10144','00-AfegirFKPArt1.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10144','00-firstScript.sql','jenkins@10.0.2.68','2022-05-13 09:44:25',NULL,NULL),('vn-database','10147','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10149','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10150','00-firstScript.sql','jenkins@10.0.2.68','2022-05-17 09:57:16',NULL,NULL),('vn-database','10152','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10153','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10154','00-compressionKk.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10157','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:35',NULL,NULL),('vn-database','10158','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10160','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:30:50',NULL,NULL),('vn-database','10163','00-firstScript.sql','jenkins@10.0.2.68','2022-05-23 08:17:14',NULL,NULL),('vn-database','10164','00-borrarSectorsDesus.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10165','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10166','00-firstScript.sql','jenkins@10.0.2.68','2022-05-24 16:11:21',NULL,NULL),('vn-database','10167','00-renameVnActiveContrat.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10168','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','00-createTableBankEntityConfig.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','02-addNotNullToBankEntityBic.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10171','00-volumeConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 14:11:11',NULL,NULL),('vn-database','10171','01-itemWeight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10171','02-agencymode.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10172','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10174','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10175','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10177','00-crearTablaSpecialLabels.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10178','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10179','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10183','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10184','00-firstScript.sql','jenkins@10.0.2.68','2022-06-03 08:05:34',NULL,NULL),('vn-database','10185','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 09:07:45',NULL,NULL),('vn-database','10186','00-desactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:31:23',NULL,NULL),('vn-database','10186','01-alter_Table_buy.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','02-alter_table_entryConfig.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','04-regularizar_Sticker_Inventario.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10186','09-reactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10187','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 12:37:31',NULL,NULL),('vn-database','10188','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 14:03:36',NULL,NULL),('vn-database','10189','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10191','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10194','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10195','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10200','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10201','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10202','00-Remove_FK_to_ediGenus.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10203','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10204','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10205','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:21',NULL,NULL),('vn-database','10207','00-Alter_table_entry.sql','jenkins@10.0.2.69','2022-06-16 07:22:50',NULL,NULL),('vn-database','10207','01-Update_invoiceAmount.sql','jenkins@10.0.2.69','2022-06-16 07:23:00',NULL,NULL),('vn-database','10208','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10209','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 08:47:40',NULL,NULL),('vn-database','10210','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 17:39:17',1046,'Base de datos no seleccionada'),('vn-database','10211','01-firstScript.sql','jenkins@10.0.2.69','2022-06-17 07:11:27',NULL,NULL),('vn-database','10215','00-renameIsInventory.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10216','00-firstScript.sql','jenkins@10.0.2.69','2022-06-23 11:15:28',NULL,NULL),('vn-database','10216','01-batchIndex.sql','jenkins@10.0.2.70','2022-06-27 18:10:55',NULL,NULL),('vn-database','10219','00-AddCollectionFkOnPackingSite.sql','jenkins@10.0.2.70','2022-06-29 09:23:42',NULL,NULL),('vn-database','10219','01-AddFkToCollectionFk.sql','jenkins@10.0.2.70','2022-06-29 09:23:43',NULL,NULL),('vn-database','10220','00-createPersonalProtectionEquipment.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10222','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:12:40',NULL,NULL),('vn-database','10223','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:52',NULL,NULL),('vn-database','10224','00-cosetes.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-21 12:03:45',NULL,NULL),('vn-database','10229','00-firstScript.sql','jenkins@10.0.2.69','2022-07-01 11:59:34',NULL,NULL),('vn-database','10231','01-tablaEktConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:25:39',NULL,NULL),('vn-database','10233','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10235','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10236','00-firstScript.sql','jenkins@10.0.2.69','2022-07-05 12:11:40',NULL,NULL),('vn-database','10237','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10238','00-worker_mobileExtension.sql','jenkins@10.0.2.69','2022-07-14 09:14:09',NULL,NULL),('vn-database','10239','00-firstScript.sql','jenkins@10.0.2.69','2022-07-07 21:51:58',NULL,NULL),('vn-database','10241','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-29 08:14:01',NULL,NULL),('vn-database','10242','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10243','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10245','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10247','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10248','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-20 17:27:51',NULL,NULL),('vn-database','10250','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:40',NULL,NULL),('vn-database','10253','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:57',NULL,NULL),('vn-database','10254','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10256','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10258','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10259','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-02 08:54:56',NULL,NULL),('vn-database','10261','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-22 08:42:20',NULL,NULL),('vn-database','10262','00-createTablepackagingWithFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','01-alterTablePackagingConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','02-insertsInicials.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','03-createTablepackingWithoutFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10263','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10265','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10267','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10267','01-fixMerge.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10275','00-improvedGeneralLog.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 09:55:56',NULL,NULL),('vn-database','10277','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10278','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 17:51:41',NULL,NULL),('vn-database','10279','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10281','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10282','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10283','00-alterTable.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10284','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-04 16:59:08',NULL,NULL),('vn-database','10285','00-firstScript.sql','jenkins@swarm-worker3.static.verdnatura.es','2022-08-05 09:19:33',NULL,NULL),('vn-database','10287','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10288','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10289','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:36',NULL,NULL),('vn-database','10291','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-10 14:19:34',NULL,NULL),('vn-database','10293','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10297','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-16 12:43:36',NULL,NULL),('vn-database','10298','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-13 21:04:13',NULL,NULL),('vn-database','10299','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','00-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','01-drop.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','02-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','00-CreateTableEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','01-insertDataEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','02-alterTableEntry.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:22',NULL,NULL),('vn-database','10303','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:23',NULL,NULL),('vn-database','10304','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:48',NULL,NULL),('vn-database','10304','01-altertableticket.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:51',NULL,NULL),('vn-database','10305','00-ektAssign.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:24:52',NULL,NULL),('vn-database','10306','00-deliveryInformation.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:25',NULL,NULL),('vn-database','10307','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:26',NULL,NULL),('vn-database','10308','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:26:43',NULL,NULL),('vn-database','10309','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:54',NULL,NULL),('vn-database','10310','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10311','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:55',NULL,NULL),('vn-database','10312','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10313','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:27:21',NULL,NULL),('vn-database','10314','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:19',NULL,NULL),('vn-database','10315','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10317','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10318','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10319','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:41',NULL,NULL),('vn-database','10320','00-operator.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','01-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','02-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10321','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 11:11:12',NULL,NULL),('vn-database','10322','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-09 09:19:05',NULL,NULL),('vn-database','10326','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10328','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10329','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10330','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10332','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','00-collectionHotbed.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','01-saleGroupDetail.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10335','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10336','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10337','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10339','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-19 09:41:19',NULL,NULL),('vn-database','10340','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10341','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10342','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10343','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:35:30',NULL,NULL),('vn-database','10345','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10347','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10347','01-addVirtualField.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10349','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10350','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-30 10:11:56',NULL,NULL),('vn-database','10352','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10353','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10354','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10356','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','01-orderConfigFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','02-orderConfigDrop.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10357','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10359','00-improvedGeneralLog_collate.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10360','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10361','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 11:16:07',NULL,NULL),('vn-database','10362','00-dropUdfs.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-10 11:01:15',NULL,NULL),('vn-database','10363','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10365','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-13 19:30:46',NULL,NULL),('vn-database','10368','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10369','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-14 13:38:06',NULL,NULL),('vn-database','10370','00-deleteForeignKey.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:41',NULL,NULL),('vn-database','10370','01-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:47',NULL,NULL),('vn-database','10370','02-deleteTable.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','03-accion.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','04-inter.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10371','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10372','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10373','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-19 08:31:58',NULL,NULL),('vn-database','10378','00-rename_routeUserPercentage.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10379','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:16',NULL,NULL),('vn-database','10382','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10383','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10384','00-business_workcenterFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10385','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10386','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10387','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-16 14:05:33',NULL,NULL),('vn-database','10388','00-resizeUtilVerionLogCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10388','01-resizeUtilVersionCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10390','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:16',NULL,NULL),('vn-database','10391','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10394','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:24',NULL,NULL),('vn-database','10395','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10396','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 15:36:38',NULL,NULL),('vn-database','10397','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10399','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10400','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10402','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-21 14:11:31',NULL,NULL),('vn-database','10404','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10405','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:22',NULL,NULL),('vn-database','10407','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10408','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10409','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10412','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-30 12:45:44',NULL,NULL),('vn-database','10413','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10416','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10420','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:25',NULL,NULL),('vn-database','10421','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:26',NULL,NULL),('vn-database','10426','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:40',NULL,NULL),('vn-database','10428','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10431','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:22',NULL,NULL),('vn-database','10433','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10434','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10435','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-13 07:30:10',NULL,NULL),('vn-database','10436','00-createFkWorker.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:59',NULL,NULL),('vn-database','10436','01-addStateToWorkerProductivity.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','02-DeprecateVnSaleTrackingState.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','03-DeprecateColumnVnSaleTrackingActionFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','04-DropSchemaVnControl.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','05-RemoveFkWorkerProductivity.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-17 14:51:19',NULL,NULL),('vn-database','10440','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10444','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10445','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10448','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10450','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-27 08:28:04',NULL,NULL),('vn-database','10451','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-06 08:08:32',NULL,NULL),('vn-database','10452','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10453','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 14:04:37',NULL,NULL),('vn-database','10454','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10455','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10456','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:30',NULL,NULL),('vn-database','10457','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:33',NULL,NULL),('vn-database','10458','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10459','00-alterTableUtilConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','01-createFunctionCurdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','02-createFunctionMockTime.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','03-createFunctionMockTimeBase.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','04-createFunctionNow.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10460','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10461','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10463','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-03 12:59:26',NULL,NULL),('vn-database','10468','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10469','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10470','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10471','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10472','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10477','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:31',NULL,NULL),('vn-database','10478','00-dropBasket.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','01-orderConfigured.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:16',NULL,NULL),('vn-database','10478','02-configuredUpdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10478','99-privileges.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10480','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 15:09:26',NULL,NULL),('vn-database','10481','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 16:37:22',NULL,NULL),('vn-database','10482','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-21 10:00:28',NULL,NULL),('vn-database','10485','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10488','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10491','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10492','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10493','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10495','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:19',NULL,NULL),('vn-database','10498','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:38',NULL,NULL),('vn-database','10500','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 07:06:03',NULL,NULL),('vn-database','10501','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 10:52:24',NULL,NULL),('vn-database','10502','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10506','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10507','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:35:23',NULL,NULL),('vn-database','10508','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:43',NULL,NULL),('vn-database','10510','00-dropBusinessFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','01-createTableProfessionalCategory.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','02-exportToNewTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','03-RecreateFK.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10510','04-kkPostgresqlTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10511','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10512','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:52',NULL,NULL),('vn-database','10513','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:56',NULL,NULL),('vn-database','10514','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10516','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10521','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 06:58:13',NULL,NULL),('vn-database','10522','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10523','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10525','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 12:42:50',NULL,NULL),('vn-database','10526','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:57',NULL,NULL),('vn-database','10528','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:00',NULL,NULL),('vn-database','10530','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-23 14:49:30',NULL,NULL),('vn-database','10531','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:47:10',NULL,NULL),('vn-database','10532','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:17:38',NULL,NULL),('vn-database','10533','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:04',NULL,NULL),('vn-database','10537','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-29 15:18:36',NULL,NULL),('vn-database','10538','00-createChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','01-createChronopostService.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','02-createChronopostExpedition.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','03-createChronopostSenderAddress.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','04-addgrantPrivilegies.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','05-updateChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 11:54:57',NULL,NULL),('vn-database','10539','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:07',NULL,NULL),('vn-database','10540','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10545','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-11 08:31:03',NULL,NULL),('vn-database','10546','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10547','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:21:58',NULL,NULL),('vn-database','10549','00-updateUpdateLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:29:22',NULL,NULL),('vn-database','10549','01-updateInsertLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:11',NULL,NULL),('vn-database','10549','02-updateDeleteLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:51',NULL,NULL),('vn-database','10549','03-deleteEmptyLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:31:34',NULL,NULL),('vn-database','10549','04-optimizeLogTables.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:33:58',NULL,NULL),('vn-database','10550','00-editorFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:42:33',NULL,NULL),('vn-database','10550','01-originFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10552','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-13 08:25:10',NULL,NULL),('vn-database','10554','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10557','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-17 07:45:56',NULL,NULL),('vn-database','10559','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-18 10:53:50',NULL,NULL),('vn-database','10560','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-17 09:19:31',NULL,NULL),('vn-database','10562','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10563','00-delivery_ticketFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 09:30:53',NULL,NULL),('vn-database','10566','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:08:41',NULL,NULL),('vn-database','10567','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:18:06',NULL,NULL),('vn-database','10568','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10569','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-24 09:14:35',NULL,NULL),('vn-database','10570','00-createSendingConfig.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','01-createSendingServiceWeekday.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','02-createSendingService.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','03-permisos.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10575','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-26 11:27:32',NULL,NULL),('vn-database','10577','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-27 14:00:12',NULL,NULL),('vn-database','10578','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10579','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-28 11:27:36',NULL,NULL),('vn-database','10580','00-itemTypeDropConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:18:52',NULL,NULL),('vn-database','10580','01-itemTypeAddConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:19:10',NULL,NULL),('vn-database','10581','00-itemTypeAutoIncrement.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 19:06:46',NULL,NULL),('vn-database','10582','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10583','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10584','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10598','00-workerLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','01-supplierLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','02-workerTimeControlLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','03-workerClockLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL),('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL),('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL),('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL),('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL),('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL),('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL),('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL),('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL),('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL),('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL),('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL),('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL),('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL),('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL),('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL),('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL),('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL),('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL),('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL),('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL),('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL),('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL),('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL),('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL),('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL),('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL),('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL),('vn-database','10093','00-autoradioConfig.sql','jenkins@10.0.2.69','2022-05-03 09:16:47',NULL,NULL),('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL),('vn-database','10097','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL),('vn-database','10103','00-awbVolume.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10104','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10105','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL),('vn-database','10113','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10114','00-updateConfig.sql','jenkins@10.0.2.69','2022-04-27 13:37:25',NULL,NULL),('vn-database','10116','00-firstScript.sql','jenkins@10.0.2.69','2022-04-28 11:10:14',NULL,NULL),('vn-database','10118','00-firstScript.sql','jenkins@10.0.2.69','2022-04-29 08:10:15',NULL,NULL),('vn-database','10119','00-AfegirFKPart1.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10119','01-AfegirFkPart2.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10125','00-firstScript.sql','jenkins@10.0.2.68','2022-05-18 18:44:30',NULL,NULL),('vn-database','10127','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 11:04:46',NULL,NULL),('vn-database','10128','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 13:04:31',NULL,NULL),('vn-database','10129','00-firstScript.sql','jenkins@10.0.2.69','2022-05-03 08:21:01',NULL,NULL),('vn-database','10132','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10133','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 14:32:30',NULL,NULL),('vn-database','10134','00-firstScript.sql','jenkins@10.0.2.69','2022-05-06 07:45:25',NULL,NULL),('vn-database','10135','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10136','00-workerTimeControl.sql','jenkins@10.0.2.69','2022-05-09 13:51:12',NULL,NULL),('vn-database','10138','00-firstScript.sql','jenkins@10.0.2.69','2022-05-10 13:58:05',NULL,NULL),('vn-database','10139','00-firstScript.sql','jenkins@10.0.2.68','2022-05-16 14:32:37',NULL,NULL),('vn-database','10139','01-secondScript.sql','jenkins@10.0.2.68','2022-05-17 12:16:13',NULL,NULL),('vn-database','10141','00-firstScript.sql','jenkins@10.0.2.70','2022-05-12 08:27:31',NULL,NULL),('vn-database','10142','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10143','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10144','00-AfegirFKPArt1.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10144','00-firstScript.sql','jenkins@10.0.2.68','2022-05-13 09:44:25',NULL,NULL),('vn-database','10147','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10149','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10150','00-firstScript.sql','jenkins@10.0.2.68','2022-05-17 09:57:16',NULL,NULL),('vn-database','10152','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10153','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10154','00-compressionKk.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10157','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:35',NULL,NULL),('vn-database','10158','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10160','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:30:50',NULL,NULL),('vn-database','10163','00-firstScript.sql','jenkins@10.0.2.68','2022-05-23 08:17:14',NULL,NULL),('vn-database','10164','00-borrarSectorsDesus.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10165','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10166','00-firstScript.sql','jenkins@10.0.2.68','2022-05-24 16:11:21',NULL,NULL),('vn-database','10167','00-renameVnActiveContrat.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10168','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','00-createTableBankEntityConfig.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','02-addNotNullToBankEntityBic.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10171','00-volumeConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 14:11:11',NULL,NULL),('vn-database','10171','01-itemWeight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10171','02-agencymode.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10172','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10174','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10175','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10177','00-crearTablaSpecialLabels.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10178','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10179','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10183','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10184','00-firstScript.sql','jenkins@10.0.2.68','2022-06-03 08:05:34',NULL,NULL),('vn-database','10185','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 09:07:45',NULL,NULL),('vn-database','10186','00-desactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:31:23',NULL,NULL),('vn-database','10186','01-alter_Table_buy.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','02-alter_table_entryConfig.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','04-regularizar_Sticker_Inventario.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10186','09-reactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10187','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 12:37:31',NULL,NULL),('vn-database','10188','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 14:03:36',NULL,NULL),('vn-database','10189','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10191','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10193','00-delete.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:35',NULL,NULL),('vn-database','10193','01-botanicExport.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:43',NULL,NULL),('vn-database','10193','02-item.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-autonomy.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-turn.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','04-country.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10194','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10195','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10200','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10201','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10202','00-Remove_FK_to_ediGenus.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10203','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10204','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10205','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:21',NULL,NULL),('vn-database','10207','00-Alter_table_entry.sql','jenkins@10.0.2.69','2022-06-16 07:22:50',NULL,NULL),('vn-database','10207','01-Update_invoiceAmount.sql','jenkins@10.0.2.69','2022-06-16 07:23:00',NULL,NULL),('vn-database','10208','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10209','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 08:47:40',NULL,NULL),('vn-database','10210','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 17:39:17',1046,'Base de datos no seleccionada'),('vn-database','10211','01-firstScript.sql','jenkins@10.0.2.69','2022-06-17 07:11:27',NULL,NULL),('vn-database','10215','00-renameIsInventory.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10216','00-firstScript.sql','jenkins@10.0.2.69','2022-06-23 11:15:28',NULL,NULL),('vn-database','10216','01-batchIndex.sql','jenkins@10.0.2.70','2022-06-27 18:10:55',NULL,NULL),('vn-database','10219','00-AddCollectionFkOnPackingSite.sql','jenkins@10.0.2.70','2022-06-29 09:23:42',NULL,NULL),('vn-database','10219','01-AddFkToCollectionFk.sql','jenkins@10.0.2.70','2022-06-29 09:23:43',NULL,NULL),('vn-database','10220','00-createPersonalProtectionEquipment.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10222','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:12:40',NULL,NULL),('vn-database','10223','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:52',NULL,NULL),('vn-database','10224','00-cosetes.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-21 12:03:45',NULL,NULL),('vn-database','10229','00-firstScript.sql','jenkins@10.0.2.69','2022-07-01 11:59:34',NULL,NULL),('vn-database','10231','01-tablaEktConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:25:39',NULL,NULL),('vn-database','10233','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10235','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10236','00-firstScript.sql','jenkins@10.0.2.69','2022-07-05 12:11:40',NULL,NULL),('vn-database','10237','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10238','00-worker_mobileExtension.sql','jenkins@10.0.2.69','2022-07-14 09:14:09',NULL,NULL),('vn-database','10239','00-firstScript.sql','jenkins@10.0.2.69','2022-07-07 21:51:58',NULL,NULL),('vn-database','10241','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-29 08:14:01',NULL,NULL),('vn-database','10242','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10243','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10245','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10247','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10248','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-20 17:27:51',NULL,NULL),('vn-database','10250','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:40',NULL,NULL),('vn-database','10253','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:57',NULL,NULL),('vn-database','10254','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10256','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10258','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10259','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-02 08:54:56',NULL,NULL),('vn-database','10261','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-22 08:42:20',NULL,NULL),('vn-database','10262','00-createTablepackagingWithFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','01-alterTablePackagingConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','02-insertsInicials.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','03-createTablepackingWithoutFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10263','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10265','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10267','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10267','01-fixMerge.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10275','00-improvedGeneralLog.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 09:55:56',NULL,NULL),('vn-database','10277','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10278','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 17:51:41',NULL,NULL),('vn-database','10279','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10281','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10282','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10283','00-alterTable.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10284','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-04 16:59:08',NULL,NULL),('vn-database','10285','00-firstScript.sql','jenkins@swarm-worker3.static.verdnatura.es','2022-08-05 09:19:33',NULL,NULL),('vn-database','10287','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10288','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10289','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:36',NULL,NULL),('vn-database','10291','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-10 14:19:34',NULL,NULL),('vn-database','10293','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10297','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-16 12:43:36',NULL,NULL),('vn-database','10298','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-13 21:04:13',NULL,NULL),('vn-database','10299','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','00-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','01-drop.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','02-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','00-CreateTableEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','01-insertDataEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','02-alterTableEntry.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:22',NULL,NULL),('vn-database','10303','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:23',NULL,NULL),('vn-database','10304','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:48',NULL,NULL),('vn-database','10304','01-altertableticket.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:51',NULL,NULL),('vn-database','10305','00-ektAssign.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:24:52',NULL,NULL),('vn-database','10306','00-deliveryInformation.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:25',NULL,NULL),('vn-database','10307','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:26',NULL,NULL),('vn-database','10308','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:26:43',NULL,NULL),('vn-database','10309','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:54',NULL,NULL),('vn-database','10310','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10311','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:55',NULL,NULL),('vn-database','10312','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10313','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:27:21',NULL,NULL),('vn-database','10314','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:19',NULL,NULL),('vn-database','10315','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10317','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10318','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10319','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:41',NULL,NULL),('vn-database','10320','00-operator.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','01-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','02-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10321','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 11:11:12',NULL,NULL),('vn-database','10322','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-09 09:19:05',NULL,NULL),('vn-database','10326','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10328','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10329','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10330','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10332','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','00-collectionHotbed.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','01-saleGroupDetail.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10335','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10336','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10337','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10339','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-19 09:41:19',NULL,NULL),('vn-database','10340','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10341','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10342','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10343','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:35:30',NULL,NULL),('vn-database','10345','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10347','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10347','01-addVirtualField.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10349','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10350','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-30 10:11:56',NULL,NULL),('vn-database','10352','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10353','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10354','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10356','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','01-orderConfigFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','02-orderConfigDrop.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10357','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10359','00-improvedGeneralLog_collate.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10360','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10361','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 11:16:07',NULL,NULL),('vn-database','10362','00-dropUdfs.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-10 11:01:15',NULL,NULL),('vn-database','10363','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10365','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-13 19:30:46',NULL,NULL),('vn-database','10368','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10369','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-14 13:38:06',NULL,NULL),('vn-database','10370','00-deleteForeignKey.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:41',NULL,NULL),('vn-database','10370','01-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:47',NULL,NULL),('vn-database','10370','02-deleteTable.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','03-accion.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','04-inter.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10371','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10372','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10373','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-19 08:31:58',NULL,NULL),('vn-database','10378','00-rename_routeUserPercentage.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10379','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:16',NULL,NULL),('vn-database','10382','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10383','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10384','00-business_workcenterFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10385','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10386','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10387','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-16 14:05:33',NULL,NULL),('vn-database','10388','00-resizeUtilVerionLogCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10388','01-resizeUtilVersionCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10390','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:16',NULL,NULL),('vn-database','10391','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10394','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:24',NULL,NULL),('vn-database','10395','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10396','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 15:36:38',NULL,NULL),('vn-database','10397','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10399','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10400','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10402','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-21 14:11:31',NULL,NULL),('vn-database','10404','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10405','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:22',NULL,NULL),('vn-database','10407','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10408','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10409','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10412','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-30 12:45:44',NULL,NULL),('vn-database','10413','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10416','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10420','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:25',NULL,NULL),('vn-database','10421','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:26',NULL,NULL),('vn-database','10426','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:40',NULL,NULL),('vn-database','10428','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10431','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:22',NULL,NULL),('vn-database','10433','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10434','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10435','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-13 07:30:10',NULL,NULL),('vn-database','10436','00-createFkWorker.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:59',NULL,NULL),('vn-database','10436','01-addStateToWorkerProductivity.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','02-DeprecateVnSaleTrackingState.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','03-DeprecateColumnVnSaleTrackingActionFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','04-DropSchemaVnControl.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','05-RemoveFkWorkerProductivity.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-17 14:51:19',NULL,NULL),('vn-database','10439','00-fixRole.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:26',NULL,NULL),('vn-database','10440','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10444','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10445','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10448','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10450','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-27 08:28:04',NULL,NULL),('vn-database','10451','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-06 08:08:32',NULL,NULL),('vn-database','10452','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10453','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 14:04:37',NULL,NULL),('vn-database','10454','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10455','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10456','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:30',NULL,NULL),('vn-database','10457','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:33',NULL,NULL),('vn-database','10458','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10459','00-alterTableUtilConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','01-createFunctionCurdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','02-createFunctionMockTime.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','03-createFunctionMockTimeBase.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','04-createFunctionNow.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10460','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10461','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10463','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-03 12:59:26',NULL,NULL),('vn-database','10468','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10469','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10470','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10471','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10472','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10477','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:31',NULL,NULL),('vn-database','10478','00-dropBasket.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','01-orderConfigured.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:16',NULL,NULL),('vn-database','10478','02-configuredUpdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10478','99-privileges.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10480','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 15:09:26',NULL,NULL),('vn-database','10481','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 16:37:22',NULL,NULL),('vn-database','10482','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-21 10:00:28',NULL,NULL),('vn-database','10485','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10488','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10491','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10492','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10493','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10495','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:19',NULL,NULL),('vn-database','10498','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:38',NULL,NULL),('vn-database','10500','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 07:06:03',NULL,NULL),('vn-database','10501','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 10:52:24',NULL,NULL),('vn-database','10502','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10504','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10506','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10506','01-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','02-secondScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','03-thirdScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10507','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:35:23',NULL,NULL),('vn-database','10508','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:43',NULL,NULL),('vn-database','10510','00-dropBusinessFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','01-createTableProfessionalCategory.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','02-exportToNewTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','03-RecreateFK.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10510','04-kkPostgresqlTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10511','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10512','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:52',NULL,NULL),('vn-database','10513','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:56',NULL,NULL),('vn-database','10514','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10516','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10521','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 06:58:13',NULL,NULL),('vn-database','10522','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10523','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10525','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 12:42:50',NULL,NULL),('vn-database','10526','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:57',NULL,NULL),('vn-database','10528','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:00',NULL,NULL),('vn-database','10530','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-23 14:49:30',NULL,NULL),('vn-database','10531','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:47:10',NULL,NULL),('vn-database','10532','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:17:38',NULL,NULL),('vn-database','10533','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:04',NULL,NULL),('vn-database','10537','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-29 15:18:36',NULL,NULL),('vn-database','10538','00-createChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','01-createChronopostService.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','02-createChronopostExpedition.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','03-createChronopostSenderAddress.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','04-addgrantPrivilegies.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','05-updateChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 11:54:57',NULL,NULL),('vn-database','10539','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:07',NULL,NULL),('vn-database','10540','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10545','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-11 08:31:03',NULL,NULL),('vn-database','10546','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10547','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:21:58',NULL,NULL),('vn-database','10549','00-updateUpdateLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:29:22',NULL,NULL),('vn-database','10549','01-updateInsertLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:11',NULL,NULL),('vn-database','10549','02-updateDeleteLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:51',NULL,NULL),('vn-database','10549','03-deleteEmptyLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:31:34',NULL,NULL),('vn-database','10549','04-optimizeLogTables.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:33:58',NULL,NULL),('vn-database','10550','00-editorFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:42:33',NULL,NULL),('vn-database','10550','01-originFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10552','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-13 08:25:10',NULL,NULL),('vn-database','10554','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10557','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-17 07:45:56',NULL,NULL),('vn-database','10559','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-18 10:53:50',NULL,NULL),('vn-database','10560','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-17 09:19:31',NULL,NULL),('vn-database','10562','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10563','00-delivery_ticketFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 09:30:53',NULL,NULL),('vn-database','10566','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:08:41',NULL,NULL),('vn-database','10567','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:18:06',NULL,NULL),('vn-database','10568','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10569','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-24 09:14:35',NULL,NULL),('vn-database','10570','00-createSendingConfig.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','01-createSendingServiceWeekday.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','02-createSendingService.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','03-permisos.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10571','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10575','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-26 11:27:32',NULL,NULL),('vn-database','10577','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-27 14:00:12',NULL,NULL),('vn-database','10578','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10579','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-28 11:27:36',NULL,NULL),('vn-database','10580','00-itemTypeDropConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:18:52',NULL,NULL),('vn-database','10580','01-itemTypeAddConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:19:10',NULL,NULL),('vn-database','10581','00-itemTypeAutoIncrement.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 19:06:46',NULL,NULL),('vn-database','10582','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10583','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10584','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10585','00-ticketLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:20:10',NULL,NULL),('vn-database','10585','01-entryLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:21:12',NULL,NULL),('vn-database','10585','02-claimLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:36',NULL,NULL),('vn-database','10585','03-clientLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:54',NULL,NULL),('vn-database','10585','04-invoiceInLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:55',NULL,NULL),('vn-database','10585','05-itemLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:29:46',NULL,NULL),('vn-database','10585','06-routeLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:18',NULL,NULL),('vn-database','10585','07-shelvingLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','08-supplierLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','09-travelLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:41',NULL,NULL),('vn-database','10585','10-workerLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:42',NULL,NULL),('vn-database','10585','11-zoneLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:43',NULL,NULL),('vn-database','10585','12-userLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10585','13-roleLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10587','00-arcRead_addMinimum.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-16 13:13:15',NULL,NULL),('vn-database','10593','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10596','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10597','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10598','00-workerLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','01-supplierLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','02-workerTimeControlLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','03-workerClockLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10599','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10601','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-17 09:26:26',NULL,NULL),('vn-database','10602','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 08:52:15',NULL,NULL),('vn-database','10606','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 09:26:00',NULL,NULL),('vn-database','10608','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 12:36:31',NULL,NULL),('vn-database','10609','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 08:28:07',NULL,NULL),('vn-database','10610','00-updateCompanyId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:07',NULL,NULL),('vn-database','10610','01-updateSupplierId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:39',NULL,NULL),('vn-database','10610','02-invoiceOutCompany.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 09:49:55',NULL,NULL),('vn-database','10611','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-19 14:39:41',NULL,NULL),('vn-database','10613','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10614','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10615','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10617','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:41',NULL,NULL),('vn-database','10618','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 12:55:56',NULL,NULL),('vn-database','10619','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10624','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-30 19:01:10',NULL,NULL),('vn-database','10628','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10630','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-02 13:30:58',NULL,NULL),('vn-database','10631','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-05 08:37:25',NULL,NULL),('vn-database','10632','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10633','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10634','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-06 12:15:55',NULL,NULL),('vn-database','10637','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:19',NULL,NULL),('vn-database','10640','00-companyFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','00-updateCompany.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-07 14:22:13',1205,'Tiempo de espera de bloqueo excedido; intente rearrancar la transacción'),('vn-database','10640','01-companyFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','02-companyFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:47:04',NULL,NULL),('vn-database','10640','04-supplierFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:48:30',NULL,NULL),('vn-database','10640','05-supplierFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:53:17',NULL,NULL),('vn-database','10640','06-supplierFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 15:06:00',NULL,NULL),('vn-database','10643','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-09 15:04:35',NULL,NULL),('vn-database','10649','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-16 10:59:06',NULL,NULL); /*!40000 ALTER TABLE `versionLog` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -54,11 +54,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-05-16 8:24:00 +-- Dump completed on 2023-06-26 8:40:00 USE `account`; -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: account +-- Host: db1.static.verdnatura.es Database: account -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -78,7 +78,7 @@ USE `account`; LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; -INSERT INTO `role` VALUES (1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31',NULL),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35',NULL),(13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 07:04:58','2021-06-30 13:29:30',NULL),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10',NULL),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27',NULL),(20,'manager','Gerencia',1,'2017-06-01 14:57:02','2022-07-29 07:36:15',NULL),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52',NULL),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12',NULL),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36',NULL),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27',NULL),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20',NULL),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34',NULL),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53',NULL),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42',NULL),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08',NULL),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53',NULL),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09',NULL),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41',NULL),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12',NULL),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26',NULL),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59',NULL),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16',NULL),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12',NULL),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23',NULL),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18',NULL),(48,'coolerBoss','Jefe de cámara',1,'2018-02-23 13:12:01','2023-03-13 08:49:43',NULL),(49,'production','Empleado de producción',1,'2018-02-26 15:28:23','2021-02-12 09:42:35',NULL),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12',NULL),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39',NULL),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57',NULL),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57',NULL),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17',NULL),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31',NULL),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02',NULL),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19',NULL),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45',NULL),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10',NULL),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01',NULL),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07',NULL),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05',NULL),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08',NULL),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26',NULL),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56',NULL),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23',NULL),(69,'coolerAssist','Asistente de cámara con permiso compras',1,'2020-02-05 12:36:09','2023-03-13 08:50:07',NULL),(70,'trainee','Alumno de prácticas',1,'2020-03-04 11:00:25','2020-03-04 11:00:25',NULL),(71,'checker','Rol de revisor con privilegios de itemPicker',1,'2020-10-02 10:50:07','2020-10-02 10:50:07',NULL),(72,'claimManager','Personal de reclamaciones',1,'2020-10-13 10:01:32','2020-10-26 07:29:46',NULL),(73,'financial','Departamento de finanzas',1,'2020-11-16 09:30:27','2020-11-16 09:30:27',NULL),(74,'userPhotos','Privilegios para subir fotos de usuario',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(75,'catalogPhotos','Privilegios para subir fotos del catálogo',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(76,'chat','Rol para utilizar el rocket chat',1,'2020-11-27 13:06:50','2020-12-17 07:49:41',NULL),(100,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2020-11-12 06:50:07',NULL),(101,'buyerBoss','Jefe del departamento de compras',1,'2021-06-16 09:53:17','2021-06-16 09:53:17',NULL),(102,'preservedBoss','Responsable preservado',1,'2021-09-14 13:45:37','2021-09-14 13:45:37',NULL),(103,'it','Departamento de informática',1,'2021-11-11 09:48:22','2021-11-11 09:48:22',NULL),(104,'itBoss','Jefe de departamento de informática',1,'2021-11-11 09:48:49','2021-11-11 09:48:49',NULL),(105,'grant','Adjudicar roles a usuarios',1,'2021-11-11 12:41:09','2021-11-11 12:41:09',NULL),(106,'ext','Usuarios externos de la Base de datos',1,'2021-11-23 14:51:16','2021-11-23 14:51:16',NULL),(107,'productionPlus','Creado para pepe por orden de Juanvi',1,'2022-02-08 06:47:10','2022-02-08 06:47:10',NULL),(108,'system','System user',1,'2022-05-16 08:09:51','2022-05-16 08:09:51',NULL),(109,'salesTeamBoss','Jefe de equipo de comerciales',1,'2022-06-14 13:45:56','2022-06-14 13:45:56',NULL),(110,'palletizer','Paletizadores',1,'2022-12-02 12:56:22','2022-12-02 12:56:30',NULL),(111,'entryEditor','Entry editor',1,'2023-01-13 11:21:55','2023-01-13 11:21:55',NULL),(112,'maintenance','Personal de mantenimiento',1,'2023-01-19 06:23:35','2023-01-19 06:23:35',NULL),(114,'maintenanceBos','Jefe de mantenimiento',1,'2023-01-19 06:31:16','2023-05-12 08:47:34',19294),(115,'itManagement','TI management',1,'2023-03-29 07:27:55','2023-03-29 07:28:04',NULL); +INSERT INTO `role` VALUES (1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2023-06-08 16:47:57',NULL),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2023-06-02 20:33:28',NULL),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35',NULL),(13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 07:04:58','2021-06-30 13:29:30',NULL),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10',NULL),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27',NULL),(20,'manager','Gerencia',1,'2017-06-01 14:57:02','2022-07-29 07:36:15',NULL),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52',NULL),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12',NULL),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36',NULL),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27',NULL),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20',NULL),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34',NULL),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53',NULL),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42',NULL),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08',NULL),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53',NULL),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09',NULL),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41',NULL),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12',NULL),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26',NULL),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59',NULL),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16',NULL),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12',NULL),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23',NULL),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18',NULL),(48,'coolerBoss','Jefe de cámara',1,'2018-02-23 13:12:01','2023-03-13 08:49:43',NULL),(49,'production','Empleado de producción',1,'2018-02-26 15:28:23','2021-02-12 09:42:35',NULL),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12',NULL),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39',NULL),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57',NULL),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57',NULL),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17',NULL),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31',NULL),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02',NULL),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19',NULL),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45',NULL),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10',NULL),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01',NULL),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07',NULL),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05',NULL),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08',NULL),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26',NULL),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56',NULL),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23',NULL),(69,'coolerAssist','Asistente de cámara con permiso compras',1,'2020-02-05 12:36:09','2023-03-13 08:50:07',NULL),(70,'trainee','Alumno de prácticas',1,'2020-03-04 11:00:25','2020-03-04 11:00:25',NULL),(71,'checker','Rol de revisor con privilegios de itemPicker',1,'2020-10-02 10:50:07','2020-10-02 10:50:07',NULL),(72,'claimManager','Personal de reclamaciones',1,'2020-10-13 10:01:32','2020-10-26 07:29:46',NULL),(73,'financial','Departamento de finanzas',1,'2020-11-16 09:30:27','2020-11-16 09:30:27',NULL),(74,'userPhotos','Privilegios para subir fotos de usuario',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(75,'catalogPhotos','Privilegios para subir fotos del catálogo',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(76,'chat','Rol para utilizar el rocket chat',1,'2020-11-27 13:06:50','2020-12-17 07:49:41',NULL),(100,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2020-11-12 06:50:07',NULL),(101,'buyerBoss','Jefe del departamento de compras',1,'2021-06-16 09:53:17','2021-06-16 09:53:17',NULL),(102,'preservedBoss','Responsable preservado',1,'2021-09-14 13:45:37','2021-09-14 13:45:37',NULL),(103,'it','Departamento de informática',1,'2021-11-11 09:48:22','2021-11-11 09:48:22',NULL),(104,'itBoss','Jefe de departamento de informática',1,'2021-11-11 09:48:49','2021-11-11 09:48:49',NULL),(105,'grant','Adjudicar roles a usuarios',1,'2021-11-11 12:41:09','2021-11-11 12:41:09',NULL),(106,'ext','Usuarios externos de la Base de datos',1,'2021-11-23 14:51:16','2021-11-23 14:51:16',NULL),(107,'productionPlus','Creado para pepe por orden de Juanvi',1,'2022-02-08 06:47:10','2022-02-08 06:47:10',NULL),(108,'system','System user',1,'2022-05-16 08:09:51','2022-05-16 08:09:51',NULL),(109,'salesTeamBoss','Jefe de equipo de comerciales',1,'2022-06-14 13:45:56','2022-06-14 13:45:56',NULL),(110,'palletizer','Paletizadores',1,'2022-12-02 12:56:22','2022-12-02 12:56:30',NULL),(111,'entryEditor','Entry editor',1,'2023-01-13 11:21:55','2023-01-13 11:21:55',NULL),(112,'maintenance','Personal de mantenimiento',1,'2023-01-19 06:23:35','2023-01-19 06:23:35',NULL),(114,'maintenanceBos','Jefe de mantenimiento',1,'2023-01-19 06:31:16','2023-05-17 11:07:21',NULL),(115,'itManagement','TI management',1,'2023-03-29 07:27:55','2023-03-29 07:28:04',NULL),(119,'palletizerBoss','Jefe de paletizadores',1,'2023-06-07 11:51:54','2023-06-07 11:51:54',NULL),(120,'developerBoss','Jefe de proyecto de desarrollo',1,'2023-06-19 07:07:21','2023-06-19 07:07:21',21709),(121,'buyerSalesAssistant','Rol para compradores que también son responsables de ventas',1,'2023-06-23 14:48:19','2023-06-23 14:48:19',NULL); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -88,7 +88,7 @@ UNLOCK TABLES; LOCK TABLES `roleInherit` WRITE; /*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */; -INSERT INTO `roleInherit` VALUES (1,1,2,NULL),(2,1,3,NULL),(3,1,70,NULL),(4,2,11,NULL),(5,3,11,NULL),(6,5,1,NULL),(8,5,33,NULL),(10,11,6,NULL),(11,13,1,NULL),(12,15,35,NULL),(15,16,15,NULL),(16,17,20,NULL),(17,17,37,NULL),(18,17,39,NULL),(19,17,64,NULL),(20,18,1,NULL),(21,19,21,NULL),(22,20,13,NULL),(23,20,16,NULL),(24,20,65,NULL),(25,21,13,NULL),(26,21,18,NULL),(27,21,53,NULL),(28,22,13,NULL),(29,22,21,NULL),(30,30,5,NULL),(31,30,20,NULL),(32,30,22,NULL),(33,30,53,NULL),(34,30,64,NULL),(35,31,1,NULL),(36,32,1,NULL),(37,34,1,NULL),(38,34,13,NULL),(39,34,33,NULL),(40,35,1,NULL),(41,36,44,NULL),(42,36,47,NULL),(43,37,1,NULL),(44,38,37,NULL),(45,38,64,NULL),(46,39,5,NULL),(47,39,21,NULL),(48,39,57,NULL),(49,40,1,NULL),(50,40,49,NULL),(51,41,13,NULL),(52,41,35,NULL),(53,41,40,NULL),(54,42,35,NULL),(55,42,49,NULL),(56,43,13,NULL),(57,43,42,NULL),(58,44,1,NULL),(59,45,13,NULL),(60,45,44,NULL),(61,47,1,NULL),(62,48,13,NULL),(63,48,47,NULL),(64,49,36,NULL),(65,49,58,NULL),(66,50,13,NULL),(67,50,21,NULL),(68,50,35,NULL),(69,50,49,NULL),(70,50,57,NULL),(72,51,1,NULL),(73,52,13,NULL),(74,52,19,NULL),(76,52,51,NULL),(77,53,1,NULL),(78,54,1,NULL),(79,55,13,NULL),(80,55,54,NULL),(81,56,1,NULL),(82,57,13,NULL),(83,57,56,NULL),(84,58,1,NULL),(85,59,13,NULL),(87,60,5,NULL),(91,61,13,NULL),(92,61,36,NULL),(94,65,35,NULL),(97,67,5,NULL),(98,67,37,NULL),(99,69,35,NULL),(101,70,11,NULL),(102,71,1,NULL),(103,71,58,NULL),(105,72,18,NULL),(106,73,5,NULL),(107,73,64,NULL),(108,73,19,NULL),(109,59,50,NULL),(115,39,76,NULL),(117,65,76,NULL),(118,30,76,NULL),(124,5,76,NULL),(125,37,76,NULL),(126,38,76,NULL),(128,42,76,NULL),(129,35,76,NULL),(130,60,76,NULL),(131,21,76,NULL),(132,18,76,NULL),(133,50,76,NULL),(134,20,76,NULL),(135,41,76,NULL),(136,17,76,NULL),(137,52,76,NULL),(138,57,76,NULL),(139,37,74,NULL),(140,51,74,NULL),(141,51,75,NULL),(142,35,75,NULL),(143,15,49,NULL),(145,17,67,NULL),(146,38,13,NULL),(147,101,35,NULL),(148,101,13,NULL),(150,15,56,NULL),(152,69,47,NULL),(153,48,35,NULL),(154,102,1,NULL),(167,9,103,NULL),(168,66,9,NULL),(169,104,100,NULL),(172,103,76,NULL),(173,103,1,NULL),(174,103,44,NULL),(175,103,45,NULL),(176,103,11,NULL),(177,103,39,NULL),(178,103,17,NULL),(179,103,5,NULL),(180,103,67,NULL),(181,103,3,NULL),(182,103,34,NULL),(183,103,42,NULL),(184,103,43,NULL),(185,103,64,NULL),(186,103,35,NULL),(187,103,101,NULL),(188,103,75,NULL),(189,103,71,NULL),(190,103,72,NULL),(191,103,47,NULL),(192,103,69,NULL),(193,103,48,NULL),(194,103,2,NULL),(195,103,56,NULL),(196,103,57,NULL),(197,103,32,NULL),(198,103,73,NULL),(199,103,30,NULL),(200,103,31,NULL),(201,103,6,NULL),(202,103,40,NULL),(203,103,41,NULL),(204,103,37,NULL),(205,103,38,NULL),(206,103,53,NULL),(207,103,33,NULL),(210,103,54,NULL),(211,103,55,NULL),(212,103,15,NULL),(213,103,16,NULL),(215,103,51,NULL),(216,103,52,NULL),(218,103,65,NULL),(219,103,58,NULL),(220,103,59,NULL),(221,103,102,NULL),(222,103,49,NULL),(223,103,60,NULL),(224,103,50,NULL),(225,103,36,NULL),(226,103,61,NULL),(228,103,21,NULL),(229,103,19,NULL),(230,103,18,NULL),(231,103,13,NULL),(232,103,22,NULL),(233,103,70,NULL),(234,103,74,NULL),(237,66,103,NULL),(238,103,20,NULL),(239,106,11,NULL),(240,107,60,NULL),(241,21,72,NULL),(242,20,9,NULL),(245,57,33,NULL),(246,102,35,NULL),(247,108,1,NULL),(248,102,13,NULL),(249,109,18,NULL),(250,109,13,NULL),(251,51,21,NULL),(253,48,49,NULL),(254,110,1,NULL),(255,110,76,NULL),(256,48,69,NULL),(257,47,111,NULL),(258,43,111,NULL),(259,72,111,NULL),(260,35,111,NULL),(261,5,111,NULL),(262,112,1,NULL),(263,114,112,NULL),(264,51,35,NULL),(265,72,49,NULL),(266,101,18,NULL),(268,65,57,NULL),(269,65,59,NULL),(270,65,49,NULL),(271,65,18,NULL),(272,65,13,NULL),(273,60,35,NULL),(275,50,59,NULL),(276,60,49,NULL),(280,5,53,NULL),(281,5,18,NULL),(282,50,60,NULL),(283,5,21,NULL),(284,60,57,NULL),(285,58,76,NULL),(287,69,58,NULL),(288,115,66,NULL),(289,115,9,NULL),(290,104,115,NULL),(291,115,103,NULL),(297,21,33,NULL),(298,49,54,NULL),(299,112,49,NULL),(300,114,13,NULL); +INSERT INTO `roleInherit` VALUES (1,1,2,NULL),(2,1,3,NULL),(3,1,70,NULL),(4,2,11,NULL),(5,3,11,NULL),(6,5,1,NULL),(8,5,33,NULL),(10,11,6,NULL),(11,13,1,NULL),(12,15,35,NULL),(15,16,15,NULL),(16,17,20,NULL),(17,17,37,NULL),(18,17,39,NULL),(19,17,64,NULL),(20,18,1,NULL),(21,19,21,NULL),(22,20,13,NULL),(23,20,16,NULL),(24,20,65,NULL),(25,21,13,NULL),(26,21,18,NULL),(27,21,53,NULL),(28,22,13,NULL),(29,22,21,NULL),(30,30,5,NULL),(31,30,20,NULL),(32,30,22,NULL),(33,30,53,NULL),(34,30,64,NULL),(35,31,1,NULL),(36,32,1,NULL),(37,34,1,NULL),(38,34,13,NULL),(39,34,33,NULL),(40,35,1,NULL),(41,36,44,NULL),(42,36,47,NULL),(43,37,1,NULL),(44,38,37,NULL),(45,38,64,NULL),(46,39,5,NULL),(47,39,21,NULL),(48,39,57,NULL),(49,40,1,NULL),(50,40,49,NULL),(51,41,13,NULL),(52,41,35,NULL),(53,41,40,NULL),(54,42,35,NULL),(55,42,49,NULL),(56,43,13,NULL),(57,43,42,NULL),(58,44,1,NULL),(59,45,13,NULL),(60,45,44,NULL),(61,47,1,NULL),(62,48,13,NULL),(63,48,47,NULL),(64,49,36,NULL),(65,49,58,NULL),(66,50,13,NULL),(67,50,21,NULL),(68,50,35,NULL),(69,50,49,NULL),(70,50,57,NULL),(72,51,1,NULL),(73,52,13,NULL),(74,52,19,NULL),(76,52,51,NULL),(77,53,1,NULL),(78,54,1,NULL),(79,55,13,NULL),(80,55,54,NULL),(81,56,1,NULL),(82,57,13,NULL),(83,57,56,NULL),(84,58,1,NULL),(85,59,13,NULL),(87,60,5,NULL),(91,61,13,NULL),(92,61,36,NULL),(94,65,35,NULL),(97,67,5,NULL),(98,67,37,NULL),(99,69,35,NULL),(101,70,11,NULL),(102,71,1,NULL),(103,71,58,NULL),(105,72,18,NULL),(106,73,5,NULL),(107,73,64,NULL),(108,73,19,NULL),(109,59,50,NULL),(115,39,76,NULL),(117,65,76,NULL),(118,30,76,NULL),(124,5,76,NULL),(125,37,76,NULL),(126,38,76,NULL),(128,42,76,NULL),(129,35,76,NULL),(130,60,76,NULL),(131,21,76,NULL),(132,18,76,NULL),(133,50,76,NULL),(134,20,76,NULL),(135,41,76,NULL),(136,17,76,NULL),(137,52,76,NULL),(138,57,76,NULL),(139,37,74,NULL),(140,51,74,NULL),(141,51,75,NULL),(142,35,75,NULL),(143,15,49,NULL),(145,17,67,NULL),(146,38,13,NULL),(147,101,35,NULL),(148,101,13,NULL),(150,15,56,NULL),(152,69,47,NULL),(153,48,35,NULL),(154,102,1,NULL),(167,9,103,NULL),(168,66,9,NULL),(169,104,100,NULL),(172,103,76,NULL),(173,103,1,NULL),(174,103,44,NULL),(175,103,45,NULL),(176,103,11,NULL),(177,103,39,NULL),(178,103,17,NULL),(179,103,5,NULL),(180,103,67,NULL),(181,103,3,NULL),(182,103,34,NULL),(183,103,42,NULL),(184,103,43,NULL),(185,103,64,NULL),(186,103,35,NULL),(187,103,101,NULL),(188,103,75,NULL),(189,103,71,NULL),(190,103,72,NULL),(191,103,47,NULL),(192,103,69,NULL),(193,103,48,NULL),(194,103,2,NULL),(195,103,56,NULL),(196,103,57,NULL),(197,103,32,NULL),(198,103,73,NULL),(199,103,30,NULL),(200,103,31,NULL),(201,103,6,NULL),(202,103,40,NULL),(203,103,41,NULL),(204,103,37,NULL),(205,103,38,NULL),(206,103,53,NULL),(207,103,33,NULL),(210,103,54,NULL),(211,103,55,NULL),(212,103,15,NULL),(213,103,16,NULL),(215,103,51,NULL),(216,103,52,NULL),(218,103,65,NULL),(219,103,58,NULL),(220,103,59,NULL),(221,103,102,NULL),(222,103,49,NULL),(223,103,60,NULL),(224,103,50,NULL),(225,103,36,NULL),(226,103,61,NULL),(228,103,21,NULL),(229,103,19,NULL),(230,103,18,NULL),(231,103,13,NULL),(232,103,22,NULL),(233,103,70,NULL),(234,103,74,NULL),(237,66,103,NULL),(238,103,20,NULL),(239,106,11,NULL),(240,107,60,NULL),(241,21,72,NULL),(242,20,9,NULL),(245,57,33,NULL),(246,102,35,NULL),(247,108,1,NULL),(248,102,13,NULL),(249,109,18,NULL),(250,109,13,NULL),(251,51,21,NULL),(253,48,49,NULL),(254,110,1,NULL),(255,110,76,NULL),(256,48,69,NULL),(257,47,111,NULL),(258,43,111,NULL),(259,72,111,NULL),(260,35,111,NULL),(261,5,111,NULL),(262,112,1,NULL),(263,114,112,NULL),(264,51,35,NULL),(265,72,49,NULL),(266,101,18,NULL),(268,65,57,NULL),(269,65,59,NULL),(270,65,49,NULL),(271,65,18,NULL),(272,65,13,NULL),(273,60,35,NULL),(275,50,59,NULL),(276,60,49,NULL),(280,5,53,NULL),(281,5,18,NULL),(282,50,60,NULL),(283,5,21,NULL),(284,60,57,NULL),(285,58,76,NULL),(287,69,58,NULL),(288,115,66,NULL),(290,104,115,NULL),(291,115,103,NULL),(297,21,33,NULL),(298,49,54,NULL),(299,112,49,NULL),(300,114,13,NULL),(302,5,35,NULL),(303,69,49,NULL),(306,119,110,NULL),(307,1,76,NULL),(309,120,9,NULL),(310,120,66,NULL),(311,120,13,25508),(312,115,120,NULL),(314,43,18,NULL),(315,121,35,NULL),(316,121,21,NULL); /*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */; UNLOCK TABLES; @@ -98,7 +98,7 @@ UNLOCK TABLES; LOCK TABLES `roleRole` WRITE; /*!40000 ALTER TABLE `roleRole` DISABLE KEYS */; -INSERT INTO `roleRole` VALUES (234609,1,1),(234610,1,2),(234611,1,3),(234614,1,6),(234613,1,11),(234612,1,70),(234496,2,2),(234498,2,6),(234497,2,11),(234357,3,3),(234359,3,6),(234358,3,11),(234313,5,1),(234324,5,2),(234323,5,3),(234312,5,5),(234330,5,6),(234326,5,11),(234321,5,13),(234314,5,18),(234315,5,21),(234316,5,33),(234329,5,36),(234332,5,44),(234331,5,47),(234325,5,49),(234317,5,53),(234328,5,54),(234327,5,58),(234322,5,70),(234320,5,72),(234318,5,76),(234319,5,111),(234720,6,6),(234549,9,1),(234550,9,2),(234551,9,3),(234552,9,5),(234553,9,6),(234547,9,9),(234554,9,11),(234555,9,13),(234556,9,15),(234557,9,16),(234558,9,17),(234559,9,18),(234560,9,19),(234561,9,20),(234562,9,21),(234563,9,22),(234564,9,30),(234565,9,31),(234566,9,32),(234567,9,33),(234568,9,34),(234569,9,35),(234570,9,36),(234571,9,37),(234572,9,38),(234573,9,39),(234574,9,40),(234575,9,41),(234576,9,42),(234577,9,43),(234578,9,44),(234579,9,45),(234580,9,47),(234581,9,48),(234582,9,49),(234583,9,50),(234584,9,51),(234585,9,52),(234586,9,53),(234587,9,54),(234588,9,55),(234589,9,56),(234590,9,57),(234591,9,58),(234592,9,59),(234593,9,60),(234594,9,61),(234595,9,64),(234596,9,65),(234597,9,67),(234598,9,69),(234599,9,70),(234600,9,71),(234601,9,72),(234602,9,73),(234603,9,74),(234604,9,75),(234605,9,76),(234606,9,101),(234607,9,102),(234548,9,103),(234608,9,111),(234225,11,6),(234224,11,11),(235592,13,1),(235593,13,2),(235594,13,3),(235597,13,6),(235596,13,11),(235591,13,13),(235595,13,70),(235008,15,1),(235017,15,2),(235016,15,3),(235019,15,6),(235018,15,11),(235002,15,15),(235003,15,35),(235010,15,36),(235014,15,44),(235013,15,47),(235004,15,49),(235011,15,54),(235005,15,56),(235012,15,58),(235015,15,70),(235007,15,75),(235006,15,76),(235009,15,111),(235027,16,1),(235036,16,2),(235035,16,3),(235038,16,6),(235037,16,11),(235021,16,15),(235020,16,16),(235022,16,35),(235029,16,36),(235033,16,44),(235032,16,47),(235023,16,49),(235030,16,54),(235024,16,56),(235031,16,58),(235034,16,70),(235026,16,75),(235025,16,76),(235028,16,111),(234258,17,1),(234268,17,2),(234267,17,3),(234263,17,5),(234293,17,6),(234262,17,9),(234292,17,11),(234261,17,13),(234273,17,15),(234260,17,16),(234250,17,17),(234272,17,18),(234291,17,19),(234251,17,20),(234264,17,21),(234290,17,22),(234289,17,30),(234288,17,31),(234287,17,32),(234275,17,33),(234286,17,34),(234271,17,35),(234285,17,36),(234252,17,37),(234284,17,38),(234253,17,39),(234283,17,40),(234282,17,41),(234281,17,42),(234280,17,43),(234294,17,44),(234295,17,45),(234296,17,47),(234297,17,48),(234270,17,49),(234298,17,50),(234299,17,51),(234300,17,52),(234276,17,53),(234301,17,54),(234302,17,55),(234279,17,56),(234265,17,57),(234303,17,58),(234269,17,59),(234304,17,60),(234305,17,61),(234254,17,64),(234259,17,65),(234255,17,67),(234306,17,69),(234266,17,70),(234307,17,71),(234278,17,72),(234308,17,73),(234257,17,74),(234309,17,75),(234256,17,76),(234310,17,101),(234311,17,102),(234274,17,103),(234277,17,111),(235504,18,1),(235507,18,2),(235506,18,3),(235510,18,6),(235509,18,11),(235503,18,18),(235508,18,70),(235505,18,76),(235492,19,1),(235498,19,2),(235497,19,3),(235502,19,6),(235501,19,11),(235484,19,13),(235485,19,18),(235482,19,19),(235483,19,21),(235486,19,33),(235495,19,36),(235500,19,44),(235499,19,47),(235491,19,49),(235487,19,53),(235494,19,54),(235493,19,58),(235496,19,70),(235488,19,72),(235489,19,76),(235490,19,111),(235080,20,1),(235092,20,2),(235091,20,3),(235090,20,5),(235089,20,6),(235072,20,9),(235088,20,11),(235073,20,13),(235079,20,15),(235074,20,16),(235087,20,17),(235078,20,18),(235086,20,19),(235071,20,20),(235085,20,21),(235093,20,22),(235094,20,30),(235095,20,31),(235096,20,32),(235097,20,33),(235098,20,34),(235077,20,35),(235099,20,36),(235100,20,37),(235101,20,38),(235102,20,39),(235103,20,40),(235104,20,41),(235105,20,42),(235106,20,43),(235107,20,44),(235108,20,45),(235109,20,47),(235110,20,48),(235082,20,49),(235111,20,50),(235112,20,51),(235113,20,52),(235114,20,53),(235115,20,54),(235116,20,55),(235117,20,56),(235083,20,57),(235118,20,58),(235084,20,59),(235119,20,60),(235120,20,61),(235121,20,64),(235075,20,65),(235122,20,67),(235123,20,69),(235124,20,70),(235125,20,71),(235126,20,72),(235127,20,73),(235128,20,74),(235129,20,75),(235076,20,76),(235130,20,101),(235131,20,102),(235081,20,103),(235132,20,111),(235471,21,1),(235477,21,2),(235476,21,3),(235481,21,6),(235480,21,11),(235463,21,13),(235464,21,18),(235462,21,21),(235465,21,33),(235474,21,36),(235479,21,44),(235478,21,47),(235470,21,49),(235466,21,53),(235473,21,54),(235472,21,58),(235475,21,70),(235467,21,72),(235468,21,76),(235469,21,111),(235602,22,1),(235611,22,2),(235610,22,3),(235618,22,6),(235615,22,11),(235599,22,13),(235601,22,18),(235600,22,21),(235598,22,22),(235603,22,33),(235614,22,36),(235617,22,44),(235616,22,47),(235608,22,49),(235604,22,53),(235613,22,54),(235612,22,58),(235609,22,70),(235605,22,72),(235606,22,76),(235607,22,111),(234662,30,1),(234674,30,2),(234673,30,3),(234651,30,5),(234684,30,6),(234657,30,9),(234685,30,11),(234663,30,13),(234669,30,15),(234664,30,16),(234683,30,17),(234661,30,18),(234682,30,19),(234652,30,20),(234660,30,21),(234653,30,22),(234650,30,30),(234681,30,31),(234680,30,32),(234659,30,33),(234679,30,34),(234668,30,35),(234678,30,36),(234677,30,37),(234676,30,38),(234686,30,39),(234687,30,40),(234688,30,41),(234689,30,42),(234690,30,43),(234691,30,44),(234692,30,45),(234693,30,47),(234694,30,48),(234667,30,49),(234695,30,50),(234696,30,51),(234697,30,52),(234654,30,53),(234698,30,54),(234699,30,55),(234700,30,56),(234666,30,57),(234701,30,58),(234675,30,59),(234702,30,60),(234703,30,61),(234655,30,64),(234665,30,65),(234704,30,67),(234705,30,69),(234672,30,70),(234706,30,71),(234671,30,72),(234707,30,73),(234708,30,74),(234709,30,75),(234656,30,76),(234710,30,101),(234711,30,102),(234670,30,103),(234658,30,111),(234713,31,1),(234714,31,2),(234715,31,3),(234718,31,6),(234717,31,11),(234712,31,31),(234716,31,70),(234617,32,1),(234618,32,2),(234619,32,3),(234622,32,6),(234621,32,11),(234616,32,32),(234620,32,70),(234783,33,33),(234361,34,1),(234366,34,2),(234365,34,3),(234368,34,6),(234367,34,11),(234362,34,13),(234363,34,33),(234360,34,34),(234364,34,70),(234407,35,1),(234413,35,2),(234412,35,3),(234415,35,6),(234414,35,11),(234406,35,35),(234411,35,70),(234408,35,75),(234409,35,76),(234410,35,111),(235368,36,1),(235370,36,2),(235369,36,3),(235373,36,6),(235372,36,11),(235364,36,36),(235365,36,44),(235366,36,47),(235371,36,70),(235367,36,111),(234756,37,1),(234761,37,2),(234760,37,3),(234763,37,6),(234762,37,11),(234755,37,37),(234759,37,70),(234757,37,74),(234758,37,76),(234770,38,1),(234773,38,2),(234772,38,3),(234775,38,6),(234774,38,11),(234765,38,13),(234766,38,37),(234764,38,38),(234767,38,64),(234771,38,70),(234769,38,74),(234768,38,76),(234234,39,1),(234242,39,2),(234241,39,3),(234227,39,5),(234249,39,6),(234246,39,11),(234236,39,13),(234233,39,18),(234228,39,21),(234232,39,33),(234245,39,36),(234226,39,39),(234248,39,44),(234247,39,47),(234239,39,49),(234231,39,53),(234244,39,54),(234238,39,56),(234229,39,57),(234243,39,58),(234240,39,70),(234237,39,72),(234230,39,76),(234235,39,111),(234722,40,1),(234725,40,2),(234724,40,3),(234735,40,6),(234733,40,11),(234727,40,36),(234721,40,40),(234732,40,44),(234731,40,47),(234723,40,49),(234728,40,54),(234729,40,58),(234726,40,70),(234730,40,76),(234734,40,111),(234744,41,1),(234748,41,2),(234747,41,3),(234754,41,6),(234753,41,11),(234737,41,13),(234738,41,35),(234745,41,36),(234739,41,40),(234736,41,41),(234752,41,44),(234751,41,47),(234741,41,49),(234749,41,54),(234750,41,58),(234746,41,70),(234743,41,75),(234740,41,76),(234742,41,111),(234375,42,1),(234383,42,2),(234382,42,3),(234385,42,6),(234384,42,11),(234370,42,35),(234376,42,36),(234369,42,42),(234380,42,44),(234379,42,47),(234371,42,49),(234377,42,54),(234378,42,58),(234381,42,70),(234374,42,75),(234372,42,76),(234373,42,111),(234392,43,1),(234397,43,2),(234396,43,3),(234404,43,6),(234403,43,11),(234387,43,13),(234391,43,35),(234398,43,36),(234388,43,42),(234386,43,43),(234402,43,44),(234401,43,47),(234390,43,49),(234399,43,54),(234400,43,58),(234395,43,70),(234394,43,75),(234393,43,76),(234389,43,111),(234209,44,1),(234210,44,2),(234211,44,3),(234214,44,6),(234213,44,11),(234208,44,44),(234212,44,70),(234218,45,1),(234220,45,2),(234219,45,3),(234223,45,6),(234222,45,11),(234216,45,13),(234217,45,44),(234215,45,45),(234221,45,70),(234457,47,1),(234460,47,2),(234459,47,3),(234463,47,6),(234462,47,11),(234456,47,47),(234461,47,70),(234458,47,111),(234487,48,1),(234493,48,2),(234492,48,3),(234495,48,6),(234494,48,11),(234478,48,13),(234479,48,35),(234483,48,36),(234490,48,44),(234480,48,47),(234477,48,48),(234481,48,49),(234488,48,54),(234489,48,58),(234482,48,69),(234491,48,70),(234486,48,75),(234485,48,76),(234484,48,111),(235273,49,1),(235279,49,2),(235278,49,3),(235282,49,6),(235281,49,11),(235270,49,36),(235275,49,44),(235274,49,47),(235269,49,49),(235271,49,54),(235272,49,58),(235277,49,70),(235276,49,76),(235280,49,111),(235325,50,1),(235334,50,2),(235333,50,3),(235329,50,5),(235336,50,6),(235335,50,11),(235310,50,13),(235324,50,18),(235311,50,21),(235323,50,33),(235312,50,35),(235318,50,36),(235331,50,44),(235330,50,47),(235313,50,49),(235309,50,50),(235322,50,53),(235326,50,54),(235328,50,56),(235314,50,57),(235327,50,58),(235315,50,59),(235316,50,60),(235332,50,70),(235321,50,72),(235320,50,75),(235317,50,76),(235319,50,111),(235134,51,1),(235143,51,2),(235142,51,3),(235154,51,6),(235150,51,11),(235140,51,13),(235139,51,18),(235135,51,21),(235144,51,33),(235136,51,35),(235153,51,36),(235156,51,44),(235155,51,47),(235149,51,49),(235133,51,51),(235145,51,53),(235152,51,54),(235151,51,58),(235141,51,70),(235146,51,72),(235137,51,74),(235138,51,75),(235147,51,76),(235148,51,111),(235165,52,1),(235171,52,2),(235170,52,3),(235180,52,6),(235176,52,11),(235158,52,13),(235168,52,18),(235159,52,19),(235164,52,21),(235167,52,33),(235163,52,35),(235179,52,36),(235182,52,44),(235181,52,47),(235175,52,49),(235160,52,51),(235157,52,52),(235172,52,53),(235178,52,54),(235177,52,58),(235169,52,70),(235173,52,72),(235162,52,74),(235166,52,75),(235161,52,76),(235174,52,111),(234777,53,1),(234778,53,2),(234779,53,3),(234782,53,6),(234781,53,11),(234776,53,53),(234780,53,70),(234923,54,1),(234924,54,2),(234925,54,3),(234928,54,6),(234927,54,11),(234922,54,54),(234926,54,70),(234932,55,1),(234934,55,2),(234933,55,3),(234937,55,6),(234936,55,11),(234930,55,13),(234931,55,54),(234929,55,55),(234935,55,70),(234500,56,1),(234501,56,2),(234502,56,3),(234505,56,6),(234504,56,11),(234499,56,56),(234503,56,70),(234511,57,1),(234514,57,2),(234513,57,3),(234516,57,6),(234515,57,11),(234507,57,13),(234508,57,33),(234509,57,56),(234506,57,57),(234512,57,70),(234510,57,76),(235214,58,1),(235217,58,2),(235216,58,3),(235220,58,6),(235219,58,11),(235213,58,58),(235218,58,70),(235215,58,76),(235225,59,1),(235237,59,2),(235236,59,3),(235244,59,5),(235248,59,6),(235247,59,11),(235222,59,13),(235234,59,18),(235224,59,21),(235233,59,33),(235226,59,35),(235240,59,36),(235246,59,44),(235245,59,47),(235227,59,49),(235223,59,50),(235232,59,53),(235241,59,54),(235243,59,56),(235228,59,57),(235242,59,58),(235221,59,59),(235229,59,60),(235235,59,70),(235231,59,72),(235238,59,75),(235230,59,76),(235239,59,111),(235293,60,1),(235306,60,2),(235305,60,3),(235284,60,5),(235308,60,6),(235307,60,11),(235299,60,13),(235292,60,18),(235291,60,21),(235290,60,33),(235285,60,35),(235296,60,36),(235302,60,44),(235301,60,47),(235286,60,49),(235289,60,53),(235297,60,54),(235300,60,56),(235287,60,57),(235298,60,58),(235283,60,60),(235304,60,70),(235303,60,72),(235295,60,75),(235288,60,76),(235294,60,111),(235378,61,1),(235382,61,2),(235381,61,3),(235385,61,6),(235384,61,11),(235375,61,13),(235376,61,36),(235377,61,44),(235379,61,47),(235374,61,61),(235380,61,70),(235383,61,111),(235183,62,62),(234405,64,64),(235198,65,1),(235207,65,2),(235206,65,3),(235208,65,5),(235212,65,6),(235211,65,11),(235185,65,13),(235186,65,18),(235202,65,21),(235192,65,33),(235187,65,35),(235195,65,36),(235204,65,44),(235203,65,47),(235188,65,49),(235200,65,50),(235210,65,53),(235194,65,54),(235199,65,56),(235189,65,57),(235193,65,58),(235190,65,59),(235201,65,60),(235184,65,65),(235205,65,70),(235209,65,72),(235197,65,75),(235191,65,76),(235196,65,111),(235525,66,1),(235524,66,2),(235526,66,3),(235527,66,5),(235528,66,6),(235522,66,9),(235529,66,11),(235530,66,13),(235531,66,15),(235532,66,16),(235533,66,17),(235534,66,18),(235535,66,19),(235536,66,20),(235537,66,21),(235538,66,22),(235539,66,30),(235540,66,31),(235541,66,32),(235542,66,33),(235543,66,34),(235544,66,35),(235545,66,36),(235546,66,37),(235547,66,38),(235548,66,39),(235549,66,40),(235550,66,41),(235551,66,42),(235552,66,43),(235553,66,44),(235554,66,45),(235555,66,47),(235556,66,48),(235557,66,49),(235558,66,50),(235559,66,51),(235560,66,52),(235561,66,53),(235562,66,54),(235563,66,55),(235564,66,56),(235565,66,57),(235566,66,58),(235567,66,59),(235568,66,60),(235569,66,61),(235570,66,64),(235571,66,65),(235521,66,66),(235572,66,67),(235573,66,69),(235574,66,70),(235575,66,71),(235576,66,72),(235577,66,73),(235578,66,74),(235579,66,75),(235580,66,76),(235581,66,101),(235582,66,102),(235523,66,103),(235583,66,111),(234337,67,1),(234348,67,2),(234347,67,3),(234334,67,5),(234354,67,6),(234350,67,11),(234345,67,13),(234336,67,18),(234338,67,21),(234339,67,33),(234353,67,36),(234335,67,37),(234356,67,44),(234355,67,47),(234349,67,49),(234340,67,53),(234352,67,54),(234351,67,58),(234333,67,67),(234346,67,70),(234344,67,72),(234343,67,74),(234341,67,76),(234342,67,111),(234470,69,1),(234474,69,2),(234473,69,3),(234476,69,6),(234475,69,11),(234465,69,35),(234466,69,47),(234467,69,58),(234464,69,69),(234472,69,70),(234469,69,75),(234468,69,76),(234471,69,111),(235621,70,6),(235620,70,11),(235619,70,70),(234432,71,1),(234435,71,2),(234434,71,3),(234439,71,6),(234438,71,11),(234433,71,58),(234436,71,70),(234431,71,71),(234437,71,76),(234446,72,1),(234453,72,2),(234452,72,3),(234455,72,6),(234454,72,11),(234441,72,18),(234444,72,36),(234450,72,44),(234449,72,47),(234442,72,49),(234447,72,54),(234448,72,58),(234451,72,70),(234440,72,72),(234445,72,76),(234443,72,111),(234632,73,1),(234641,73,2),(234640,73,3),(234627,73,5),(234647,73,6),(234643,73,11),(234638,73,13),(234631,73,18),(234628,73,19),(234630,73,21),(234633,73,33),(234646,73,36),(234649,73,44),(234648,73,47),(234642,73,49),(234634,73,53),(234645,73,54),(234644,73,58),(234629,73,64),(234639,73,70),(234637,73,72),(234626,73,73),(234635,73,76),(234636,73,111),(235622,74,74),(234429,75,75),(234430,76,76),(235413,100,1),(235408,100,2),(235394,100,3),(235392,100,5),(235421,100,6),(235412,100,9),(235389,100,11),(235458,100,13),(235433,100,15),(235434,100,16),(235391,100,17),(235454,100,18),(235453,100,19),(235437,100,20),(235452,100,21),(235459,100,22),(235418,100,30),(235419,100,31),(235415,100,32),(235427,100,33),(235395,100,34),(235399,100,35),(235450,100,36),(235424,100,37),(235425,100,38),(235390,100,39),(235422,100,40),(235423,100,41),(235396,100,42),(235397,100,43),(235387,100,44),(235388,100,45),(235405,100,47),(235407,100,48),(235446,100,49),(235448,100,50),(235438,100,51),(235439,100,52),(235426,100,53),(235430,100,54),(235431,100,55),(235409,100,56),(235410,100,57),(235442,100,58),(235443,100,59),(235447,100,60),(235451,100,61),(235440,100,62),(235398,100,64),(235441,100,65),(235456,100,66),(235393,100,67),(235406,100,69),(235460,100,70),(235403,100,71),(235404,100,72),(235417,100,73),(235461,100,74),(235401,100,75),(235402,100,76),(235386,100,100),(235400,100,101),(235445,100,102),(235428,100,103),(235429,100,104),(235420,100,105),(235416,100,106),(235449,100,107),(235457,100,108),(235455,100,109),(235444,100,110),(235414,100,111),(235435,100,112),(235436,100,114),(235432,100,115),(235411,100,116),(234422,101,1),(234426,101,2),(234425,101,3),(234428,101,6),(234427,101,11),(234417,101,13),(234418,101,18),(234419,101,35),(234424,101,70),(234420,101,75),(234421,101,76),(234416,101,101),(234423,101,111),(235258,102,1),(235263,102,2),(235262,102,3),(235268,102,6),(235267,102,11),(235259,102,13),(235260,102,35),(235261,102,70),(235264,102,75),(235265,102,76),(235257,102,102),(235266,102,111),(234785,103,1),(234786,103,2),(234787,103,3),(234788,103,5),(234789,103,6),(234844,103,9),(234790,103,11),(234791,103,13),(234792,103,15),(234793,103,16),(234794,103,17),(234795,103,18),(234796,103,19),(234797,103,20),(234798,103,21),(234799,103,22),(234800,103,30),(234801,103,31),(234802,103,32),(234803,103,33),(234804,103,34),(234805,103,35),(234806,103,36),(234807,103,37),(234808,103,38),(234809,103,39),(234810,103,40),(234811,103,41),(234812,103,42),(234813,103,43),(234814,103,44),(234815,103,45),(234816,103,47),(234817,103,48),(234818,103,49),(234819,103,50),(234820,103,51),(234821,103,52),(234822,103,53),(234823,103,54),(234824,103,55),(234825,103,56),(234826,103,57),(234827,103,58),(234828,103,59),(234829,103,60),(234830,103,61),(234831,103,64),(234832,103,65),(234833,103,67),(234834,103,69),(234835,103,70),(234836,103,71),(234837,103,72),(234838,103,73),(234839,103,74),(234840,103,75),(234841,103,76),(234842,103,101),(234843,103,102),(234784,103,103),(234845,103,111),(234854,104,1),(234853,104,2),(234852,104,3),(234855,104,5),(234856,104,6),(234850,104,9),(234857,104,11),(234858,104,13),(234859,104,15),(234860,104,16),(234861,104,17),(234862,104,18),(234863,104,19),(234864,104,20),(234865,104,21),(234866,104,22),(234867,104,30),(234868,104,31),(234869,104,32),(234870,104,33),(234871,104,34),(234872,104,35),(234873,104,36),(234874,104,37),(234875,104,38),(234876,104,39),(234877,104,40),(234878,104,41),(234879,104,42),(234880,104,43),(234881,104,44),(234882,104,45),(234883,104,47),(234884,104,48),(234885,104,49),(234886,104,50),(234887,104,51),(234888,104,52),(234889,104,53),(234890,104,54),(234891,104,55),(234892,104,56),(234893,104,57),(234894,104,58),(234895,104,59),(234896,104,60),(234897,104,61),(234917,104,62),(234898,104,64),(234899,104,65),(234849,104,66),(234900,104,67),(234901,104,69),(234902,104,70),(234903,104,71),(234904,104,72),(234905,104,73),(234906,104,74),(234907,104,75),(234908,104,76),(234847,104,100),(234909,104,101),(234910,104,102),(234851,104,103),(234846,104,104),(234914,104,105),(234913,104,106),(234919,104,107),(234921,104,108),(234920,104,109),(234918,104,110),(234911,104,111),(234915,104,112),(234916,104,114),(234848,104,115),(234912,104,116),(234719,105,105),(234625,106,6),(234624,106,11),(234623,106,106),(235348,107,1),(235361,107,2),(235360,107,3),(235339,107,5),(235363,107,6),(235362,107,11),(235354,107,13),(235347,107,18),(235346,107,21),(235345,107,33),(235340,107,35),(235351,107,36),(235357,107,44),(235356,107,47),(235341,107,49),(235344,107,53),(235352,107,54),(235355,107,56),(235342,107,57),(235353,107,58),(235338,107,60),(235359,107,70),(235358,107,72),(235350,107,75),(235343,107,76),(235337,107,107),(235349,107,111),(235585,108,1),(235586,108,2),(235587,108,3),(235590,108,6),(235589,108,11),(235588,108,70),(235584,108,108),(235515,109,1),(235517,109,2),(235516,109,3),(235520,109,6),(235519,109,11),(235512,109,13),(235513,109,18),(235518,109,70),(235514,109,76),(235511,109,109),(235250,110,1),(235253,110,2),(235252,110,3),(235256,110,6),(235255,110,11),(235254,110,70),(235251,110,76),(235249,110,110),(234615,111,111),(235040,112,1),(235043,112,2),(235042,112,3),(235053,112,6),(235051,112,11),(235045,112,36),(235050,112,44),(235049,112,47),(235041,112,49),(235046,112,54),(235047,112,58),(235044,112,70),(235048,112,76),(235052,112,111),(235039,112,112),(235058,114,1),(235060,114,2),(235059,114,3),(235070,114,6),(235068,114,11),(235055,114,13),(235062,114,36),(235067,114,44),(235066,114,47),(235057,114,49),(235063,114,54),(235064,114,58),(235061,114,70),(235065,114,76),(235069,114,111),(235056,114,112),(235054,114,114),(234944,115,1),(234943,115,2),(234942,115,3),(234945,115,5),(234946,115,6),(234939,115,9),(234947,115,11),(234948,115,13),(234949,115,15),(234950,115,16),(234951,115,17),(234952,115,18),(234953,115,19),(234954,115,20),(234955,115,21),(234956,115,22),(234957,115,30),(234958,115,31),(234959,115,32),(234960,115,33),(234961,115,34),(234962,115,35),(234963,115,36),(234964,115,37),(234965,115,38),(234966,115,39),(234967,115,40),(234968,115,41),(234969,115,42),(234970,115,43),(234971,115,44),(234972,115,45),(234973,115,47),(234974,115,48),(234975,115,49),(234976,115,50),(234977,115,51),(234978,115,52),(234979,115,53),(234980,115,54),(234981,115,55),(234982,115,56),(234983,115,57),(234984,115,58),(234985,115,59),(234986,115,60),(234987,115,61),(234988,115,64),(234989,115,65),(234940,115,66),(234990,115,67),(234991,115,69),(234992,115,70),(234993,115,71),(234994,115,72),(234995,115,73),(234996,115,74),(234997,115,75),(234998,115,76),(234999,115,101),(235000,115,102),(234941,115,103),(235001,115,111),(234938,115,115),(234533,116,1),(234544,116,2),(234543,116,3),(234521,116,5),(234546,116,6),(234545,116,11),(234537,116,13),(234532,116,18),(234525,116,19),(234531,116,21),(234530,116,33),(234520,116,35),(234534,116,36),(234540,116,44),(234539,116,47),(234522,116,49),(234529,116,53),(234535,116,54),(234538,116,56),(234523,116,57),(234536,116,58),(234518,116,60),(234526,116,64),(234542,116,70),(234541,116,72),(234519,116,73),(234527,116,75),(234524,116,76),(234528,116,111),(234517,116,116); +INSERT INTO `roleRole` VALUES (276665,1,1),(276666,1,2),(276667,1,3),(276671,1,6),(276670,1,11),(276668,1,70),(276669,1,76),(276672,2,2),(276674,2,6),(276673,2,11),(276675,3,3),(276677,3,6),(276676,3,11),(276679,5,1),(276692,5,2),(276691,5,3),(276678,5,5),(276698,5,6),(276694,5,11),(276689,5,13),(276680,5,18),(276681,5,21),(276682,5,33),(276683,5,35),(276697,5,36),(276700,5,44),(276699,5,47),(276693,5,49),(276684,5,53),(276696,5,54),(276695,5,58),(276690,5,70),(276688,5,72),(276687,5,75),(276685,5,76),(276686,5,111),(276701,6,6),(276704,9,1),(276705,9,2),(276706,9,3),(276707,9,5),(276708,9,6),(276702,9,9),(276709,9,11),(276710,9,13),(276711,9,15),(276712,9,16),(276713,9,17),(276714,9,18),(276715,9,19),(276716,9,20),(276717,9,21),(276718,9,22),(276719,9,30),(276720,9,31),(276721,9,32),(276722,9,33),(276723,9,34),(276724,9,35),(276725,9,36),(276726,9,37),(276727,9,38),(276728,9,39),(276729,9,40),(276730,9,41),(276731,9,42),(276732,9,43),(276733,9,44),(276734,9,45),(276735,9,47),(276736,9,48),(276737,9,49),(276738,9,50),(276739,9,51),(276740,9,52),(276741,9,53),(276742,9,54),(276743,9,55),(276744,9,56),(276745,9,57),(276746,9,58),(276747,9,59),(276748,9,60),(276749,9,61),(276750,9,64),(276751,9,65),(276752,9,67),(276753,9,69),(276754,9,70),(276755,9,71),(276756,9,72),(276757,9,73),(276758,9,74),(276759,9,75),(276760,9,76),(276761,9,101),(276762,9,102),(276703,9,103),(276763,9,111),(276765,11,6),(276764,11,11),(276767,13,1),(276768,13,2),(276769,13,3),(276773,13,6),(276772,13,11),(276766,13,13),(276770,13,70),(276771,13,76),(276780,15,1),(276789,15,2),(276788,15,3),(276791,15,6),(276790,15,11),(276774,15,15),(276775,15,35),(276782,15,36),(276786,15,44),(276785,15,47),(276776,15,49),(276783,15,54),(276777,15,56),(276784,15,58),(276787,15,70),(276779,15,75),(276778,15,76),(276781,15,111),(276799,16,1),(276808,16,2),(276807,16,3),(276810,16,6),(276809,16,11),(276793,16,15),(276792,16,16),(276794,16,35),(276801,16,36),(276805,16,44),(276804,16,47),(276795,16,49),(276802,16,54),(276796,16,56),(276803,16,58),(276806,16,70),(276798,16,75),(276797,16,76),(276800,16,111),(276819,17,1),(276829,17,2),(276828,17,3),(276824,17,5),(276854,17,6),(276823,17,9),(276853,17,11),(276822,17,13),(276834,17,15),(276821,17,16),(276811,17,17),(276833,17,18),(276852,17,19),(276812,17,20),(276825,17,21),(276851,17,22),(276850,17,30),(276849,17,31),(276848,17,32),(276836,17,33),(276847,17,34),(276832,17,35),(276846,17,36),(276813,17,37),(276845,17,38),(276814,17,39),(276844,17,40),(276843,17,41),(276842,17,42),(276841,17,43),(276855,17,44),(276856,17,45),(276857,17,47),(276858,17,48),(276831,17,49),(276859,17,50),(276860,17,51),(276861,17,52),(276837,17,53),(276862,17,54),(276863,17,55),(276840,17,56),(276826,17,57),(276864,17,58),(276830,17,59),(276865,17,60),(276866,17,61),(276815,17,64),(276820,17,65),(276816,17,67),(276867,17,69),(276827,17,70),(276868,17,71),(276839,17,72),(276869,17,73),(276818,17,74),(276870,17,75),(276817,17,76),(276871,17,101),(276872,17,102),(276835,17,103),(276838,17,111),(276874,18,1),(276877,18,2),(276876,18,3),(276880,18,6),(276879,18,11),(276873,18,18),(276878,18,70),(276875,18,76),(276891,19,1),(276897,19,2),(276896,19,3),(276901,19,6),(276900,19,11),(276883,19,13),(276884,19,18),(276881,19,19),(276882,19,21),(276885,19,33),(276894,19,36),(276899,19,44),(276898,19,47),(276890,19,49),(276886,19,53),(276893,19,54),(276892,19,58),(276895,19,70),(276887,19,72),(276888,19,76),(276889,19,111),(276911,20,1),(276923,20,2),(276922,20,3),(276921,20,5),(276920,20,6),(276903,20,9),(276919,20,11),(276904,20,13),(276910,20,15),(276905,20,16),(276918,20,17),(276909,20,18),(276917,20,19),(276902,20,20),(276916,20,21),(276924,20,22),(276925,20,30),(276926,20,31),(276927,20,32),(276928,20,33),(276929,20,34),(276908,20,35),(276930,20,36),(276931,20,37),(276932,20,38),(276933,20,39),(276934,20,40),(276935,20,41),(276936,20,42),(276937,20,43),(276938,20,44),(276939,20,45),(276940,20,47),(276941,20,48),(276913,20,49),(276942,20,50),(276943,20,51),(276944,20,52),(276945,20,53),(276946,20,54),(276947,20,55),(276948,20,56),(276914,20,57),(276949,20,58),(276915,20,59),(276950,20,60),(276951,20,61),(276952,20,64),(276906,20,65),(276953,20,67),(276954,20,69),(276955,20,70),(276956,20,71),(276957,20,72),(276958,20,73),(276959,20,74),(276960,20,75),(276907,20,76),(276961,20,101),(276962,20,102),(276912,20,103),(276963,20,111),(276973,21,1),(276979,21,2),(276978,21,3),(276983,21,6),(276982,21,11),(276965,21,13),(276966,21,18),(276964,21,21),(276967,21,33),(276976,21,36),(276981,21,44),(276980,21,47),(276972,21,49),(276968,21,53),(276975,21,54),(276974,21,58),(276977,21,70),(276969,21,72),(276970,21,76),(276971,21,111),(276988,22,1),(276997,22,2),(276996,22,3),(277004,22,6),(277001,22,11),(276985,22,13),(276987,22,18),(276986,22,21),(276984,22,22),(276989,22,33),(277000,22,36),(277003,22,44),(277002,22,47),(276994,22,49),(276990,22,53),(276999,22,54),(276998,22,58),(276995,22,70),(276991,22,72),(276992,22,76),(276993,22,111),(277017,30,1),(277031,30,2),(277030,30,3),(277006,30,5),(277040,30,6),(277018,30,9),(277041,30,11),(277019,30,13),(277025,30,15),(277020,30,16),(277039,30,17),(277016,30,18),(277038,30,19),(277007,30,20),(277015,30,21),(277008,30,22),(277005,30,30),(277037,30,31),(277036,30,32),(277014,30,33),(277035,30,34),(277013,30,35),(277034,30,36),(277033,30,37),(277032,30,38),(277042,30,39),(277043,30,40),(277044,30,41),(277045,30,42),(277046,30,43),(277047,30,44),(277048,30,45),(277049,30,47),(277050,30,48),(277024,30,49),(277051,30,50),(277052,30,51),(277053,30,52),(277009,30,53),(277054,30,54),(277055,30,55),(277056,30,56),(277023,30,57),(277057,30,58),(277022,30,59),(277058,30,60),(277059,30,61),(277010,30,64),(277021,30,65),(277060,30,67),(277061,30,69),(277029,30,70),(277062,30,71),(277028,30,72),(277063,30,73),(277064,30,74),(277027,30,75),(277011,30,76),(277065,30,101),(277066,30,102),(277026,30,103),(277012,30,111),(277068,31,1),(277069,31,2),(277070,31,3),(277074,31,6),(277073,31,11),(277067,31,31),(277071,31,70),(277072,31,76),(277076,32,1),(277077,32,2),(277078,32,3),(277082,32,6),(277081,32,11),(277075,32,32),(277079,32,70),(277080,32,76),(277083,33,33),(277085,34,1),(277090,34,2),(277089,34,3),(277093,34,6),(277092,34,11),(277086,34,13),(277087,34,33),(277084,34,34),(277088,34,70),(277091,34,76),(277095,35,1),(277101,35,2),(277100,35,3),(277103,35,6),(277102,35,11),(277094,35,35),(277099,35,70),(277096,35,75),(277097,35,76),(277098,35,111),(277108,36,1),(277110,36,2),(277109,36,3),(277114,36,6),(277113,36,11),(277104,36,36),(277105,36,44),(277106,36,47),(277111,36,70),(277112,36,76),(277107,36,111),(277116,37,1),(277121,37,2),(277120,37,3),(277123,37,6),(277122,37,11),(277115,37,37),(277119,37,70),(277117,37,74),(277118,37,76),(277130,38,1),(277133,38,2),(277132,38,3),(277135,38,6),(277134,38,11),(277125,38,13),(277126,38,37),(277124,38,38),(277127,38,64),(277131,38,70),(277129,38,74),(277128,38,76),(277144,39,1),(277154,39,2),(277153,39,3),(277137,39,5),(277161,39,6),(277158,39,11),(277147,39,13),(277143,39,18),(277138,39,21),(277142,39,33),(277141,39,35),(277157,39,36),(277136,39,39),(277160,39,44),(277159,39,47),(277150,39,49),(277145,39,53),(277156,39,54),(277149,39,56),(277139,39,57),(277155,39,58),(277152,39,70),(277148,39,72),(277151,39,75),(277140,39,76),(277146,39,111),(277163,40,1),(277166,40,2),(277165,40,3),(277176,40,6),(277174,40,11),(277169,40,36),(277162,40,40),(277173,40,44),(277172,40,47),(277164,40,49),(277170,40,54),(277171,40,58),(277167,40,70),(277168,40,76),(277175,40,111),(277185,41,1),(277189,41,2),(277188,41,3),(277195,41,6),(277194,41,11),(277178,41,13),(277179,41,35),(277186,41,36),(277180,41,40),(277177,41,41),(277193,41,44),(277192,41,47),(277182,41,49),(277190,41,54),(277191,41,58),(277187,41,70),(277184,41,75),(277181,41,76),(277183,41,111),(277202,42,1),(277210,42,2),(277209,42,3),(277212,42,6),(277211,42,11),(277197,42,35),(277203,42,36),(277196,42,42),(277207,42,44),(277206,42,47),(277198,42,49),(277204,42,54),(277205,42,58),(277208,42,70),(277201,42,75),(277199,42,76),(277200,42,111),(277221,43,1),(277225,43,2),(277224,43,3),(277232,43,6),(277231,43,11),(277214,43,13),(277215,43,18),(277219,43,35),(277226,43,36),(277216,43,42),(277213,43,43),(277230,43,44),(277229,43,47),(277218,43,49),(277227,43,54),(277228,43,58),(277223,43,70),(277222,43,75),(277220,43,76),(277217,43,111),(277234,44,1),(277235,44,2),(277236,44,3),(277240,44,6),(277239,44,11),(277233,44,44),(277237,44,70),(277238,44,76),(277244,45,1),(277246,45,2),(277245,45,3),(277250,45,6),(277249,45,11),(277242,45,13),(277243,45,44),(277241,45,45),(277247,45,70),(277248,45,76),(277252,47,1),(277255,47,2),(277254,47,3),(277259,47,6),(277258,47,11),(277251,47,47),(277256,47,70),(277257,47,76),(277253,47,111),(277270,48,1),(277276,48,2),(277275,48,3),(277278,48,6),(277277,48,11),(277261,48,13),(277262,48,35),(277266,48,36),(277273,48,44),(277263,48,47),(277260,48,48),(277264,48,49),(277271,48,54),(277272,48,58),(277265,48,69),(277274,48,70),(277269,48,75),(277268,48,76),(277267,48,111),(277283,49,1),(277289,49,2),(277288,49,3),(277292,49,6),(277291,49,11),(277280,49,36),(277285,49,44),(277284,49,47),(277279,49,49),(277281,49,54),(277282,49,58),(277287,49,70),(277286,49,76),(277290,49,111),(277309,50,1),(277318,50,2),(277317,50,3),(277313,50,5),(277320,50,6),(277319,50,11),(277294,50,13),(277308,50,18),(277295,50,21),(277307,50,33),(277296,50,35),(277302,50,36),(277315,50,44),(277314,50,47),(277297,50,49),(277293,50,50),(277306,50,53),(277310,50,54),(277312,50,56),(277298,50,57),(277311,50,58),(277299,50,59),(277300,50,60),(277316,50,70),(277305,50,72),(277304,50,75),(277301,50,76),(277303,50,111),(277322,51,1),(277331,51,2),(277330,51,3),(277342,51,6),(277338,51,11),(277327,51,13),(277332,51,18),(277323,51,21),(277333,51,33),(277324,51,35),(277341,51,36),(277344,51,44),(277343,51,47),(277337,51,49),(277321,51,51),(277334,51,53),(277340,51,54),(277339,51,58),(277329,51,70),(277335,51,72),(277325,51,74),(277326,51,75),(277328,51,76),(277336,51,111),(277353,52,1),(277359,52,2),(277358,52,3),(277368,52,6),(277364,52,11),(277346,52,13),(277356,52,18),(277347,52,19),(277352,52,21),(277355,52,33),(277351,52,35),(277367,52,36),(277370,52,44),(277369,52,47),(277363,52,49),(277348,52,51),(277345,52,52),(277360,52,53),(277366,52,54),(277365,52,58),(277357,52,70),(277361,52,72),(277350,52,74),(277354,52,75),(277349,52,76),(277362,52,111),(277372,53,1),(277373,53,2),(277374,53,3),(277378,53,6),(277377,53,11),(277371,53,53),(277375,53,70),(277376,53,76),(277380,54,1),(277381,54,2),(277382,54,3),(277386,54,6),(277385,54,11),(277379,54,54),(277383,54,70),(277384,54,76),(277390,55,1),(277392,55,2),(277391,55,3),(277396,55,6),(277395,55,11),(277388,55,13),(277389,55,54),(277387,55,55),(277393,55,70),(277394,55,76),(277398,56,1),(277399,56,2),(277400,56,3),(277404,56,6),(277403,56,11),(277397,56,56),(277401,56,70),(277402,56,76),(277410,57,1),(277413,57,2),(277412,57,3),(277415,57,6),(277414,57,11),(277406,57,13),(277407,57,33),(277408,57,56),(277405,57,57),(277411,57,70),(277409,57,76),(277417,58,1),(277420,58,2),(277419,58,3),(277423,58,6),(277422,58,11),(277416,58,58),(277421,58,70),(277418,58,76),(277428,59,1),(277440,59,2),(277439,59,3),(277447,59,5),(277451,59,6),(277450,59,11),(277425,59,13),(277437,59,18),(277427,59,21),(277436,59,33),(277429,59,35),(277443,59,36),(277449,59,44),(277448,59,47),(277430,59,49),(277426,59,50),(277435,59,53),(277444,59,54),(277446,59,56),(277431,59,57),(277445,59,58),(277424,59,59),(277432,59,60),(277438,59,70),(277434,59,72),(277441,59,75),(277433,59,76),(277442,59,111),(277462,60,1),(277475,60,2),(277474,60,3),(277453,60,5),(277477,60,6),(277476,60,11),(277468,60,13),(277461,60,18),(277460,60,21),(277459,60,33),(277454,60,35),(277465,60,36),(277471,60,44),(277470,60,47),(277455,60,49),(277458,60,53),(277466,60,54),(277469,60,56),(277456,60,57),(277467,60,58),(277452,60,60),(277473,60,70),(277472,60,72),(277464,60,75),(277457,60,76),(277463,60,111),(277482,61,1),(277486,61,2),(277485,61,3),(277490,61,6),(277489,61,11),(277479,61,13),(277480,61,36),(277481,61,44),(277483,61,47),(277478,61,61),(277484,61,70),(277487,61,76),(277488,61,111),(277491,62,62),(277492,64,64),(277507,65,1),(277516,65,2),(277515,65,3),(277517,65,5),(277521,65,6),(277520,65,11),(277494,65,13),(277495,65,18),(277511,65,21),(277501,65,33),(277496,65,35),(277504,65,36),(277513,65,44),(277512,65,47),(277497,65,49),(277509,65,50),(277519,65,53),(277503,65,54),(277508,65,56),(277498,65,57),(277502,65,58),(277499,65,59),(277510,65,60),(277493,65,65),(277514,65,70),(277518,65,72),(277506,65,75),(277500,65,76),(277505,65,111),(277526,66,1),(277525,66,2),(277527,66,3),(277528,66,5),(277529,66,6),(277523,66,9),(277530,66,11),(277531,66,13),(277532,66,15),(277533,66,16),(277534,66,17),(277535,66,18),(277536,66,19),(277537,66,20),(277538,66,21),(277539,66,22),(277540,66,30),(277541,66,31),(277542,66,32),(277543,66,33),(277544,66,34),(277545,66,35),(277546,66,36),(277547,66,37),(277548,66,38),(277549,66,39),(277550,66,40),(277551,66,41),(277552,66,42),(277553,66,43),(277554,66,44),(277555,66,45),(277556,66,47),(277557,66,48),(277558,66,49),(277559,66,50),(277560,66,51),(277561,66,52),(277562,66,53),(277563,66,54),(277564,66,55),(277565,66,56),(277566,66,57),(277567,66,58),(277568,66,59),(277569,66,60),(277570,66,61),(277571,66,64),(277572,66,65),(277522,66,66),(277573,66,67),(277574,66,69),(277575,66,70),(277576,66,71),(277577,66,72),(277578,66,73),(277579,66,74),(277580,66,75),(277581,66,76),(277582,66,101),(277583,66,102),(277524,66,103),(277584,66,111),(277589,67,1),(277602,67,2),(277601,67,3),(277586,67,5),(277608,67,6),(277604,67,11),(277599,67,13),(277588,67,18),(277590,67,21),(277591,67,33),(277592,67,35),(277607,67,36),(277587,67,37),(277610,67,44),(277609,67,47),(277603,67,49),(277593,67,53),(277606,67,54),(277605,67,58),(277585,67,67),(277600,67,70),(277598,67,72),(277596,67,74),(277597,67,75),(277594,67,76),(277595,67,111),(277619,69,1),(277625,69,2),(277624,69,3),(277627,69,6),(277626,69,11),(277612,69,35),(277620,69,36),(277622,69,44),(277613,69,47),(277614,69,49),(277621,69,54),(277615,69,58),(277611,69,69),(277623,69,70),(277618,69,75),(277617,69,76),(277616,69,111),(277630,70,6),(277629,70,11),(277628,70,70),(277632,71,1),(277635,71,2),(277634,71,3),(277639,71,6),(277638,71,11),(277633,71,58),(277636,71,70),(277631,71,71),(277637,71,76),(277646,72,1),(277653,72,2),(277652,72,3),(277655,72,6),(277654,72,11),(277641,72,18),(277644,72,36),(277650,72,44),(277649,72,47),(277642,72,49),(277647,72,54),(277648,72,58),(277651,72,70),(277640,72,72),(277645,72,76),(277643,72,111),(277662,73,1),(277673,73,2),(277672,73,3),(277657,73,5),(277679,73,6),(277675,73,11),(277670,73,13),(277661,73,18),(277658,73,19),(277660,73,21),(277663,73,33),(277664,73,35),(277678,73,36),(277681,73,44),(277680,73,47),(277674,73,49),(277665,73,53),(277677,73,54),(277676,73,58),(277659,73,64),(277671,73,70),(277669,73,72),(277656,73,73),(277668,73,75),(277666,73,76),(277667,73,111),(277682,74,74),(277683,75,75),(277684,76,76),(277686,100,1),(277687,100,2),(277688,100,3),(277689,100,5),(277690,100,6),(277691,100,9),(277692,100,11),(277693,100,13),(277694,100,15),(277695,100,16),(277696,100,17),(277697,100,18),(277698,100,19),(277699,100,20),(277700,100,21),(277701,100,22),(277702,100,30),(277703,100,31),(277704,100,32),(277705,100,33),(277706,100,34),(277707,100,35),(277708,100,36),(277709,100,37),(277710,100,38),(277711,100,39),(277712,100,40),(277713,100,41),(277714,100,42),(277715,100,43),(277716,100,44),(277717,100,45),(277718,100,47),(277719,100,48),(277720,100,49),(277721,100,50),(277722,100,51),(277723,100,52),(277724,100,53),(277725,100,54),(277726,100,55),(277727,100,56),(277728,100,57),(277729,100,58),(277730,100,59),(277731,100,60),(277732,100,61),(277733,100,62),(277734,100,64),(277735,100,65),(277736,100,66),(277737,100,67),(277738,100,69),(277739,100,70),(277740,100,71),(277741,100,72),(277742,100,73),(277743,100,74),(277744,100,75),(277745,100,76),(277685,100,100),(277746,100,101),(277747,100,102),(277748,100,103),(277749,100,104),(277750,100,105),(277751,100,106),(277752,100,107),(277753,100,108),(277754,100,109),(277755,100,110),(277756,100,111),(277757,100,112),(277758,100,114),(277759,100,115),(277760,100,119),(277762,100,120),(277761,100,121),(277769,101,1),(277773,101,2),(277772,101,3),(277775,101,6),(277774,101,11),(277764,101,13),(277765,101,18),(277766,101,35),(277771,101,70),(277767,101,75),(277768,101,76),(277763,101,101),(277770,101,111),(277777,102,1),(277782,102,2),(277781,102,3),(277787,102,6),(277786,102,11),(277778,102,13),(277779,102,35),(277780,102,70),(277784,102,75),(277783,102,76),(277776,102,102),(277785,102,111),(277789,103,1),(277790,103,2),(277791,103,3),(277792,103,5),(277793,103,6),(277848,103,9),(277794,103,11),(277795,103,13),(277796,103,15),(277797,103,16),(277798,103,17),(277799,103,18),(277800,103,19),(277801,103,20),(277802,103,21),(277803,103,22),(277804,103,30),(277805,103,31),(277806,103,32),(277807,103,33),(277808,103,34),(277809,103,35),(277810,103,36),(277811,103,37),(277812,103,38),(277813,103,39),(277814,103,40),(277815,103,41),(277816,103,42),(277817,103,43),(277818,103,44),(277819,103,45),(277820,103,47),(277821,103,48),(277822,103,49),(277823,103,50),(277824,103,51),(277825,103,52),(277826,103,53),(277827,103,54),(277828,103,55),(277829,103,56),(277830,103,57),(277831,103,58),(277832,103,59),(277833,103,60),(277834,103,61),(277835,103,64),(277836,103,65),(277837,103,67),(277838,103,69),(277839,103,70),(277840,103,71),(277841,103,72),(277842,103,73),(277843,103,74),(277844,103,75),(277845,103,76),(277846,103,101),(277847,103,102),(277788,103,103),(277849,103,111),(277857,104,1),(277856,104,2),(277859,104,3),(277860,104,5),(277861,104,6),(277858,104,9),(277862,104,11),(277863,104,13),(277864,104,15),(277865,104,16),(277866,104,17),(277867,104,18),(277868,104,19),(277869,104,20),(277870,104,21),(277871,104,22),(277872,104,30),(277873,104,31),(277874,104,32),(277875,104,33),(277876,104,34),(277877,104,35),(277878,104,36),(277879,104,37),(277880,104,38),(277881,104,39),(277882,104,40),(277883,104,41),(277884,104,42),(277885,104,43),(277886,104,44),(277887,104,45),(277888,104,47),(277889,104,48),(277890,104,49),(277891,104,50),(277892,104,51),(277893,104,52),(277894,104,53),(277895,104,54),(277896,104,55),(277897,104,56),(277898,104,57),(277899,104,58),(277900,104,59),(277901,104,60),(277902,104,61),(277922,104,62),(277903,104,64),(277904,104,65),(277854,104,66),(277905,104,67),(277906,104,69),(277907,104,70),(277908,104,71),(277909,104,72),(277910,104,73),(277911,104,74),(277912,104,75),(277913,104,76),(277851,104,100),(277914,104,101),(277915,104,102),(277853,104,103),(277850,104,104),(277919,104,105),(277918,104,106),(277925,104,107),(277927,104,108),(277926,104,109),(277923,104,110),(277916,104,111),(277920,104,112),(277921,104,114),(277852,104,115),(277924,104,119),(277855,104,120),(277917,104,121),(277928,105,105),(277931,106,6),(277930,106,11),(277929,106,106),(277943,107,1),(277956,107,2),(277955,107,3),(277934,107,5),(277958,107,6),(277957,107,11),(277949,107,13),(277942,107,18),(277941,107,21),(277940,107,33),(277935,107,35),(277946,107,36),(277952,107,44),(277951,107,47),(277936,107,49),(277939,107,53),(277947,107,54),(277950,107,56),(277937,107,57),(277948,107,58),(277933,107,60),(277954,107,70),(277953,107,72),(277945,107,75),(277938,107,76),(277932,107,107),(277944,107,111),(277960,108,1),(277961,108,2),(277962,108,3),(277966,108,6),(277965,108,11),(277963,108,70),(277964,108,76),(277959,108,108),(277971,109,1),(277973,109,2),(277972,109,3),(277976,109,6),(277975,109,11),(277968,109,13),(277969,109,18),(277974,109,70),(277970,109,76),(277967,109,109),(277978,110,1),(277981,110,2),(277980,110,3),(277984,110,6),(277983,110,11),(277982,110,70),(277979,110,76),(277977,110,110),(277985,111,111),(277987,112,1),(277990,112,2),(277989,112,3),(278000,112,6),(277998,112,11),(277993,112,36),(277997,112,44),(277996,112,47),(277988,112,49),(277994,112,54),(277995,112,58),(277991,112,70),(277992,112,76),(277999,112,111),(277986,112,112),(278005,114,1),(278007,114,2),(278006,114,3),(278017,114,6),(278015,114,11),(278002,114,13),(278010,114,36),(278014,114,44),(278013,114,47),(278004,114,49),(278011,114,54),(278012,114,58),(278008,114,70),(278009,114,76),(278016,114,111),(278003,114,112),(278001,114,114),(278023,115,1),(278022,115,2),(278025,115,3),(278026,115,5),(278027,115,6),(278024,115,9),(278028,115,11),(278029,115,13),(278030,115,15),(278031,115,16),(278032,115,17),(278033,115,18),(278034,115,19),(278035,115,20),(278036,115,21),(278037,115,22),(278038,115,30),(278039,115,31),(278040,115,32),(278041,115,33),(278042,115,34),(278043,115,35),(278044,115,36),(278045,115,37),(278046,115,38),(278047,115,39),(278048,115,40),(278049,115,41),(278050,115,42),(278051,115,43),(278052,115,44),(278053,115,45),(278054,115,47),(278055,115,48),(278056,115,49),(278057,115,50),(278058,115,51),(278059,115,52),(278060,115,53),(278061,115,54),(278062,115,55),(278063,115,56),(278064,115,57),(278065,115,58),(278066,115,59),(278067,115,60),(278068,115,61),(278069,115,64),(278070,115,65),(278019,115,66),(278071,115,67),(278072,115,69),(278073,115,70),(278074,115,71),(278075,115,72),(278076,115,73),(278077,115,74),(278078,115,75),(278079,115,76),(278080,115,101),(278081,115,102),(278020,115,103),(278082,115,111),(278018,115,115),(278021,115,120),(278085,119,1),(278088,119,2),(278087,119,3),(278091,119,6),(278090,119,11),(278089,119,70),(278086,119,76),(278084,119,110),(278083,119,119),(278119,120,1),(278123,120,2),(278122,120,3),(278121,120,5),(278124,120,6),(278116,120,9),(278125,120,11),(278117,120,13),(278126,120,15),(278127,120,16),(278128,120,17),(278129,120,18),(278130,120,19),(278131,120,20),(278132,120,21),(278133,120,22),(278134,120,30),(278135,120,31),(278136,120,32),(278137,120,33),(278138,120,34),(278139,120,35),(278140,120,36),(278141,120,37),(278142,120,38),(278143,120,39),(278144,120,40),(278145,120,41),(278146,120,42),(278147,120,43),(278148,120,44),(278149,120,45),(278150,120,47),(278151,120,48),(278152,120,49),(278153,120,50),(278154,120,51),(278155,120,52),(278156,120,53),(278157,120,54),(278158,120,55),(278159,120,56),(278160,120,57),(278161,120,58),(278162,120,59),(278163,120,60),(278164,120,61),(278165,120,64),(278166,120,65),(278118,120,66),(278167,120,67),(278168,120,69),(278169,120,70),(278170,120,71),(278171,120,72),(278172,120,73),(278173,120,74),(278174,120,75),(278175,120,76),(278176,120,101),(278177,120,102),(278120,120,103),(278178,120,111),(278115,120,120),(278101,121,1),(278106,121,2),(278105,121,3),(278112,121,6),(278108,121,11),(278096,121,13),(278095,121,18),(278093,121,21),(278097,121,33),(278094,121,35),(278111,121,36),(278114,121,44),(278113,121,47),(278107,121,49),(278098,121,53),(278110,121,54),(278109,121,58),(278104,121,70),(278099,121,72),(278102,121,75),(278100,121,76),(278103,121,111),(278092,121,121); /*!40000 ALTER TABLE `roleRole` ENABLE KEYS */; UNLOCK TABLES; @@ -140,11 +140,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-05-16 8:24:00 +-- Dump completed on 2023-06-26 8:40:02 USE `salix`; -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: salix +-- Host: db1.static.verdnatura.es Database: salix -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -164,7 +164,7 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','claimManager'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','claimManager'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','READ','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','logisticBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'Calendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'Calendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','*','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','deliveryBoss'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','claimManager'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(222,'Client','*','READ','ALLOW','ROLE','trainee'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','*','READ','ALLOW','ROLE','salesAssistant'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'),(236,'Buy','*','*','ALLOW','ROLE','buyer'),(237,'WorkerDms','filter','*','ALLOW','ROLE','employee'),(238,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(239,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(240,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative'),(242,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(244,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(248,'RoleMapping','*','READ','ALLOW','ROLE','account'),(249,'UserPassword','*','READ','ALLOW','ROLE','account'),(250,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(251,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(252,'Supplier','*','READ','ALLOW','ROLE','employee'),(253,'Supplier','*','WRITE','ALLOW','ROLE','administrative'),(254,'SupplierLog','*','READ','ALLOW','ROLE','employee'),(256,'Image','*','WRITE','ALLOW','ROLE','employee'),(257,'FixedPrice','*','*','ALLOW','ROLE','buyer'),(258,'PayDem','*','READ','ALLOW','ROLE','employee'),(259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant'),(260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee'),(261,'SupplierAccount','*','*','ALLOW','ROLE','administrative'),(262,'Entry','*','*','ALLOW','ROLE','administrative'),(263,'InvoiceIn','*','*','ALLOW','ROLE','administrative'),(264,'StarredModule','*','*','ALLOW','ROLE','employee'),(265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss'),(266,'ZoneLog','*','READ','ALLOW','ROLE','employee'),(267,'Genus','*','WRITE','ALLOW','ROLE','logisticBoss'),(268,'Specie','*','WRITE','ALLOW','ROLE','logisticBoss'),(269,'InvoiceOut','createPdf','WRITE','ALLOW','ROLE','employee'),(270,'SupplierAddress','*','*','ALLOW','ROLE','employee'),(271,'SalesMonitor','*','*','ALLOW','ROLE','employee'),(272,'InvoiceInLog','*','READ','ALLOW','ROLE','employee'),(273,'InvoiceInTax','*','*','ALLOW','ROLE','administrative'),(274,'InvoiceInLog','*','READ','ALLOW','ROLE','administrative'),(275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'),(276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'),(277,'Role','*','*','ALLOW','ROLE','it'),(278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'),(279,'MailAlias','*','*','ALLOW','ROLE','marketing'),(283,'EntryObservation','*','*','ALLOW','ROLE','buyer'),(284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'),(285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'),(286,'ACL','*','*','ALLOW','ROLE','developer'),(287,'AccessToken','*','*','ALLOW','ROLE','developer'),(288,'MailAliasAccount','*','*','ALLOW','ROLE','marketing'),(289,'MailAliasAccount','*','*','ALLOW','ROLE','hr'),(290,'MailAlias','*','*','ALLOW','ROLE','hr'),(291,'MailForward','*','*','ALLOW','ROLE','marketing'),(292,'MailForward','*','*','ALLOW','ROLE','hr'),(293,'RoleInherit','*','*','ALLOW','ROLE','it'),(294,'RoleRole','*','*','ALLOW','ROLE','it'),(295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'),(296,'Collection','*','READ','ALLOW','ROLE','employee'),(297,'Sale','refund','WRITE','ALLOW','ROLE','invoicing'),(298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'),(299,'Collection','setSaleQuantity','*','ALLOW','ROLE','employee'),(300,'Docuware','*','*','ALLOW','ROLE','employee'),(301,'Agency','*','READ','ALLOW','ROLE','employee'),(302,'AgencyTerm','*','*','ALLOW','ROLE','administrative'),(303,'ClaimLog','*','READ','ALLOW','ROLE','claimManager'),(304,'Edi','updateData','WRITE','ALLOW','ROLE','employee'),(305,'EducationLevel','*','*','ALLOW','ROLE','employee'),(306,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(307,'SupplierAgencyTerm','*','*','ALLOW','ROLE','administrative'),(308,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(309,'Zone','getZoneClosing','*','ALLOW','ROLE','employee'),(310,'ExpeditionState','*','READ','ALLOW','ROLE','employee'),(311,'Expense','*','READ','ALLOW','ROLE','employee'),(312,'Expense','*','WRITE','ALLOW','ROLE','administrative'),(314,'SupplierActivity','*','READ','ALLOW','ROLE','employee'),(315,'SupplierActivity','*','WRITE','ALLOW','ROLE','administrative'),(316,'Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee'),(317,'ClientUnpaid','*','*','ALLOW','ROLE','administrative'),(318,'MdbVersion','*','*','ALLOW','ROLE','developer'),(319,'ItemType','*','READ','ALLOW','ROLE','employee'),(320,'ItemType','*','WRITE','ALLOW','ROLE','buyer'),(321,'InvoiceOut','refund','WRITE','ALLOW','ROLE','invoicing'),(322,'InvoiceOut','refund','WRITE','ALLOW','ROLE','salesAssistant'),(323,'InvoiceOut','refund','WRITE','ALLOW','ROLE','claimManager'),(324,'Ticket','refund','WRITE','ALLOW','ROLE','invoicing'),(325,'Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'),(326,'Ticket','refund','WRITE','ALLOW','ROLE','claimManager'),(327,'Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'),(328,'Sale','refund','WRITE','ALLOW','ROLE','claimManager'),(329,'TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'),(330,'ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'),(331,'ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'),(332,'Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),(333,'Client','updateUser','WRITE','ALLOW','ROLE','salesPerson'),(334,'ShelvingLog','*','READ','ALLOW','ROLE','employee'),(335,'ZoneExclusionGeo','*','READ','ALLOW','ROLE','employee'),(336,'ZoneExclusionGeo','*','WRITE','ALLOW','ROLE','deliveryBoss'),(337,'Parking','*','*','ALLOW','ROLE','employee'),(338,'Shelving','*','*','ALLOW','ROLE','employee'),(339,'OsTicket','*','*','ALLOW','ROLE','employee'),(340,'OsTicketConfig','*','*','ALLOW','ROLE','it'),(341,'ClientConsumptionQueue','*','WRITE','ALLOW','ROLE','employee'),(342,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','employee'),(343,'Ticket','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(344,'Ticket','deliveryNoteCsvPdf','READ','ALLOW','ROLE','employee'),(345,'Ticket','deliveryNoteCsvEmail','WRITE','ALLOW','ROLE','employee'),(346,'Client','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(347,'Client','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(348,'Client','clientWelcomeHtml','READ','ALLOW','ROLE','employee'),(349,'Client','clientWelcomeEmail','WRITE','ALLOW','ROLE','employee'),(350,'Client','creditRequestPdf','READ','ALLOW','ROLE','employee'),(351,'Client','creditRequestHtml','READ','ALLOW','ROLE','employee'),(352,'Client','creditRequestEmail','WRITE','ALLOW','ROLE','employee'),(353,'Client','printerSetupHtml','READ','ALLOW','ROLE','employee'),(354,'Client','printerSetupEmail','WRITE','ALLOW','ROLE','employee'),(355,'Client','sepaCoreEmail','WRITE','ALLOW','ROLE','employee'),(356,'Client','letterDebtorPdf','READ','ALLOW','ROLE','employee'),(357,'Client','letterDebtorStHtml','READ','ALLOW','ROLE','employee'),(358,'Client','letterDebtorStEmail','WRITE','ALLOW','ROLE','employee'),(359,'Client','letterDebtorNdHtml','READ','ALLOW','ROLE','employee'),(360,'Client','letterDebtorNdEmail','WRITE','ALLOW','ROLE','employee'),(361,'Client','clientDebtStatementPdf','READ','ALLOW','ROLE','employee'),(362,'Client','clientDebtStatementHtml','READ','ALLOW','ROLE','employee'),(363,'Client','clientDebtStatementEmail','WRITE','ALLOW','ROLE','employee'),(364,'Client','incotermsAuthorizationPdf','READ','ALLOW','ROLE','employee'),(365,'Client','incotermsAuthorizationHtml','READ','ALLOW','ROLE','employee'),(366,'Client','incotermsAuthorizationEmail','WRITE','ALLOW','ROLE','employee'),(367,'Client','consumptionSendQueued','WRITE','ALLOW','ROLE','system'),(368,'InvoiceOut','invoiceEmail','WRITE','ALLOW','ROLE','employee'),(369,'InvoiceOut','exportationPdf','READ','ALLOW','ROLE','employee'),(370,'InvoiceOut','sendQueued','WRITE','ALLOW','ROLE','system'),(371,'Ticket','invoiceCsvPdf','READ','ALLOW','ROLE','employee'),(372,'Ticket','invoiceCsvEmail','WRITE','ALLOW','ROLE','employee'),(373,'Supplier','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(374,'Supplier','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(375,'Travel','extraCommunityPdf','READ','ALLOW','ROLE','employee'),(376,'Travel','extraCommunityEmail','WRITE','ALLOW','ROLE','employee'),(377,'Entry','entryOrderPdf','READ','ALLOW','ROLE','employee'),(378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','ROLE','system'),(379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system'),(380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee'),(381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager'),(382,'Item','labelPdf','READ','ALLOW','ROLE','employee'),(383,'Sector','*','READ','ALLOW','ROLE','employee'),(384,'Sector','*','WRITE','ALLOW','ROLE','employee'),(385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee'),(386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'),(387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'),(388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'),(389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager'),(390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'),(391,'Notification','*','WRITE','ALLOW','ROLE','system'),(392,'Boxing','*','*','ALLOW','ROLE','employee'),(393,'Url','*','READ','ALLOW','ROLE','employee'),(394,'Url','*','WRITE','ALLOW','ROLE','it'),(395,'ItemShelving','*','READ','ALLOW','ROLE','employee'),(396,'ItemShelving','*','WRITE','ALLOW','ROLE','production'),(397,'ItemShelvingPlacementSupplyStock','*','READ','ALLOW','ROLE','employee'),(398,'NotificationQueue','*','*','ALLOW','ROLE','employee'),(399,'InvoiceOut','clientsToInvoice','WRITE','ALLOW','ROLE','invoicing'),(400,'InvoiceOut','invoiceClient','WRITE','ALLOW','ROLE','invoicing'),(401,'Sale','editTracked','WRITE','ALLOW','ROLE','production'),(402,'Sale','editFloramondo','WRITE','ALLOW','ROLE','salesAssistant'),(403,'Receipt','balanceCompensationEmail','WRITE','ALLOW','ROLE','employee'),(404,'Receipt','balanceCompensationPdf','READ','ALLOW','ROLE','employee'),(405,'Ticket','getTicketsFuture','READ','ALLOW','ROLE','employee'),(406,'Ticket','merge','WRITE','ALLOW','ROLE','employee'),(407,'Sale','editFloramondo','WRITE','ALLOW','ROLE','logistic'),(408,'ZipConfig','*','*','ALLOW','ROLE','employee'),(409,'Item','*','WRITE','ALLOW','ROLE','administrative'),(410,'Sale','editCloned','WRITE','ALLOW','ROLE','buyer'),(411,'Sale','editCloned','WRITE','ALLOW','ROLE','salesAssistant'),(414,'MdbVersion','*','READ','ALLOW','ROLE','$everyone'),(416,'TicketLog','getChanges','READ','ALLOW','ROLE','employee'),(417,'Ticket','getTicketsAdvance','READ','ALLOW','ROLE','employee'),(418,'EntryLog','*','READ','ALLOW','ROLE','administrative'),(419,'Sale','editTracked','WRITE','ALLOW','ROLE','buyer'),(420,'MdbBranch','*','READ','ALLOW','ROLE','$everyone'),(421,'ItemShelvingSale','*','*','ALLOW','ROLE','employee'),(422,'Docuware','checkFile','READ','ALLOW','ROLE','employee'),(423,'Docuware','download','READ','ALLOW','ROLE','salesPerson'),(424,'Docuware','upload','WRITE','ALLOW','ROLE','productionAssi'),(425,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','salesPerson'),(426,'TpvTransaction','confirm','WRITE','ALLOW','ROLE','$everyone'),(427,'TpvTransaction','start','WRITE','ALLOW','ROLE','$authenticated'),(428,'TpvTransaction','end','WRITE','ALLOW','ROLE','$authenticated'),(429,'ItemConfig','*','READ','ALLOW','ROLE','employee'),(431,'Tag','onSubmit','WRITE','ALLOW','ROLE','employee'),(432,'Worker','updateAttributes','WRITE','ALLOW','ROLE','hr'),(433,'Worker','createAbsence','*','ALLOW','ROLE','employee'),(434,'Worker','updateAbsence','WRITE','ALLOW','ROLE','employee'),(435,'Worker','deleteAbsence','*','ALLOW','ROLE','employee'),(436,'Worker','new','WRITE','ALLOW','ROLE','hr'),(437,'Role','*','READ','ALLOW','ROLE','hr'),(438,'Client','getClientOrSupplierReference','READ','ALLOW','ROLE','employee'),(439,'NotificationSubscription','*','*','ALLOW','ROLE','employee'),(440,'NotificationAcl','*','READ','ALLOW','ROLE','employee'),(441,'MdbApp','*','READ','ALLOW','ROLE','$everyone'),(442,'MdbApp','*','*','ALLOW','ROLE','developer'),(443,'ItemConfig','*','*','ALLOW','ROLE','employee'),(444,'DeviceProduction','*','*','ALLOW','ROLE','hr'),(445,'DeviceProductionModels','*','*','ALLOW','ROLE','hr'),(446,'DeviceProductionState','*','*','ALLOW','ROLE','hr'),(447,'DeviceProductionUser','*','*','ALLOW','ROLE','hr'),(448,'DeviceProduction','*','*','ALLOW','ROLE','productionAssi'),(449,'DeviceProductionModels','*','*','ALLOW','ROLE','productionAssi'),(450,'DeviceProductionState','*','*','ALLOW','ROLE','productionAssi'),(451,'DeviceProductionUser','*','*','ALLOW','ROLE','productionAssi'),(452,'Worker','deallocatePDA','*','ALLOW','ROLE','hr'),(453,'Worker','allocatePDA','*','ALLOW','ROLE','hr'),(454,'Worker','deallocatePDA','*','ALLOW','ROLE','productionAssi'),(455,'Worker','allocatePDA','*','ALLOW','ROLE','productionAssi'),(456,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(457,'Account','setPassword','WRITE','ALLOW','ROLE','itManagement'),(458,'Operator','*','READ','ALLOW','ROLE','employee'),(459,'Operator','*','WRITE','ALLOW','ROLE','employee'),(460,'InvoiceIn','getSerial','READ','ALLOW','ROLE','administrative'),(461,'Ticket','saveSign','WRITE','ALLOW','ROLE','employee'),(462,'InvoiceOut','negativeBases','READ','ALLOW','ROLE','administrative'),(463,'InvoiceOut','negativeBasesCsv','READ','ALLOW','ROLE','administrative'),(464,'WorkerObservation','*','*','ALLOW','ROLE','hr'),(465,'ClientInforma','*','READ','ALLOW','ROLE','employee'),(466,'ClientInforma','*','WRITE','ALLOW','ROLE','financial'),(467,'Receipt','receiptEmail','*','ALLOW','ROLE','salesAssistant'),(468,'Client','setRating','WRITE','ALLOW','ROLE','financial'),(469,'Client','*','READ','ALLOW','ROLE','employee'),(470,'Client','addressesPropagateRe','*','ALLOW','ROLE','employee'),(471,'Client','canBeInvoiced','*','ALLOW','ROLE','employee'),(472,'Client','canCreateTicket','*','ALLOW','ROLE','employee'),(473,'Client','consumption','*','ALLOW','ROLE','employee'),(474,'Client','createAddress','*','ALLOW','ROLE','employee'),(475,'Client','createWithUser','*','ALLOW','ROLE','employee'),(476,'Client','extendedListFilter','*','ALLOW','ROLE','employee'),(477,'Client','getAverageInvoiced','*','ALLOW','ROLE','employee'),(478,'Client','getCard','*','ALLOW','ROLE','employee'),(479,'Client','getDebt','*','ALLOW','ROLE','employee'),(480,'Client','getMana','*','ALLOW','ROLE','employee'),(481,'Client','transactions','*','ALLOW','ROLE','employee'),(482,'Client','hasCustomerRole','*','ALLOW','ROLE','employee'),(483,'Client','isValidClient','*','ALLOW','ROLE','employee'),(484,'Client','lastActiveTickets','*','ALLOW','ROLE','employee'),(485,'Client','sendSms','*','ALLOW','ROLE','employee'),(486,'Client','setPassword','*','ALLOW','ROLE','employee'),(487,'Client','summary','*','ALLOW','ROLE','employee'),(488,'Client','updateAddress','*','ALLOW','ROLE','employee'),(489,'Client','updateFiscalData','*','ALLOW','ROLE','employee'),(490,'Client','updateUser','*','ALLOW','ROLE','employee'),(491,'Client','uploadFile','*','ALLOW','ROLE','employee'),(492,'Client','campaignMetricsPdf','*','ALLOW','ROLE','employee'),(493,'Client','campaignMetricsEmail','*','ALLOW','ROLE','employee'),(494,'Client','clientWelcomeHtml','*','ALLOW','ROLE','employee'),(495,'Client','clientWelcomeEmail','*','ALLOW','ROLE','employee'),(496,'Client','printerSetupHtml','*','ALLOW','ROLE','employee'),(497,'Client','printerSetupEmail','*','ALLOW','ROLE','employee'),(498,'Client','sepaCoreEmail','*','ALLOW','ROLE','employee'),(499,'Client','letterDebtorPdf','*','ALLOW','ROLE','employee'),(500,'Client','letterDebtorStHtml','*','ALLOW','ROLE','employee'),(501,'Client','letterDebtorStEmail','*','ALLOW','ROLE','employee'),(502,'Client','letterDebtorNdHtml','*','ALLOW','ROLE','employee'),(503,'Client','letterDebtorNdEmail','*','ALLOW','ROLE','employee'),(504,'Client','clientDebtStatementPdf','*','ALLOW','ROLE','employee'),(505,'Client','clientDebtStatementHtml','*','ALLOW','ROLE','employee'),(506,'Client','clientDebtStatementEmail','*','ALLOW','ROLE','employee'),(507,'Client','creditRequestPdf','*','ALLOW','ROLE','employee'),(508,'Client','creditRequestHtml','*','ALLOW','ROLE','employee'),(509,'Client','creditRequestEmail','*','ALLOW','ROLE','employee'),(510,'Client','incotermsAuthorizationPdf','*','ALLOW','ROLE','employee'),(511,'Client','incotermsAuthorizationHtml','*','ALLOW','ROLE','employee'),(512,'Client','incotermsAuthorizationEmail','*','ALLOW','ROLE','employee'),(513,'Client','consumptionSendQueued','*','ALLOW','ROLE','employee'),(514,'Client','filter','*','ALLOW','ROLE','employee'),(515,'Client','getClientOrSupplierReference','*','ALLOW','ROLE','employee'),(516,'Client','upsert','*','ALLOW','ROLE','employee'),(517,'Client','create','*','ALLOW','ROLE','employee'),(518,'Client','replaceById','*','ALLOW','ROLE','employee'),(519,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(520,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(521,'Client','deleteById','*','ALLOW','ROLE','employee'),(522,'Client','replaceOrCreate','*','ALLOW','ROLE','employee'),(523,'Client','updateAll','*','ALLOW','ROLE','employee'),(524,'Client','upsertWithWhere','*','ALLOW','ROLE','employee'),(525,'Defaulter','observationEmail','WRITE','ALLOW','ROLE','employee'),(526,'VnUser','*','*','ALLOW','ROLE','employee'),(527,'VnUser','acl','READ','ALLOW','ROLE','account'),(528,'VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'),(529,'VnUser','changePassword','WRITE','ALLOW','ROLE','account'),(530,'Account','exists','READ','ALLOW','ROLE','account'),(531,'Account','exists','READ','ALLOW','ROLE','account'),(532,'UserLog','*','READ','ALLOW','ROLE','employee'),(533,'RoleLog','*','READ','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','claimManager'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','claimManager'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','logisticBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'Calendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'Calendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','*','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','deliveryBoss'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','claimManager'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(222,'Client','*','READ','ALLOW','ROLE','trainee'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','find','READ','ALLOW','ROLE','hr'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'),(236,'Buy','*','*','ALLOW','ROLE','buyer'),(237,'WorkerDms','filter','*','ALLOW','ROLE','employee'),(238,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(239,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(240,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative'),(242,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(244,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(248,'RoleMapping','*','READ','ALLOW','ROLE','account'),(249,'UserPassword','*','READ','ALLOW','ROLE','account'),(250,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(251,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(252,'Supplier','*','READ','ALLOW','ROLE','employee'),(253,'Supplier','*','WRITE','ALLOW','ROLE','administrative'),(254,'SupplierLog','*','READ','ALLOW','ROLE','employee'),(256,'Image','*','WRITE','ALLOW','ROLE','employee'),(257,'FixedPrice','*','*','ALLOW','ROLE','buyer'),(258,'PayDem','*','READ','ALLOW','ROLE','employee'),(259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant'),(260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee'),(261,'SupplierAccount','*','*','ALLOW','ROLE','administrative'),(262,'Entry','*','*','ALLOW','ROLE','administrative'),(263,'InvoiceIn','*','*','ALLOW','ROLE','administrative'),(264,'StarredModule','*','*','ALLOW','ROLE','employee'),(265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss'),(266,'ZoneLog','*','READ','ALLOW','ROLE','employee'),(267,'Genus','*','WRITE','ALLOW','ROLE','logisticBoss'),(268,'Specie','*','WRITE','ALLOW','ROLE','logisticBoss'),(269,'InvoiceOut','createPdf','WRITE','ALLOW','ROLE','employee'),(270,'SupplierAddress','*','*','ALLOW','ROLE','employee'),(271,'SalesMonitor','*','*','ALLOW','ROLE','employee'),(272,'InvoiceInLog','*','READ','ALLOW','ROLE','employee'),(273,'InvoiceInTax','*','*','ALLOW','ROLE','administrative'),(274,'InvoiceInLog','*','READ','ALLOW','ROLE','administrative'),(275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'),(276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'),(277,'Role','*','*','ALLOW','ROLE','it'),(278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'),(279,'MailAlias','*','*','ALLOW','ROLE','marketing'),(283,'EntryObservation','*','*','ALLOW','ROLE','buyer'),(284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'),(285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'),(286,'ACL','*','*','ALLOW','ROLE','developer'),(287,'AccessToken','*','*','ALLOW','ROLE','developer'),(288,'MailAliasAccount','*','*','ALLOW','ROLE','marketing'),(289,'MailAliasAccount','*','*','ALLOW','ROLE','hr'),(291,'MailForward','*','*','ALLOW','ROLE','marketing'),(292,'MailForward','*','*','ALLOW','ROLE','hr'),(293,'RoleInherit','*','*','ALLOW','ROLE','it'),(294,'RoleRole','*','*','ALLOW','ROLE','it'),(295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'),(296,'Collection','*','READ','ALLOW','ROLE','employee'),(297,'Sale','refund','WRITE','ALLOW','ROLE','invoicing'),(298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'),(299,'Collection','setSaleQuantity','*','ALLOW','ROLE','employee'),(302,'AgencyTerm','*','*','ALLOW','ROLE','administrative'),(303,'ClaimLog','*','READ','ALLOW','ROLE','claimManager'),(304,'Edi','updateData','WRITE','ALLOW','ROLE','employee'),(305,'EducationLevel','*','*','ALLOW','ROLE','employee'),(306,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(307,'SupplierAgencyTerm','*','*','ALLOW','ROLE','administrative'),(308,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(309,'Zone','getZoneClosing','*','ALLOW','ROLE','employee'),(310,'ExpeditionState','*','READ','ALLOW','ROLE','employee'),(311,'Expense','*','READ','ALLOW','ROLE','employee'),(312,'Expense','*','WRITE','ALLOW','ROLE','administrative'),(314,'SupplierActivity','*','READ','ALLOW','ROLE','employee'),(315,'SupplierActivity','*','WRITE','ALLOW','ROLE','administrative'),(316,'Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee'),(317,'ClientUnpaid','*','*','ALLOW','ROLE','administrative'),(318,'MdbVersion','*','*','ALLOW','ROLE','developer'),(319,'ItemType','*','READ','ALLOW','ROLE','employee'),(320,'ItemType','*','WRITE','ALLOW','ROLE','buyer'),(321,'InvoiceOut','refund','WRITE','ALLOW','ROLE','invoicing'),(322,'InvoiceOut','refund','WRITE','ALLOW','ROLE','salesAssistant'),(323,'InvoiceOut','refund','WRITE','ALLOW','ROLE','claimManager'),(324,'Ticket','refund','WRITE','ALLOW','ROLE','invoicing'),(325,'Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'),(326,'Ticket','refund','WRITE','ALLOW','ROLE','claimManager'),(327,'Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'),(328,'Sale','refund','WRITE','ALLOW','ROLE','claimManager'),(329,'TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'),(330,'ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'),(331,'ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'),(332,'Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),(333,'Client','updateUser','WRITE','ALLOW','ROLE','salesPerson'),(334,'ShelvingLog','*','READ','ALLOW','ROLE','employee'),(335,'ZoneExclusionGeo','*','READ','ALLOW','ROLE','employee'),(336,'ZoneExclusionGeo','*','WRITE','ALLOW','ROLE','deliveryBoss'),(337,'Parking','*','*','ALLOW','ROLE','employee'),(338,'Shelving','*','*','ALLOW','ROLE','employee'),(339,'OsTicket','*','*','ALLOW','ROLE','employee'),(340,'OsTicketConfig','*','*','ALLOW','ROLE','it'),(341,'ClientConsumptionQueue','*','WRITE','ALLOW','ROLE','employee'),(342,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','employee'),(343,'Ticket','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(344,'Ticket','deliveryNoteCsvPdf','READ','ALLOW','ROLE','employee'),(345,'Ticket','deliveryNoteCsvEmail','READ','ALLOW','ROLE','employee'),(346,'Client','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(347,'Client','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(348,'Client','clientWelcomeHtml','READ','ALLOW','ROLE','employee'),(349,'Client','clientWelcomeEmail','WRITE','ALLOW','ROLE','employee'),(350,'Client','creditRequestPdf','READ','ALLOW','ROLE','employee'),(351,'Client','creditRequestHtml','READ','ALLOW','ROLE','employee'),(352,'Client','creditRequestEmail','WRITE','ALLOW','ROLE','employee'),(353,'Client','printerSetupHtml','READ','ALLOW','ROLE','employee'),(354,'Client','printerSetupEmail','WRITE','ALLOW','ROLE','employee'),(355,'Client','sepaCoreEmail','WRITE','ALLOW','ROLE','employee'),(356,'Client','letterDebtorPdf','READ','ALLOW','ROLE','employee'),(357,'Client','letterDebtorStHtml','READ','ALLOW','ROLE','employee'),(358,'Client','letterDebtorStEmail','WRITE','ALLOW','ROLE','employee'),(359,'Client','letterDebtorNdHtml','READ','ALLOW','ROLE','employee'),(360,'Client','letterDebtorNdEmail','WRITE','ALLOW','ROLE','employee'),(361,'Client','clientDebtStatementPdf','READ','ALLOW','ROLE','employee'),(362,'Client','clientDebtStatementHtml','READ','ALLOW','ROLE','employee'),(363,'Client','clientDebtStatementEmail','WRITE','ALLOW','ROLE','employee'),(364,'Client','incotermsAuthorizationPdf','READ','ALLOW','ROLE','employee'),(365,'Client','incotermsAuthorizationHtml','READ','ALLOW','ROLE','employee'),(366,'Client','incotermsAuthorizationEmail','WRITE','ALLOW','ROLE','employee'),(367,'Client','consumptionSendQueued','WRITE','ALLOW','ROLE','system'),(368,'InvoiceOut','invoiceEmail','WRITE','ALLOW','ROLE','employee'),(369,'InvoiceOut','exportationPdf','READ','ALLOW','ROLE','employee'),(370,'InvoiceOut','sendQueued','WRITE','ALLOW','ROLE','system'),(371,'Ticket','invoiceCsvPdf','READ','ALLOW','ROLE','employee'),(372,'Ticket','invoiceCsvEmail','WRITE','ALLOW','ROLE','employee'),(373,'Supplier','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(374,'Supplier','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(375,'Travel','extraCommunityPdf','READ','ALLOW','ROLE','employee'),(376,'Travel','extraCommunityEmail','WRITE','ALLOW','ROLE','employee'),(377,'Entry','entryOrderPdf','READ','ALLOW','ROLE','employee'),(378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','ROLE','system'),(379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system'),(380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee'),(381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager'),(382,'Item','labelPdf','READ','ALLOW','ROLE','employee'),(383,'Sector','*','READ','ALLOW','ROLE','employee'),(384,'Sector','*','WRITE','ALLOW','ROLE','employee'),(385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee'),(386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'),(387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'),(388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'),(389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager'),(390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'),(391,'Notification','*','WRITE','ALLOW','ROLE','system'),(392,'Boxing','*','*','ALLOW','ROLE','employee'),(393,'Url','*','READ','ALLOW','ROLE','employee'),(394,'Url','*','WRITE','ALLOW','ROLE','it'),(395,'ItemShelving','*','READ','ALLOW','ROLE','employee'),(396,'ItemShelving','*','WRITE','ALLOW','ROLE','production'),(397,'ItemShelvingPlacementSupplyStock','*','READ','ALLOW','ROLE','employee'),(398,'NotificationQueue','*','*','ALLOW','ROLE','employee'),(399,'InvoiceOut','clientsToInvoice','WRITE','ALLOW','ROLE','invoicing'),(400,'InvoiceOut','invoiceClient','WRITE','ALLOW','ROLE','invoicing'),(401,'Sale','editTracked','WRITE','ALLOW','ROLE','production'),(402,'Sale','editFloramondo','WRITE','ALLOW','ROLE','salesAssistant'),(403,'Receipt','balanceCompensationEmail','WRITE','ALLOW','ROLE','employee'),(404,'Receipt','balanceCompensationPdf','READ','ALLOW','ROLE','employee'),(405,'Ticket','getTicketsFuture','READ','ALLOW','ROLE','employee'),(406,'Ticket','merge','WRITE','ALLOW','ROLE','employee'),(407,'Sale','editFloramondo','WRITE','ALLOW','ROLE','logistic'),(408,'ZipConfig','*','*','ALLOW','ROLE','employee'),(409,'Item','*','WRITE','ALLOW','ROLE','administrative'),(410,'Sale','editCloned','WRITE','ALLOW','ROLE','buyer'),(411,'Sale','editCloned','WRITE','ALLOW','ROLE','salesAssistant'),(414,'MdbVersion','*','READ','ALLOW','ROLE','$everyone'),(416,'TicketLog','getChanges','READ','ALLOW','ROLE','employee'),(417,'Ticket','getTicketsAdvance','READ','ALLOW','ROLE','employee'),(418,'EntryLog','*','READ','ALLOW','ROLE','administrative'),(419,'Sale','editTracked','WRITE','ALLOW','ROLE','buyer'),(420,'MdbBranch','*','READ','ALLOW','ROLE','$everyone'),(421,'ItemShelvingSale','*','*','ALLOW','ROLE','employee'),(422,'Docuware','checkFile','READ','ALLOW','ROLE','employee'),(423,'Docuware','download','READ','ALLOW','ROLE','salesPerson'),(424,'Docuware','upload','WRITE','ALLOW','ROLE','productionAssi'),(425,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','salesPerson'),(426,'TpvTransaction','confirm','WRITE','ALLOW','ROLE','$everyone'),(427,'TpvTransaction','start','WRITE','ALLOW','ROLE','$authenticated'),(428,'TpvTransaction','end','WRITE','ALLOW','ROLE','$authenticated'),(429,'ItemConfig','*','READ','ALLOW','ROLE','employee'),(431,'Tag','onSubmit','WRITE','ALLOW','ROLE','employee'),(432,'Worker','updateAttributes','WRITE','ALLOW','ROLE','hr'),(433,'Worker','createAbsence','*','ALLOW','ROLE','employee'),(434,'Worker','updateAbsence','WRITE','ALLOW','ROLE','employee'),(435,'Worker','deleteAbsence','*','ALLOW','ROLE','employee'),(436,'Worker','new','WRITE','ALLOW','ROLE','hr'),(437,'Role','*','READ','ALLOW','ROLE','hr'),(438,'Client','getClientOrSupplierReference','READ','ALLOW','ROLE','employee'),(439,'NotificationSubscription','*','*','ALLOW','ROLE','employee'),(440,'NotificationAcl','*','READ','ALLOW','ROLE','employee'),(441,'MdbApp','*','READ','ALLOW','ROLE','$everyone'),(442,'MdbApp','*','*','ALLOW','ROLE','developer'),(443,'ItemConfig','*','*','ALLOW','ROLE','employee'),(444,'DeviceProduction','*','*','ALLOW','ROLE','hr'),(445,'DeviceProductionModels','*','*','ALLOW','ROLE','hr'),(446,'DeviceProductionState','*','*','ALLOW','ROLE','hr'),(447,'DeviceProductionUser','*','*','ALLOW','ROLE','hr'),(448,'DeviceProduction','*','*','ALLOW','ROLE','productionAssi'),(449,'DeviceProductionModels','*','*','ALLOW','ROLE','productionAssi'),(450,'DeviceProductionState','*','*','ALLOW','ROLE','productionAssi'),(451,'DeviceProductionUser','*','*','ALLOW','ROLE','productionAssi'),(452,'Worker','deallocatePDA','*','ALLOW','ROLE','hr'),(453,'Worker','allocatePDA','*','ALLOW','ROLE','hr'),(454,'Worker','deallocatePDA','*','ALLOW','ROLE','productionAssi'),(455,'Worker','allocatePDA','*','ALLOW','ROLE','productionAssi'),(456,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(457,'Account','setPassword','WRITE','ALLOW','ROLE','itManagement'),(458,'Operator','*','READ','ALLOW','ROLE','employee'),(459,'Operator','*','WRITE','ALLOW','ROLE','employee'),(460,'InvoiceIn','getSerial','READ','ALLOW','ROLE','administrative'),(461,'Ticket','saveSign','WRITE','ALLOW','ROLE','employee'),(462,'InvoiceOut','negativeBases','READ','ALLOW','ROLE','administrative'),(463,'InvoiceOut','negativeBasesCsv','READ','ALLOW','ROLE','administrative'),(464,'WorkerObservation','*','*','ALLOW','ROLE','hr'),(465,'ClientInforma','*','READ','ALLOW','ROLE','employee'),(466,'ClientInforma','*','WRITE','ALLOW','ROLE','financial'),(467,'Receipt','receiptEmail','*','ALLOW','ROLE','salesAssistant'),(468,'Client','setRating','WRITE','ALLOW','ROLE','financial'),(469,'Client','*','READ','ALLOW','ROLE','employee'),(470,'Client','addressesPropagateRe','*','ALLOW','ROLE','employee'),(471,'Client','canBeInvoiced','*','ALLOW','ROLE','employee'),(472,'Client','canCreateTicket','*','ALLOW','ROLE','employee'),(473,'Client','consumption','*','ALLOW','ROLE','employee'),(474,'Client','createAddress','*','ALLOW','ROLE','employee'),(475,'Client','createWithUser','*','ALLOW','ROLE','employee'),(476,'Client','extendedListFilter','*','ALLOW','ROLE','employee'),(477,'Client','getAverageInvoiced','*','ALLOW','ROLE','employee'),(478,'Client','getCard','*','ALLOW','ROLE','employee'),(479,'Client','getDebt','*','ALLOW','ROLE','employee'),(480,'Client','getMana','*','ALLOW','ROLE','employee'),(481,'Client','transactions','*','ALLOW','ROLE','employee'),(482,'Client','hasCustomerRole','*','ALLOW','ROLE','employee'),(483,'Client','isValidClient','*','ALLOW','ROLE','employee'),(484,'Client','lastActiveTickets','*','ALLOW','ROLE','employee'),(485,'Client','sendSms','*','ALLOW','ROLE','employee'),(486,'Client','setPassword','*','ALLOW','ROLE','employee'),(487,'Client','summary','*','ALLOW','ROLE','employee'),(488,'Client','updateAddress','*','ALLOW','ROLE','employee'),(489,'Client','updateFiscalData','*','ALLOW','ROLE','employee'),(491,'Client','uploadFile','*','ALLOW','ROLE','employee'),(492,'Client','campaignMetricsPdf','*','ALLOW','ROLE','employee'),(493,'Client','campaignMetricsEmail','*','ALLOW','ROLE','employee'),(494,'Client','clientWelcomeHtml','*','ALLOW','ROLE','employee'),(495,'Client','clientWelcomeEmail','*','ALLOW','ROLE','employee'),(496,'Client','printerSetupHtml','*','ALLOW','ROLE','employee'),(497,'Client','printerSetupEmail','*','ALLOW','ROLE','employee'),(498,'Client','sepaCoreEmail','*','ALLOW','ROLE','employee'),(499,'Client','letterDebtorPdf','*','ALLOW','ROLE','employee'),(500,'Client','letterDebtorStHtml','*','ALLOW','ROLE','employee'),(501,'Client','letterDebtorStEmail','*','ALLOW','ROLE','employee'),(502,'Client','letterDebtorNdHtml','*','ALLOW','ROLE','employee'),(503,'Client','letterDebtorNdEmail','*','ALLOW','ROLE','employee'),(504,'Client','clientDebtStatementPdf','*','ALLOW','ROLE','employee'),(505,'Client','clientDebtStatementHtml','*','ALLOW','ROLE','employee'),(506,'Client','clientDebtStatementEmail','*','ALLOW','ROLE','employee'),(507,'Client','creditRequestPdf','*','ALLOW','ROLE','employee'),(508,'Client','creditRequestHtml','*','ALLOW','ROLE','employee'),(509,'Client','creditRequestEmail','*','ALLOW','ROLE','employee'),(510,'Client','incotermsAuthorizationPdf','*','ALLOW','ROLE','employee'),(511,'Client','incotermsAuthorizationHtml','*','ALLOW','ROLE','employee'),(512,'Client','incotermsAuthorizationEmail','*','ALLOW','ROLE','employee'),(513,'Client','consumptionSendQueued','*','ALLOW','ROLE','employee'),(514,'Client','filter','*','ALLOW','ROLE','employee'),(515,'Client','getClientOrSupplierReference','*','ALLOW','ROLE','employee'),(516,'Client','upsert','*','ALLOW','ROLE','employee'),(517,'Client','create','*','ALLOW','ROLE','employee'),(518,'Client','replaceById','*','ALLOW','ROLE','employee'),(519,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(520,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(521,'Client','deleteById','*','ALLOW','ROLE','employee'),(522,'Client','replaceOrCreate','*','ALLOW','ROLE','employee'),(523,'Client','updateAll','*','ALLOW','ROLE','employee'),(524,'Client','upsertWithWhere','*','ALLOW','ROLE','employee'),(525,'Defaulter','observationEmail','WRITE','ALLOW','ROLE','employee'),(526,'VnUser','*','*','ALLOW','ROLE','employee'),(527,'VnUser','acl','READ','ALLOW','ROLE','account'),(528,'VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'),(529,'VnUser','changePassword','WRITE','ALLOW','ROLE','account'),(530,'Account','exists','READ','ALLOW','ROLE','account'),(531,'Account','exists','READ','ALLOW','ROLE','account'),(532,'UserLog','*','READ','ALLOW','ROLE','employee'),(533,'RoleLog','*','READ','ALLOW','ROLE','employee'),(534,'WagonType','*','*','ALLOW','ROLE','productionAssi'),(535,'WagonTypeColor','*','*','ALLOW','ROLE','productionAssi'),(536,'WagonTypeTray','*','*','ALLOW','ROLE','productionAssi'),(537,'WagonConfig','*','*','ALLOW','ROLE','productionAssi'),(538,'CollectionWagon','*','*','ALLOW','ROLE','productionAssi'),(539,'CollectionWagonTicket','*','*','ALLOW','ROLE','productionAssi'),(540,'Wagon','*','*','ALLOW','ROLE','productionAssi'),(541,'WagonType','createWagonType','*','ALLOW','ROLE','productionAssi'),(542,'WagonType','deleteWagonType','*','ALLOW','ROLE','productionAssi'),(543,'WagonType','editWagonType','*','ALLOW','ROLE','productionAssi'),(544,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(545,'Agency','find','READ','ALLOW','ROLE','employee'),(546,'Agency','seeExpired','READ','ALLOW','ROLE','coolerAssist'),(547,'WorkerLog','models','READ','ALLOW','ROLE','hr'),(548,'Ticket','editDiscount','WRITE','ALLOW','ROLE','claimManager'),(549,'Ticket','editDiscount','WRITE','ALLOW','ROLE','salesPerson'),(550,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','salesAssistant'),(551,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','deliveryBoss'),(552,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','buyer'),(553,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','claimManager'),(554,'Ticket','deleteTicketWithPartPrepared','WRITE','ALLOW','ROLE','salesAssistant'),(555,'Ticket','editZone','WRITE','ALLOW','ROLE','deliveryBoss'),(556,'State','editableStates','READ','ALLOW','ROLE','employee'),(557,'State','seeEditableStates','READ','ALLOW','ROLE','administrative'),(558,'State','seeEditableStates','READ','ALLOW','ROLE','production'),(559,'State','isSomeEditable','READ','ALLOW','ROLE','salesPerson'),(560,'State','isAllEditable','READ','ALLOW','ROLE','production'),(561,'State','isAllEditable','READ','ALLOW','ROLE','administrative'),(562,'Agency','seeExpired','READ','ALLOW','ROLE','administrative'),(563,'Agency','seeExpired','READ','ALLOW','ROLE','productionBoss'),(564,'Claim','createAfterDeadline','WRITE','ALLOW','ROLE','claimManager'),(565,'Client','editAddressLogifloraAllowed','WRITE','ALLOW','ROLE','salesAssistant'),(566,'Client','editFiscalDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(567,'Client','editVerifiedDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(568,'Client','editCredit','WRITE','ALLOW','ROLE','employee'),(569,'Client','isNotEditableCredit','WRITE','ALLOW','ROLE','financialBoss'),(570,'InvoiceOut','canCreatePdf','WRITE','ALLOW','ROLE','invoicing'),(571,'Supplier','editPayMethodCheck','WRITE','ALLOW','ROLE','financial'),(572,'Worker','isTeamBoss','WRITE','ALLOW','ROLE','teamBoss'),(573,'Worker','forceIsSubordinate','READ','ALLOW','ROLE','hr'),(574,'Claim','editState','WRITE','ALLOW','ROLE','claimManager'),(575,'Claim','find','READ','ALLOW','ROLE','salesPerson'),(576,'Claim','findById','READ','ALLOW','ROLE','salesPerson'),(577,'Claim','findOne','READ','ALLOW','ROLE','salesPerson'),(578,'Claim','getSummary','READ','ALLOW','ROLE','salesPerson'),(579,'Claim','updateClaim','WRITE','ALLOW','ROLE','salesPerson'),(580,'Claim','regularizeClaim','WRITE','ALLOW','ROLE','claimManager'),(581,'Claim','updateClaimDestination','WRITE','ALLOW','ROLE','claimManager'),(582,'Claim','downloadFile','READ','ALLOW','ROLE','claimManager'),(583,'Claim','deleteById','WRITE','ALLOW','ROLE','claimManager'),(584,'Claim','filter','READ','ALLOW','ROLE','salesPerson'),(585,'Claim','logs','READ','ALLOW','ROLE','claimManager'),(586,'Ticket','find','READ','ALLOW','ROLE','employee'),(587,'Ticket','findById','READ','ALLOW','ROLE','employee'),(588,'Ticket','findOne','READ','ALLOW','ROLE','employee'),(589,'Ticket','getVolume','READ','ALLOW','ROLE','employee'),(590,'Ticket','getTotalVolume','READ','ALLOW','ROLE','employee'),(591,'Ticket','summary','READ','ALLOW','ROLE','employee'),(592,'Ticket','priceDifference','READ','ALLOW','ROLE','employee'),(593,'Ticket','componentUpdate','WRITE','ALLOW','ROLE','employee'),(594,'Ticket','new','WRITE','ALLOW','ROLE','employee'),(595,'Ticket','isEditable','READ','ALLOW','ROLE','employee'),(596,'Ticket','setDeleted','WRITE','ALLOW','ROLE','employee'),(597,'Ticket','restore','WRITE','ALLOW','ROLE','employee'),(598,'Ticket','getSales','READ','ALLOW','ROLE','employee'),(599,'Ticket','getSalesPersonMana','READ','ALLOW','ROLE','employee'),(600,'Ticket','filter','READ','ALLOW','ROLE','employee'),(601,'Ticket','makeInvoice','WRITE','ALLOW','ROLE','employee'),(602,'Ticket','updateEditableTicket','WRITE','ALLOW','ROLE','employee'),(603,'Ticket','updateDiscount','WRITE','ALLOW','ROLE','employee'),(604,'Ticket','transferSales','WRITE','ALLOW','ROLE','employee'),(605,'Ticket','sendSms','WRITE','ALLOW','ROLE','employee'),(606,'Ticket','isLocked','READ','ALLOW','ROLE','employee'),(607,'Ticket','freightCost','READ','ALLOW','ROLE','employee'),(608,'Ticket','getComponentsSum','READ','ALLOW','ROLE','employee'),(609,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','delivery'),(610,'Ticket','deliveryNoteCsv','READ','ALLOW','ROLE','employee'),(611,'State','find','READ','ALLOW','ROLE','employee'),(612,'State','findById','READ','ALLOW','ROLE','employee'),(613,'State','findOne','READ','ALLOW','ROLE','employee'),(614,'Worker','find','READ','ALLOW','ROLE','employee'),(615,'Worker','findById','READ','ALLOW','ROLE','employee'),(616,'Worker','findOne','READ','ALLOW','ROLE','employee'),(617,'Worker','filter','READ','ALLOW','ROLE','employee'),(618,'Worker','getWorkedHours','READ','ALLOW','ROLE','employee'),(619,'Worker','active','READ','ALLOW','ROLE','employee'),(620,'Worker','activeWithRole','READ','ALLOW','ROLE','employee'),(621,'Worker','uploadFile','WRITE','ALLOW','ROLE','hr'),(622,'Worker','contracts','READ','ALLOW','ROLE','employee'),(623,'Worker','holidays','READ','ALLOW','ROLE','employee'),(624,'Worker','activeContract','READ','ALLOW','ROLE','employee'),(625,'Worker','activeWithInheritedRole','READ','ALLOW','ROLE','employee'),(626,'Ticket','collectionLabel','READ','ALLOW','ROLE','employee'),(628,'Ticket','expeditionPalletLabel','READ','ALLOW','ROLE','employee'),(629,'Ticket','editDiscount','WRITE','ALLOW','ROLE','artificialBoss'),(630,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesTeamBoss'),(635,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','administrative'),(636,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesPerson'),(637,'Claim','downloadFile','READ','ALLOW','ROLE','salesPerson'),(638,'Agency','seeExpired','READ','ALLOW','ROLE','artificialBoss'),(639,'Agency','seeExpired','READ','ALLOW','ROLE','logistic'),(640,'Claim','filter','READ','ALLOW','ROLE','buyer'),(641,'Claim','find','READ','ALLOW','ROLE','buyer'),(642,'Claim','findById','READ','ALLOW','ROLE','buyer'),(643,'Claim','getSummary','READ','ALLOW','ROLE','buyer'),(644,'Claim','filter','READ','ALLOW','ROLE','handmadeBoss'),(645,'Claim','find','READ','ALLOW','ROLE','handmadeBoss'),(646,'Claim','findById','READ','ALLOW','ROLE','handmadeBoss'),(647,'Claim','getSummary','READ','ALLOW','ROLE','handmadeBoss'),(648,'Claim','__get__lines','READ','ALLOW','ROLE','claimManager'),(649,'Claim','__get__lines','READ','ALLOW','ROLE','salesPerson'),(650,'Claim','getSummary','READ','ALLOW','ROLE','deliveryBoss'),(651,'Claim','findById','READ','ALLOW','ROLE','deliveryBoss'),(652,'Claim','find','READ','ALLOW','ROLE','deliveryBoss'),(653,'Claim','filter','READ','ALLOW','ROLE','deliveryBoss'),(654,'Ticket','editZone','WRITE','ALLOW','ROLE','logistic'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -206,11 +206,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-05-16 8:24:00 +-- Dump completed on 2023-06-26 8:40:03 USE `vn`; -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: vn +-- Host: db1.static.verdnatura.es Database: vn -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -250,7 +250,7 @@ UNLOCK TABLES; LOCK TABLES `bookingPlanner` WRITE; /*!40000 ALTER TABLE `bookingPlanner` DISABLE KEYS */; -INSERT INTO `bookingPlanner` VALUES (5,'2017-06-30 22:00:00','4770000002','WORLD',7,4,1),(6,'2017-06-30 22:00:00','4770000010','NATIONAL',3,1,1),(8,'2017-06-30 22:00:00','4770000021','NATIONAL',1,2,1),(9,'2017-06-30 22:00:00','4770000101','EQU',3,1,1),(11,'2017-06-30 22:00:00','4770000110','EQU',4,1,1),(12,'2017-06-30 22:00:00','4770000215','EQU',1,2,1),(13,'2017-06-30 22:00:00','4770000521','EQU',2,2,1),(15,'2017-06-30 22:00:00','4771000000','CEE',3,1,1),(16,'2017-06-30 22:00:00','4771000001','CEE',8,3,1),(19,'2017-07-05 11:54:58','4770000020','NATIONAL',7,4,1),(20,'2017-07-05 12:09:24','4771000000','CEE',1,2,1),(21,'2017-07-05 12:09:24','4771000000','CEE',7,4,1),(22,'2017-07-05 12:12:14','4770000002','WORLD',3,1,1),(23,'2017-07-05 12:12:14','4770000002','WORLD',1,2,1),(24,'2017-07-06 08:07:21','4770000002','WORLD',7,4,5),(25,'2017-07-06 08:07:21','HolandaRED','NATIONAL',3,1,5),(27,'2017-07-06 08:07:21','HolandaGEN','NATIONAL',1,2,5),(32,'2017-07-06 08:07:21','4771000000','CEE',3,1,5),(33,'2017-07-06 08:07:21','4771000001','CEE',8,3,5),(34,'2017-07-06 08:07:21','4770000020','NATIONAL',7,4,5),(35,'2017-07-06 08:07:21','4771000000','CEE',1,2,5),(36,'2017-07-06 08:07:21','4771000000','CEE',7,4,5),(37,'2017-07-06 08:07:21','4770000002','WORLD',3,1,5),(38,'2017-07-06 08:07:21','4770000002','WORLD',1,2,5),(70,'2017-07-06 08:08:48','4770000002','WORLD',7,4,30),(71,'2017-07-06 08:08:48','IGIC reduc','NATIONAL',3,1,30),(72,'2017-07-06 08:08:48','4770000020','NATIONAL',7,4,30),(73,'2017-07-06 08:08:48','IGIC gener','NATIONAL',1,2,30),(78,'2017-07-06 08:08:48','4770000020','NATIONAL',7,4,30),(79,'2017-07-06 08:08:48','4770000002','WORLD',3,1,30),(80,'2017-07-06 08:08:48','4770000002','WORLD',1,2,30),(81,'2017-07-05 22:00:00','IGIC cero','NATIONAL',5,5,30),(82,'2019-01-01 11:51:56','4770000504','EQU',5,5,1),(83,'2019-09-11 10:54:03','4770000405','EQU',6,5,1),(84,'2019-09-11 10:58:17','4770000004','NATIONAL',5,5,1),(85,'2019-09-18 22:00:00','4771000000','CEE',5,5,1),(86,'2021-10-13 22:00:00','4770000002','WORLD',5,5,1); +INSERT INTO `bookingPlanner` VALUES (5,'2017-06-30 22:00:00','4770000002','WORLD',7,4,1),(6,'2017-06-30 22:00:00','4770000010','NATIONAL',3,1,1),(8,'2017-06-30 22:00:00','4770000021','NATIONAL',1,2,1),(9,'2017-06-30 22:00:00','4770000101','EQU',3,1,1),(11,'2017-06-30 22:00:00','4770000110','EQU',4,1,1),(12,'2017-06-30 22:00:00','4770000215','EQU',1,2,1),(13,'2017-06-30 22:00:00','4770000521','EQU',2,2,1),(15,'2017-06-30 22:00:00','4771000000','CEE',3,1,1),(16,'2017-06-30 22:00:00','4771000001','CEE',8,3,1),(19,'2017-07-05 11:54:58','4770000020','NATIONAL',7,4,1),(20,'2017-07-05 12:09:24','4771000000','CEE',1,2,1),(21,'2017-07-05 12:09:24','4771000000','CEE',7,4,1),(22,'2017-07-05 12:12:14','4770000002','WORLD',3,1,1),(23,'2017-07-05 12:12:14','4770000002','WORLD',1,2,1),(24,'2017-07-06 08:07:21','4770000002','WORLD',7,4,5),(25,'2017-07-06 08:07:21','HolandaRED','NATIONAL',3,1,5),(27,'2017-07-06 08:07:21','HolandaGEN','NATIONAL',1,2,5),(32,'2017-07-06 08:07:21','4771000000','CEE',3,1,5),(33,'2017-07-06 08:07:21','4771000001','CEE',8,3,5),(34,'2017-07-06 08:07:21','4770000020','NATIONAL',7,4,5),(35,'2017-07-06 08:07:21','4771000000','CEE',1,2,5),(36,'2017-07-06 08:07:21','4771000000','CEE',7,4,5),(37,'2017-07-06 08:07:21','4770000002','WORLD',3,1,5),(38,'2017-07-06 08:07:21','4770000002','WORLD',1,2,5),(82,'2019-01-01 11:51:56','4770000504','EQU',5,5,1),(83,'2019-09-11 10:54:03','4770000405','EQU',6,5,1),(84,'2019-09-11 10:58:17','4770000004','NATIONAL',5,5,1),(85,'2019-09-18 22:00:00','4771000000','CEE',5,5,1),(86,'2021-10-13 22:00:00','4770000002','WORLD',5,5,1); /*!40000 ALTER TABLE `bookingPlanner` ENABLE KEYS */; UNLOCK TABLES; @@ -260,7 +260,7 @@ UNLOCK TABLES; LOCK TABLES `businessType` WRITE; /*!40000 ALTER TABLE `businessType` DISABLE KEYS */; -INSERT INTO `businessType` VALUES ('decoration','Decoración'),('events','Eventos'),('florist','Floristería'),('gardenCentre','Vivero'),('gardening','Jardinería'),('individual','Particular'),('mortuary','Funeraria'),('officialOrganism','Organismo oficial'),('others','Otros'),('otherSector','Profesional de otro sector'),('restoration','Restauración'),('trainingCentre','Centro de formación'),('wholesaler','Mayorista'); +INSERT INTO `businessType` VALUES ('decoration','Decoración'),('events','Eventos'),('florist','Floristería'),('gardenCentre','Vivero'),('gardening','Jardinería'),('individual','Particular'),('mortuary','Funeraria'),('officialOrganism','Organismo oficial'),('others','Otros'),('otherSector','Profesional de otro sector'),('restoration','Restauración'),('trainingCentre','Centro de formación'),('wholesaler','Mayorista'),('worker','Trabajador'); /*!40000 ALTER TABLE `businessType` ENABLE KEYS */; UNLOCK TABLES; @@ -340,7 +340,7 @@ UNLOCK TABLES; LOCK TABLES `claimReason` WRITE; /*!40000 ALTER TABLE `claimReason` DISABLE KEYS */; -INSERT INTO `claimReason` VALUES (1,'Prisas',0),(2,'Novato',0),(3,'Exceso de confianza',0),(4,'Exceso de celo',0),(5,'Indiferencia',0),(6,'Extraviado o Hurto',0),(7,'Incompetencia',0),(8,'Ubicación erronea',0),(9,'Dat.Inctos/Pak.conf',0),(10,'Datos duplicados',0),(11,'Fallo stock',0),(12,'Innovación',0),(13,'Distracción',1),(15,'Portes indebidos',0),(16,'Baja calidad',0),(17,'Defectuoso',0),(19,'Endiñado',0),(20,'Calor',0),(21,'Frio',0),(22,'Cambiado',0),(24,'Cansancio',1),(25,'Mal etiquetado',1),(26,'Cantidad malentendido',0),(30,'No revisado',1),(34,'Error fotografia',0),(40,'Fallo Personal VN',0),(41,'Fallo Personal Cliente',0),(42,'Otros',0),(43,'Precio alto',0),(44,'Abuso de confianza',0),(45,'Retraso Agencia',0),(46,'Delicado',0),(47,'Seco',0),(48,'Retraso Reparto',0),(49,'Mal Embalado',0),(50,'Tumbado',0),(51,'Enfermo/Plaga',0),(52,'Mala gestión comercial',0),(53,'Mala gestión comprador',0),(54,'A2',0); +INSERT INTO `claimReason` VALUES (1,'Prisas',0),(2,'Novato',0),(3,'Exceso de confianza',0),(4,'Exceso de celo',0),(5,'Indiferencia',0),(6,'Extraviado o Hurto',0),(7,'Incompetencia',0),(8,'Ubicación erronea',0),(9,'Dat.Inctos/Pak.conf',0),(10,'Datos duplicados',0),(11,'Fallo stock',0),(12,'Innovación',0),(13,'Distracción',1),(15,'Portes indebidos',0),(16,'Baja calidad',0),(17,'Defectuoso',0),(19,'Endiñado',0),(20,'Calor',0),(21,'Frio',0),(22,'Cambiado',0),(24,'Cansancio',1),(25,'Mal etiquetado',1),(26,'Cantidad malentendido',0),(30,'No revisado',1),(34,'Error fotografia',0),(40,'Fallo Personal VN',0),(41,'Fallo Personal Cliente',0),(42,'Otros',0),(43,'Precio alto',0),(44,'Abuso de confianza',0),(45,'Retraso Agencia',0),(46,'Delicado',0),(47,'Seco',0),(48,'Retraso Reparto',0),(49,'Mal Embalado',0),(50,'Tumbado',0),(51,'Enfermo/Plaga',0),(52,'Mala gestión comercial',0),(53,'Mala gestión comprador',0),(54,'A2',0),(55,'Entrega 48h o más',0); /*!40000 ALTER TABLE `claimReason` ENABLE KEYS */; UNLOCK TABLES; @@ -400,7 +400,7 @@ UNLOCK TABLES; LOCK TABLES `department` WRITE; /*!40000 ALTER TABLE `department` DISABLE KEYS */; -INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,100,763,0,0,0,0,29,NULL,'/',NULL,0,NULL,0,0,0,0,NULL),(22,NULL,'COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL),(31,'IT','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL),(36,NULL,'LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(37,'PROD','PRODUCCION',12,27,NULL,72,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL),(38,NULL,'SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(43,'VT','VENTAS',30,53,NULL,0,0,0,1,11,1,'/1/',NULL,1,'',1,0,0,0,NULL),(44,'management','GERENCIA',54,55,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(45,NULL,'LOGISTICA',56,57,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(46,NULL,'REPARTO',58,59,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(48,NULL,'ALMACENAJE',60,61,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(49,NULL,'PROPIEDAD',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(52,NULL,'CARGA AEREA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(54,NULL,'ORNAMENTALES',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(55,NULL,'TALLER NATURAL',70,73,14548,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,1,1,0,1118),(56,NULL,'TALLER ARTIFICIAL',71,72,8470,72,0,0,2,0,55,'/1/55/',NULL,0,NULL,0,1,1,0,1927),(58,'CMP','CAMPOS',74,77,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(59,NULL,'MANTENIMIENTO',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(60,NULL,'RECLAMACIONES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL),(61,NULL,'VNH',82,83,NULL,73,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(66,NULL,'VERDNAMADRID',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL),(69,NULL,'VERDNABARNA',86,87,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(80,NULL,'EQUIPO J VALLES',31,32,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(86,NULL,'LIMPIEZA',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(89,NULL,'COORDINACION',90,91,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(90,NULL,'TRAILER',92,93,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(92,NULL,'EQUIPO SILVERIO',33,34,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(93,NULL,'CONFECCION',94,95,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(94,NULL,'EQUIPO J BROCAL',35,36,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(95,NULL,'EQUIPO C ZAMBRANO',37,38,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(96,NULL,'EQUIPO C LOPEZ',39,40,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(115,NULL,'EQUIPO CLAUDI',41,42,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',43,44,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(124,NULL,'CONTROL INTERNO',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL),(125,NULL,'EQUIPO MIRIAM MAR',45,46,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(126,NULL,'PRESERVADO',98,99,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(130,NULL,'REVISION',25,26,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(131,NULL,'INVERNADERO',75,76,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL),(132,NULL,'EQUIPO DC',47,48,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(133,'franceTeam','EQUIPO FRANCIA',49,50,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(134,NULL,'EQUIPO RODRI',51,52,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL); +INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,104,763,0,0,0,0,30,NULL,'/',NULL,0,NULL,0,0,0,0,NULL),(22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL),(31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL),(36,NULL,'LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(37,'PROD','PRODUCCION',12,27,NULL,72,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL),(38,NULL,'SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(43,'VT','VENTAS',30,53,NULL,0,0,0,1,11,1,'/1/',NULL,1,'',1,0,0,0,NULL),(44,'management','GERENCIA',54,55,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(45,NULL,'LOGISTICA',56,57,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(46,'delivery','REPARTO',58,59,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(48,NULL,'ALMACENAJE',60,61,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(49,NULL,'PROPIEDAD',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(52,NULL,'CARGA AEREA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(54,NULL,'ORNAMENTALES',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(55,NULL,'TALLER NATURAL',70,73,14548,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,1,1,0,1118),(56,NULL,'TALLER ARTIFICIAL',71,72,8470,72,0,0,2,0,55,'/1/55/',NULL,0,NULL,0,1,1,0,1927),(58,'CMP','CAMPOS',74,77,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(59,NULL,'MANTENIMIENTO',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(60,NULL,'RECLAMACIONES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL),(61,NULL,'VNH',82,85,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(66,NULL,'VERDNAMADRID',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL),(69,NULL,'VERDNABARNA',88,89,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(80,NULL,'EQUIPO J VALLES',31,32,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(86,NULL,'LIMPIEZA',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(89,NULL,'COORDINACION',92,93,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(90,NULL,'TRAILER',83,84,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(92,NULL,'EQUIPO SILVERIO',33,34,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(93,NULL,'CONFECCION',94,95,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(94,NULL,'EQUIPO J BROCAL',35,36,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(95,NULL,'EQUIPO C ZAMBRANO',37,38,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(96,NULL,'EQUIPO C LOPEZ',39,40,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(115,NULL,'EQUIPO CLAUDI',41,42,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',43,44,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(124,NULL,'CONTROL INTERNO',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL),(125,NULL,'EQUIPO MIRIAM MAR',45,46,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(126,NULL,'PRESERVADO',98,99,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(130,NULL,'REVISION',25,26,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(131,NULL,'INVERNADERO',75,76,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL),(132,NULL,'EQUIPO DC',47,48,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(133,'franceTeam','EQUIPO FRANCIA',49,50,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(134,NULL,'EQUIPO RODRI',51,52,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(135,'routers','ENRUTADORES',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(136,'heavyVehicles','VEHICULOS PESADOS',102,103,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; @@ -512,11 +512,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-05-16 8:24:00 +-- Dump completed on 2023-06-26 8:40:09 USE `cache`; -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: cache +-- Host: db1.static.verdnatura.es Database: cache -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -548,11 +548,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-05-16 8:24:00 +-- Dump completed on 2023-06-26 8:40:10 USE `hedera`; -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: hedera +-- Host: db1.static.verdnatura.es Database: hedera -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -642,7 +642,7 @@ UNLOCK TABLES; LOCK TABLES `message` WRITE; /*!40000 ALTER TABLE `message` DISABLE KEYS */; -INSERT INTO `message` VALUES (1,'ORDER_DATE_HOLIDAY','No es posible realizar pedidos para días festivos'),(2,'ORDER_EMPTY','El pedido esta vacío'),(3,'ORDER_UNAVAILABLE','Algunos artículos ya no están disponibles, verifica las cantidades resaltadas en rojo'),(4,'SURVEY_MAX_ONE_VOTE','Solo es posible realizar un voto por encuesta'),(5,'ORDER_MAX_EXCEEDED','Has excedido el número máximo de pedidos por confirmar, por favor elimina o confirma los pedidos iniciados'),(6,'LOGIN_INCORRECT','Usuario o contraseña incorrectos. Recuerda que se hace distinción entre mayúsculas y minúsculas.'),(7,'ORDER_DATE_PAST','La fecha de su pedido debe ser mayor o igual al día de hoy'),(8,'ORDER_DATE_LAST','No es posible realizar más para hoy, por favor atrasa la fecha de tu pedido a mañana o días posteriores'),(9,'ORDER_DATE_SUNDAY','No es posible confirmar pedidos para Domingo'),(10,'ORDER_DATE_SATURATED','Estamos saturados de pedidos, por favor selecciona otra fecha de envío o recogida '),(11,'USER_DISCONNECTED','Has sido desconectado del servidor, por favor vuelve a iniciar sesión'),(12,'UNAUTH_ACTION','Acción no permitida'),(13,'ORDER_INVALID_AGENCY','La agencia de envío no es válida'),(14,'ORDER_EMPTY_ADDRESS','Selecciona una dirección de envío'),(15,'ORDER_AMOUNT_ROUNDED','Este artículo se vende agrupado y la cantidad ha sido redondeada'),(17,'orderOutdated','La configuración del pedido es incorrecta, por favor vuelve a configurarlo para continuar comprando'),(18,'orderNotOwnedByUser','El pedido pertenece a otro usuario'),(19,'orderConfirmed','El pedido ya ha sido confirmado y no puede modificarse'); +INSERT INTO `message` VALUES (1,'ORDER_DATE_HOLIDAY','No es posible realizar pedidos para días festivos'),(2,'ORDER_EMPTY','El pedido esta vacío'),(3,'ORDER_UNAVAILABLE','Algunos artículos ya no están disponibles, verifica las cantidades resaltadas en rojo'),(4,'SURVEY_MAX_ONE_VOTE','Solo es posible realizar un voto por encuesta'),(5,'ORDER_MAX_EXCEEDED','Has excedido el número máximo de pedidos por confirmar, por favor elimina o confirma los pedidos iniciados'),(6,'LOGIN_INCORRECT','Usuario o contraseña incorrectos. Recuerda que se hace distinción entre mayúsculas y minúsculas.'),(7,'ORDER_DATE_PAST','La fecha de su pedido debe ser mayor o igual al día de hoy'),(8,'ORDER_DATE_LAST','No es posible realizar más para hoy, por favor atrasa la fecha de tu pedido a mañana o días posteriores'),(9,'ORDER_DATE_SUNDAY','No es posible confirmar pedidos para Domingo'),(10,'ORDER_DATE_SATURATED','Estamos saturados de pedidos, por favor selecciona otra fecha de envío o recogida '),(11,'USER_DISCONNECTED','Has sido desconectado del servidor, por favor vuelve a iniciar sesión'),(12,'UNAUTH_ACTION','Acción no permitida'),(13,'ORDER_INVALID_AGENCY','La agencia de envío no es válida'),(14,'ORDER_EMPTY_ADDRESS','Selecciona una dirección de envío'),(15,'ORDER_AMOUNT_ROUNDED','Este artículo se vende agrupado y la cantidad ha sido redondeada'),(17,'orderOutdated','La configuración del pedido es incorrecta, por favor vuelve a configurarlo para continuar comprando'),(18,'orderNotOwnedByUser','El pedido pertenece a otro usuario'),(19,'orderConfirmed','El pedido ya ha sido confirmado y no puede modificarse'),(20,'clientNotVerified','Datos fiscales incompletos, por favor contacte con su comercial'); /*!40000 ALTER TABLE `message` ENABLE KEYS */; UNLOCK TABLES; @@ -714,11 +714,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-05-16 8:24:00 +-- Dump completed on 2023-06-26 8:40:14 USE `postgresql`; -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: postgresql +-- Host: db1.static.verdnatura.es Database: postgresql -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -760,11 +760,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-05-16 8:24:00 +-- Dump completed on 2023-06-26 8:40:15 USE `sage`; -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: sage +-- Host: db1.static.verdnatura.es Database: sage -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -782,41 +782,9 @@ USE `sage`; -- Dumping data for table `TiposIva` -- -LOCK TABLES `taxType` WRITE; -/*!40000 ALTER TABLE `taxType` DISABLE KEYS */; -INSERT INTO `sage`.`taxType` (id, code, isIntracommunity) VALUES - (2, NULL, 0), - (4, 'national4', 0), - (5, NULL, 0), - (6, NULL, 1), - (7, NULL, 1), - (8, NULL, 1), - (10, 'national10', 0), - (11, NULL, 0), - (16, 'CEEServices21', 1), - (18, NULL, 0), - (20, 'national0', 0), - (21, 'national21', 0), - (22, 'import10', 0), - (26, NULL, 0), - (90, 'import21', 0), - (91, NULL, 0), - (92, NULL, 0), - (93, NULL, 0), - (94, NULL, 0), - (100, NULL, 0), - (108, NULL, 0), - (109, NULL, 0), - (110, NULL, 1), - (111, NULL, 0), - (112, NULL, 0), - (113, 'ISP21', 0), - (114, NULL, 0), - (115, 'import4', 0); - LOCK TABLES `TiposIva` WRITE; /*!40000 ALTER TABLE `TiposIva` DISABLE KEYS */; -INSERT INTO `TiposIva` VALUES (2,0,'Operaciones no sujetas',0.0000000000,0.0000000000,0.0000000000,'','4770000020','','','','','','','95B21A93-5910-489D-83BB-C32788C9B19D','','','','','','','','','',0,0),(4,0,'I.V.A. 4%',0.0000000000,4.0000000000,0.0000000000,'4720000004','4770000004','','6310000000','','','','','9E6160D5-984E-4643-ACBC-1EBC3BF73360','','','','','','','','','',0,0),(5,0,'I.V.A. 4% y R.E. 0.5%',0.0000000000,4.0000000000,0.5000000000,'','4770000504','4770000405','','','','','','DBEFA562-63FB-4FFC-8171-64F0C6F065FF','','','','','','','','','',0,0),(6,0,'H.P. IVA 4% CEE',0.0000000000,4.0000000000,0.0000000000,'4721000004','4771000004','','','','','','','DD0ECBA8-2EF5-425E-911B-623580BADA77','','','','','','','','','',0,1),(7,0,'H.P. IVA 10% CEE',0.0000000000,10.0000000000,0.0000000000,'4721000011','4771000010','','','','','','','593208CD-6F28-4489-B6EC-907AD689EAC9','','','','','','','','','',0,1),(8,0,'H.P. IVA 21% CEE',0.0000000000,21.0000000000,0.0000000000,'4721000021','4771000021','','','','','','','27061852-9BC1-4C4F-9B6E-69970E208F23','','','','','','','','','',0,1),(10,0,'I.V.A. 10% Nacional',0.0000000000,10.0000000000,0.0000000000,'4720000011','4770000010','','6290000553','','','','','828A9D6F-5C01-4C3A-918A-B2E4482830D3','','','','','','','','','',0,0),(11,0,'I.V.A. 10% y R.E. 1,4%',0.0000000000,10.0000000000,1.4000000000,'','4770000101','4770000110','','','','','','C1F2D910-83A1-4191-A76C-8B3D7AB98348','','','','','','','','','',0,0),(16,0,'I.V.A. Adqui. servicios CEE',0.0000000000,21.0000000000,0.0000000000,'4721000015','4771000016','','','','','','','E3EDE961-CE8F-41D4-9E6C-D8BCD32275A1','','','','','','','','','',0,1),(18,0,'H.P. Iva Importación 0% ISP',0.0000000000,0.0000000000,0.0000000000,'4720000005','4770000005','','','','','','','27AD4158-2349-49C2-B53A-A4E0EFAC5D09','','','','','','','','','',0,0),(20,0,'I.V.A 0% Nacional',0.0000000000,0.0000000000,0.0000000000,'4720000000','','','','','','','','B90B0FBD-E513-4F04-9721-C873504E08DF','','','','','','','','','',0,0),(21,0,'I.V.A. 21%',0.0000000000,21.0000000000,0.0000000000,'4720000021','4770000021','4770000000','','','','','','BA8C4E28-DCFA-4F7B-AE4F-CA044626B55E','','','','','','','','','',0,0),(22,0,'IVA 10% importaciones',0.0000000000,10.0000000000,0.0000000000,'4722000010','','','','','','','','540450A8-4B41-4607-96D1-E7F296FB6933','','','','','','','','','',0,0),(26,0,'I.V.A. 21% y R.E. 5,2%',0.0000000000,21.0000000000,5.2000000000,'4720000021','4770000215','4770000521','631000000','','','','','2BC0765F-7739-49AE-A5F0-28B648B81677','','','','','','','','','',0,0),(90,0,'IVA 21% importaciones',0.0000000000,21.0000000000,0.0000000000,'4722000021','','','','','','','','EB675F91-5FF2-4E26-A31E-EEB674125945','','','','','','','','','',0,0),(91,0,'IVA 0% importaciones',0.0000000000,0.0000000000,0.0000000000,'4723000000','','','','','','','','5E5EFA56-2A99-4D54-A16B-5D818274CA18','','','','','','','','','',0,0),(92,0,'8.5% comp. ganadera o pesquera',0.0000000000,8.5000000000,0.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0,0),(93,0,'12% com. agrícola o forestal',0.0000000000,12.0000000000,0.0000000000,'4720000012','','','','','','','','267B1DDB-247F-4A71-AB95-3349FEFC5F92','','','','','','','','','',0,0),(94,0,'10,5% com. ganadera o pesquera',0.0000000000,10.5000000000,0.0000000000,'4770000000','4720000000','631000000','477000000','','','','','','','','','','','','','','',0,0),(100,0,'HP IVA SOPORTADO 5%',0.0000000000,5.0000000000,0.0000000000,'4720000055','','','','','','','','3AD36CB2-4172-4CC9-9F87-2BF2B56AAC80','','','','','','','','','',0,0),(108,0,'I.V.A. 8%',0.0000000000,8.0000000000,0.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0,0),(109,0,'I.V.A. 8% y R.E. 1%',0.0000000000,8.0000000000,1.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0,0),(110,0,'HP IVA Devengado Exento CEE',0.0000000000,0.0000000000,0.0000000000,'','4771000000','','','','','','','C605BC32-E161-42FD-83F3-3A66B1FBE399','','','','','','','','','',0,1),(111,0,'H.P. Iva Devengado Exento Ser',0.0000000000,0.0000000000,0.0000000000,'','4771000001','','','','','','','F1AEC4DC-AFE5-498E-A713-2648FFB6DA32','','','','','','','','','',0,0),(112,0,'H.P. IVA Devengado en exportac',0.0000000000,0.0000000000,0.0000000000,'','4770000002','','','','','','','F980AE74-BF75-4F4C-927F-0CCCE0DB8D15','','','','','','','','','',0,0),(113,0,'HP DEVENGADO 21 ISP ',0.0000000000,21.0000000000,0.0000000000,'4720000006','4770000006','','','','','','','728D7A76-E936-438C-AF05-3CA38FE16EA5','','','','','','','','','',0,0),(114,0,'HP.IVA NO DEDUCIBLE 10%',0.0000000000,0.0000000000,0.0000000000,'4720000026','','','','','','','','','','','','','','','','','',0,0),(115,0,'H.P. IVA Soportado Impor 4% ',0.0000000000,4.0000000000,0.0000000000,'4722000004','','','','','','','','','','','','','','','','','',0,0); +INSERT INTO `TiposIva` VALUES (2,0,'Operaciones no sujetas',0.0000000000,0.0000000000,0.0000000000,'','4770000020','','','','','','','95B21A93-5910-489D-83BB-C32788C9B19D','','','','','','','','','',0),(4,0,'I.V.A. 4%',0.0000000000,4.0000000000,0.0000000000,'4720000004','4770000004','','6310000000','','','','','9E6160D5-984E-4643-ACBC-1EBC3BF73360','','','','','','','','','',0),(5,0,'I.V.A. 4% y R.E. 0.5%',0.0000000000,4.0000000000,0.5000000000,'','4770000504','4770000405','','','','','','DBEFA562-63FB-4FFC-8171-64F0C6F065FF','','','','','','','','','',0),(6,0,'H.P. IVA 4% CEE',0.0000000000,4.0000000000,0.0000000000,'4721000004','4771000004','','','','','','','DD0ECBA8-2EF5-425E-911B-623580BADA77','','','','','','','','','',0),(7,0,'H.P. IVA 10% CEE',0.0000000000,10.0000000000,0.0000000000,'4721000011','4771000010','','','','','','','593208CD-6F28-4489-B6EC-907AD689EAC9','','','','','','','','','',0),(8,0,'H.P. IVA 21% CEE',0.0000000000,21.0000000000,0.0000000000,'4721000021','4771000021','','','','','','','27061852-9BC1-4C4F-9B6E-69970E208F23','','','','','','','','','',0),(10,0,'I.V.A. 10% Nacional',0.0000000000,10.0000000000,0.0000000000,'4720000011','4770000010','','6290000553','','','','','828A9D6F-5C01-4C3A-918A-B2E4482830D3','','','','','','','','','',0),(11,0,'I.V.A. 10% y R.E. 1,4%',0.0000000000,10.0000000000,1.4000000000,'','4770000101','4770000110','','','','','','C1F2D910-83A1-4191-A76C-8B3D7AB98348','','','','','','','','','',0),(16,0,'I.V.A. Adqui. servicios CEE',0.0000000000,21.0000000000,0.0000000000,'4721000015','4771000016','','','','','','','E3EDE961-CE8F-41D4-9E6C-D8BCD32275A1','','','','','','','','','',0),(18,0,'H.P. Iva Importación 0% ISP',0.0000000000,0.0000000000,0.0000000000,'4720000005','4770000005','','','','','','','27AD4158-2349-49C2-B53A-A4E0EFAC5D09','','','','','','','','','',0),(20,0,'I.V.A 0% Nacional',0.0000000000,0.0000000000,0.0000000000,'4720000000','','','','','','','','B90B0FBD-E513-4F04-9721-C873504E08DF','','','','','','','','','',0),(21,0,'I.V.A. 21%',0.0000000000,21.0000000000,0.0000000000,'4720000021','4770000021','4770000000','','','','','','BA8C4E28-DCFA-4F7B-AE4F-CA044626B55E','','','','','','','','','',0),(22,0,'IVA 10% importaciones',0.0000000000,10.0000000000,0.0000000000,'4722000010','','','','','','','','540450A8-4B41-4607-96D1-E7F296FB6933','','','','','','','','','',0),(26,0,'I.V.A. 21% y R.E. 5,2%',0.0000000000,21.0000000000,5.2000000000,'4720000021','4770000215','4770000521','631000000','','','','','2BC0765F-7739-49AE-A5F0-28B648B81677','','','','','','','','','',0),(90,0,'IVA 21% importaciones',0.0000000000,21.0000000000,0.0000000000,'4722000021','','','','','','','','EB675F91-5FF2-4E26-A31E-EEB674125945','','','','','','','','','',0),(91,0,'IVA 0% importaciones',0.0000000000,0.0000000000,0.0000000000,'4723000000','','','','','','','','5E5EFA56-2A99-4D54-A16B-5D818274CA18','','','','','','','','','',0),(92,0,'8.5% comp. ganadera o pesquera',0.0000000000,8.5000000000,0.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0),(93,0,'12% com. agrícola o forestal',0.0000000000,12.0000000000,0.0000000000,'4720000012','','','','','','','','267B1DDB-247F-4A71-AB95-3349FEFC5F92','','','','','','','','','',0),(94,0,'10,5% com. ganadera o pesquera',0.0000000000,10.5000000000,0.0000000000,'4770000000','4720000000','631000000','477000000','','','','','','','','','','','','','','',0),(100,0,'HP IVA SOPORTADO 5%',0.0000000000,5.0000000000,0.0000000000,'4720000055','','','','','','','','3AD36CB2-4172-4CC9-9F87-2BF2B56AAC80','','','','','','','','','',0),(108,0,'I.V.A. 8%',0.0000000000,8.0000000000,0.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0),(109,0,'I.V.A. 8% y R.E. 1%',0.0000000000,8.0000000000,1.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0),(110,0,'HP IVA Devengado Exento CEE',0.0000000000,0.0000000000,0.0000000000,'','4771000000','','','','','','','C605BC32-E161-42FD-83F3-3A66B1FBE399','','','','','','','','','',0),(111,0,'H.P. Iva Devengado Exento Ser',0.0000000000,0.0000000000,0.0000000000,'','4771000001','','','','','','','F1AEC4DC-AFE5-498E-A713-2648FFB6DA32','','','','','','','','','',0),(112,0,'H.P. IVA Devengado en exportac',0.0000000000,0.0000000000,0.0000000000,'','4770000002','','','','','','','F980AE74-BF75-4F4C-927F-0CCCE0DB8D15','','','','','','','','','',0),(113,0,'HP DEVENGADO 21 ISP ',0.0000000000,21.0000000000,0.0000000000,'4720000006','4770000006','','','','','','','728D7A76-E936-438C-AF05-3CA38FE16EA5','','','','','','','','','',0),(114,0,'HP.IVA NO DEDUCIBLE 10%',0.0000000000,0.0000000000,0.0000000000,'4720000026','','','','','','','','','','','','','','','','','',0),(115,0,'H.P. IVA Soportado Impor 4% ',0.0000000000,4.0000000000,0.0000000000,'4722000004','','','','','','','','','','','','','','','','','',0); /*!40000 ALTER TABLE `TiposIva` ENABLE KEYS */; UNLOCK TABLES; @@ -839,6 +807,16 @@ LOCK TABLES `TiposRetencion` WRITE; INSERT INTO `TiposRetencion` VALUES (1,'RETENCION ESTIMACION OBJETIVA',1.0000000000,'4730000000','4751000000',NULL,NULL,NULL,'03811652-0F3A-44A1-AE1C-B19624525D7F'),(2,'ACTIVIDADES AGRICOLAS O GANADERAS',2.0000000000,'4730000000','4751000000',NULL,NULL,NULL,'F3F91EF3-FED6-444D-B03C-75B639D13FB4'),(9,'ACTIVIDADES PROFESIONALES 2 PRIMEROS AÑOS',9.0000000000,'4730000000','4751000000',NULL,NULL,NULL,'73F95642-E951-4C91-970A-60C503A4792B'),(15,'ACTIVIDADES PROFESIONALES',15.0000000000,'4730000000','4751000000','6',NULL,NULL,'F6BDE0EE-3B01-4023-8FFF-A73AE9AC50D7'),(19,'ARRENDAMIENTO Y SUBARRENDAMIENTO',19.0000000000,'4730000000','4751000000','8',NULL,NULL,'09B033AE-16E5-4057-8D4A-A7710C8A4FB9'); /*!40000 ALTER TABLE `TiposRetencion` ENABLE KEYS */; UNLOCK TABLES; + +-- +-- Dumping data for table `taxType` +-- + +LOCK TABLES `taxType` WRITE; +/*!40000 ALTER TABLE `taxType` DISABLE KEYS */; +INSERT INTO `taxType` VALUES (2,NULL,0),(4,'national4',0),(5,NULL,0),(6,NULL,1),(7,NULL,1),(8,NULL,1),(10,'national10',0),(11,NULL,0),(16,'CEEServices21',1),(18,NULL,0),(20,'national0',0),(21,'national21',0),(22,'import10',0),(26,NULL,0),(90,'import21',0),(91,NULL,0),(92,NULL,0),(93,NULL,0),(94,NULL,0),(100,NULL,0),(108,NULL,0),(109,NULL,0),(110,NULL,1),(111,NULL,0),(112,NULL,0),(113,'ISP21',0),(114,NULL,0),(115,'import4',0); +/*!40000 ALTER TABLE `taxType` ENABLE KEYS */; +UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -848,4 +826,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-05-16 8:24:00 +-- Dump completed on 2023-06-26 8:40:15 diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 35b0ba0af..46bccf9dc 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -77,9 +77,10 @@ INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `role`,`active`,`email`, ` ORDER BY id; INSERT INTO `account`.`account`(`id`) - SELECT id - FROM `account`.`user` - WHERE role <> 2; + SELECT `u`.`id` + FROM `account`.`user` `u` + JOIN `account`.`role` `r` ON `u`.`role` = `r`.`id` + WHERE `r`.`name` <> 'customer'; INSERT INTO `vn`.`educationLevel` (`id`, `name`) VALUES @@ -146,17 +147,17 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`) (3, 'GBP', 'Libra', 1), (4, 'JPY', 'Yen Japones', 1); -INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`, `politicalCountryFk`) +INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`) VALUES - (1, 'España', 1, 'ES', 1, 24, 4, 0, 1, 1), - (2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1, 2), - (3, 'Alemania', 1, 'DE', 1, 22, 4, 0, 1, 3), - (4, 'Rumania', 1, 'RO', 1, 24, 4, 0, 1, 4), - (5, 'Holanda', 1, 'NL', 1, 18, 4, 0, 1, 5), - (8, 'Portugal', 1, 'PT', 1, 27, 4, 0, 1, 8), - (13,'Ecuador', 0, 'EC', 1, 24, 2, 1, 2, 13), - (19,'Francia', 1, 'FR', 1, 27, 4, 0, 1, 19), - (30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2, 30); + (1, 'España', 1, 'ES', 1, 24, 4, 0, 1), + (2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1), + (3, 'Alemania', 1, 'DE', 1, 22, 4, 0, 1), + (4, 'Rumania', 1, 'RO', 1, 24, 4, 0, 1), + (5, 'Holanda', 1, 'NL', 1, 18, 4, 0, 1), + (8, 'Portugal', 1, 'PT', 1, 27, 4, 0, 1), + (13,'Ecuador', 0, 'EC', 1, 24, 2, 1, 2), + (19,'Francia', 1, 'FR', 1, 27, 4, 0, 1), + (30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2); INSERT INTO `vn`.`warehouseAlias`(`id`, `name`) VALUES @@ -552,10 +553,13 @@ INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `pr INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`) VALUES - (1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), - (2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), - (442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), - (1381, 'Ornamentales', 'Ornamentales', 7185000440, 1, '03815934E', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); + (1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), + (2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), + (69, 'Packaging', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), + (442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), + (567, 'Holland', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), + (791, 'Bros SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), + (1381, 'Ornamentales', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`) VALUES @@ -701,12 +705,12 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`) VALUES - (1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, 'T1111111', 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T1111111', 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T2222222', 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), - (4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T3333333', 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)), - (5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, 'T4444444', 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)), - (6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, 'A1111111', 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), + (4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)), + (5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)), + (6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), (7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE()), (8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE()), (9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE()), @@ -2574,6 +2578,26 @@ INSERT INTO `vn`.`ticketRecalc`(`ticketFk`) CALL `vn`.`ticket_doRecalc`(); +UPDATE `vn`.`ticket` + SET refFk = 'T1111111' + WHERE id IN (1,2); + +UPDATE `vn`.`ticket` + SET refFk = 'T2222222' + WHERE id = 3; + +UPDATE `vn`.`ticket` + SET refFk = 'T3333333' + WHERE id = 4; + +UPDATE `vn`.`ticket` + SET refFk = 'T4444444' + WHERE id = 5; + +UPDATE `vn`.`ticket` + SET refFk = 'A1111111' + WHERE id = 6; + INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) VALUES (1, 1, 1), @@ -2581,7 +2605,7 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) (3, 6, 5), (4, 7, 1); -INSERT INTO `vn`.`expeditionTruck` (`id`, `ETD`, `description`) +INSERT INTO `vn`.`expeditionTruck` (`id`, `eta`, `description`) VALUES (1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet'); diff --git a/db/dump/structure.sql b/db/dump/structure.sql index b07e88fde..ee5fb40a1 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -1,6 +1,7 @@ -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: account + +-- Host: db1.static.verdnatura.es Database: account -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -76,7 +77,6 @@ BEGIN SELECT `name` FROM `user` WHERE id = NEW.id; END */;; DELIMITER ; - /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; @@ -114,6 +114,12 @@ DELIMITER ;; AFTER DELETE ON `account` FOR EACH ROW BEGIN + INSERT INTO userLog + SET `action` = 'delete', + `changedModel` = 'Account', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); + INSERT IGNORE INTO userSync (`name`) SELECT `name` FROM `user` WHERE id = OLD.id; END */;; @@ -243,7 +249,6 @@ BEGIN SET NEW.editorFk = account.myUser_getId(); END */;; DELIMITER ; - /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; @@ -347,7 +352,6 @@ CREATE TABLE `mailConfig` ( -- Table structure for table `mailForward` -- - DROP TABLE IF EXISTS `mailForward`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -397,7 +401,30 @@ BEGIN SET NEW.editorFk = account.myUser_getId(); END */;; DELIMITER ; - +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `account`.`mailForward_afterDelete` + AFTER DELETE ON `mailForward` + FOR EACH ROW +BEGIN + INSERT INTO userLog + SET `action` = 'delete', + `changedModel` = 'MailForward', + `changedModelId` = OLD.account, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; @@ -462,7 +489,7 @@ DROP TABLE IF EXISTS `role`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `role` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(14) NOT NULL COMMENT 'MySQL doesn''t support more than 14 chars for proxied user names', + `name` varchar(79) NOT NULL COMMENT 'MariaDB doesn''t support more than 79 chars for proxied user names', `description` varchar(100) DEFAULT NULL, `hasLogin` tinyint(3) unsigned NOT NULL DEFAULT 1, `created` timestamp NOT NULL DEFAULT current_timestamp(), @@ -661,17 +688,18 @@ CREATE TABLE `roleLog` ( `action` set('insert','update','delete','select') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Role','RoleInherit') NOT NULL DEFAULT 'Role', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), + KEY `roleLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `roleLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `roleLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `roleLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -720,7 +748,7 @@ CREATE TABLE `user` ( `realm` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `name` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `nickname` varchar(127) NOT NULL, - `bcryptPassword` varchar(512) DEFAULT NULL, + `password` varchar(512) DEFAULT NULL, `role` int(10) unsigned NOT NULL DEFAULT 2, `active` tinyint(1) NOT NULL DEFAULT 1, `email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, @@ -731,11 +759,12 @@ CREATE TABLE `user` ( `created` timestamp NOT NULL DEFAULT current_timestamp(), `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `image` varchar(255) DEFAULT NULL, - `password` char(64) NOT NULL COMMENT 'Deprecated', + `password__` char(64) NOT NULL COMMENT 'Deprecated', `recoverPass` tinyint(3) unsigned NOT NULL DEFAULT 1 COMMENT 'Deprecated', `sync` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Deprecated', `hasGrant` tinyint(1) NOT NULL, `editorFk` int(10) unsigned DEFAULT NULL, + `passExpired` date DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), UNIQUE KEY `mail` (`email`), @@ -799,11 +828,11 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `account`.`user_beforeUpdate` BEFORE UPDATE ON `user` @@ -816,7 +845,6 @@ BEGIN END IF; IF !(NEW.`password` <=> OLD.`password`) THEN - SET NEW.bcryptPassword = NULL; SET NEW.lastPassChange = util.VN_NOW(); END IF; END */;; @@ -851,7 +879,34 @@ BEGIN END */;; DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `account`.`user_afterDelete` + AFTER DELETE ON `user` + FOR EACH ROW +BEGIN + INSERT INTO userLog + SET `action` = 'delete', + `changedModel` = 'User', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); + CALL hedera.image_unref('user', OLD.image); + + INSERT IGNORE INTO userSync SET `name` = OLD.`name`; +END */;; +DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; @@ -885,17 +940,18 @@ CREATE TABLE `userLog` ( `action` set('insert','update','delete','select') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('VnUser','Account','MailAliasAccount','MailForward') NOT NULL DEFAULT 'VnUser', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), + KEY `userLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `userLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1327,31 +1383,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `myUser_changePassword` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `myUser_changePassword`(vOldPassword VARCHAR(255), vPassword VARCHAR(255)) -BEGIN -/** - * Changes the current user password. - * - * @param vOldPassword The current password - * @param vPassword The new password - */ - CALL user_changePassword(myUser_getId(), vOldPassword, vPassword); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `myUser_login` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1485,31 +1516,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `myUser_restorePassword` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `myUser_restorePassword`(vVerificationToken VARCHAR(255), vPassword VARCHAR(255)) -BEGIN -/** - * Changes the current user password using recovery token. - * - * @param vVerificationToken The current password - * @param vPassword The new password - */ - CALL user_restorePassword(myUser_getId(), vVerificationToken, vPassword); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `role_checkName` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2254,45 +2260,6 @@ BEGIN FLUSH PRIVILEGES; END ;; DELIMITER ; - -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `user_changePassword` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `user_changePassword`(vSelf INT, vOldPassword VARCHAR(255), vPassword VARCHAR(255)) -BEGIN -/** - * Changes the user password. - * - * @param vSelf The user id - * @param vOldPassword The current password - * @param vPassword The new password - */ - DECLARE vPasswordOk BOOL; - DECLARE vUserName VARCHAR(255); - - SELECT `password` = MD5(vOldPassword), `name` - INTO vPasswordOk, vUserName - FROM user WHERE id = vSelf; - - IF NOT vPasswordOk THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Invalid password'; - END IF; - - CALL user_setPassword(vSelf, vPassword); -END ;; -DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; @@ -2393,76 +2360,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `user_restorePassword` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `user_restorePassword`(vSelf INT, vVerificationToken VARCHAR(255), vPassword VARCHAR(255)) -BEGIN -/** - * Changes the user password using recovery token. - * - * @param vSelf The user id - * @param vVerificationToken The verification token - * @param vPassword The new password - */ - DECLARE vTokenVerified BOOL; - DECLARE vUserName VARCHAR(255); - - SELECT verificationToken = vVerificationToken, `name` - INTO vTokenVerified, vUserName - FROM user WHERE id = vSelf; - - IF NOT vTokenVerified THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Invalid verification token'; - END IF; - - CALL user_setPassword(vSelf, vPassword); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `user_setPassword` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `user_setPassword`(vSelf INT, vPassword VARCHAR(255)) -BEGIN -/** - * Change the password of the passed as a parameter. Only administrators should - * have execute privileges on the procedure since it does not request the user's - * current password. - * - * @param vSelf The user id - * @param vPassword New password - */ - CALL user_checkPassword(vPassword); - - UPDATE user SET - `password` = MD5(vPassword), - `verificationToken` = NULL - WHERE id = vSelf; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Current Database: `bs` @@ -3008,16 +2905,16 @@ CREATE TABLE `sale` ( `dated` date NOT NULL, `typeFk` smallint(5) unsigned NOT NULL, `clientFk` int(11) NOT NULL DEFAULT 1, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `margin` decimal(10,3) NOT NULL DEFAULT 0.000, PRIMARY KEY (`saleFk`), KEY `tip_to_tip_idx` (`typeFk`), KEY `clientes_bs_ventas_idx` (`clientFk`), KEY `empresa_bs_ventas_idx` (`companyFk`), KEY `fecha_bs` (`dated`,`clientFk`), + CONSTRAINT `saleCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `vn`.`company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sale_FK` FOREIGN KEY (`saleFk`) REFERENCES `vn`.`sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sale_FK_1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `sale_FK_2` FOREIGN KEY (`companyFk`) REFERENCES `vn`.`company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sale_FK_3` FOREIGN KEY (`typeFk`) REFERENCES `vn`.`itemType` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3320,7 +3217,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2022-02-08 04:14:00' ON COMPLETION PRESERVE ENABLE DO CALL bs.nightTask_launchAll */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2022-02-08 04:14:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL bs.nightTask_launchAll */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -5978,7 +5875,7 @@ CREATE TABLE `cache_valid` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `valid` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORYDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6102,7 +5999,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `cacheCalc_clean` ON SCHEDULE EVERY 30 MINUTE STARTS '2022-01-28 09:29:18' ON COMPLETION NOT PRESERVE ENABLE DO CALL cacheCalc_clean */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `cacheCalc_clean` ON SCHEDULE EVERY 30 MINUTE STARTS '2022-01-28 09:29:18' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL cacheCalc_clean */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -6120,7 +6017,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `cache_clean` ON SCHEDULE EVERY 5 MINUTE STARTS '2022-01-28 09:29:18' ON COMPLETION NOT PRESERVE ENABLE DO CALL cache_clean */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `cache_clean` ON SCHEDULE EVERY 5 MINUTE STARTS '2022-01-28 09:29:18' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL cache_clean */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -7038,8 +6935,7 @@ proc: BEGIN CALL `cache`.stock_refresh(false); - DROP TEMPORARY TABLE IF EXISTS vn2008.tmp_item; - CREATE TEMPORARY TABLE vn2008.tmp_item + CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible (PRIMARY KEY (item_id)) ENGINE = MEMORY SELECT item_id, amount stock, amount visible FROM `cache`.stock @@ -7050,11 +6946,11 @@ proc: BEGIN DELETE FROM visible WHERE calc_id = v_calc; INSERT INTO visible (calc_id, item_id,visible) - SELECT v_calc, item_id, visible FROM vn2008.tmp_item; + SELECT v_calc, item_id, visible FROM tmp.itemVisible; CALL cache_calc_end (v_calc); - DROP TEMPORARY TABLE vn2008.tmp_item; + DROP TEMPORARY TABLE tmp.itemVisible; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8392,7 +8288,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `floramondo` ON SCHEDULE EVERY 6 MINUTE STARTS '2022-01-28 09:52:45' ON COMPLETION NOT PRESERVE ENABLE DO CALL edi.floramondo_offerRefresh() */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `floramondo` ON SCHEDULE EVERY 6 MINUTE STARTS '2022-01-28 09:52:45' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL edi.floramondo_offerRefresh() */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -9544,70 +9440,87 @@ proc: BEGIN SET vLastInserted := util.VN_NOW(); -- Inserta la oferta - INSERT INTO vn.buy( entryFk, - itemFk, - quantity, - buyingValue, - stickers, - packing, - `grouping`, - groupingMode, - packageFk, - deliveryFk) - SELECT wf.entryFk, - i.id, - o.NumberOfUnits * o.NumberOfItemsPerCask quantity, - o.Price, - o.NumberOfUnits etiquetas, - o.NumberOfItemsPerCask packing, - GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask `grouping`, - 2, -- Obliga al Packing - o.embalageCode, - o.diId - FROM edi.offer o - JOIN vn.item i ON i.supplyResponseFk = o.srId - JOIN edi.warehouseFloramondo wf - JOIN vn.packaging p ON p.id - LIKE o.embalageCode - LEFT JOIN vn.buy b ON b.itemFk = i.id - AND b.entryFk = wf.entryFk - WHERE b.id IS NULL; -- Quitar esta linea y mirar de crear los packages a tiempo REAL + INSERT INTO vn.buy ( + entryFk, + itemFk, + quantity, + buyingValue, + stickers, + packing, + `grouping`, + groupingMode, + packageFk, + deliveryFk) + SELECT wf.entryFk, + i.id, + o.NumberOfUnits * o.NumberOfItemsPerCask quantity, + o.Price, + o.NumberOfUnits etiquetas, + o.NumberOfItemsPerCask packing, + GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask `grouping`, + 2, -- Obliga al Packing + o.embalageCode, + o.diId + FROM edi.offer o + JOIN vn.item i ON i.supplyResponseFk = o.srId + JOIN edi.warehouseFloramondo wf + JOIN vn.packaging p ON p.id + LIKE o.embalageCode + LEFT JOIN vn.buy b ON b.itemFk = i.id + AND b.entryFk = wf.entryFk + WHERE b.id IS NULL; -- Quitar esta linea y mirar de crear los packages a tiempo REAL - DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; - - CREATE TEMPORARY TABLE tmp.buyRecalc - SELECT b.id - FROM vn.buy b - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - WHERE b.created >= vLastInserted; - - CALL vn.buy_recalcPrices(); - - UPDATE edi.offerList o - JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total - FROM vn.buy b + INSERT INTO vn.itemCost( + itemFk, + warehouseFk, + cm3, + cm3delivery) + SELECT b.itemFk, + wf.warehouseFk, + @cm3 := vn.buy_getUnitVolume(b.id), + IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3) + FROM warehouseFloramondo wf + JOIN vn.volumeConfig vc + JOIN vn.buy b ON b.entryFk = wf.entryFk JOIN vn.item i ON i.id = b.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.warehouse w ON w.id = wf.warehouseFk - WHERE w.name = 'VNH' - AND b.quantity > 0 - GROUP BY sr.vmpID) sub ON o.supplier = sub.name - SET o.vnh = sub.total; + LEFT JOIN vn.itemCost ic ON ic.itemFk = b.itemFk + AND ic.warehouseFk = wf.warehouseFk + WHERE (ic.cm3 IS NULL OR ic.cm3 = 0) + ON DUPLICATE KEY UPDATE cm3 = @cm3, cm3delivery = IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3); - UPDATE edi.offerList o - JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total - FROM vn.buy b - JOIN vn.item i ON i.id = b.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.warehouse w ON w.id = wf.warehouseFk - WHERE w.name = 'ALGEMESI' - AND b.quantity > 0 - GROUP BY sr.vmpID) sub ON o.supplier = sub.name - SET o.algemesi = sub.total; + CREATE OR REPLACE TEMPORARY TABLE tmp.buyRecalc + SELECT b.id + FROM vn.buy b + JOIN warehouseFloramondo wf ON wf.entryFk = b.entryFk + WHERE b.created >= vLastInserted; + + CALL vn.buy_recalcPrices(); + + UPDATE edi.offerList o + JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total + FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk + JOIN vn.warehouse w ON w.id = wf.warehouseFk + WHERE w.name = 'VNH' + AND b.quantity > 0 + GROUP BY sr.vmpID) sub ON o.supplier = sub.name + SET o.vnh = sub.total; + + UPDATE edi.offerList o + JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total + FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk + JOIN vn.warehouse w ON w.id = wf.warehouseFk + WHERE w.name = 'ALGEMESI' + AND b.quantity > 0 + GROUP BY sr.vmpID) sub ON o.supplier = sub.name + SET o.algemesi = sub.total; END IF; DROP TEMPORARY TABLE @@ -10312,6 +10225,36 @@ CREATE TABLE `message` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `messageI18n` +-- + +DROP TABLE IF EXISTS `messageI18n`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `messageI18n` ( + `code` char(35) NOT NULL, + `lang` char(2) NOT NULL, + `description` varchar(255) NOT NULL, + PRIMARY KEY (`code`,`lang`), + CONSTRAINT `messageI18nFk` FOREIGN KEY (`code`) REFERENCES `message` (`code`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `messageL10n` +-- + +DROP TABLE IF EXISTS `messageL10n`; +/*!50001 DROP VIEW IF EXISTS `messageL10n`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `messageL10n` ( + `code` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `metatag` -- @@ -10830,15 +10773,15 @@ CREATE TABLE `orderConfig` ( `guestMethod` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `guestAgencyFk` int(11) NOT NULL, `reserveTime` time NOT NULL, - `defaultCompanyFk` smallint(6) unsigned DEFAULT NULL, + `defaultCompanyFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `employeeFk` (`employeeFk`), KEY `guestAgencyFk` (`guestAgencyFk`), KEY `defaultCompanyFk` (`defaultCompanyFk`), KEY `guestMethod` (`guestMethod`), KEY `defaultAgencyFk` (`defaultAgencyFk`), + CONSTRAINT `orderConfigCompany_Fk` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderConfig_ibfk_1` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `orderConfig_ibfk_2` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderConfig_ibfk_3` FOREIGN KEY (`guestAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderConfig_ibfk_4` FOREIGN KEY (`defaultAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -11436,7 +11379,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `order_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2019-08-29 14:18:04' ON COMPLETION PRESERVE ENABLE DO CALL order_doRecalc */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `order_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2019-08-29 14:18:04' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL order_doRecalc */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -12605,7 +12548,7 @@ BEGIN FROM myTicket t WHERE shipped BETWEEN TIMESTAMP(vFrom) AND TIMESTAMP(vTo, '23:59:59'); - CALL vn.ticketGetTotal; + CALL vn.ticketGetTotal(NULL); SELECT v.id, IFNULL(v.landed, v.shipped) landed, v.shipped, v.companyFk, v.nickname, @@ -13217,6 +13160,7 @@ BEGIN DECLARE vIsLogifloraItem BOOL; DECLARE vOldQuantity INT; DECLARE vNewQuantity INT; + DECLARE vIsTaxDataChecked BOOL; DECLARE cDates CURSOR FOR SELECT zgs.shipped, r.warehouse_id @@ -13245,14 +13189,20 @@ BEGIN END; -- Carga los datos del pedido - SELECT o.date_send, o.address_id, o.note, - a.clientFk, o.company_id, o.agency_id - INTO vDelivery, vAddress, vNotes, - vClientId, vCompanyId, vAgencyModeId + SELECT o.date_send, o.address_id, o.note, a.clientFk, + o.company_id, o.agency_id, c.isTaxDataChecked + INTO vDelivery, vAddress, vNotes, vClientId, + vCompanyId, vAgencyModeId, vIsTaxDataChecked FROM hedera.`order` o JOIN vn.address a ON a.id = o.address_id + JOIN vn.client c ON c.id = a.clientFk WHERE o.id = vSelf; + -- Verifica si el cliente tiene los datos comprobados + IF NOT vIsTaxDataChecked THEN + CALL util.throw ('clientNotVerified'); + END IF; + -- Carga las fechas de salida de cada almacen CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE); @@ -15463,26 +15413,6 @@ CREATE TABLE `incometype_employee__` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='@deprecated 2023-03-15'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `journey` --- - -DROP TABLE IF EXISTS `journey`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `journey` ( - `journey_id` int(11) NOT NULL AUTO_INCREMENT, - `day_id` smallint(6) NOT NULL DEFAULT 1 COMMENT 'Lunes = 1 \nDomingo = 7', - `start` time DEFAULT NULL, - `end` time DEFAULT NULL, - `business_id` int(11) NOT NULL, - PRIMARY KEY (`journey_id`), - UNIQUE KEY `day_id` (`day_id`,`start`,`end`,`business_id`), - KEY `journey_business_id_idx` (`business_id`), - CONSTRAINT `journey_business_id` FOREIGN KEY (`business_id`) REFERENCES `vn`.`business` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `labour_agreement` -- @@ -15620,18 +15550,6 @@ CREATE TABLE `ClavesOperacion` ( -- -- Table structure for table `Municipios` -- -DROP TABLE IF EXISTS `taxType`; - -CREATE TABLE `taxType` ( - id INT(11) NOT NULL, - code VARCHAR(25) DEFAULT NULL NULL, - isIntracommunity TINYINT(1) DEFAULT FALSE NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `taxType_UN` (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Coincidencia del id con Sage.TiposIVA.CodigoIva(propia de Sage), en ningún caso vincular mediate FK'; - -ALTER TABLE `sage`.`taxType` ADD CONSTRAINT taxType_PK PRIMARY KEY IF NOT EXISTS (id); -ALTER TABLE `sage`.`taxType` ADD CONSTRAINT taxType_UN UNIQUE KEY IF NOT EXISTS (code); DROP TABLE IF EXISTS `Municipios`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -15724,7 +15642,6 @@ CREATE TABLE `TiposIva` ( `CuentaIVARecCajaPu` varchar(15) NOT NULL DEFAULT '', `CuentaIVARecCajaVen` varchar(15) NOT NULL DEFAULT '', `IGICImplicito` smallint(6) NOT NULL DEFAULT 0, - `isIntracommunity` tinyint(2) NOT NULL DEFAULT 0, PRIMARY KEY (`CodigoIva`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -15927,25 +15844,6 @@ CREATE TABLE `config` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `invoiceInList` --- - -DROP TABLE IF EXISTS `invoiceInList`; -/*!50001 DROP VIEW IF EXISTS `invoiceInList`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `invoiceInList` ( - `id` tinyint NOT NULL, - `supplierRef` tinyint NOT NULL, - `serial` tinyint NOT NULL, - `supplierFk` tinyint NOT NULL, - `issued` tinyint NOT NULL, - `isVatDeductible` tinyint NOT NULL, - `serialNumber` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `invoiceType` -- @@ -16309,6 +16207,22 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `taxType` +-- + +DROP TABLE IF EXISTS `taxType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `taxType` ( + `id` int(11) NOT NULL, + `code` varchar(25) DEFAULT NULL, + `isIntracommunity` tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE KEY `taxType_UN` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Coincidencia del id con Sage.TiposIVA.CodigoIva(propia de Sage), en ningún caso vincular mediate FK'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Dumping events for database 'sage' -- @@ -16357,16 +16271,20 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `accountingMovements_add`(vYear INT, vCompanyFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `accountingMovements_add`( + vYear INT, + vCompanyFk INT +) BEGIN /** - * Traslada la info de contabilidad generada en base a vn.XDiario a la tabla sage.movConta para poder ejecutar posteriormente el proceso de importación de datos de SQL Server + * Traslada la info de contabilidad generada en base a vn.XDiario a la tabla sage.movConta + * para poder ejecutar posteriormente el proceso de importación de datos de SQL Server * Solo traladará los asientos marcados con el campo vn.XDiario.enlazadoSage = FALSE * @vYear Año contable del que se quiere trasladar la información * @vCompanyFk Empresa de la que se quiere trasladar datos @@ -16396,17 +16314,17 @@ BEGIN FROM TiposTransacciones WHERE Transaccion = 'Import. bienes y serv. corrientes pdte. liquidar'; - SELECT CodigoIva INTO vTaxImportFk - FROM TiposIva - WHERE Iva = 'IVA 21% importaciones'; + SELECT id INTO vTaxImportFk + FROM taxType + WHERE code = 'import21'; - SELECT CodigoIva INTO vTaxImportReducedFk - FROM TiposIva - WHERE Iva = 'IVA 10% importaciones'; + SELECT id INTO vTaxImportReducedFk + FROM taxType + WHERE code = 'import10'; - SELECT CodigoIva INTO vTaxImportSuperReducedFk - FROM TiposIva - WHERE Iva = 'H.P. IVA Soportado Impor 4%'; + SELECT id INTO vTaxImportSuperReducedFk + FROM taxType + WHERE code = 'import4'; SELECT CodigoTransaccion INTO vTransactionExportFk FROM TiposTransacciones @@ -16419,7 +16337,7 @@ BEGIN SELECT codeSage INTO vInvoiceTypeInformativeCode FROM invoiceType WHERE code ='informative'; - SELECT CAST(CONCAT(vYear, '-01-01') AS DATETIME), util.dayEnd(CAST(CONCAT(vYear, '-12-31') AS DATE)) + SELECT MAKEDATE(vYear, 1), MAKEDATE(vYear + 1, 1) - INTERVAL 1 DAY INTO vDatedFrom, vDatedTo; TRUNCATE movContaIVA; @@ -16524,7 +16442,8 @@ BEGIN YEAR(x.FECHA) Ejercicio, company_getCode(vCompanyFk) AS CodigoEmpresa, x.ASIEN Asiento, - IF(EURODEBE <> 0 OR (EURODEBE = 0 AND EUROHABER IS NULL), 'D', 'H') CargoAbono, + IF(EURODEBE <> 0 OR (EURODEBE = 0 AND EUROHABER IS NULL), + 'D', 'H') CargoAbono, x.SUBCTA CodigoCuenta, x.CONTRA Contrapartida, x.FECHA FechaAsiento, @@ -16671,7 +16590,8 @@ BEGIN -- DUAS UPDATE movConta mci JOIN vn.XDiario x ON x.ASIEN = mci.Asiento - JOIN TiposIva ti ON ti.CodigoIva = x.IVA + JOIN TiposIva ti ON ti.PorcentajeIva = x.IVA + JOIN taxType tt ON tt.id = ti.CodigoIva JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8mb3_unicode_ci SET mci.BaseIva1 = x.BASEEURO, mci.PorIva1 = x.IVA, @@ -16682,15 +16602,18 @@ BEGIN mci.FechaFacturaOriginal = x.FECHA_EX, mci.SuFacturaNo = x.FACTURAEX, mci.FechaOperacion = x.FECHA_OP, - mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) + mci.ImporteFactura = mci.ImporteFactura + + x.BASEEURO + + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) WHERE pm.description = 'HP Iva pendiente' AND mci.enlazadoSage = FALSE AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci - AND ti.Iva = 'I.V.A. 10% Nacional'; + AND tt.code = 'national10'; UPDATE movConta mci JOIN vn.XDiario x ON x.ASIEN = mci.Asiento - JOIN TiposIva ti ON ti.CodigoIva = x.IVA + JOIN TiposIva ti ON ti.PorcentajeIva = x.IVA + JOIN taxType tt ON tt.id = ti.CodigoIva JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8mb3_unicode_ci SET mci.BaseIva2 = x.BASEEURO , mci.PorIva2 = x.IVA, @@ -16698,15 +16621,18 @@ BEGIN mci.CodigoTransaccion2 = vDuaTransactionFk , mci.CodigoIva2 = vTaxImportFk, mci.IvaDeducible2 = TRUE, - mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) + mci.ImporteFactura = mci.ImporteFactura + + x.BASEEURO + + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) WHERE pm.description = 'HP Iva pendiente' AND mci.enlazadoSage = FALSE AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci - AND ti.Iva = 'I.V.A. 21%'; + AND tt.code = 'national21'; UPDATE movConta mci JOIN vn.XDiario x ON x.ASIEN = mci.Asiento - JOIN TiposIva ti ON ti.CodigoIva = x.IVA + JOIN TiposIva ti ON ti.PorcentajeIva = x.IVA + JOIN taxType tt ON tt.id = ti.CodigoIva JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8mb3_unicode_ci SET mci.BaseIva3 = x.BASEEURO , mci.PorIva3 = x.IVA, @@ -16714,11 +16640,13 @@ BEGIN mci.CodigoTransaccion3 = vDuaTransactionFk , mci.CodigoIva3 = vTaxImportSuperReducedFk, mci.IvaDeducible3 = TRUE, - mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) + mci.ImporteFactura = mci.ImporteFactura + + x.BASEEURO + + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) WHERE pm.description = 'HP Iva pendiente' AND mci.enlazadoSage = FALSE AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci - AND ti.Iva = 'I.V.A. 4%'; + AND tt.code = 'national4'; -- Rectificativas UPDATE movConta mci @@ -16747,12 +16675,15 @@ BEGIN OR CodigoTransaccion2 = vTransactionExportFk OR CodigoTransaccion3 = vTransactionExportFk OR CodigoTransaccion4 = vTransactionExportFk) - AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8mb3_unicode_ci, vCountryCeutaMelillaCode COLLATE utf8mb3_unicode_ci); + AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8mb3_unicode_ci, + vCountryCeutaMelillaCode COLLATE utf8mb3_unicode_ci); UPDATE movConta mc SET CodigoDivisa = 'USD', FactorCambio = TRUE, - ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio = 0, ImporteAsiento / ImporteDivisa, ImporteCambio) AS DECIMAL( 10, 2))) + ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio = 0, + ImporteAsiento / ImporteDivisa, + ImporteCambio) AS DECIMAL( 10, 2))) WHERE enlazadoSage = FALSE AND (ImporteCambio <> 0 OR ImporteDivisa <> 0 OR FactorCambio); @@ -16793,7 +16724,9 @@ BEGIN AND sub.amountTaxableBase/2 <> sub2.amountTaxableBase) sub; IF vBookEntries IS NOT NULL THEN - SELECT util.notification_send ("book-entries-imported-incorrectly", CONCAT('{"bookEntries":"', vBookEntries,'"}'), null); + SELECT util.notification_send ("book-entries-imported-incorrectly", + CONCAT('{"bookEntries":"', vBookEntries,'"}'), + null); END IF; END ;; DELIMITER ; @@ -16873,7 +16806,7 @@ BEGIN IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla := IF(pr.Provincia IN ('CEUTA', 'MELILLA'), TRUE, FALSE), vCountryCeutaMelillaFk, IF (@isCanarias, vCountryCanariasCode, n.CodigoNacion)), n.CodigoNacion), IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla, vCountryCeutaMelillaCode, IF (@isCanarias, vCountryCanariasCode, n.SiglaNacion)), n.SiglaNacion), IF((c.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F'), - IF(cu.code IN('ES','EX'), + IF(cu.code = 'ES', 1, IF((cu.isUeeMember AND c.isVies), 2, 4)), IFNULL(c.taxTypeSageFk,0), @@ -16911,7 +16844,7 @@ BEGIN n.CodigoNacion, n.SiglaNacion COLLATE utf8mb3_unicode_ci, IF((s.nif REGEXP '^([[:blank:]]|[[:digit:]])'),'J','F'), - IF(co.country IN ('España', 'España exento'), 1,IF(co.isUeeMember = 1, 2, 4)), + IF(co.code = 'ES', 1, IF(co.isUeeMember, 2, 4)), IFNULL(s.taxTypeSageFk, 0), n.Nacion, IFNULL(sc.phone, ''), @@ -16978,11 +16911,12 @@ BEGIN t.PorcentajeIva, it.transactionTypeSageFk, it.taxTypeSageFk, - t.isIntracommunity, + tty.isIntracommunity, tt.ClaveOperacionDefecto FROM vn.invoiceIn i JOIN vn.invoiceInTax it ON it.InvoiceInFk = i.id JOIN TiposIva t ON t.CodigoIva = it.taxTypeSageFk + JOIN taxType tty ON tty.id = t.CodigoIva JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk LEFT JOIN vn.dua d ON d.id = vInvoiceInFk WHERE i.id = vInvoiceInFk @@ -16999,15 +16933,6 @@ BEGIN SELECT codeSage INTO vInvoiceTypeInformative FROM invoiceType WHERE code ='informative'; - SELECT d.ASIEN AND x.ASIEN IS NULL INTO vIsInformativeExportation - FROM vn.dua d - LEFT JOIN vn.XDiario x ON x.ASIEN = d.ASIEN - AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci - WHERE d.ASIEN = ( - SELECT ASIEN - FROM vn.XDiario - WHERE id = vXDiarioFk); - INSERT INTO movContaIVA(id, LibreA1) VALUES (vXDiarioFk, vInvoiceInFk); @@ -17087,6 +17012,16 @@ BEGIN CLOSE vCursor; + SELECT d.ASIEN AND x.ASIEN IS NULL INTO vIsInformativeExportation + FROM vn.dua d + LEFT JOIN vn.XDiario x ON x.ASIEN = d.ASIEN + AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci + WHERE d.ASIEN = ( + SELECT ASIEN + FROM vn.XDiario + WHERE id = vXDiarioFk) + LIMIT 1; + UPDATE movContaIVA mci JOIN tmp.invoiceIn ii ON ii.id = vInvoiceInFk JOIN vn.XDiario x ON x.id = mci.id @@ -17096,7 +17031,7 @@ BEGIN SET mci.CodigoDivisa = ii.currencyFk, mci.Año = YEAR(ii.issued), mci.Serie = ii.serial, - mci.Factura = ii.serialNumber, + mci.Factura = ii.id, mci.FechaFactura = ii.issued, mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) + IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) + @@ -17230,7 +17165,6 @@ BEGIN i.supplierFk, i.issued, IF(expenceFkDeductible, FALSE, i.isVatDeductible) isVatDeductible, - i.serialNumber, IF(c.code = 'EUR', '',c.`code`) currencyFk FROM vn.invoiceIn i JOIN vn.currency c ON c.id = i.currencyFk @@ -17238,11 +17172,10 @@ BEGIN UNION ALL SELECT d.id, d.code, - vSerialDua, + vSerialDua COLLATE utf8mb3_unicode_ci, d.companyFk , d.issued, FALSE, - d.id, '' -- EUROS FROM vn.dua d WHERE d.issued IS NOT NULL @@ -17989,7 +17922,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `accessToken_prune` ON SCHEDULE EVERY 1 DAY STARTS '2023-03-14 05:14:00' ON COMPLETION PRESERVE ENABLE DO CALL salix.accessToken_prune */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `accessToken_prune` ON SCHEDULE EVERY 1 DAY STARTS '2023-03-14 05:14:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL salix.accessToken_prune */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -18275,7 +18208,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `log_clean` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-28 09:29:18' ON COMPLETION PRESERVE ENABLE DO CALL log_clean */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `log_clean` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-28 09:29:18' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL log_clean */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -19497,7 +19430,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `slowLog_prune` ON SCHEDULE EVERY 1 DAY STARTS '2021-10-08 00:00:00' ON COMPLETION PRESERVE ENABLE DO CALL util.slowLog_prune */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `slowLog_prune` ON SCHEDULE EVERY 1 DAY STARTS '2021-10-08 00:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL util.slowLog_prune */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -20064,7 +19997,7 @@ BEGIN RETURN NOW(); END IF; */ - RETURN CONVERT_TZ('2001-01-01 11:00:00', 'utc', 'Europe/Madrid'); + RETURN NOW(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -20090,7 +20023,19 @@ BEGIN * @param vIsUtc If date must be returned as UTC format * @return The formatted mock time */ - RETURN CONVERT_TZ('2001-01-01 11:00:00', 'utc', 'Europe/Madrid'); +DECLARE vMockUtcTime DATETIME; + DECLARE vMockTz VARCHAR(255); + + SELECT mockUtcTime, mockTz + INTO vMockUtcTime, vMockTz + FROM config + LIMIT 1; + + IF vIsUtc OR vMockTz IS NULL THEN + RETURN vMockUtcTime; + ELSE + RETURN CONVERT_TZ(vMockUtcTime, '+00:00', vMockTz); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -20127,7 +20072,7 @@ BEGIN RETURN UTC_TIMESTAMP(); END IF; */ - RETURN CONVERT_TZ('2001-01-01 11:00:00', 'utc', 'Europe/Madrid'); + RETURN UTC_TIMESTAMP(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -21002,6 +20947,7 @@ BEGIN SET vNewInstance = vNew; WHEN 'delete' THEN SET vOldInstance = json_removeNulls(vOldInstance); + ELSE BEGIN END; END CASE; SET vOldInstance = log_formatDate(vOldInstance); @@ -21303,7 +21249,7 @@ CREATE TABLE `XDiario` ( `enlazado` tinyint(1) NOT NULL DEFAULT 0, `FECHA_EX` date DEFAULT NULL COMMENT 'FEcha de expedicion de la factura', `LRECT349` tinyint(1) NOT NULL DEFAULT 0, - `empresa_id` smallint(5) unsigned NOT NULL DEFAULT 442, + `empresa_id` int(10) unsigned NOT NULL DEFAULT 442, `LDIFADUAN` tinyint(4) NOT NULL DEFAULT 0, `METAL` tinyint(1) NOT NULL DEFAULT 0, `METALIMP` decimal(10,2) NOT NULL DEFAULT 0.00, @@ -21332,7 +21278,7 @@ CREATE TABLE `XDiario` ( KEY `SERIEidx` (`ASIEN`,`SERIE`), KEY `XDiario` (`enlazado`), KEY `enlazadoSage` (`enlazadoSage`), - CONSTRAINT `XDiario_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `XDiarioCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -21997,6 +21943,7 @@ CREATE TABLE `arcRead` ( `ip` varchar(50) NOT NULL, `counter` smallint(2) unsigned DEFAULT NULL COMMENT 'Número de etiquetas leídas del pallet actual por el arco', `error` varchar(50) DEFAULT NULL, + `minimum` tinyint(4) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `arcRead_ip_UN` (`ip`), KEY `worker_printer_FK` (`printerFk`), @@ -22093,7 +22040,7 @@ CREATE TABLE `autonomy` ( KEY `autonomy_FK_1` (`geoFk`), CONSTRAINT `autonomy_FK` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `autonomy_FK_1` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=109 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Comunidades autónomas o su equivalente en otros paises. Agrupación de provincias, en una categoria inferior a country.'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Comunidades autónomas o su equivalente en otros paises. Agrupación de provincias, en una categoria inferior a country.'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -22179,12 +22126,12 @@ CREATE TABLE `awb` ( `package` float unsigned NOT NULL, `weight` float unsigned DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `transitoryFk` int(11) DEFAULT NULL, + `transitoryFk` int(10) unsigned DEFAULT NULL, `taxFk` int(10) unsigned DEFAULT 62, `duakk` varchar(18) DEFAULT NULL, `docFk` int(11) DEFAULT NULL, `amount` double NOT NULL DEFAULT 0, - `freightFk` int(11) DEFAULT NULL, + `freightFk` int(10) unsigned DEFAULT NULL, `m3` double unsigned DEFAULT NULL, `stems` int(10) unsigned DEFAULT NULL, `flightFk` varchar(10) DEFAULT NULL, @@ -22213,12 +22160,11 @@ CREATE TABLE `awb` ( KEY `awb_FK` (`docFk`), KEY `awb_FK_3` (`invoiceInPaletizedFk`), CONSTRAINT `awbInvoiceIn` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `awbTransitoryFk` FOREIGN KEY (`transitoryFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `awb_FK` FOREIGN KEY (`docFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, CONSTRAINT `awb_FK_1` FOREIGN KEY (`flightFk`) REFERENCES `vn2008`.`flight` (`flight_id`) ON UPDATE CASCADE, - CONSTRAINT `awb_FK_2` FOREIGN KEY (`freightFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `awb_FK_3` FOREIGN KEY (`invoiceInPaletizedFk`) REFERENCES `invoiceIn` (`id`) ON UPDATE CASCADE, - CONSTRAINT `awb_ibfk_1` FOREIGN KEY (`taxFk`) REFERENCES `taxCode` (`id`) ON UPDATE CASCADE + CONSTRAINT `awb_ibfk_1` FOREIGN KEY (`taxFk`) REFERENCES `taxCode` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_supplierFk` FOREIGN KEY (`transitoryFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -22350,6 +22296,7 @@ DROP TABLE IF EXISTS `bankEntityConfig`; CREATE TABLE `bankEntityConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `bicLength` tinyint(4) DEFAULT 11 COMMENT 'Tamaño del campo bic', + `defaultBankId` int(11) NOT NULL DEFAULT 3117 COMMENT 'Id del banco por defecto', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -22454,16 +22401,16 @@ CREATE TABLE `botanicExport` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ediGenusFk` mediumint(8) unsigned NOT NULL, `ediSpecieFk` mediumint(8) unsigned DEFAULT NULL, - `countryFk` mediumint(8) unsigned DEFAULT NULL, + `countryFk__` mediumint(8) unsigned DEFAULT NULL, `restriction` enum('Sin restriccion','Importacion Prohibida','pasaporte fitosanitario','pasaporte individual','declaracion origen') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `description` varchar(45) DEFAULT NULL, `isProtectedZone` tinyint(1) NOT NULL DEFAULT 0, `code` enum('importProhibited','phytosanitaryPassport','individualPassport') DEFAULT NULL, PRIMARY KEY (`id`), - KEY `Id_Paises` (`countryFk`), + KEY `Id_Paises` (`countryFk__`), KEY `botanicExport_ibfk_2_idx` (`ediGenusFk`), KEY `botanicExport_ibfk_3_idx` (`ediSpecieFk`), - CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) + CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk__`) REFERENCES `country` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -22479,7 +22426,7 @@ DELIMITER ;; BEFORE INSERT ON `botanicExport` FOR EACH ROW BEGIN - IF (SELECT botanicExport_isUpdatable (NEW.ediGenusFk, NEW.ediSpecieFk, NEW.countryFk, NEW.restriction) ) > 0 THEN + IF (SELECT botanicExport_isUpdatable (NEW.ediGenusFk, NEW.ediSpecieFk, NEW.restriction) ) > 0 THEN CALL util.throw ('Datos duplicados'); END IF; END */;; @@ -22504,7 +22451,7 @@ CREATE TABLE `budget` ( `finished` date DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `departmentFk` int(11) DEFAULT NULL, - `supplierFk` int(11) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, `photo` blob DEFAULT NULL, `amount` decimal(10,2) DEFAULT NULL, `projectFk` int(11) NOT NULL, @@ -22512,11 +22459,11 @@ CREATE TABLE `budget` ( KEY `budget_FK` (`projectFk`), KEY `budget_FK_1` (`userFk`), KEY `budget_FK_2` (`departmentFk`), - KEY `budget_FK_3` (`supplierFk`), + KEY `budget_supplierFk` (`supplierFk`), CONSTRAINT `budget_FK` FOREIGN KEY (`projectFk`) REFERENCES `project` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budget_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budget_FK_2` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `budget_FK_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `budget_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Master de presupuestos de project'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -22651,7 +22598,6 @@ CREATE TABLE `business` ( KEY `business_fk_editor` (`editorFk`), CONSTRAINT `business_FK` FOREIGN KEY (`workerBusinessProfessionalCategoryFk`) REFERENCES `professionalCategory` (`id`) ON UPDATE CASCADE, CONSTRAINT `business_calendarTypeFk` FOREIGN KEY (`calendarTypeFk`) REFERENCES `calendarType` (`id`) ON UPDATE CASCADE, - CONSTRAINT `business_companyCodeFk` FOREIGN KEY (`companyCodeFk`) REFERENCES `company` (`code`) ON UPDATE CASCADE, CONSTRAINT `business_departmentFk` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON UPDATE CASCADE, CONSTRAINT `business_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), CONSTRAINT `business_occupationCodeFk` FOREIGN KEY (`occupationCodeFk`) REFERENCES `occupationCode` (`code`) ON UPDATE CASCADE, @@ -22833,6 +22779,26 @@ CREATE TABLE `businessReasonEnd` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `businessSchedule` +-- + +DROP TABLE IF EXISTS `businessSchedule`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `businessSchedule` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `weekday` smallint(6) NOT NULL DEFAULT 1 COMMENT 'Lunes = 1 \nDomingo = 7', + `started` time DEFAULT NULL, + `ended` time DEFAULT NULL, + `businessFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `day_id` (`weekday`,`started`,`ended`,`businessFk`), + KEY `journey_business_id_idx` (`businessFk`), + CONSTRAINT `journey_business_id` FOREIGN KEY (`businessFk`) REFERENCES `business` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `businessType` -- @@ -22973,7 +22939,9 @@ trig: BEGIN SET NEW.itemFk = vGenericFk; END IF; - + END IF; + IF NEW.quantity < 0 THEN + SET NEW.isIgnored = TRUE; END IF; END */;; DELIMITER ; @@ -23060,6 +23028,10 @@ trig:BEGIN CALL util.throw("Stickers cannot be modified if they are inventory"); END IF; END IF; + + IF NEW.quantity < 0 THEN + SET NEW.isIgnored = TRUE; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -23191,6 +23163,20 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `buyConfig` +-- + +DROP TABLE IF EXISTS `buyConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `buyConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `monthsAgo` int(11) NOT NULL DEFAULT 6 COMMENT 'Meses desde la última compra', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `buyMark` -- @@ -23586,7 +23572,7 @@ DELIMITER ;; AFTER DELETE ON `claim` FOR EACH ROW BEGIN - INSERT INTO clientLog + INSERT INTO claimLog SET `action` = 'delete', `changedModel` = 'Claim', `changedModelId` = OLD.id, @@ -24007,17 +23993,18 @@ CREATE TABLE `claimLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Claim','ClaimBeginning','ClaimState','ClaimDevelopment','ClaimDms','ClaimEnd','ClaimObservation') NOT NULL DEFAULT 'Claim', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), + KEY `claimLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `claimLog_claimLog` (`originFk`,`creationDate`), CONSTRAINT `claimOriginFk` FOREIGN KEY (`originFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24309,7 +24296,7 @@ CREATE TABLE `client` ( `mobile` varchar(15) DEFAULT NULL, `accountingAccount` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `isEqualizated` tinyint(1) NOT NULL DEFAULT 0, - `city` varchar(25) DEFAULT NULL, + `city` varchar(100) DEFAULT NULL, `provinceFk` smallint(5) unsigned NOT NULL, `postcode` varchar(8) DEFAULT NULL, `socialName` varchar(60) DEFAULT NULL, @@ -24900,17 +24887,18 @@ CREATE TABLE `clientLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Client','Address','ClientContact','ClientDms','ClientObservation','ClientSample','Greuge','Recovery','TpvTransaction','WorkerDms','Sms') NOT NULL DEFAULT 'Client', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), + KEY `clientLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `clientLog_clientLog` (`originFk`,`creationDate`), CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25092,12 +25080,12 @@ DROP TABLE IF EXISTS `clientRisk`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientRisk` ( `clientFk` int(11) NOT NULL DEFAULT 0, - `companyFk` smallint(6) unsigned NOT NULL DEFAULT 0, + `companyFk` int(10) unsigned NOT NULL DEFAULT 0, `amount` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`clientFk`,`companyFk`), KEY `company_id` (`companyFk`), - CONSTRAINT `clientRisk_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `clientRisk_ibfk_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `clientRiskCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `clientRisk_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Saldo de apertura < 2015-01-01'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -25115,14 +25103,14 @@ CREATE TABLE `clientSample` ( `created` datetime NOT NULL DEFAULT current_timestamp(), `workerFk` int(10) unsigned NOT NULL, `balance` float NOT NULL, - `companyFk` smallint(5) unsigned DEFAULT NULL, + `companyFk` int(10) unsigned DEFAULT NULL, `userFk` int(11) DEFAULT NULL, `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `empresa_id` (`companyFk`), KEY `clientSample_fk_editor` (`editorFk`), - CONSTRAINT `clientSample_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), - CONSTRAINT `clientSample_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE + CONSTRAINT `clientSampleCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `clientSample_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -25256,10 +25244,10 @@ CREATE TABLE `cmr` ( `paymentInstruccions` varchar(255) DEFAULT 'Carriage paid', `specialAgreements` varchar(255) DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), - `companyFk` smallint(5) unsigned DEFAULT NULL, + `companyFk` int(10) unsigned DEFAULT NULL, `addressToFk` int(11) DEFAULT NULL, `addressFromFk` int(11) DEFAULT NULL, - `supplierFk` int(11) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, `packagesList` varchar(255) DEFAULT NULL, `merchandiseDetail` varchar(255) DEFAULT NULL, `state` varchar(100) DEFAULT NULL, @@ -25271,11 +25259,11 @@ CREATE TABLE `cmr` ( KEY `cmr_fk3_idx` (`addressToFk`), KEY `cm_fk4_idx` (`supplierFk`), KEY `cmr_FK` (`addressFromFk`), - CONSTRAINT `cm_fk4` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `cmrCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `cmr_FK` FOREIGN KEY (`addressFromFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `cmr_fk2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `cmr_fk3` FOREIGN KEY (`addressToFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `cmr_fk3` FOREIGN KEY (`addressToFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `cmr_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -25320,6 +25308,28 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`cmr_beforeDelete` + BEFORE DELETE ON `cmr` + FOR EACH ROW +BEGIN + IF NOT (OLD.companyFk <=> NULL AND OLD.addressFromFk <=> NULL AND OLD.packagesList <=> NULL) THEN + CALL util.throw("Can not delete cmr, fields required not empty"); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `cmrConfig` @@ -25659,7 +25669,7 @@ DROP TABLE IF EXISTS `company`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `company` ( - `id` smallint(5) unsigned NOT NULL, + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `code` char(3) DEFAULT NULL, `register` varchar(120) NOT NULL, `workerManagerFk` int(10) unsigned NOT NULL, @@ -25691,10 +25701,11 @@ CREATE TABLE `company` ( KEY `empresa_grupo_fk_idx` (`companyGroupFk`), KEY `company_fhAdminNumber_IDX` (`fhAdminNumber`) USING BTREE, CONSTRAINT `company_ibfk_1` FOREIGN KEY (`workerManagerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `company_supplierFk` FOREIGN KEY (`id`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `empresa_cliente` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `empresa_fk4` FOREIGN KEY (`supplierAccountFk`) REFERENCES `supplierAccount` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_empresa_grupo` FOREIGN KEY (`companyGroupFk`) REFERENCES `companyGroup` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25719,11 +25730,11 @@ DROP TABLE IF EXISTS `companyI18n`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `companyI18n` ( - `companyFk` smallint(5) unsigned NOT NULL, + `companyFk` int(10) unsigned NOT NULL, `lang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `footnotes` longtext DEFAULT NULL, PRIMARY KEY (`companyFk`,`lang`), - CONSTRAINT `companyI18n_FK` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE + CONSTRAINT `companyI18nCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -25892,29 +25903,6 @@ CREATE TABLE `continent` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='World continents'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `contratos_subvencion_270619` --- - -DROP TABLE IF EXISTS `contratos_subvencion_270619`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `contratos_subvencion_270619` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `cod_centroFk` int(11) NOT NULL, - `CodContratoFk` int(11) NOT NULL, - `journey` decimal(5,2) NOT NULL DEFAULT 8.00, - `name` varchar(50) NOT NULL, - `nif` varchar(12) NOT NULL, - PRIMARY KEY (`id`), - KEY `contratos_subvencion_270619_fk2_idx` (`cod_centroFk`), - KEY `contratos_subvencion_270619_fk1_idx` (`workerFk`), - CONSTRAINT `contratos_subvencion_270619_fk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `contratos_subvencion_270619_fk2` FOREIGN KEY (`cod_centroFk`) REFERENCES `vn2008`.`payroll_centros` (`cod_centro`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Segun los informes de vida laboral aportados por la SS'; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `conveyor` -- @@ -26066,7 +26054,7 @@ CREATE TABLE `country` ( `CEE` tinyint(1) NOT NULL DEFAULT 1, `code` varchar(2) DEFAULT NULL, `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 1, - `politicalCountryFk` mediumint(8) unsigned NOT NULL COMMENT 'Pais Real(apaño por culpa del España Exento)', + `politicalCountryFk__` mediumint(8) unsigned DEFAULT NULL COMMENT 'Pais Real(apaño por culpa del España Exento)', `geoFk` int(11) DEFAULT NULL, `hasDailyInvoice` tinyint(4) NOT NULL DEFAULT 0, `isUeeMember` tinyint(4) NOT NULL DEFAULT 0, @@ -26074,13 +26062,13 @@ CREATE TABLE `country` ( `continentFk` tinyint(4) DEFAULT NULL, `a3Code` int(11) DEFAULT NULL COMMENT 'Código país para a3', PRIMARY KEY (`id`), - KEY `Id_Paisreal` (`politicalCountryFk`), + KEY `Id_Paisreal` (`politicalCountryFk__`), KEY `currency_id_fk_idx` (`currencyFk`), KEY `country_Ix4` (`country`), KEY `continent_id_fk_idx` (`continentFk`), KEY `country_FK_1` (`geoFk`), CONSTRAINT `continent_id_fk` FOREIGN KEY (`continentFk`) REFERENCES `continent` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, - CONSTRAINT `country_FK` FOREIGN KEY (`politicalCountryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, + CONSTRAINT `country_FK` FOREIGN KEY (`politicalCountryFk__`) REFERENCES `country` (`id`) ON UPDATE CASCADE, CONSTRAINT `country_FK_1` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE, CONSTRAINT `currency_id_fk` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -26506,7 +26494,9 @@ SET character_set_client = utf8; `created` tinyint NOT NULL, `amount` tinyint NOT NULL, `defaulterSinced` tinyint NOT NULL, - `hasChanged` tinyint NOT NULL + `hasChanged` tinyint NOT NULL, + `country` tinyint NOT NULL, + `payMethod` tinyint NOT NULL ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; @@ -26905,7 +26895,7 @@ CREATE TABLE `deviceProductionLog` ( `changedModel` varchar(50) DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26980,7 +26970,7 @@ CREATE TABLE `dms` ( `dmsTypeFk` int(11) NOT NULL DEFAULT 1, `reference` varchar(50) DEFAULT NULL, `description` varchar(200) DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `hardCopyNumber` mediumint(8) unsigned DEFAULT NULL, `contentType` varchar(150) DEFAULT NULL, `file` varchar(30) DEFAULT NULL, @@ -26994,7 +26984,7 @@ CREATE TABLE `dms` ( KEY `trabajador_id` (`workerFk`), KEY `warehouse_id` (`warehouseFk`), KEY `dms_dmsTypeFk_idx` (`dmsTypeFk`), - CONSTRAINT `dms_companyFk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `dmsCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `dms_dmsTypeFk` FOREIGN KEY (`dmsTypeFk`) REFERENCES `dmsType` (`id`) ON UPDATE CASCADE, CONSTRAINT `dms_warehouseFk` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `dms_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE @@ -27195,16 +27185,16 @@ CREATE TABLE `dua` ( `bookEntried` date DEFAULT NULL, `gestdocFk` int(11) DEFAULT NULL, `customsValue` decimal(10,2) DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `ASIEN` double DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`), KEY `fk_awb_dua_awb_idx` (`awbFk`), KEY `fk_dua_gestdoc1_idx` (`gestdocFk`), KEY `dua_fk4_idx` (`companyFk`), + CONSTRAINT `duaCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `dua_fk1` FOREIGN KEY (`gestdocFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `dua_fk2` FOREIGN KEY (`awbFk`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `dua_fk4` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE + CONSTRAINT `dua_fk2` FOREIGN KEY (`awbFk`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -27279,7 +27269,7 @@ DROP TABLE IF EXISTS `duaTax`; CREATE TABLE `duaTax` ( `id` int(11) NOT NULL AUTO_INCREMENT, `duaFk` int(11) NOT NULL, - `supplierFk` int(11) NOT NULL, + `supplierFk` int(10) unsigned NOT NULL, `taxClassFk` tinyint(3) unsigned NOT NULL, `base` decimal(10,2) NOT NULL, `rate` decimal(5,2) NOT NULL, @@ -27289,8 +27279,8 @@ CREATE TABLE `duaTax` ( KEY `duaTax_fk2_idx` (`supplierFk`), KEY `duaTax_fk3_idx` (`taxClassFk`), CONSTRAINT `duaTax_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `duaTax_fk2` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE + CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE, + CONSTRAINT `duaTax_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -27524,7 +27514,7 @@ DROP TABLE IF EXISTS `entry`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `entry` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `supplierFk` int(11) NOT NULL DEFAULT 644, + `supplierFk` int(10) unsigned NOT NULL DEFAULT 644, `dated` datetime NOT NULL, `invoiceNumber` varchar(50) DEFAULT NULL, `isBooked` tinyint(1) NOT NULL DEFAULT 0, @@ -27537,7 +27527,7 @@ CREATE TABLE `entry` ( `evaNotes` varchar(45) DEFAULT NULL, `travelFk` int(11) unsigned DEFAULT NULL, `currencyFk` tinyint(3) unsigned DEFAULT 1, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `gestDocFk` int(11) DEFAULT NULL, `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, `isBlocked` tinyint(4) NOT NULL DEFAULT 0, @@ -27565,13 +27555,13 @@ CREATE TABLE `entry` ( KEY `entry_observationEditorFk` (`observationEditorFk`), KEY `entry_fk_editor` (`editorFk`), CONSTRAINT `Entradas_fk8` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `entryCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_FK` FOREIGN KEY (`buyerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `entryType` (`code`) ON UPDATE CASCADE, CONSTRAINT `entry_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), - CONSTRAINT `entry_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_ibfk_6` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, - CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `entry_observationEditorFk` FOREIGN KEY (`observationEditorFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE + CONSTRAINT `entry_observationEditorFk` FOREIGN KEY (`observationEditorFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, + CONSTRAINT `entry_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -27675,14 +27665,6 @@ BEGIN OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); END IF; - - IF NOT (ABS(NEW.isBooked) <=> ABS(OLD.isBooked)) THEN - INSERT INTO entryLog SET - action = 'update', - description = 'Cambia a Contabilizada', - userFk = account.myUser_getId(), - originFk = NEW.id; - END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27794,18 +27776,18 @@ CREATE TABLE `entryLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Entry','Buy','EntryObservation') NOT NULL DEFAULT 'Entry', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `logEntry_ibfk_1` (`originFk`), KEY `entryLog_ibfk_2` (`userFk`), KEY `entryLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `entryLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28142,7 +28124,7 @@ CREATE TABLE `expedition` ( `itemPackingTypeFk` varchar(1) DEFAULT NULL, `hostFk` varchar(6) NOT NULL, `stateTypeFk` int(11) DEFAULT NULL COMMENT 'Ultimo estado de la expedicion', - `hasNewRoute` bit(1) NOT NULL DEFAULT b'0', + `hasNewRoute` tinyint(1) NOT NULL DEFAULT 0, `isBox` int(11) GENERATED ALWAYS AS (`freightItemFk`) VIRTUAL COMMENT 'Columna virtual provisional para Salix', `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), @@ -28307,7 +28289,7 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE TABLE `expeditionCommon` ( `truckFk` tinyint NOT NULL, - `etd` tinyint NOT NULL, + `eta` tinyint NOT NULL, `description` tinyint NOT NULL, `palletFk` tinyint NOT NULL, `routeFk` tinyint NOT NULL, @@ -28678,13 +28660,13 @@ CREATE TABLE `expeditionTruck` ( `id` int(11) NOT NULL AUTO_INCREMENT, `roadmapFk` int(10) unsigned DEFAULT NULL, `warehouseFk` smallint(6) unsigned DEFAULT NULL, - `ETD` datetime DEFAULT NULL, + `eta` datetime DEFAULT NULL COMMENT 'Estimated time of arrival', `description` varchar(45) NOT NULL, `bufferFk` int(11) DEFAULT NULL COMMENT 'buffer destino de las cajas', `created` timestamp NULL DEFAULT current_timestamp(), `userFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), - KEY `expeditionTruck_idx1` (`ETD`), + KEY `expeditionTruck_idx1` (`eta`), KEY `expeditionTruck_FK` (`bufferFk`), KEY `expeditionTruck_FK_1` (`warehouseFk`), KEY `expeditionTruck_FK_2` (`roadmapFk`), @@ -28772,7 +28754,7 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE TABLE `expeditionTruck_Control_Detail` ( `id` tinyint NOT NULL, - `ETD` tinyint NOT NULL, + `eta` tinyint NOT NULL, `destino` tinyint NOT NULL, `pallet` tinyint NOT NULL, `routes` tinyint NOT NULL, @@ -28793,7 +28775,7 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE TABLE `expeditionTruck_Control_Detail_Pallet` ( `id` tinyint NOT NULL, - `ETD` tinyint NOT NULL, + `eta` tinyint NOT NULL, `destino` tinyint NOT NULL, `pallet` tinyint NOT NULL, `route` tinyint NOT NULL, @@ -28816,13 +28798,12 @@ CREATE TABLE `expence` ( `id` varchar(10) NOT NULL, `name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, `isWithheld` tinyint(4) NOT NULL DEFAULT 0, - PRIMARY KEY (`id`) + `code` varchar(25) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `expence_UN` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -ALTER TABLE `vn`.`expence` - ADD code VARCHAR(25) DEFAULT NULL NULL; -ALTER TABLE `vn`.`expence` - ADD CONSTRAINT expence_UN UNIQUE KEY IF NOT EXISTS (code); + -- -- Table structure for table `farming` -- @@ -28833,18 +28814,18 @@ DROP TABLE IF EXISTS `farming`; CREATE TABLE `farming` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, - `location` varchar(255) NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL, + `location` varchar(255) DEFAULT NULL, + `warehouseFk` smallint(6) unsigned DEFAULT NULL, `description` text DEFAULT NULL, `photo` blob DEFAULT NULL, `isActive` tinyint(1) NOT NULL DEFAULT 1, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `companyFk` smallint(5) unsigned DEFAULT NULL, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, PRIMARY KEY (`id`), KEY `farming_FK` (`warehouseFk`), - KEY `farming_FK_1` (`companyFk`), - CONSTRAINT `farming_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `farming_FK_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) + KEY `farmingCompany_Fk` (`companyFk`), + CONSTRAINT `farmingCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`), + CONSTRAINT `farming_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29281,7 +29262,7 @@ CREATE TABLE `host` ( `windowsSerial` varchar(40) DEFAULT NULL, `printerFk` tinyint(3) unsigned DEFAULT NULL, `warehouseFk` smallint(5) unsigned DEFAULT 60, - `companyFk` smallint(5) unsigned DEFAULT 442, + `companyFk` int(10) unsigned DEFAULT 442, `bankFk` int(11) DEFAULT 13, `routeDaysBefore` smallint(6) DEFAULT 2, `routeDaysAfter` smallint(6) DEFAULT 1, @@ -29295,9 +29276,9 @@ CREATE TABLE `host` ( KEY `configHost_FK_5` (`workerFk`), CONSTRAINT `configHost_FK` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) ON UPDATE CASCADE, CONSTRAINT `configHost_FK_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `configHost_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `configHost_FK_4` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, - CONSTRAINT `configHost_FK_5` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) + CONSTRAINT `configHost_FK_5` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`), + CONSTRAINT `hostCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -29556,13 +29537,13 @@ CREATE TABLE `invoiceIn` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `serialNumber` mediumint(11) unsigned DEFAULT NULL COMMENT 'insertado por Trigger', `serial` char(1) NOT NULL DEFAULT 'R', - `supplierFk` int(11) NOT NULL, + `supplierFk` int(10) unsigned NOT NULL, `issued` date DEFAULT NULL COMMENT 'Fecha de emision de la factura', `supplierRef` varchar(50) DEFAULT NULL, `isBooked` tinyint(1) NOT NULL DEFAULT 0, `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 1, `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `docFk` int(11) DEFAULT NULL, `booked` date DEFAULT NULL COMMENT 'Fecha de contabilizacion', `operated` date DEFAULT NULL COMMENT 'Fecha de entrega de la mercancia o el suministro', @@ -29591,15 +29572,15 @@ CREATE TABLE `invoiceIn` ( KEY `invoiceIn_withholdingFk_idx` (`withholdingSageFk`), KEY `invoiceIn_expenceFkDeductible_idx` (`expenceFkDeductible`), KEY `invoiceIn_fk_editor` (`editorFk`), + CONSTRAINT `invoiceInCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_expenceFkDeductible` FOREIGN KEY (`expenceFkDeductible`) REFERENCES `expence` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), - CONSTRAINT `invoiceIn_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `invoiceIn_ibfk_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_ibfk_3` FOREIGN KEY (`cplusSubjectOpFk`) REFERENCES `cplusSubjectOp` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `cplusTaxBreak` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_ibfk_5` FOREIGN KEY (`cplusInvoiceType472Fk`) REFERENCES `cplusInvoiceType472` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_ibfk_6` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `cplusRectificationType` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_ibfk_7` FOREIGN KEY (`cplusTrascendency472Fk`) REFERENCES `cplusTrascendency472` (`id`) ON UPDATE CASCADE, + CONSTRAINT `invoiceIn_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_withholdingFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29661,14 +29642,6 @@ BEGIN SET NEW.serial = IFNULL(vSerie,'R'); - IF vSerie LIKE 'W' THEN - SELECT IFNULL(MAX(serialNumber) + 1,1) INTO vNumReceived - FROM invoiceIn - WHERE `serial` LIKE NEW.serial AND - YEAR(issued) = YEAR(NEW.issued) AND - companyFk = NEW.companyFk; - SET NEW.serialNumber = vNumReceived; - END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -29941,17 +29914,18 @@ CREATE TABLE `invoiceInLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('InvoiceIn','invoiceInTax') NOT NULL DEFAULT 'InvoiceIn', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), + KEY `invoiceInLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `invoiceInLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `invoiceInLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceInLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30147,7 +30121,7 @@ CREATE TABLE `invoiceOut` ( `bankFk` int(11) DEFAULT NULL, `clientFk` int(11) DEFAULT 0, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `hasPdf` tinyint(3) unsigned NOT NULL DEFAULT 0, `booked` date DEFAULT NULL, `cplusInvoiceType477Fk` int(10) unsigned NOT NULL DEFAULT 1, @@ -30166,7 +30140,6 @@ CREATE TABLE `invoiceOut` ( KEY `Facturas_ibfk_5_idx` (`cplusTrascendency477Fk`), KEY `Facturas_idx_Vencimiento` (`dued`), KEY `invoiceOut_serial` (`serial`), - CONSTRAINT `invoiceOut_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceOut_ibfk_2` FOREIGN KEY (`cplusInvoiceType477Fk`) REFERENCES `cplusInvoiceType477` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceOut_ibfk_3` FOREIGN KEY (`cplusSubjectOpFk`) REFERENCES `cplusSubjectOp` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceOut_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `cplusTaxBreak` (`id`) ON UPDATE CASCADE, @@ -30397,7 +30370,7 @@ CREATE TABLE `item` ( `intrastatFk` int(8) unsigned zerofill NOT NULL DEFAULT 06039010, `hasMinPrice` tinyint(1) NOT NULL DEFAULT 0, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `comment` varchar(150) DEFAULT NULL, + `comment` varchar(150) DEFAULT NULL COMMENT 'referencia del proveedor', `typeFk` smallint(5) unsigned NOT NULL, `generic` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, `producerFk` mediumint(3) unsigned DEFAULT NULL, @@ -30516,8 +30489,7 @@ BEGIN INSERT INTO vn.itemTaxCountry(itemFk, countryFk) VALUES (NEW.id, 1), - (NEW.id, 5), - (NEW.id, 30); + (NEW.id, 5); DELETE ifr.* FROM edi.item_free ifr @@ -31138,19 +31110,18 @@ CREATE TABLE `itemLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Item','ItemBarcode','ItemBotanical','ItemNiche','ItemTag','ItemTaxCountry') NOT NULL DEFAULT 'Item', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `itemLogItemFk_idx` (`originFk`), KEY `itemLogUserFk_idx` (`userFk`), - KEY `itemLog_changedModel_idx` (`changedModel`,`changedModelId`) USING BTREE, KEY `itemLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `itemLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `itemLogItemFk` FOREIGN KEY (`originFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31989,26 +31960,6 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_beforeInsert` - BEFORE INSERT ON `itemTaxCountry` - FOR EACH ROW -BEGIN - SET NEW.editorFk = account.myUser_getId(); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTaxCountry_beforeUpdate` BEFORE UPDATE ON `itemTaxCountry` FOR EACH ROW @@ -32029,26 +31980,6 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_beforeUpdate` - BEFORE UPDATE ON `itemTaxCountry` - FOR EACH ROW -BEGIN - SET NEW.editorFk = account.myUser_getId(); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTaxCountry_afterDelete` AFTER DELETE ON `itemTaxCountry` FOR EACH ROW @@ -32407,16 +32338,16 @@ CREATE TABLE `machine` ( `workerFk` int(10) unsigned DEFAULT NULL, `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `ppeFk` int(11) DEFAULT NULL, - `supplierFk` int(11) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `plate` (`plate`), UNIQUE KEY `serialNumber` (`serialNumber`), KEY `machine_FK` (`ppeFk`), - KEY `machine_FK_2` (`supplierFk`), KEY `machine_FK_1` (`workerFk`), + KEY `machine_supplierFk` (`supplierFk`), CONSTRAINT `machine_FK` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `machine_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `machine_FK_2` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `machine_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Maquinaria industrial, vehículos y demás elementos amortizables'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -32603,7 +32534,7 @@ DROP TABLE IF EXISTS `mandate`; CREATE TABLE `mandate` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL, + `companyFk` int(10) unsigned NOT NULL, `code` varchar(32) DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), `finished` timestamp NULL DEFAULT NULL, @@ -32612,8 +32543,8 @@ CREATE TABLE `mandate` ( KEY `mandato_fgkey1_idx` (`clientFk`), KEY `mandato_fgkey2_idx` (`companyFk`), KEY `mandato_fgkey3_idx` (`mandateTypeFk`), + CONSTRAINT `mandateCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, - CONSTRAINT `mandato_fgkey2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey3` FOREIGN KEY (`mandateTypeFk`) REFERENCES `mandateType` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -33684,7 +33615,7 @@ DROP TABLE IF EXISTS `payment`; CREATE TABLE `payment` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `received` date NOT NULL, - `supplierFk` int(11) NOT NULL, + `supplierFk` int(10) unsigned NOT NULL, `amount` decimal(10,2) NOT NULL DEFAULT 0.00, `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 1, `divisa` decimal(10,2) DEFAULT NULL, @@ -33692,7 +33623,7 @@ CREATE TABLE `payment` ( `payMethodFk` tinyint(3) unsigned NOT NULL, `bankingFees` double(6,2) unsigned NOT NULL DEFAULT 0.00, `concept` varchar(30) DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, `dueDated` date DEFAULT NULL, @@ -33703,14 +33634,14 @@ CREATE TABLE `payment` ( KEY `id_moneda` (`currencyFk`), KEY `pay_met` (`payMethodFk`), KEY `pagoDueDatedIdx` (`dueDated`), - KEY `pago_ibfk_3` (`supplierFk`), KEY `payment_FK` (`workerFk`), - CONSTRAINT `pago_ibfk_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + KEY `payment_supplierFk` (`supplierFk`), CONSTRAINT `pago_moneda_1` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, CONSTRAINT `pago_pay_met` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, + CONSTRAINT `paymentCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `payment_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`), - CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `payment_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE + CONSTRAINT `payment_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, + CONSTRAINT `payment_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -34238,7 +34169,7 @@ CREATE TABLE `ppe` ( `photo` blob DEFAULT NULL, `isInvestmentAsset` tinyint(4) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `description` varchar(45) DEFAULT NULL, `isDone` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`), @@ -34250,11 +34181,11 @@ CREATE TABLE `ppe` ( KEY `ppe_fk6` (`endowment`), KEY `ppe_fk7` (`elementAccount`), KEY `ppe_FK` (`location`), + CONSTRAINT `ppeCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `ppe_FK` FOREIGN KEY (`location`) REFERENCES `ppeLocation` (`code`) ON UPDATE CASCADE, CONSTRAINT `ppe_fk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `ppe_fk2` FOREIGN KEY (`planFk`) REFERENCES `ppePlan` (`id`) ON UPDATE CASCADE, CONSTRAINT `ppe_fk3` FOREIGN KEY (`groupFk`) REFERENCES `ppeGroup` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `ppe_fk4` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `ppe_fk5` FOREIGN KEY (`account`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE, CONSTRAINT `ppe_fk6` FOREIGN KEY (`endowment`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE, CONSTRAINT `ppe_fk7` FOREIGN KEY (`elementAccount`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE @@ -34674,18 +34605,18 @@ CREATE TABLE `project` ( `finished` date DEFAULT NULL, `userFk` int(11) unsigned NOT NULL, `departmentFk` int(11) DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `location` varchar(100) DEFAULT NULL, `amount` decimal(15,2) DEFAULT NULL, `stateFk` varchar(25) DEFAULT 'open', PRIMARY KEY (`id`), KEY `project_FK` (`userFk`), KEY `project_FK_1` (`departmentFk`), - KEY `project_FK_2` (`companyFk`), KEY `project_FK_3` (`stateFk`), + KEY `projectCompany_Fk` (`companyFk`), + CONSTRAINT `projectCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `project_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `project_FK_1` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `project_FK_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `project_FK_3` FOREIGN KEY (`stateFk`) REFERENCES `projectState` (`code`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla master de proyectos'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -34773,7 +34704,7 @@ CREATE TABLE `property` ( `registration` int(11) DEFAULT NULL, `value` int(11) DEFAULT NULL, `propertyGroupFk` int(11) NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL, + `companyFk` int(10) unsigned NOT NULL, `photo` blob DEFAULT NULL, `allocation` varchar(200) DEFAULT NULL, `m2` decimal(10,2) DEFAULT NULL, @@ -34786,9 +34717,9 @@ CREATE TABLE `property` ( KEY `property_FK` (`propertyGroupFk`), KEY `property_FK_1` (`townFk`), KEY `property_company` (`companyFk`), + CONSTRAINT `propertyCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `property_FK` FOREIGN KEY (`propertyGroupFk`) REFERENCES `propertyGroup` (`id`) ON UPDATE CASCADE, - CONSTRAINT `property_FK_1` FOREIGN KEY (`townFk`) REFERENCES `town` (`id`) ON UPDATE CASCADE, - CONSTRAINT `property_company` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE + CONSTRAINT `property_FK_1` FOREIGN KEY (`townFk`) REFERENCES `town` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35069,7 +35000,7 @@ CREATE TABLE `receipt` ( `bankFk` int(11) DEFAULT 0, `clientFk` int(11) DEFAULT 0, `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `isConciliate` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, PRIMARY KEY (`Id`), KEY `Id_Banco` (`bankFk`), @@ -35078,8 +35009,8 @@ CREATE TABLE `receipt` ( KEY `clientDate` (`clientFk`,`payed`), KEY `id_factura` (`invoiceFk`), KEY `payed` (`payed`), + CONSTRAINT `receiptCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `receiptWorkerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `receipt_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `receipt_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibo_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -35426,16 +35357,16 @@ CREATE TABLE `roadmap` ( `tractorPlate` varchar(10) DEFAULT NULL, `trailerPlate` varchar(12) DEFAULT NULL, `phone` varchar(15) DEFAULT NULL, - `supplierFk` int(11) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, `etd` datetime DEFAULT NULL, `observations` varchar(255) DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), `userFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), - KEY `supplierFk` (`supplierFk`), KEY `userFk` (`userFk`), - CONSTRAINT `roadmap_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `roadmap_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE + KEY `roadmap_supplierFk` (`supplierFk`), + CONSTRAINT `roadmap_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, + CONSTRAINT `roadmap_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35748,7 +35679,7 @@ CREATE TABLE `routeConfig` ( `distributionM3Category2` decimal(5,2) DEFAULT NULL, `plusCategory1Concept` varchar(45) DEFAULT NULL, `plusCategory2Concept` varchar(45) DEFAULT NULL, - `defaultCompanyFk` smallint(5) unsigned DEFAULT 442, + `defaultCompanyFk` int(10) unsigned DEFAULT 442, `kmHeavy` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por kilometro vehículo pesado', `kmLight` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por kilometro vehículo ligero', `kmYearly` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por kilometro objetivo anual', @@ -35771,8 +35702,8 @@ CREATE TABLE `routeConfig` ( `kmMax` int(11) DEFAULT 4000 COMMENT 'Máximo número de km validos para una ruta', `truckerBusinessProfessionalCategoryFk` int(11) NOT NULL DEFAULT 42, PRIMARY KEY (`id`), - KEY `routeConfig_FK` (`defaultCompanyFk`), - CONSTRAINT `routeConfig_FK` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `company` (`id`) + KEY `routeConfigCompany_Fk` (`defaultCompanyFk`), + CONSTRAINT `routeConfigCompany_Fk` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `company` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35805,17 +35736,18 @@ CREATE TABLE `routeLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Route') NOT NULL DEFAULT 'Route', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), + KEY `routeLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `routeLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35928,7 +35860,7 @@ SET character_set_client = utf8; `description` tinyint NOT NULL, `name` tinyint NOT NULL, `routeFk` tinyint NOT NULL, - `ETD` tinyint NOT NULL, + `eta` tinyint NOT NULL, `bufferFk` tinyint NOT NULL, `beachFk` tinyint NOT NULL, `itempackingTypeFk` tinyint NOT NULL @@ -36825,15 +36757,17 @@ CREATE TABLE `sector` ( `isMain` tinyint(1) NOT NULL DEFAULT 0, `itemPackingTypeFk` varchar(1) DEFAULT NULL, `workerFk` int(11) DEFAULT NULL, - `printerFk` tinyint(3) unsigned DEFAULT NULL, `isHideForPickers` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'sector a ocultar a los sacadores', `isReserve` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Sectores de reserva, como Albenfruit o Fuentes', + `mainPrinterFk` tinyint(3) unsigned DEFAULT NULL, PRIMARY KEY (`id`,`warehouseFk`), UNIQUE KEY `code_UNIQUE` (`code`), KEY `sector_fk1_idx` (`warehouseFk`), KEY `sector_report` (`reportFk`), KEY `sector_FK` (`sonFk`,`warehouseFk`), + KEY `sector_FK_1` (`mainPrinterFk`), CONSTRAINT `sector_FK` FOREIGN KEY (`sonFk`, `warehouseFk`) REFERENCES `sector` (`id`, `warehouseFk`) ON UPDATE CASCADE, + CONSTRAINT `sector_FK_1` FOREIGN KEY (`mainPrinterFk`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sector_fk1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sector_report` FOREIGN KEY (`reportFk`) REFERENCES `report` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -37255,16 +37189,18 @@ CREATE TABLE `shelvingLog` ( `action` set('insert','update','delete','select') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Shelving') NOT NULL DEFAULT 'Shelving', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `userFk` (`userFk`), - KEY `originFk` (`originFk`), + KEY `shelvingLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `shelvingLog_originFk` (`originFk`,`creationDate`), + CONSTRAINT `shelvingLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `shelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `shelvingLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37293,23 +37229,23 @@ DROP TABLE IF EXISTS `sinister`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sinister` ( `id` int(11) NOT NULL, - `supplierFk` int(11) NOT NULL, + `supplierFk` int(10) unsigned NOT NULL, `clientFk` int(11) NOT NULL, `amount` decimal(10,2) NOT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), `insureRate` decimal(3,2) NOT NULL DEFAULT 0.75, `isBooked` tinyint(4) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL, + `companyFk` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `sinister_fk1_idx` (`supplierFk`), KEY `sinister_fk2_idx` (`clientFk`), KEY `sinister_fk3_idx` (`workerFk`), KEY `sinister_fk4_idx` (`companyFk`), - CONSTRAINT `sinister_fk1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `sinisterCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sinister_fk2` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sinister_fk3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `sinister_fk4` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `sinister_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Impago de cliente asegurado'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37768,7 +37704,7 @@ DROP TABLE IF EXISTS `supplier`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplier` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, `account` varchar(10) DEFAULT NULL, `street` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, @@ -37937,7 +37873,7 @@ DROP TABLE IF EXISTS `supplierAccount`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplierAccount` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `supplierFk` int(11) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, `iban` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `office` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `DC` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, @@ -37952,9 +37888,9 @@ CREATE TABLE `supplierAccount` ( KEY `fk_Proveedores_account_entity1_idx` (`bankEntityFk`), KEY `fk_banco_prov_account_idx` (`accountingFk`), KEY `supplierAccount_fk_editor` (`editorFk`), - CONSTRAINT `supplierAccount_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `supplierAccount_FK_1` FOREIGN KEY (`bankEntityFk`) REFERENCES `bankEntity` (`id`) ON UPDATE CASCADE, - CONSTRAINT `supplierAccount_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) + CONSTRAINT `supplierAccount_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), + CONSTRAINT `supplierAccount_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -37966,6 +37902,46 @@ CREATE TABLE `supplierAccount` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_beforeInsert` + BEFORE INSERT ON `supplierAccount` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_beforeUpdate` + BEFORE UPDATE ON `supplierAccount` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierAccount_afterDelete` AFTER DELETE ON `supplierAccount` FOR EACH ROW @@ -38095,7 +38071,7 @@ DROP TABLE IF EXISTS `supplierAgencyTerm`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplierAgencyTerm` ( `agencyFk` smallint(5) unsigned NOT NULL, - `supplierFk` int(11) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, `minimumPackages` int(11) NOT NULL DEFAULT 0 COMMENT 'numero minimo de bultos', `kmPrice` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'precio extra por km', `packagePrice` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'precio extra por bulto', @@ -38104,9 +38080,9 @@ CREATE TABLE `supplierAgencyTerm` ( `minimumM3` decimal(10,2) NOT NULL DEFAULT 0.00, `m3Price` decimal(10,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`agencyFk`), - KEY `agencyTerm_FK_1` (`supplierFk`), + KEY `supplierAgencyTerm_supplierFk` (`supplierFk`), CONSTRAINT `agencyTerm_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON UPDATE CASCADE, - CONSTRAINT `agencyTerm_FK_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE + CONSTRAINT `supplierAgencyTerm_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -38119,7 +38095,7 @@ DROP TABLE IF EXISTS `supplierContact`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplierContact` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `supplierFk` int(11) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, `phone` varchar(16) DEFAULT NULL, `mobile` varchar(16) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, @@ -38127,12 +38103,76 @@ CREATE TABLE `supplierContact` ( `name` varchar(255) DEFAULT NULL, `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), - KEY `supplier_id` (`supplierFk`), KEY `supplierContact_fk_editor` (`editorFk`), + KEY `supplierContact_supplierFk` (`supplierFk`), CONSTRAINT `supplierContact_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), - CONSTRAINT `supplier_id` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `supplierContact_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierContact_beforeInsert` + BEFORE INSERT ON `supplierContact` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierContact_beforeUpdate` + BEFORE UPDATE ON `supplierContact` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplierContact_afterDelete` + AFTER DELETE ON `supplierContact` + FOR EACH ROW +BEGIN + INSERT INTO supplierLog + SET `action` = 'delete', + `changedModel` = 'SupplierContact', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `supplierDebtConfig` @@ -38157,11 +38197,11 @@ DROP TABLE IF EXISTS `supplierExpense`; CREATE TABLE `supplierExpense` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, - `supplierFk` int(11) NOT NULL, + `supplierFk` int(10) unsigned NOT NULL, `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 2, `amount` decimal(10,2) NOT NULL DEFAULT 0.00, `description` varchar(50) DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `dmsFk` int(11) DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, @@ -38174,9 +38214,9 @@ CREATE TABLE `supplierExpense` ( KEY `gestdoc_id` (`dmsFk`), KEY `dueDatedIdx` (`dueDated`), CONSTRAINT `gestdoc_fk` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `pago_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `pago_moneda` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, - CONSTRAINT `proveedor_pago` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE + CONSTRAINT `supplierExpenseCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `supplierExpense_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -38189,22 +38229,23 @@ DROP TABLE IF EXISTS `supplierLog`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplierLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` int(11) DEFAULT NULL, + `originFk` int(10) unsigned DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Supplier','SupplierAddress','SupplierAccount','SupplierContact') NOT NULL DEFAULT 'Supplier', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `logSupplier_ibfk_1` (`originFk`), KEY `supplierLog_ibfk_2` (`userFk`), - CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + KEY `supplierLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `supplierLog_originFk` (`originFk`,`creationDate`), + CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, + CONSTRAINT `supplierLog_supplierFk` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38494,7 +38535,7 @@ DROP TABLE IF EXISTS `ticket`; CREATE TABLE `ticket` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL DEFAULT 0, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 1, + `warehouseFk` smallint(6) unsigned DEFAULT NULL, `shipped` datetime NOT NULL, `nickname` varchar(50) DEFAULT NULL, `refFk` varchar(20) DEFAULT NULL, @@ -38513,7 +38554,7 @@ CREATE TABLE `ticket` ( `routeFk` int(10) unsigned DEFAULT NULL, `priority` tinyint(3) unsigned DEFAULT NULL, `hasPriority` tinyint(1) unsigned NOT NULL DEFAULT 1, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, `agencyModeFk` int(11) DEFAULT NULL, `landed` date DEFAULT NULL, `isBoxed` tinyint(2) NOT NULL DEFAULT 0, @@ -38539,11 +38580,11 @@ CREATE TABLE `ticket` ( KEY `Fecha` (`shipped`,`clientFk`), KEY `tickets_zone_fk_idx` (`zoneFk`), KEY `ticket_fk_editor` (`editorFk`), + CONSTRAINT `ticketCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticket_FK` FOREIGN KEY (`refFk`) REFERENCES `invoiceOut` (`ref`) ON UPDATE CASCADE, CONSTRAINT `ticket_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticket_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), CONSTRAINT `ticket_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `ticket_ibfk_5` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticket_ibfk_6` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticket_ibfk_8` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`), CONSTRAINT `ticket_ibfk_9` FOREIGN KEY (`routeFk`) REFERENCES `route` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, @@ -38686,14 +38727,6 @@ BEGIN IF vNewTime THEN SET NEW.shipped = TIMESTAMP(DATE(NEW.shipped), vNewTime); - INSERT INTO vn.ticketLog - SET originFk = NEW.id, - userFk = account.myUser_getId(), - `action` = 'update', - description = CONCAT('Cambia la hora por cambio de ruta de ', - TIME(OLD.shipped), - ' a ', - TIME(NEW.shipped)); END IF; INSERT IGNORE INTO zoneAgencyMode (agencyModeFk,zoneFk) SELECT r.agencyModeFk, NEW.zoneFk FROM route r @@ -39110,19 +39143,18 @@ CREATE TABLE `ticketLog` ( `action` set('insert','update','delete','select') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Ticket','Sale','TicketWeekly','TicketTracking','TicketService','TicketRequest','TicketRefund','TicketPackaging','TicketObservation','TicketDms','Expedition','Sms') NOT NULL DEFAULT 'Ticket', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `logTicketoriginFk` (`originFk`), KEY `logTicketuserFk` (`userFk`), - KEY `ticketLog_creationDate_IDX` (`creationDate`) USING BTREE, KEY `ticketLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `ticketLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39505,8 +39537,8 @@ CREATE TABLE `ticketRefund` ( `originalTicketFk` int(11) NOT NULL, `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), + UNIQUE KEY `ticketRefund_UN` (`refundTicketFk`), KEY `ticketRefund_FK_1` (`originalTicketFk`), - KEY `ticketRefund_FK` (`refundTicketFk`), KEY `ticketRefund_fk_editor` (`editorFk`), CONSTRAINT `ticketRefund_FK` FOREIGN KEY (`refundTicketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketRefund_FK_1` FOREIGN KEY (`originalTicketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE, @@ -39959,6 +39991,7 @@ CREATE TABLE `ticketTracking` ( KEY `inter_state` (`stateFk`), KEY `inter_id` (`ticketFk`,`id`) USING BTREE, KEY `ticketTracking_fk_editor` (`editorFk`), + KEY `ticketTracking_created_IDX` (`created`) USING BTREE, CONSTRAINT `inter_state` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE, CONSTRAINT `responsable` FOREIGN KEY (`supervisorFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticketTracking_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), @@ -40715,6 +40748,8 @@ BEGIN IF NEW.agencyModeFk THEN SET NEW.agencyFk = NEW.agencyModeFk; END IF; + + CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -40754,6 +40789,7 @@ BEGIN CALL travel_checkPackaging(NEW.id); END IF; + CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -40828,20 +40864,20 @@ CREATE TABLE `travelClonedWeekly` ( `weekDay` tinyint(3) unsigned NOT NULL, `duration` tinyint(3) unsigned NOT NULL, `ref` varchar(50) NOT NULL, - `supplierFk` int(11) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, `kg` decimal(10,0) unsigned DEFAULT NULL, `travelFk` int(11) unsigned DEFAULT NULL COMMENT 'Travel origen para clonar ademas sus entradas', PRIMARY KEY (`id`), KEY `travelClonedWeekly_FK` (`warehouseOutFk`), KEY `travelClonedWeekly_FK_1` (`warehouseInFk`), KEY `travelClonedWeekly_FK_2` (`agencyModeFk`), - KEY `travelClonedWeekly_FK_3` (`supplierFk`), KEY `travelClonedWeekly_FK_4` (`travelFk`), + KEY `travelClonedWeekly_supplierFk` (`supplierFk`), CONSTRAINT `travelClonedWeekly_FK` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travelClonedWeekly_FK_1` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travelClonedWeekly_FK_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travelClonedWeekly_FK_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `travelClonedWeekly_FK_4` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE + CONSTRAINT `travelClonedWeekly_FK_4` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, + CONSTRAINT `travelClonedWeekly_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40859,17 +40895,18 @@ CREATE TABLE `travelLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Travel','TravelThermograph') NOT NULL DEFAULT 'Travel', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), + KEY `travelLog_changedModel` (`changedModel`,`changedModelId`,`originFk`), + KEY `travelLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `travel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `travelLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41058,7 +41095,7 @@ CREATE TABLE `userLog` ( KEY `userFk` (`userFk`), CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41104,10 +41141,10 @@ DROP TABLE IF EXISTS `vehicle`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `vehicle` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `numberPlate` varchar(10) NOT NULL, + `numberPlate` varchar(10) DEFAULT NULL, `model` varchar(20) NOT NULL, `tradeMark` varchar(20) NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, + `companyFk` int(10) unsigned DEFAULT 442, `m3` double DEFAULT NULL, `isActive` tinyint(4) NOT NULL DEFAULT 1, `warehouseFk` smallint(6) unsigned DEFAULT NULL, @@ -41118,6 +41155,8 @@ CREATE TABLE `vehicle` ( `chassis` varchar(100) DEFAULT NULL COMMENT 'numero de bastidor', `fuelTypeFk` int(11) DEFAULT NULL, `ppeFk` int(11) DEFAULT NULL, + `countryCodeFk` varchar(2) DEFAULT 'ES', + `leasing` varchar(50) DEFAULT NULL COMMENT 'Id de arrendamiento', PRIMARY KEY (`id`), KEY `empresa_id` (`companyFk`), KEY `provinceFk_idx` (`warehouseFk`), @@ -41125,12 +41164,52 @@ CREATE TABLE `vehicle` ( KEY `vehicle_FK` (`fuelTypeFk`), KEY `vehicle_FK_1` (`ppeFk`), CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `vehicleCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `vehicle_FK` FOREIGN KEY (`fuelTypeFk`) REFERENCES `fuelType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `vehicle_FK_1` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE, - CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE + CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`vehicle_beforeInsert` + BEFORE INSERT ON `vehicle` + FOR EACH ROW +BEGIN + CALL vehicle_checkNumberPlate(NEW.numberPlate, NEW.countryCodeFk); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`vehicle_beforeUpdate` + BEFORE UPDATE ON `vehicle` + FOR EACH ROW +BEGIN + CALL vehicle_checkNumberPlate(NEW.numberPlate, NEW.countryCodeFk); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `vehicleConfig` @@ -41228,6 +41307,20 @@ CREATE TABLE `vehicleNotes` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `vehiclePlateRegex` +-- + +DROP TABLE IF EXISTS `vehiclePlateRegex`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehiclePlateRegex` ( + `countryCodeFk` varchar(2) NOT NULL, + `regex` varchar(45) NOT NULL, + PRIMARY KEY (`countryCodeFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `vehicleState` -- @@ -41279,7 +41372,9 @@ CREATE TABLE `wagon` ( `plate` varchar(10) NOT NULL COMMENT 'Matrícula', `typeFk` int(11) unsigned NOT NULL, `label` int(11) unsigned NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + KEY `wagon_type` (`typeFk`), + CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -41314,7 +41409,7 @@ CREATE TABLE `wagonType` ( `divisible` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41411,6 +41506,8 @@ CREATE TABLE `warehouse` ( `isLogiflora` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Este almacén acepta productos de Logiflora', `isBionic` tinyint(1) NOT NULL DEFAULT 1, `isHalt` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Almacén en el que descargan nuestros troncales', + `isOrigin` tinyint(1) DEFAULT NULL, + `isDestiny` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`), KEY `Id_Paises` (`countryFk`), @@ -41434,13 +41531,11 @@ CREATE TABLE `warehouse` ( /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`warehouse_afterInsert` - AFTER INSERT ON `warehouse` + BEFORE UPDATE ON `warehouse` FOR EACH ROW BEGIN - IF NEW.isFeedStock THEN - INSERT INTO warehouseAlias(`name`) VALUES(NEW.`name`); - INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) - VALUES(NEW.id,LAST_INSERT_ID()); + IF NEW.isFeedStock AND NEW.isInventory THEN + CALL util.throw("isFeedStock and isInventory cannot both be true"); END IF; END */;; DELIMITER ; @@ -41462,8 +41557,8 @@ DELIMITER ;; FOR EACH ROW BEGIN IF NEW.isFeedStock IS TRUE and OLD.isFeedStock IS FALSE then - INSERT INTO warehouseAlias(`name`) VALUES(NEW.`name`); - INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) + INSERT IGNORE INTO warehouseAlias(`name`) VALUES(NEW.`name`); + INSERT IGNORE INTO warehouseJoined(warehouseFk, warehouseAliasFk) VALUES(NEW.id,LAST_INSERT_ID()); END IF; END */;; @@ -41593,9 +41688,10 @@ CREATE TABLE `worker` ( /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_beforeInsert` -BEFORE INSERT -ON worker FOR EACH ROW + BEFORE INSERT ON `worker` + FOR EACH ROW BEGIN + SET NEW.editorFk = account.myUser_getId(); CALL vn.printer_checkSector(NEW.labelerFk, NEW.sectorFk); END */;; DELIMITER ; @@ -41606,16 +41702,18 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_beforeUpdate` BEFORE UPDATE ON `worker` FOR EACH ROW BEGIN + SET NEW.editorFk = account.myUser_getId(); + IF NOT (NEW.labelerFk <=> OLD.labelerFk AND NEW.sectorFk <=> OLD.sectorFk) THEN CALL vn.printer_checkSector(NEW.labelerFk, NEW.sectorFk); @@ -41633,6 +41731,30 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_afterDelete` + AFTER DELETE ON `worker` + FOR EACH ROW +BEGIN + INSERT INTO workerLog + SET `action` = 'delete', + `changedModel` = 'Worker', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `workerAppTester` @@ -41732,7 +41854,13 @@ CREATE TABLE `workerConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `businessUpdated` date DEFAULT NULL, `roleFk` int(10) unsigned NOT NULL COMMENT 'Rol por defecto al dar de alta un trabajador nuevo', - PRIMARY KEY (`id`) + `businessTypeFk` varchar(100) DEFAULT NULL COMMENT 'Tipo de negocio por defecto al dar de alta un trabajador nuevo', + `payMethodFk` tinyint(3) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `workerConfig_FK` (`roleFk`), + KEY `workerConfig_FK_1` (`payMethodFk`), + CONSTRAINT `workerConfig_FK` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE, + CONSTRAINT `workerConfig_FK_1` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -42081,18 +42209,19 @@ CREATE TABLE `workerLog` ( `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text NOT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `description` text DEFAULT NULL, + `changedModel` enum('Worker','Calendar','WorkerTimeControlMail','Business','WorkerDms') NOT NULL DEFAULT 'Worker', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `workerFk_idx` (`originFk`), KEY `userFk_idx` (`userFk`), + KEY `workerLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `workerLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42396,8 +42525,6 @@ CREATE TABLE `workerTimeControlConfig` ( `longWeekDays` int(11) DEFAULT NULL COMMENT 'Días a tener en cuenta para calcular el descanso largo', `teleworkingStart` int(11) DEFAULT NULL COMMENT 'Hora comienzo jornada de los teletrabajdores expresada en segundos', `teleworkingStartBreakTime` int(11) DEFAULT NULL COMMENT 'Hora comienzo descanso de los teletrabjadores expresada en segundos', - `breakTimeSplitDay` int(11) unsigned DEFAULT 3600 COMMENT 'Tiempo de descanso a partir del cual se determina que la jornada es partida', - `dateSplitDay` date DEFAULT '2023-03-01' COMMENT 'Fecha a partir de la cual se tiene en cuenta el valor de configuración de breakTimeSplitDay', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='All values in seconds'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -42511,7 +42638,6 @@ SET character_set_client = utf8; `surname` tinyint NOT NULL, `user` tinyint NOT NULL, `password` tinyint NOT NULL, - `bcryptPassword` tinyint NOT NULL, `departmentFk` tinyint NOT NULL, `dni` tinyint NOT NULL ) ENGINE=MyISAM */; @@ -43190,17 +43316,18 @@ CREATE TABLE `zoneLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` varchar(45) DEFAULT NULL, - `oldInstance` text DEFAULT NULL, - `newInstance` text DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, + `changedModel` enum('Zone','ZoneEvent','ZoneExclusion','ZoneIncluded','ZoneWarehouse') NOT NULL DEFAULT 'Zone', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), + KEY `zoneLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `zoneLog_originFk` (`originFk`,`creationDate`), CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43305,7 +43432,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `collection_make` ON SCHEDULE EVERY 5 MINUTE STARTS '2022-09-15 00:00:00' ON COMPLETION PRESERVE ENABLE DO CALL vn.collection_make */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `collection_make` ON SCHEDULE EVERY 5 MINUTE STARTS '2022-09-15 00:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL vn.collection_make */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43323,7 +43450,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `department_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-11-15 00:00:00' ON COMPLETION PRESERVE ENABLE DO CALL vn.department_doCalc */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `department_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-11-15 00:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL vn.department_doCalc */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43341,7 +43468,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `envialiaThreHoldChecker` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-28 09:52:46' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `envialiaThreHoldChecker` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-28 09:52:46' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO BEGIN DECLARE vActualNumber BIGINT; DECLARE vEndRange BIGINT; DECLARE vIsAlreadyNotified BOOLEAN; @@ -43387,7 +43514,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `greuge_notify` ON SCHEDULE EVERY 1 DAY STARTS '2023-01-01 00:07:00' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'Notifies subscribed users of events in wrong greuges' DO CALL vn.greuge_notifyEvents(util.CURDATE(), util.CURDATE()) */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `greuge_notify` ON SCHEDULE EVERY 1 DAY STARTS '2023-01-01 00:07:00' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE COMMENT 'Notifies subscribed users of events in wrong greuges' DO CALL vn.greuge_notifyEvents() */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43405,7 +43532,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `mysqlConnectionsSorter_kill` ON SCHEDULE EVERY 1 MINUTE STARTS '2021-10-28 09:56:27' ON COMPLETION NOT PRESERVE ENABLE DO CALL mysqlConnectionsSorter_kill() */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `mysqlConnectionsSorter_kill` ON SCHEDULE EVERY 1 MINUTE STARTS '2021-10-28 09:56:27' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL mysqlConnectionsSorter_kill() */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43423,7 +43550,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2022-01-28 09:52:46' ON COMPLETION PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2022-01-28 09:52:46' ON COMPLETION PRESERVE DISABLE ON SLAVE DO BEGIN DECLARE vCurrentCount INT; DECLARE vCheckSum INT; @@ -43532,7 +43659,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `route_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2021-07-08 07:32:23' ON COMPLETION PRESERVE ENABLE DO CALL route_doRecalc */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `route_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2021-07-08 07:32:23' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL route_doRecalc */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43550,7 +43677,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `sale_checkWithoutComponents` ON SCHEDULE EVERY 10 MINUTE STARTS '2020-05-04 11:56:23' ON COMPLETION PRESERVE DISABLE ON SLAVE DO call sale_checkNoComponents(DATE_ADD(util.VN_NOW(), INTERVAL -10 MINUTE),DATE_ADD(util.VN_NOW(), INTERVAL -1 MINUTE)) */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `sale_checkWithoutComponents` ON SCHEDULE EVERY 10 MINUTE STARTS '2020-05-04 11:56:23' ON COMPLETION PRESERVE DISABLE DO call sale_checkNoComponents(DATE_ADD(util.VN_NOW(), INTERVAL -10 MINUTE),DATE_ADD(util.VN_NOW(), INTERVAL -1 MINUTE)) */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43568,7 +43695,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticketClosure` ON SCHEDULE EVERY 1 DAY STARTS '2017-09-18 00:30:00' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE COMMENT 'Realiza el cierre de todos los almacenes del dia actual' DO CALL ticketClosureMultiWarehouse(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 DAY)) */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticketClosure` ON SCHEDULE EVERY 1 DAY STARTS '2017-09-18 00:30:00' ON COMPLETION NOT PRESERVE DISABLE COMMENT 'Realiza el cierre de todos los almacenes del dia actual' DO CALL ticketClosureMultiWarehouse(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 DAY)) */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43586,7 +43713,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticket_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2022-01-28 09:29:18' ON COMPLETION PRESERVE ENABLE DO CALL ticket_doRecalc */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticket_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2022-01-28 09:29:18' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL ticket_doRecalc */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43604,7 +43731,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `travel_doRecalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-05-17 10:52:29' ON COMPLETION PRESERVE ENABLE DO CALL travel_doRecalc */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `travel_doRecalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-05-17 10:52:29' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL travel_doRecalc */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43622,7 +43749,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `vehicle_notify` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-01 00:07:00' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'Notifies subscribed users of events in vehicles that are about t' DO CALL vn.vehicle_notifyEvents */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `vehicle_notify` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-01 00:07:00' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE COMMENT 'Notifies subscribed users of events in vehicles that are about t' DO CALL vn.vehicle_notifyEvents */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43640,7 +43767,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `worker_updateChangedBusiness` ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:05' ON COMPLETION NOT PRESERVE ENABLE DO CALL worker_updateChangedBusiness */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `worker_updateChangedBusiness` ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:05' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL worker_updateChangedBusiness */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43658,7 +43785,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `zoneGeo_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-09-13 15:30:47' ON COMPLETION PRESERVE ENABLE DO CALL vn.zoneGeo_doCalc */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `zoneGeo_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-09-13 15:30:47' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL vn.zoneGeo_doCalc */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43820,8 +43947,9 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `botanicExport_isUpdatable`(vEdiGenusFk MEDIUMINT,vEdiSpecieFk MEDIUMINT, - vCountryFk MEDIUMINT,vRestriction MEDIUMINT) RETURNS int(11) +CREATE DEFINER=`root`@`localhost` FUNCTION `botanicExport_isUpdatable`(vEdiGenusFk MEDIUMINT, + vEdiSpecieFk MEDIUMINT, + vRestriction MEDIUMINT) RETURNS int(11) DETERMINISTIC BEGIN DECLARE vIsUpdatable INTEGER; @@ -43829,8 +43957,7 @@ BEGIN FROM botanicExport WHERE ediGenusFk = vEdiGenusFk AND (vEdiSpecieFk = ediSpecieFk OR IFNULL(vEdiSpecieFk,ediSpecieFk) IS NULL) - AND (vCountryFk = countryFk OR IFNULL(vCountryFk,countryFk) IS NULL) - AND vRestriction = restriction; + AND vRestriction = restriction; RETURN vIsUpdatable; END ;; DELIMITER ; @@ -44134,21 +44261,21 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `clientTaxArea`(vClientId INT, vCompa READS SQL DATA BEGIN /** - * Devuelve el area de un cliente, - * intracomunitario, extracomunitario o nacional. - * - * @param vClient Id del cliente - * @param vCompanyFk Compañia desde la que se factura - * @return Código de area - */ - DECLARE vTaxArea VARCHAR(25); +* Devuelve el area de un cliente, +* intracomunitario, extracomunitario o nacional. +* +* @param vClient Id del cliente +* @param vCompanyFk Compañia desde la que se factura +* @return Código de area +*/ + DECLARE vTaxArea VARCHAR(25); - SELECT addressTaxArea(defaultAddressFk, vCompanyId) - INTO vTaxArea - FROM client - WHERE id = vClientId; + SELECT addressTaxArea(defaultAddressFk, vCompanyId) + INTO vTaxArea + FROM client + WHERE id = vClientId; - RETURN vTaxArea; + RETURN vTaxArea; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -44940,6 +45067,56 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `entry_isIntrastat` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_isIntrastat`(vSelf INT) RETURNS int(11) + READS SQL DATA +BEGIN +/** +* Devuelve si el proveedor de la entrada es de la CEE +* +* @param vSelf Id de la entrada +* @return true si es de la CEE +*/ + DECLARE vIsUeeSupplier BOOLEAN; + DECLARE vIsUeeCompany BOOLEAN; + DECLARE vSupplierCountry INT; + DECLARE vCompanyCountry INT; + + SELECT IFNULL(a.isUeeMember, c.isUeeMember), c.id + INTO vIsUeeSupplier, vSupplierCountry + FROM entry e + JOIN supplier s ON s.id = e.supplierFk + JOIN country c ON c.id = s.countryFk + LEFT JOIN province p ON p.id = s.provinceFk + LEFT JOIN autonomy a ON a.id = p.autonomyFk + WHERE e.id = vSelf; + + SELECT IFNULL(a.isUeeMember, c.isUeeMember), c.id + INTO vIsUeeCompany, vCompanyCountry + FROM entry e + JOIN supplier s ON s.id = e.companyFk + JOIN country c ON c.id = s.countryFk + LEFT JOIN province p ON p.id = s.provinceFk + LEFT JOIN autonomy a ON a.id = p.autonomyFk + WHERE e.id = vSelf; + + + RETURN vIsUeeCompany AND vIsUeeSupplier AND (vSupplierCountry <> vCompanyCountry); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `entry_isInventoryOrPrevious` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45340,115 +45517,6 @@ BEGIN WHERE itemFk = vItemFk AND clientFk = vClientFk ; RETURN price; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `getTicketToPrepare` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getTicketToPrepare`(`vWorker` INT, `vWarehouse` INT) RETURNS int(11) - READS SQL DATA -BEGIN -/** - * Devuelve el ticket que debe de preparar el trabajador - * - * @param vWorker Id del trabajador - * @param vWarehouse Id del almacén - * @return Id del ticket - * - * #UPDATED PAK 2019/08/16 - * #PENDING REVIEW - **/ - - DECLARE vToday DATETIME DEFAULT util.VN_CURDATE(); - DECLARE vYesterday DATETIME; - DECLARE vTodayvMidniight DATETIME DEFAULT midnight(vToday); - DECLARE vTicket INT DEFAULT NULL; - DECLARE PREVIOUS_PREPARATION INT; - DECLARE vHasBeenPreviouslyPrepared INT DEFAULT 0; - - SELECT id INTO PREVIOUS_PREPARATION - FROM vn.state - WHERE code LIKE 'PREVIOUS_PREPARATION'; - - SET vYesterday = TIMESTAMPADD(DAY,-1,vToday); - - DROP TEMPORARY TABLE IF EXISTS tmp.workerComercial; - CREATE TEMPORARY TABLE tmp.workerComercial - ENGINE = MEMORY - SELECT workerFk as worker FROM `grant` g - JOIN grantGroup gg ON g.`groupFk` = gg.id - WHERE gg.description = 'Comerciales'; - - DELETE wc.* - FROM tmp.workerComercial wc - JOIN `grant` g ON g.workerFk = wc.worker - JOIN grantGroup gg ON g.`groupFk` = gg.id - WHERE gg.description = 'Gerencia'; - - DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; - CREATE TEMPORARY TABLE tmp.production_buffer - ENGINE = MEMORY - SELECT t.id as ticket - , am.agencyFk as agency_id - , t.warehouseFk as warehouse_id - , a.provinceFk as province_id - , IF (HOUR(t.shipped),HOUR(t.shipped),HOUR(z.`hour`)) as Hora - , HOUR(t.shipped) as Departure - , IF (MINUTE(t.shipped),MINUTE(t.shipped),MINUTE(z.`hour`)) as Minuto - , tls.code - , IFNULL(t.priority,0) loadingOrder - FROM ticket t - JOIN ticketState tls on t.id = tls.ticket - JOIN agencyMode am on am.id = t.agencyModeFk - JOIN address a on a.id = t.addressFk - LEFT JOIN tmp.workerComercial wc ON wc.worker = vWorker - LEFT JOIN vn.zone z ON z.id = t.zoneFk - WHERE t.shipped BETWEEN vYesterday AND vTodayvMidniight - AND t.warehouseFk = vWarehouse - AND - ( - (tls.code = 'PRINTED' AND wc.worker IS NULL) - OR - (tls.code ='PICKER_DESIGNED' AND tls.worker = vWorker) - OR - (tls.code = 'PRINTED_BACK') - OR - (tls.code = 'PRINTED PREVIOUS') - ); - - - SELECT ticket INTO vTicket - FROM tmp.production_buffer - ORDER BY (code = 'PICKER_DESIGNED') DESC, (code = 'PRINTED PREVIOUS') DESC ,Hora, Minuto, loadingOrder - LIMIT 1; - - -- Aviso de ticket para bajar - SELECT COUNT(*) INTO vHasBeenPreviouslyPrepared - FROM ticketTracking - WHERE ticketFk = vTicket - AND stateFk = PREVIOUS_PREPARATION; - - IF vHasBeenPreviouslyPrepared AND ticketWarehouseGet(vTicket) = 1 THEN - - INSERT IGNORE INTO vn.ticketDown(ticketFk) VALUES(vTicket); - - END IF; - - -- END IF; - - RETURN vTicket; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -45933,30 +46001,9 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `isIntrastatEntry`(vEntryFk INT) RETURNS int(11) READS SQL DATA BEGIN - DECLARE isIntrastatOperation BOOL DEFAULT FALSE; - DECLARE vSupplierCountry INT DEFAULT -1; - DECLARE vClientCountry INT DEFAULT -1; + -- para retrocompatibilidad, eliminar en la siguiente version - SELECT c.id INTO vSupplierCountry - FROM vn.country c - JOIN vn.supplier s ON s.countryFk = c.id - JOIN vn.entry e ON e.supplierFk = s.id - WHERE e.id = vEntryFk - AND c.isUeeMember = TRUE; - - SELECT c.id INTO vClientCountry - FROM vn.country c - JOIN vn.supplier s ON s.countryFk = c.id - JOIN vn.company co ON co.id = s.id - JOIN vn.entry e ON e.companyFk = co.id - WHERE e.id = vEntryFk - AND c.isUeeMember = TRUE; - - IF vSupplierCountry != vClientCountry AND vSupplierCountry * vClientCountry > 0 THEN - SET isIntrastatOperation = TRUE; - END IF; - - RETURN isIntrastatOperation; + RETURN (SELECT entry_isIntrastat(vEntryFk)); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47167,7 +47214,7 @@ BEGIN ENGINE = MEMORY SELECT vTicketId ticketFk; - CALL ticketGetTotal; + CALL ticketGetTotal(NULL); SELECT total INTO vTotal FROM tmp.ticketTotal; @@ -48430,18 +48477,17 @@ BEGIN * @return tmp.addressTaxArea(addressFk,companyFk) */ - DECLARE vSpainCountryCode INT DEFAULT 1; - - DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; + DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; CREATE TEMPORARY TABLE tmp.addressTaxArea (PRIMARY KEY (addressFk, companyFk)) ENGINE = MEMORY SELECT CASE - WHEN (NOT cClient.isUeeMember OR NOT cSupplier.isUeeMember) AND s.countryFk != c.countryFk THEN + WHEN (NOT IFNULL(auClient.isUeeMember, cClient.isUeeMember) OR NOT cSupplier.isUeeMember) + AND NOT (auSupplier.id <=> auClient.id) THEN 'WORLD' WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.isVies THEN 'CEE' - WHEN a.isEqualizated AND c.countryFk = vSpainCountryCode THEN + WHEN a.isEqualizated AND cClient.code = 'ES' THEN 'EQU' ELSE 'NATIONAL' @@ -48450,8 +48496,12 @@ BEGIN JOIN address a ON a.id = ac.addressFk JOIN `client` c ON c.id = a.clientFk JOIN country cClient ON cClient.id = c.countryFk + LEFT JOIN province pClient ON pClient.id = c.provinceFk + LEFT JOIN autonomy auClient ON auClient.id = pClient.autonomyFk JOIN supplier s ON s.id = ac.companyFk - JOIN country cSupplier ON cSupplier.id = s.countryFk; + JOIN country cSupplier ON cSupplier.id = s.countryFk + LEFT JOIN province pSupplier ON pSupplier.id = s.provinceFk + LEFT JOIN autonomy auSupplier ON auSupplier.id = pSupplier.autonomyFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -50345,7 +50395,7 @@ BEGIN c.created < vDateShort; DELETE FROM vn.expeditionTruck - WHERE ETD < v3Month; + WHERE eta < v3Month; -- borrar travels sin entradas DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; @@ -50570,11 +50620,11 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientCreate`( vFirstname VARCHAR(50), @@ -50619,7 +50669,7 @@ BEGIN isEqualizated) VALUES ( vUserFk, - CONCAT('TR ', vFirstname, ' ', vSurnames), + CONCAT(vFirstname, ' ', vSurnames), vAddress, TRIM(vFi), vPhone, @@ -50960,169 +51010,6 @@ BEGIN END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `clientPackagingOverstock` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstock`(vClientFk INT, vGraceDays INT ) -BEGIN - DROP TEMPORARY TABLE IF EXISTS tmp.clientPackagingOverstock; - CREATE TEMPORARY TABLE tmp.clientPackagingOverstock - ENGINE = MEMORY - SELECT itemFk, - sum(GotfromClient) - sum(SenttoClient) as devueltos, - sum(InvoicedtoClient) - sum(InvoicedfromClient) as facturados, - LEAST( - sum(GotfromClient) - sum(SenttoClient), - sum(InvoicedtoClient) - sum(InvoicedfromClient) - ) as abonables - FROM - ( - SELECT t.*, - IF(@month = month, 0, 1) monthEnd, - @month := month - FROM - ( - SELECT x.id as ticketFk, - date(x.shipped) as shipped, - x.itemFk, - IFNULL(cast(sum(x.InvoicedtoClient) as DECIMAL(10,0)),0) InvoicedtoClient, - IFNULL(cast(sum(x.InvoicedfromClient) as DECIMAL(10,0)),0) InvoicedfromClient, - IFNULL(cast(sum(x.SenttoClient) as DECIMAL(10,0)),0) SenttoClient, - IFNULL(cast(sum(x.GotfromClient) as DECIMAL(10,0)),0) GotfromClient, - i.name as concept, - x.refFk as invoice, - month(shipped) month, - x.companyFk - FROM - ( - SELECT t.id, - t.shipped, - IFNULL(pe.equivalentFk, s.itemFk) itemFk, - IF(s.quantity > 0, s.quantity, NULL) InvoicedtoClient, - IF(s.quantity < 0, -s.quantity, NULL) InvoicedfromClient, - NULL SenttoClient, - NULL GotfromClient, - t.refFk, - @month := 0 month, - t.companyFk - FROM sale s - JOIN ticket t on t.id = s.ticketFk - JOIN packaging p ON p.itemFk = s.itemFk - LEFT JOIN packageEquivalentItem pe ON pe.itemFk = s.itemFk - WHERE t.clientFk = vClientFk - AND t.shipped > '2017-11-30' - AND p.isPackageReturnable - UNION ALL - SELECT NULL, - '2017-11-30', - IFNULL(pe.equivalentFk, tps.itemFk) itemFk, - tps.sent InvoicedtoClient, - tps.returned InvoicedfromClient, - NULL SenttoClient, - NULL GotfromClient, - 'Histórico', - NULL, - NULL - - FROM ticketPackagingStartingStock tps - LEFT JOIN packageEquivalentItem pe ON pe.itemFk = tps.itemFk - WHERE tps.clientFk = vClientFk - AND tps.isForgetable = FALSE - UNION ALL - SELECT t.id, - t.shipped, - IFNULL(pe.equivalentFk, p.itemFk) itemFk, - NULL, - NULL, - IF(tp.quantity > 0 AND t.shipped <= TIMESTAMPADD(DAY, - vGraceDays, util.VN_CURDATE()), tp.quantity, NULL) SenttoClient, - IF(tp.quantity < 0, -tp.quantity, NULL) GotfromClient, - NULL AS refFk, - NULL, - t.companyFk - FROM ticketPackaging tp - JOIN ticket t on t.id = tp.ticketFk - JOIN packaging p ON p.id = tp.packagingFk - LEFT JOIN packageEquivalentItem pe ON pe.itemFk = p.itemFk - WHERE t.clientFk = vClientFk - AND t.shipped > '2017-11-21' ) x - - JOIN item i ON x.itemFk = i.id - GROUP BY x.id, x.itemFk - ) t - ORDER BY itemFk, shipped DESC - LIMIT 10000000000000000000 - ) t2 - GROUP BY itemFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `clientPackagingOverstockReturn` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstockReturn`(vClientFk INT, vGraceDays INT ) -BEGIN - - DECLARE vNewTicket INT DEFAULT 0; - DECLARE vWarehouseFk INT; - -- SET vGraceDays = GREATEST(vGraceDays, 90); - - CALL vn.clientPackagingOverstock(vClientFk,vGraceDays); - - SELECT id INTO vWarehouseFk - FROM vn.warehouse - WHERE hasConfectionTeam; - - CALL vn.ticket_add( - vClientFk - ,util.VN_CURDATE() - ,vWarehouseFk -- Algemesi - ,442 -- Verdnatura - ,NULL -- address - ,NULL -- agencia - ,NULL -- route - ,util.VN_CURDATE() - ,account.myUser_getId() - ,TRUE - ,vNewTicket); - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) - SELECT vNewTicket, cpo.itemFk, - cpo.abonables, i.longName, p.price - FROM tmp.clientPackagingOverstock cpo - JOIN vn.item i ON i.id = cpo.itemFk - JOIN vn.packaging p ON p.itemFk = cpo.itemFk - WHERE cpo.abonables > 0; - - INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) - SELECT vNewTicket, p.id, cpo.abonables - FROM tmp.clientPackagingOverstock cpo - JOIN vn.packaging p ON p.itemFk = cpo.itemFk - WHERE cpo.abonables > 0; - - SELECT vNewTicket; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51156,22 +51043,22 @@ BEGIN CREATE TEMPORARY TABLE tmp.clientGetDebt SELECT cd.id as clientFk FROM bs.clientDied cd - LEFT JOIN vn.clientProtected cp ON cp.clientFk = cd.id - JOIN vn.client c ON c.id = cd.id - JOIN vn.province p ON p.id = c.provinceFk - JOIN vn.country co ON co.id = p.countryFk - WHERE cd.Aviso = 'TERCER AVISO' AND - cp.clientFk IS NULL AND - co.country NOT IN ('Portugal','Francia','España exento') AND - c.salesPersonFk IS NOT NULL; + LEFT JOIN clientProtected cp ON cp.clientFk = cd.id + JOIN client c ON c.id = cd.id + JOIN province p ON p.id = c.provinceFk + LEFT JOIN autonomy a ON a.id = p.autonomyFk + JOIN country co ON co.id = p.countryFk + WHERE cd.Aviso = 'TERCER AVISO' + AND cp.clientFk IS NULL + AND co.code NOT IN ('PT','FR') + AND a.name <> 'Canarias' + AND c.salesPersonFk IS NOT NULL; OPEN rs; FETCH rs INTO vClientFk; WHILE NOT vDone DO CALL vn.clientGreugeSpray(vClientFk, TRUE, '',TRUE); UPDATE vn.client SET salesPersonFk = NULL WHERE id = vClientFk; - INSERT INTO vn.clientLog (originFk, userFk, `action`, description) - VALUES (vClientFk, account.myUser_getId(), 'update', CONCAT('Se ha desasignado el cliente por que no ha comprado en 3 meses')); FETCH rs INTO vClientFk; END WHILE; CLOSE rs; @@ -52180,7 +52067,7 @@ proc:BEGIN DECLARE vWagons INT; DECLARE vTrainFk INT; DECLARE vMaxTickets INT; - DECLARE vStateFk INT; + DECLARE vStateFk VARCHAR(45); DECLARE vFirstTicketFk INT; DECLARE vHour INT; DECLARE vMinute INT; @@ -52217,7 +52104,7 @@ proc:BEGIN w.code, o.warehouseFk, o.itemPackingTypeFk, - st.id, + st.code, CONCAT('collection_new', o.warehouseFk, ':',o.itemPackingTypeFk), o.numberOfWagons, o.trainFk @@ -52231,10 +52118,10 @@ proc:BEGIN vLockName, vWagons, vTrainFk - FROM vn.productionConfig pc - JOIN vn.worker w ON w.id = vUserFk - JOIN vn.state st ON st.`code` = 'ON_PREPARATION' - JOIN vn.operator o ON o.workerFk = vUserFk; + FROM productionConfig pc + JOIN worker w ON w.id = vUserFk + JOIN state st ON st.`code` = 'ON_PREPARATION' + JOIN operator o ON o.workerFk = vUserFk; IF NOT GET_LOCK(vLockName,vLockTime) THEN LEAVE proc; @@ -52256,20 +52143,20 @@ proc:BEGIN INSERT INTO tTrain(wagon, shelve, liters, `lines`, height) SELECT vWagonCounter, cv.`level` , cv.liters , cv.`lines` , cv.height - FROM vn.collectionVolumetry cv + FROM collectionVolumetry cv WHERE cv.trainFk = vTrainFk AND cv.itemPackingTypeFk = vItemPackingTypeFk; END WHILE; -- Esto desaparecerá cuando tengamos la table cache.ticket - CALL vn.productionControl(vWarehouseFk, 0); + CALL productionControl(vWarehouseFk, 0); ALTER TABLE tmp.productionBuffer ADD COLUMN liters INT, ADD COLUMN height INT; -- Se obtiene nº de colección. - INSERT INTO vn.collection + INSERT INTO collection SET itemPackingTypeFk = vItemPackingTypeFk, trainFk = vTrainFk, wagons = vWagons, @@ -52281,7 +52168,7 @@ proc:BEGIN -- Los pedidos con riesgo no se sacan aunque se asignen. DELETE pb.* FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state + JOIN state s ON s.id = pb.state WHERE (pb.agency = 'REC_ALGEMESI' AND s.code <> 'PICKER_DESIGNED') OR pb.problem LIKE '%RIESGO%'; @@ -52291,7 +52178,7 @@ proc:BEGIN -- de problemas o tamaños SELECT COUNT(*) INTO vHasAssignedTickets FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state + JOIN state s ON s.id = pb.state WHERE s.code = 'PICKER_DESIGNED' AND pb.workerCode = vWorkerCode; @@ -52299,16 +52186,16 @@ proc:BEGIN IF vHasAssignedTickets THEN DELETE pb.* FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state + JOIN state s ON s.id = pb.state WHERE s.code <> 'PICKER_DESIGNED' OR pb.workerCode <> vWorkerCode; ELSE DELETE pb.* FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.productionConfig pc + JOIN state s ON s.id = pb.state + JOIN agencyMode am ON am.id = pb.agencyModeFk + JOIN agency a ON a.id = am.agencyFk + JOIN productionConfig pc WHERE pb.shipped <> util.VN_CURDATE() OR (pb.ubicacion IS NULL AND a.isOwn = TRUE) OR (s.isPreparable = FALSE AND s.isPrintable = FALSE) @@ -52351,15 +52238,15 @@ proc:BEGIN read_loop: LOOP SET vDone = FALSE; - CALL vn.ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk); + CALL ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk); DROP TEMPORARY TABLE tmp.ticketIPT; UPDATE tmp.productionBuffer pb JOIN (SELECT @litros:= SUM(litros) liters, COUNT(*) `lines`, MAX(i.`size`) height - FROM vn.saleVolume sv - JOIN vn.sale s ON s.id = sv.saleFk - JOIN vn.item i ON i.id = s.itemFk + FROM saleVolume sv + JOIN sale s ON s.id = sv.saleFk + JOIN item i ON i.id = s.itemFk WHERE sv.ticketFk = vTicketFk ) sub SET pb.liters = sub.liters, pb.`lines` = sub.`lines`, pb.height = sub.height WHERE pb.ticketFk = vTicketFk; @@ -52420,37 +52307,35 @@ proc:BEGIN CLOSE cur1; IF (SELECT COUNT(*) FROM tTrain WHERE ticketFk) THEN - UPDATE vn.collection c - JOIN vn.state st ON st.code = 'ON_PREPARATION' + UPDATE collection c + JOIN state st ON st.code = 'ON_PREPARATION' SET c.stateFk = st.id WHERE c.id = vCollectionFk; -- Asigna las bandejas - INSERT IGNORE INTO vn.ticketCollection(ticketFk, collectionFk, `level`, wagon, liters) + INSERT IGNORE INTO ticketCollection(ticketFk, collectionFk, `level`, wagon, liters) SELECT tt.ticketFk, vCollectionFk, tt.shelve, tt.wagon, tt.liters FROM tTrain tt WHERE tt.ticketFk IS NOT NULL ORDER BY tt.wagon, tt.shelve; -- Actualiza el estado de los tickets - INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) - SELECT vStateFk, ticketFk, vUserFk - FROM vn.ticketCollection tc - WHERE tc.collectionFk = vCollectionFk; + + CALL collection_setState(vCollectionFk, vStateFk); -- Aviso para la preparacion previa - INSERT INTO vn.ticketDown(ticketFk, collectionFk) + INSERT INTO ticketDown(ticketFk, collectionFk) SELECT tc.ticketFk, tc.collectionFk - FROM vn.ticketCollection tc + FROM ticketCollection tc WHERE tc.collectionFk = vCollectionFk; - CALL vn.sales_mergeByCollection(vCollectionFk); + CALL sales_mergeByCollection(vCollectionFk); - UPDATE vn.collection c + UPDATE collection c JOIN (SELECT count(*) saleTotalCount , sum(s.isPicked != 0) salePickedCount - FROM vn.ticketCollection tc - JOIN vn.sale s ON s.ticketFk = tc.ticketFk + FROM ticketCollection tc + JOIN sale s ON s.ticketFk = tc.ticketFk WHERE tc.collectionFk = vCollectionFk AND s.quantity > 0 ) sub @@ -52461,7 +52346,7 @@ proc:BEGIN ELSE -- CALL util.throw('No ha sido posible obtener colección'); - DELETE FROM vn.collection WHERE id = vCollectionFk; + DELETE FROM collection WHERE id = vCollectionFk; SET vCollectionFk = NULL; END IF; @@ -52551,6 +52436,63 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collection_setState` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_setState`(vSelf INT, vStateCode VARCHAR(255) COLLATE utf8_general_ci) +BEGIN +/** + * Modifica el estado de los tickets de una colección. + * + * @param vSelf el id del colección + * @param vStateCode estado a modificar de los tickets + */ + DECLARE vTicketFk INT; + DECLARE vDone INT DEFAULT FALSE; + DECLARE vCursor CURSOR FOR + SELECT DISTINCT ticketFk + FROM ticketCollection tc + WHERE tc.collectionFk = vSelf; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + OPEN vCursor; + + read_loop: LOOP + + FETCH vCursor INTO vTicketFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + CALL ticket_setState(vTicketFk, vStateCode); + + END LOOP; + + CLOSE vCursor; + + COMMIT; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `company_getFiscaldata` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53616,7 +53558,7 @@ BEGIN WHILE NOT done DO - CALL invoiceInBookingMain(vInvoiceFk); + CALL invoiceIn_booking(vInvoiceFk); IF vCounter > 0 OR vASIEN > 0 THEN @@ -53703,9 +53645,9 @@ BEGIN FROM dua WHERE id = vDuaFk; - IF vBookNumber IS NULL OR NOT vBookNumber THEN + IF vBookNumber IS NULL OR NOT vBookNumber THEN CALL ledger_next(vBookNumber); - END IF; + END IF; -- Apunte de la aduana @@ -53715,10 +53657,10 @@ BEGIN SUBCTA, CONCEPTO, EUROHABER, - SERIE, + SERIE, empresa_id, - CLAVE, - FACTURA) + CLAVE, + FACTURA) SELECT vBookNumber, @@ -53726,15 +53668,15 @@ BEGIN '4700000999', CONCAT('DUA ',d.`code`), sum(dt.base * dt.rate / 100) EUROHABER, - 'R', + 'R', d.companyFk, - vDuaFk, - vDuaFk + vDuaFk, + vDuaFk FROM duaTax dt JOIN dua d ON d.id = dt.duaFk - WHERE dt.duaFk = vDuaFk; + WHERE dt.duaFk = vDuaFk; - -- Apuntes por tipo de IVA y proveedor + -- Apuntes por tipo de IVA y proveedor INSERT INTO XDiario( ASIEN, @@ -53789,27 +53731,28 @@ BEGIN 1 TIPONOSUJE, 5 TIPOFACT, 1 TIPORECTIF, - IF(s.countryFk IN (30, 1), 1, 4) TERIDNIF, + IF(c.code = 'ES', 1, 4) TERIDNIF, s.nif TERNIF, s.name TERNOM, d.companyFk, d.booked FECREGCON FROM duaTax dt JOIN dua d ON dt.duaFk = d.id - JOIN (SELECT account, rate + JOIN (SELECT account, rate FROM (SELECT rate, account FROM invoiceInTaxBookingAccount ta - WHERE ta.effectived <= vBookDated - AND taxAreaFk = 'WORLD' - ORDER BY ta.effectived DESC + WHERE ta.effectived <= vBookDated + AND taxAreaFk = 'WORLD' + ORDER BY ta.effectived DESC LIMIT 10000000000000000000 ) tba GROUP BY rate - ) tr ON tr.rate = dt.rate + ) tr ON tr.rate = dt.rate JOIN supplier s ON s.id = d.companyFk + JOIN country c ON c.id = s.countryFk WHERE d.id = vDuaFk - GROUP BY dt.rate; + GROUP BY dt.rate; SELECT SUM(EURODEBE) -SUM(EUROHABER), MAX(id) INTO vDiff, vApunte FROM XDiario @@ -53820,9 +53763,9 @@ BEGIN EURODEBE = EURODEBE - vDiff WHERE id = vApunte; - UPDATE dua + UPDATE dua SET ASIEN = vBookNumber - WHERE id = vDuaFk; + WHERE id = vDuaFk; END ;; DELIMITER ; @@ -54120,54 +54063,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `entryLog_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entryLog_add`( - vChangedModel VARCHAR(45), - vOriginFk INT, - vChangedModelId INT, - vActionCode VARCHAR(45), - vChangedModelValue VARCHAR(255), - vOldInstance JSON, - vNewInstance JSON) -BEGIN -/** - * Guarda las acciones realizadas por el usuario - * - * @param vChangedModel Nombre que hace referencia a la tabla que se modifica - * @param vOriginFk Id del registro de la tabla origen - * @param vChangedModelId Id del registro de la tabla a la que se realiza la acción - * @param vActionCode Código de la acción {insert | delete | update} - * @param vOldInstance JSON que contiene los valores viejos - * @param vNewInstance JSON que contiene los valores nuevos - */ - CALL util.log_cleanInstances(vActionCode, vOldInstance, vNewInstance); - - IF !(vOldInstance = '{}' AND vNewInstance = '{}') THEN - INSERT INTO entryLog SET - changedModel = vChangedModel, - originFk = vOriginFk, - changedModelId = vChangedModelId, - `action` = vActionCode, - changedModelValue = vChangedModelValue, - oldInstance = vOldInstance, - newInstance = vNewInstance, - userFk = account.myUser_getId(); - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `entryWithItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54758,18 +54653,6 @@ BEGIN e.invoiceAmount = vInvoiceAmountNewEntry WHERE e.id = vNewEntryFk; - INSERT INTO entryLog - SET `action` = 'update', - description = CONCAT('Se ha creado la entrada ', vNewEntryFk,' transferida desde la ', vSelf), - userFk = account.myUser_getId(), - originFk = vSelf; - - INSERT INTO entryLog - SET `action` = 'update', - description = CONCAT('Se ha creado la entrada ', vNewEntryFk,' transferida desde la ', vSelf), - userFk = account.myUser_getId(), - originFk = vNewEntryFk; - UPDATE entry SET gestDocFk = (SELECT gestDocFk FROM entry WHERE id = vSelf LIMIT 1) WHERE id = vNewEntryFk; @@ -55939,7 +55822,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_Add`(vHour VARCHAR(5), vDescription VARCHAR(45)) BEGIN - INSERT INTO vn.expeditionTruck(ETD,description) + INSERT INTO vn.expeditionTruck(eta,description) VALUES(CONCAT(util.VN_CURDATE(), ' ', vHour), vDescription); END ;; @@ -55962,11 +55845,11 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_List`() BEGIN SELECT id truckFk, - ETD, + eta, description Destino - FROM vn.expeditionTruck - WHERE ETD BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) - ORDER BY ETD; + FROM expeditionTruck + WHERE eta BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) + ORDER BY eta; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56073,7 +55956,7 @@ BEGIN am.name zonaRuta, t.routeFk ruta, rm.beachFk ubicacion, - et.ETD , + et.eta , et.description camion, vTicketsPendientes AS ticketsPendientes, vEtiquetasTotales AS etiquetasTotales, @@ -56159,7 +56042,7 @@ BEGIN am.name zonaRuta, t.routeFk ruta, rm.beachFk ubicacion, - et.ETD , + et.eta , et.description camion, vTicketsPendientes AS ticketsPendientes, vEtiquetasTotales AS etiquetasTotales, @@ -57274,7 +57157,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `invoiceInBookingCommon` */; +/*!50003 DROP PROCEDURE IF EXISTS `invoiceInDueDay_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -57284,50 +57167,219 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInBookingCommon`(vInvoiceInId INT, OUT vSerialNumber INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_calculate`(vInvoiceInFk INT) BEGIN - DROP TEMPORARY TABLE IF EXISTS newInvoiceIn; + IF !(SELECT COUNT(*) + FROM invoiceInDueDay iid + WHERE iid.invoiceInFk = vInvoiceInFk) THEN - CREATE TEMPORARY TABLE newInvoiceIn - SELECT - i.*, - YEAR(i.booked) datedYear, - CONCAT('s/fra',RIGHT(i.supplierRef,8),':',LEFT(s.name, 10)) conceptWithSupplier, - (cc.id = c.id) isSameCountry, - cit.id invoicesCount - FROM invoiceIn i - JOIN cplusInvoiceType472 cit ON cit.id = i.cplusInvoiceType472Fk - JOIN supplier s ON s.id = i.supplierFk - JOIN country c ON c.id = s.countryFk - JOIN supplier sc ON sc.id = i.companyFk - JOIN country cc ON cc.id = sc.countryFk - WHERE i.id = vInvoiceInId; + INSERT INTO invoiceInDueDay (invoiceInFk, + dueDated, + amount, + foreignValue) + SELECT vInvoiceInFk, + IF(payDay, + IF(vn.getNextDueDate(issued, detail, payDay) < DATE_ADD(created, INTERVAL 2 DAY), + DATE_ADD(created, INTERVAL 2 DAY), + vn.getNextDueDate(issued, detail, payDay)), + GREATEST(TIMESTAMPADD(DAY, 2, created), TIMESTAMPADD(DAY, detail, issued))), + IF((@cont:=@cont + 1) < cont, TRUNCATE(venc / cont, 2),venc-(TRUNCATE(venc / cont, 2) * (cont - 1))), + IF(@cont < cont, TRUNCATE(foreignValue / cont, 2), foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) + FROM ( SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100)*(s.countryFk = s2.countryFk)) * iit.taxableBase)/COUNT(DISTINCT(pdd.detail)) venc, + SUM(iit.foreignValue)/COUNT(DISTINCT(pdd.detail)) foreignValue, + s.payDemFk, + ii.companyFk, + COUNT(DISTINCT(pdd.detail)) cont, + s.payDay, + ii.issued, + DATE(ii.created) created + FROM invoiceIn ii + JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id + LEFT JOIN sage.TiposIva AS ti ON ti.CodigoIva= iit.taxTypeSageFk + JOIN supplier s ON s.id = ii.supplierFk + JOIN supplier s2 ON s2.id = ii.companyFk + JOIN vn.payDemDetail pdd ON pdd.id = s.payDemFk + WHERE ii.id = vInvoiceInFk + GROUP BY ii.id + ) sub + JOIN (SELECT @cont:=0) sub2 + JOIN vn.payDemDetail pdd ON pdd.id = sub.payDemFk + GROUP BY detail; + END IF; - DROP TEMPORARY TABLE IF EXISTS newSupplier; - CREATE TEMPORARY TABLE newSupplier - SELECT - s.*, - REPLACE(s.account,' ','') supplierAccount, - IF(c.CEE < 2, TRUE, FALSE) isUeeMember - FROM supplier s - JOIN newInvoiceIn n - JOIN country c ON c.id = s.countryFk - WHERE s.id = n.supplierFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `invoiceInDueDay_recalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_recalc`(vInvoiceInFk INT) +BEGIN - IF (SELECT isActive FROM newSupplier) = 0 THEN - CALL util.throw('INACTIVE_PROVIDER'); + DELETE FROM invoiceInDueDay + WHERE invoiceInFk = vInvoiceInFk; + + CALL invoiceInDueDay_calculate(vInvoiceInFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `invoiceInTaxMakeByDua` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(vDuaFk INT) +BEGIN + + DECLARE done BOOL DEFAULT FALSE; + DECLARE vInvoiceInFk INT; + + DECLARE rs CURSOR FOR + SELECT invoiceInFk + FROM entry e + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + FETCH rs INTO vInvoiceInFk; + + WHILE NOT done DO + + CALL vn2008.recibidaIvaInsert(vInvoiceInFk); + CALL invoiceInDueDay_recalc(vInvoiceInFk); + + FETCH rs INTO vInvoiceInFk; + + END WHILE; + + CLOSE rs; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `invoiceInTax_getFromDua` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT) +BEGIN + + DECLARE done BOOL DEFAULT FALSE; + DECLARE vInvoiceInFk INT; + + DECLARE rs CURSOR FOR + SELECT invoiceInFk + FROM entry e + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + FETCH rs INTO vInvoiceInFk; + + WHILE NOT done DO + + CALL invoiceInTax_getFromEntries(vInvoiceInFk); + CALL invoiceInDueDay_calculate(vInvoiceInFk); + + FETCH rs INTO vInvoiceInFk; + + END WHILE; + + CLOSE rs; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `invoiceInTax_getFromEntries` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vId INT) +BEGIN + DECLARE vRate DOUBLE DEFAULT 1; + DECLARE vDated DATE; + DECLARE vExpenceFk VARCHAR(10); + + SELECT MAX(rr.dated) INTO vDated + FROM referenceRate rr + JOIN invoiceIn ii ON ii.id = vId + WHERE rr.dated <= ii.issued + AND rr.currencyFk = ii.currencyFk ; + + IF vDated THEN + SELECT `value` INTO vRate + FROM referenceRate + WHERE dated = vDated; END IF; - SELECT IFNULL(MAX(i.serialNumber) + 1,1) - INTO vSerialNumber - FROM invoiceIn i - JOIN newInvoiceIn n - WHERE i.serial LIKE n.serial - AND YEAR(i.booked) = n.datedYear - AND i.companyFk = n.companyFk - GROUP BY i.companyFk; + SELECT id INTO vExpenceFk + FROM vn.expence + WHERE `name` = 'Adquisición mercancia Extracomunitaria' + GROUP BY id + LIMIT 1; + DELETE FROM invoiceInTax + WHERE invoiceInFk = vId; + + INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) + SELECT ii.id, + SUM(b.buyingValue * b.quantity) / IFNULL(vRate,1) taxableBase, + vExpenceFk, + IF(ii.currencyFk = 1,NULL,SUM(b.buyingValue * b.quantity )) divisa, + taxTypeSageFk, + transactionTypeSageFk + FROM invoiceIn ii + JOIN entry e ON e.invoiceInFk = ii.id + JOIN supplier s ON s.id = e.supplierFk + JOIN buy b ON b.entryFk = e.id + LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk + AND rr.dated = ii.issued + WHERE ii.id = vId + HAVING taxableBase IS NOT NULL; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -57340,14 +57392,11 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; - - - +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceIn_booking`(vSelf INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_booking`(vSelf INT) BEGIN DECLARE vBookNumber INT; @@ -57624,238 +57673,6 @@ BEGIN DROP TEMPORARY TABLE tInvoiceIn; END ;; DELIMITER ; - - - -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `invoiceInDueDay_calculate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_calculate`(vInvoiceInFk INT) -BEGIN - - IF !(SELECT COUNT(*) - FROM invoiceInDueDay iid - WHERE iid.invoiceInFk = vInvoiceInFk) THEN - - INSERT INTO invoiceInDueDay (invoiceInFk, - dueDated, - amount, - foreignValue) - SELECT vInvoiceInFk, - IF(payDay, - IF(vn.getNextDueDate(issued, detail, payDay) < DATE_ADD(created, INTERVAL 2 DAY), - DATE_ADD(created, INTERVAL 2 DAY), - vn.getNextDueDate(issued, detail, payDay)), - GREATEST(TIMESTAMPADD(DAY, 2, created), TIMESTAMPADD(DAY, detail, issued))), - IF((@cont:=@cont + 1) < cont, TRUNCATE(venc / cont, 2),venc-(TRUNCATE(venc / cont, 2) * (cont - 1))), - IF(@cont < cont, TRUNCATE(foreignValue / cont, 2), foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) - FROM ( SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100)*(s.countryFk = s2.countryFk)) * iit.taxableBase)/COUNT(DISTINCT(pdd.detail)) venc, - SUM(iit.foreignValue)/COUNT(DISTINCT(pdd.detail)) foreignValue, - s.payDemFk, - ii.companyFk, - COUNT(DISTINCT(pdd.detail)) cont, - s.payDay, - ii.issued, - DATE(ii.created) created - FROM invoiceIn ii - JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id - LEFT JOIN sage.TiposIva AS ti ON ti.CodigoIva= iit.taxTypeSageFk - JOIN supplier s ON s.id = ii.supplierFk - JOIN supplier s2 ON s2.id = ii.companyFk - JOIN vn.payDemDetail pdd ON pdd.id = s.payDemFk - WHERE ii.id = vInvoiceInFk - GROUP BY ii.id - ) sub - JOIN (SELECT @cont:=0) sub2 - JOIN vn.payDemDetail pdd ON pdd.id = sub.payDemFk - GROUP BY detail; - END IF; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `invoiceInDueDay_recalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_recalc`(vInvoiceInFk INT) -BEGIN - - DELETE FROM invoiceInDueDay - WHERE invoiceInFk = vInvoiceInFk; - - CALL invoiceInDueDay_calculate(vInvoiceInFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `invoiceInTaxMakeByDua` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(vDuaFk INT) -BEGIN - - DECLARE done BOOL DEFAULT FALSE; - DECLARE vInvoiceInFk INT; - - DECLARE rs CURSOR FOR - SELECT invoiceInFk - FROM entry e - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO - - CALL vn2008.recibidaIvaInsert(vInvoiceInFk); - CALL vn2008.recibidaVencimientoReplace(vInvoiceInFk); - - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `invoiceInTax_getFromDua` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT) -BEGIN - - DECLARE done BOOL DEFAULT FALSE; - DECLARE vInvoiceInFk INT; - - DECLARE rs CURSOR FOR - SELECT invoiceInFk - FROM entry e - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO - - CALL invoiceInTax_getFromEntries(vInvoiceInFk); - CALL invoiceInDueDay_calculate(vInvoiceInFk); - - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `invoiceInTax_getFromEntries` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vId INT) -BEGIN - DECLARE vRate DOUBLE DEFAULT 1; - DECLARE vDated DATE; - DECLARE vExpenceFk VARCHAR(10); - - SELECT MAX(rr.dated) INTO vDated - FROM referenceRate rr - JOIN invoiceIn ii ON ii.id = vId - WHERE rr.dated <= ii.issued - AND rr.currencyFk = ii.currencyFk ; - - IF vDated THEN - SELECT `value` INTO vRate - FROM referenceRate - WHERE dated = vDated; - END IF; - - SELECT id INTO vExpenceFk - FROM vn.expence - WHERE `name` = 'Adquisición mercancia Extracomunitaria' - GROUP BY id - LIMIT 1; - - DELETE FROM invoiceInTax - WHERE invoiceInFk = vId; - - INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) - SELECT ii.id, - SUM(b.buyingValue * b.quantity) / IFNULL(vRate,1) taxableBase, - vExpenceFk, - IF(ii.currencyFk = 1,NULL,SUM(b.buyingValue * b.quantity )) divisa, - taxTypeSageFk, - transactionTypeSageFk - FROM invoiceIn ii - JOIN entry e ON e.invoiceInFk = ii.id - JOIN supplier s ON s.id = e.supplierFk - JOIN buy b ON b.entryFk = e.id - LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk - AND rr.dated = ii.issued - WHERE ii.id = vId - HAVING taxableBase IS NOT NULL; -END ;; -DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; @@ -57948,7 +57765,6 @@ BEGIN */ DECLARE vBookNumber INT; DECLARE vExpenceConcept VARCHAR(50); - DECLARE vIsUeeMember BOOL DEFAULT TRUE; DECLARE vSpainCountryFk INT; DECLARE vOldBookNumber INT; @@ -57986,8 +57802,8 @@ BEGIN ic.cplusRectificationTypeFk AS TIPORECTIF, io.companyFk, RIGHT(io.ref, LENGTH(io.ref) - 1) AS invoiceNum, - IF(ct.politicalCountryFk = vSpainCountryFk, vSpainCountryFk, IF(ct.isUeeMember = vIsUeeMember,2,4)) AS TERIDNIF, - CONCAT(IF(ct.isUeeMember = vIsUeeMember AND ct.politicalCountryFk <> vSpainCountryFk,ct.code,''),c.fi) AS TERNIF, + IF(c.countryFk = vSpainCountryFk, vSpainCountryFk, IF(ct.isUeeMember,2,4)) AS TERIDNIF, + CONCAT(IF(ct.isUeeMember AND c.countryFk <> vSpainCountryFk,ct.code,''),c.fi) AS TERNIF, c.socialName AS TERNOM, ior.serial AS SERIE_RT, RIGHT(ior.ref, LENGTH(ior.ref) - 1) AS FACTU_RT, @@ -58455,11 +58271,11 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_new`( vSerial VARCHAR(255), @@ -58494,6 +58310,13 @@ BEGIN DECLARE vIsCEESerial BOOL DEFAULT FALSE; DECLARE vIsCorrectInvoiceDate BOOL; DECLARE vMaxShipped DATE; + DECLARE vDone BOOL; + DECLARE vTicketFk INT; + DECLARE vCursor CURSOR FOR + SELECT id + FROM tmp.ticketToInvoice; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; SET vInvoiceDate = IFNULL(vInvoiceDate, util.VN_CURDATE()); @@ -58579,6 +58402,20 @@ BEGIN FROM invoiceOut WHERE id = vNewInvoiceId; + OPEN vCursor; + l: LOOP + SET vDone = FALSE; + FETCH vCursor INTO vTicketFk; + + IF vDone THEN + LEAVE l; + END IF; + + CALL ticket_recalc(vTicketFk, vTaxArea); + + END LOOP; + CLOSE vCursor; + UPDATE ticket t JOIN tmp.ticketToInvoice ti ON ti.id = t.id SET t.refFk = vNewRef; @@ -58594,10 +58431,6 @@ BEGIN INSERT INTO ticketTracking(stateFk,ticketFk,workerFk) SELECT * FROM tmp.updateInter; - INSERT INTO ticketLog (action, userFk, originFk, description) - SELECT 'UPDATE', account.myUser_getId(), ti.id, CONCAT('Crea factura ', vNewRef) - FROM tmp.ticketToInvoice ti; - CALL invoiceExpenceMake(vNewInvoiceId); CALL invoiceTaxMake(vNewInvoiceId,vTaxArea); @@ -59049,54 +58882,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `itemLog_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemLog_add`( - vChangedModel VARCHAR(45), - vOriginFk INT, - vChangedModelId INT, - vActionCode VARCHAR(45), - vChangedModelValue VARCHAR(255), - vOldInstance JSON, - vNewInstance JSON) -BEGIN -/** - * Guarda las acciones realizadas por el usuario - * - * @param vChangedModel Nombre que hace referencia a la tabla que se modifica - * @param vOriginFk Id del registro de la tabla origen - * @param vChangedModelId Id del registro de la tabla a la que se realiza la acción - * @param vActionCode Código de la acción {insert | delete | update} - * @param vOldInstance JSON que contiene los valores viejos - * @param vNewInstance JSON que contiene los valores nuevos - */ - CALL util.log_cleanInstances(vActionCode, vOldInstance, vNewInstance); - - IF !(vOldInstance = '{}' AND vNewInstance = '{}') THEN - INSERT INTO itemLog SET - changedModel = vChangedModel, - originFk = vOriginFk, - changedModelId = vChangedModelId, - `action` = vActionCode, - changedModelValue = vChangedModelValue, - oldInstance = vOldInstance, - newInstance = vNewInstance, - userFk = account.myUser_getId(); - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemPlacementFromTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59996,51 +59781,43 @@ proc:BEGIN DECLARE vBuyerFk INT DEFAULT 0; DECLARE vWarehouseFk INT DEFAULT 0; DECLARE vSonSectorFk INT; - DECLARE vWorkerFk INT; + DECLARE vWorkerFk INT; - SELECT s.workerFk - INTO vWorkerFk - FROM vn.sector s - WHERE s.id = vSectorFk; + SELECT s.workerFk + INTO vWorkerFk + FROM vn.sector s + WHERE s.id = vSectorFk; - IF IFNULL(vWorkerFk,0) THEN - - CALL vn.itemShelvingRadar_Urgent(vWorkerFk); - LEAVE proc; - - end if; - - - SELECT w.id, s.warehouseFk INTO vBuyerFk, vWarehouseFk + SELECT w.id, s.warehouseFk INTO vBuyerFk, vWarehouseFk FROM vn.worker w JOIN vn.sector s ON s.code = w.code - WHERE s.id = vSectorFk; + WHERE s.id = vSectorFk; - SELECT s.id INTO vSectorFk + SELECT s.id INTO vSectorFk FROM vn.sector s - WHERE s.warehouseFk = vWarehouseFk + WHERE s.warehouseFk = vWarehouseFk AND s.isMain; - SELECT COUNT(*) INTO hasFatherSector + SELECT COUNT(*) INTO hasFatherSector FROM vn.sector - WHERE sonFk = vSectorFk; + WHERE sonFk = vSectorFk; - SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk + SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk FROM vn.sector - WHERE id = vSectorFk; + WHERE id = vSectorFk; CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); + CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); - DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; + DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; - IF hasFatherSector THEN + IF hasFatherSector THEN CREATE TEMPORARY TABLE tmp.itemShelvingRadar (PRIMARY KEY (itemFk)) ENGINE = MEMORY - SELECT * FROM ( + SELECT * FROM ( SELECT iss.itemFk, i.longName, i.size, @@ -60049,22 +59826,22 @@ proc:BEGIN SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible,0), 0)) upstairs, SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible,0), 0)) downstairs, IF(it.isPackaging, null, IFNULL(v.visible,0)) as visible, - vSectorFk as sectorFk + vSectorFk as sectorFk FROM vn.itemShelvingStock iss JOIN vn.sector s ON s.id = iss.sectorFk JOIN vn.item i on i.id = iss.itemFk - JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) + JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk - WHERE vSectorFk IN (iss.sectorFk, s.sonFk) + WHERE vSectorFk IN (iss.sectorFk, s.sonFk) AND it.workerFk != 3366 GROUP BY iss.itemFk - UNION ALL + UNION ALL - SELECT v.item_id, + SELECT v.item_id, i.longName, i.size, i.subName producer, @@ -60072,35 +59849,35 @@ proc:BEGIN 0 upstairs, 0 downstairs, IF(it.isPackaging, NULL, v.visible) visible, - vSectorFk as sectorFk + vSectorFk as sectorFk FROM cache.visible v JOIN vn.item i on i.id = v.item_id - JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) - LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk - LEFT JOIN cache.available a ON a.item_id = v.item_id AND a.calc_id = vCalcAvailableFk - WHERE v.calc_id = vCalcVisibleFk + JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) + LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk + LEFT JOIN cache.available a ON a.item_id = v.item_id AND a.calc_id = vCalcAvailableFk + WHERE v.calc_id = vCalcVisibleFk AND iss.itemFk IS NULL - AND it.isInventory - ) sub GROUP BY itemFk; + AND it.isInventory + ) sub GROUP BY itemFk; SELECT ishr.*, CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho, - CAST(downstairs - IFNULL(notPickedYed,0) AS DECIMAL(10,0)) as pendiente - FROM tmp.itemShelvingRadar ishr + CAST(downstairs - IFNULL(notPickedYed,0) AS DECIMAL(10,0)) as pendiente + FROM tmp.itemShelvingRadar ishr JOIN vn.item i ON i.id = ishr.itemFk LEFT JOIN (SELECT s.itemFk, sum(s.quantity) as notPickedYed FROM vn.ticket t JOIN vn.ticketStateToday tst ON tst.ticket = t.id JOIN vn.sale s ON s.ticketFk = t.id WHERE t.warehouseFk = vWarehouseFk - AND tst.alertLevel = 0 + AND tst.alertLevel = 0 GROUP BY s.itemFk ) sub ON sub.itemFk = ishr.itemFk ORDER BY i.typeFk, i.longName ; - ELSE + ELSE CREATE TEMPORARY TABLE tmp.itemShelvingRadar (PRIMARY KEY (itemFk)) @@ -60139,16 +59916,16 @@ proc:BEGIN /* UPDATE tmp.itemShelvingRadar isr JOIN vn.itemShelvingStock iss ON iss.itemFk = isr.itemFk - SET isr.dayEndVisible = isr.dayEndVisible + iss.visible, + SET isr.dayEndVisible = isr.dayEndVisible + iss.visible, isr.firstNegative = isr.firstNegative + iss.visible, - isr.itemPlacementVisible = isr.itemPlacementVisible + iss.visible + isr.itemPlacementVisible = isr.itemPlacementVisible + iss.visible WHERE iss.sectorFk = vSonSectorFk; - */ + */ DROP TEMPORARY TABLE IF EXISTS tmp.itemOutTime; CREATE TEMPORARY TABLE tmp.itemOutTime - SELECT *,SUM(amount) quantity + SELECT *,SUM(amount) quantity FROM - (SELECT item_id itemFk, + (SELECT item_id itemFk, amount, IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes @@ -60168,8 +59945,8 @@ proc:BEGIN AND NOT io.Reservado AND stPrevious.saleFk IS NULL AND io.dat >= util.VN_CURDATE() - AND io.dat < util.VN_CURDATE()+1 - ) sub + AND io.dat < util.VN_CURDATE() + INTERVAL 1 DAY + ) sub GROUP BY itemFk, hours, minutes; INSERT INTO tmp.itemShelvingRadar (itemFk) @@ -60184,7 +59961,7 @@ proc:BEGIN dayEndVisible = 0, firstNegative = 0 WHERE itemPlacementVisible = - itemShelvingStock; - */ +*/ SELECT * FROM tmp.itemShelvingRadar; END IF; @@ -60313,102 +60090,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `itemShelvingRadar_Urgent` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Urgent`() -BEGIN -/** - * Devuelve lo mismo que itemShelving_filterBuyer per sin filtrar - */ - DECLARE vCalcVisibleFk INT; - DECLARE vWarehouseFk INT DEFAULT 60; - - CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - - SELECT * FROM - (SELECT sub.itemFk, - sub.longName, - CONCAT(DATE_FORMAT(sub2.etd,'%H:%i'), ' salen ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, - CONCAT(IF(sub2.itemFk, IF(sub2.pendiente > (sub.upstairs + sub.downstairs),'(1) ','(2) '),'(3) ' ),sub.producer) producer, - sub.upstairs, - sub.downstairs, - sub.visible, - sub.sectorFk, - CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) nicho, - sub2.etd - FROM (SELECT iss.itemFk, - CONCAT(i.longName,' ',i.size,' ',IFNULL(i.subName,'') ) longName, - '' size, - CONCAT(iss.parkingCode , ' ', iss.shelvingFk) producer, - 0 upstairs, - SUM(IFNULL(iss.visible,0)) downstairs, - IF(it.isPackaging, null, IFNULL(v.visible,0)) visible, - IFNULL(iss.sectorFk,0) sectorFk - FROM itemShelvingStock iss - JOIN sector s ON s.id = iss.sectorFk - JOIN item i on i.id = iss.itemFk - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = @vCalcVisibleFk - WHERE s.warehouseFk = vWarehouseFk - GROUP BY itemFk - ) sub LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente, MIN(zc.`hour`) etd - FROM sale s - LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk - JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) - AND ISNULL(st.saleFk) - AND ct.code IN ('normal', 'trust') - GROUP BY s.itemFk - ) sub2 ON sub2.itemFk = sub.itemFk - UNION ALL - SELECT v.item_id , - i.longName, - CONCAT(DATE_FORMAT(sub5.etd,'%H:%i'), ' salen ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, - CONCAT(IF(sub5.pendiente,'(0) ','(3) ')) producer, - 0, - 0, - v.visible, - IFNULL(iss.sectorFk,0), - v.visible nicho, - sub5.etd - FROM cache.visible v - JOIN item i ON i.id = v.item_id - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id - LEFT JOIN (SELECT s.itemFk , SUM(s.quantity) pendiente, MIN(zc.`hour`) etd - FROM sale s - LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk - JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) - AND ISNULL(st.saleFk) - AND ct.code IN ('normal', 'trust') - GROUP BY s.itemFk - ) sub5 ON sub5.itemFk = v.item_id - WHERE v.calc_id = @vCalcVisibleFk - AND ISNULL(iss.itemFk) - ) sub3 - WHERE nicho - ORDER BY LEFT(producer,3), etd, producer; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingSale_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60784,7 +60465,7 @@ proc:BEGIN JOIN item i ON i.id = v.item_id LEFT JOIN ink ik ON ik.id = i.inkFk JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id + LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente FROM sale s LEFT JOIN saleTracking st ON st.saleFk = s.id @@ -61090,7 +60771,7 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_selfConsumption`( - vShelvingFk VARCHAR(255) COLLATE utf8_general_ci, + vShelvingFk VARCHAR(10) COLLATE utf8_general_ci, vItemFk INT, vQuantity INT ) @@ -61113,11 +60794,9 @@ BEGIN SELECT c.id, c.clientFk, - a.agencyModeFk, s.warehouseFk INTO vCompanyFk, vClientFk, - vAgencyModeFk, vWarehouseFk FROM company c JOIN address a ON a.clientFk = c.clientFk @@ -61158,7 +60837,7 @@ BEGIN CURDATE(), NULL, vCompanyFk, - vAgencyModeFk, + NULL, vTicketFk ); @@ -61167,11 +60846,12 @@ BEGIN FROM item WHERE id = vItemFk; - CALL sale_calculateComponent(LAST_INSERT_ID(), NULL); UPDATE itemShelving SET visible = IF(id = vItemShelvingFk, vQuantity, 0) WHERE shelvingFk = vShelvingFk AND itemFk = vItemFk; + + CALL vn.ticket_setState(vTicketFk, 'DELIVERED'); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -61999,12 +61679,17 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getBalance`(vItemFk int, vWarehouseFk int, vDate DATETIME) +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getBalance`( + vItemFk INT, + vWarehouseFk INT, + vDate DATETIME +) BEGIN /** * @vItemFk item a buscar * @vWarehouseFk almacen donde buscar - * @vDate Si la fecha es null, muestra el histórico desde el inventario. Si la fecha no es null, muestra histórico desde la fecha pasada. + * @vDate Si la fecha es null, muestra el histórico desde el inventario. + * Si la fecha no es null, muestra histórico desde la fecha pasada. */ DECLARE vDateInventory DATETIME; DECLARE vInvCalculated INT; @@ -62017,7 +61702,7 @@ BEGIN FROM util.config; END IF; - CREATE OR REPLACE TEMPORARY TABLE itemDiary( + CREATE OR REPLACE TEMPORARY TABLE tItemDiary( shipped DATE, `in` INT(11), `out` INT(11), @@ -62032,119 +61717,125 @@ BEGIN lineFk INT(11), `order` TINYINT(3) UNSIGNED, clientType VARCHAR(20), - claimFk INT(10) UNSIGNED + claimFk INT(10) UNSIGNED, + inventorySupplierFk INT(10) ); - INSERT INTO itemDiary - SELECT tr.landed shipped, - b.quantity `in`, - NULL `out`, - al.id alertLevel, - st.name stateName, - s.name `name`, - e.invoiceNumber reference, - e.id origin, - s.id clientFk, - IF(al.code = 'DELIVERED', TRUE, FALSE) isPicked, - FALSE isTicket, - b.id lineFk, - NULL `order`, - NULL clientType, - NULL claimFk - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.code = - CASE - WHEN tr.landed < util.VN_CURDATE() THEN 'DELIVERED' - WHEN tr.landed = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 'DELIVERED' - ELSE 'FREE' - END - JOIN state st ON st.code = al.code - WHERE tr.landed >= vDateInventory - AND vWarehouseFk = tr.warehouseInFk - AND b.itemFk = vItemFk - AND e.isExcludedFromAvailable = FALSE - AND e.isRaid = FALSE - UNION ALL - SELECT tr.shipped, - NULL, - b.quantity, - al.id, - st.name, - s.name, - e.invoiceNumber, - e.id, - s.id, - IF(al.code = 'DELIVERED', TRUE, FALSE), - FALSE, - b.id, - NULL, - NULL, - NULL - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN warehouse w ON w.id = tr.warehouseOutFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.code = - CASE - WHEN tr.shipped < util.VN_CURDATE() THEN 'DELIVERED' - WHEN tr.shipped = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 'DELIVERED' - ELSE 'FREE' - END - JOIN state st ON st.code = al.code - JOIN entryConfig ec - WHERE tr.shipped >= vDateInventory - AND vWarehouseFk =tr.warehouseOutFk - AND s.id <> ec.inventorySupplierFk - AND b.itemFk = vItemFk - AND e.isExcludedFromAvailable = FALSE - AND w.isFeedStock = FALSE - AND e.isRaid = FALSE - UNION ALL - SELECT DATE(t.shipped), + INSERT INTO tItemDiary + SELECT tr.landed shipped, + b.quantity `in`, + NULL `out`, + st.alertLevel , + st.name stateName, + s.name `name`, + e.invoiceNumber reference, + e.id origin, + s.id clientFk, + IF(st.`code` = 'DELIVERED', TRUE, FALSE) isPicked, + FALSE isTicket, + b.id lineFk, + NULL `order`, + NULL clientType, + NULL claimFk, + ec.inventorySupplierFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN supplier s ON s.id = e.supplierFk + JOIN state st ON st.`code` = IF( tr.landed < util.VN_CURDATE() + OR (util.VN_CURDATE() AND tr.isReceived), + 'DELIVERED', + 'FREE') + JOIN entryConfig ec + WHERE tr.landed >= vDateInventory + AND vWarehouseFk = tr.warehouseInFk + AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL) + AND b.itemFk = vItemFk + AND e.isExcludedFromAvailable = FALSE + AND e.isRaid = FALSE + UNION ALL + SELECT tr.shipped, NULL, - s.quantity, - al3.id, + b.quantity, + st.alertLevel, st.name, - t.nickname, - t.refFk, - t.id, - t.clientFk, - stk.id, - TRUE, + s.name, + e.invoiceNumber, + e.id, s.id, - st.`order`, - ct.code, - cb.claimFk - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN ticketState ts ON ts.ticket = t.id - LEFT JOIN state st ON st.code = ts.code - JOIN client c ON c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk - JOIN alertLevel al ON al.code = 'DELIVERED' - JOIN alertLevel al2 ON al2.code = 'FREE' - JOIN alertLevel al3 ON al3.id = - CASE - WHEN t.shipped < util.VN_CURDATE() THEN al.code - WHEN t.shipped > util.dayEnd(util.VN_CURDATE()) THEN al2.code - ELSE IFNULL(ts.alertLevel, al2.code) - END - LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' - LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id - LEFT JOIN claimBeginning cb ON s.id = cb.saleFk - WHERE t.shipped >= vDateInventory - AND s.itemFk = vItemFk - AND vWarehouseFk =t.warehouseFk - ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC; + IF(st.`code` = 'DELIVERED' , TRUE, FALSE), + FALSE, + b.id, + NULL, + NULL, + NULL, + ec.inventorySupplierFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + JOIN supplier s ON s.id = e.supplierFk + JOIN state st ON st.`code` = IF(tr.shipped < util.VN_CURDATE() + OR (tr.shipped = util.VN_CURDATE() AND tr.isReceived), + 'DELIVERED', + 'FREE') + JOIN entryConfig ec + WHERE tr.shipped >= vDateInventory + AND vWarehouseFk = tr.warehouseOutFk + AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL) + AND b.itemFk = vItemFk + AND e.isExcludedFromAvailable = FALSE + AND w.isFeedStock = FALSE + AND e.isRaid = FALSE + UNION ALL + SELECT DATE(t.shipped), + NULL, + s.quantity, + st2.alertLevel, + st2.name, + t.nickname, + t.refFk, + t.id, + t.clientFk, + stk.id, + TRUE, + s.id, + st.`order`, + ct.`code`, + cb.claimFk, + NULL + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN ticketState ts ON ts.ticket = t.id + LEFT JOIN state st ON st.`code` = ts.`code` + JOIN client c ON c.id = t.clientFk + JOIN clientType ct ON ct.id = c.clientTypeFk + JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(), + 'DELIVERED', + IF (t.shipped > util.dayEnd(util.VN_CURDATE()), + 'FREE', + IFNULL(ts.code, 'FREE'))) + LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' + LEFT JOIN saleTracking stk ON stk.saleFk = s.id + AND stk.stateFk = stPrep.id + LEFT JOIN claimBeginning cb ON s.id = cb.saleFk + WHERE t.shipped >= vDateInventory + AND s.itemFk = vItemFk + AND vWarehouseFk =t.warehouseFk + ORDER BY shipped, + (inventorySupplierFk = clientFk) DESC, + alertLevel DESC, + isTicket, + `order` DESC, + isPicked DESC, + `in` DESC, + `out` DESC; IF vDate IS NULL THEN - SET @a = 0; - SET @currentLineFk = 0; - SET @shipped = ''; + + SET @a := 0; + SET @currentLineFk := 0; + SET @shipped := ''; SELECT DATE(@shipped:= shipped) shipped, alertLevel, @@ -62153,50 +61844,63 @@ BEGIN reference, clientFk, name, - `in` AS invalue, + `in` invalue, `out`, - @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, + @a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0) balance, @currentLineFk := IF (@shipped < util.VN_CURDATE() - OR (@shipped = util.VN_CURDATE() AND (isPicked OR a.code >= 'ON_PREPARATION')), - lineFk, @currentLineFk) lastPreparedLineFk, + OR (@shipped = util.VN_CURDATE() AND (isPicked OR a.`code` >= 'ON_PREPARATION')), + lineFk, + @currentLineFk) lastPreparedLineFk, isTicket, lineFk, isPicked, clientType, claimFk - FROM itemDiary - JOIN alertLevel a ON a.id = itemDiary.alertLevel; + FROM tItemDiary + LEFT JOIN alertLevel a ON a.id = tItemDiary.alertLevel; + ELSE - SELECT sum(`in`) - sum(`out`) INTO vInvCalculated - FROM itemDiary + SELECT SUM(`in`) - SUM(`out`) INTO vInvCalculated + FROM tItemDiary WHERE shipped < vDate; - SELECT p1.* - FROM( - SELECT vDate shipped, - 0 alertLevel, - 0 stateName, - 0 origin, - '' reference, - 0 clientFk, - 'Inventario calculado', - vInvCalculated invalue, - NULL `out`, - 0 balance, - 0 lastPreparedLineFk, - 0 isTicket, - 0 lineFk, - 0 isPicked, - 0 clientType, - 0 claimFk - UNION ALL - SELECT shipped, alertlevel, stateName, origin, reference, clientFk, name, `in`, `out`, 0,0, isTicket, lineFk, isPicked, clientType, claimFk - FROM itemDiary - WHERE shipped >= vDate - )as p1; + SELECT vDate shipped, + 0 alertLevel, + 0 stateName, + 0 origin, + '' reference, + 0 clientFk, + 'Inventario calculado', + vInvCalculated invalue, + NULL `out`, + 0 balance, + 0 lastPreparedLineFk, + 0 isTicket, + 0 lineFk, + 0 isPicked, + 0 clientType, + 0 claimFk + UNION ALL + SELECT shipped, + alertlevel, + stateName, + origin, + reference, + clientFk, + name, `in`, + `out`, + 0, + 0, + isTicket, + lineFk, + isPicked, + clientType, + claimFk + FROM tItemDiary + WHERE shipped >= vDate; END IF; - DROP TEMPORARY TABLE itemDiary; + DROP TEMPORARY TABLE tItemDiary; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -62592,7 +62296,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `item_GetVisible`(vWarehouse SMALLIN BEGIN DECLARE vTomorrow DATETIME DEFAULT TIMESTAMPADD(DAY, 1, util.VN_CURDATE()); - INSERT INTO vn2008.tmp_item (item_id, visible) + INSERT INTO tmp.itemVisible (item_id, visible) SELECT item_id, SUM(amount) amount FROM ( SELECT i.itemFk AS item_id, quantity AS amount @@ -62781,149 +62485,6 @@ BEGIN CLOSE cur1; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_refreshTags_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshTags_beta`() -BEGIN -/** - * Actualiza la tabla item, los campos "cache" de tags - * - * @param temporary table tmp.item(id) del articulo - **/ - - DECLARE done INT DEFAULT FALSE; - DECLARE vItemFk INT; - DECLARE cur1 CURSOR FOR SELECT id FROM tmp.item; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN cur1; - - read_loop: LOOP - - FETCH cur1 INTO vItemFk; - - IF done THEN - LEAVE read_loop; - END IF; - - UPDATE item i - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, IF(it3.`value` = 'A1','',it3.`value`)) - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value` - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value` - SET i.`name` = CONCAT_WS(' ', - IFNULL(ta1.abbreviation,it1.`value`), - IFNULL(ta2.abbreviation,it2.`value`), - IF(i.isFloramondo,'',IFNULL(ta3.abbreviation,it3.`value`))) - WHERE i.id = vItemFk; - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4 - SET i.subName = it.`value`; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag5 = t.name, value5 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag6 = t.name, value6 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7 - LEFT JOIN tag t ON t.id = it.tagFk - SET i.tag7 = t.name, i.value7 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag8 = t.name, value8 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag9 = t.name, value9 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag10 = t.name, value10 = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag color se modifica también el antiguo campo color - UPDATE item i - JOIN tag t ON t.overwrite = 'inkFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN ink ON ink.`name` = it.`value` - SET i.inkFk = ink.id - WHERE i.id = vItemFk; - - -- Al insertar el tag origen se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'originFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN origin o ON o.`name` = it.`value` - SET i.originFk = o.id - WHERE i.id = vItemFk; - - -- Al insertar el tag medida se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'size' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.size = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag productor se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'producerFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN producer p ON p.`name` = it.`value` - SET i.producerFk = p.id - WHERE i.id = vItemFk; - - -- Al insertar el tag tallos se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'stems' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.stems = it.`value` - WHERE i.id = vItemFk; - - END LOOP; - - CLOSE cur1; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63394,75 +62955,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `logAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `logAdd`(vOriginFk INT, vActionCode VARCHAR(45), vEntity VARCHAR(45), vDescription TEXT) -BEGIN -/** - * Guarda las acciones realizadas por el usuario - * - * @param vOriginFk Id del registro de origen - * @param vActionCode Código de la acción {insert | delete | update} - * @param vEntity Nombre que hace referencia a la tabla. - * @param descripcion Descripción de la acción realizada por el usuario - */ - - CALL logAddWithUser(vOriginFk, account.myUser_getId(), vActionCode, vEntity, vDescription); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `logAddWithUser` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `logAddWithUser`(vOriginFk INT, vUserId INT, vActionCode VARCHAR(45), vEntity VARCHAR(45), vDescription TEXT) -BEGIN - /** - * Guarda las acciones realizadas por el usuario - * - * @param vOriginFk Id del registro de origen - * @param vActionCode Código de la acción {insert | delete | update} - * @param vEntity Nombre que hace referencia a la tabla. - * @param descripcion Descripción de la acción realizada por el usuario - */ - DECLARE vTableName VARCHAR(255) DEFAULT CONCAT(IFNULL(vEntity, ''), 'Log'); - - SET @sqlQuery = CONCAT( - 'INSERT INTO vn.', vTableName, ' SET originFk = ?, userFk = ?, action = ?, description = ?' - ); - SET @originFk = vOriginFk; - SET @userFk = vUserId; - SET @action = vActionCode; - SET @description = vDescription; - - PREPARE stmt FROM @sqlQuery; - EXECUTE stmt USING @originFk, @userFk, @action, @description; - DEALLOCATE PREPARE stmt; - - SET @sqlQuery = NULL; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `logShow` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65820,54 +65312,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `routeLog_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `routeLog_add`( - vChangedModel VARCHAR(45), - vOriginFk INT, - vChangedModelId INT, - vActionCode VARCHAR(45), - vChangedModelValue VARCHAR(255), - vOldInstance JSON, - vNewInstance JSON) -BEGIN -/** - * Guarda las acciones realizadas por el usuario - * - * @param vChangedModel Nombre que hace referencia a la tabla que se modifica - * @param vOriginFk Id del registro de la tabla origen - * @param vChangedModelId Id del registro de la tabla a la que se realiza la acción - * @param vActionCode Código de la acción {insert | delete | update} - * @param vOldInstance JSON que contiene los valores viejos - * @param vNewInstance JSON que contiene los valores nuevos - */ - CALL util.log_cleanInstances(vActionCode, vOldInstance, vNewInstance); - - IF !(vOldInstance = '{}' AND vNewInstance = '{}') THEN - INSERT INTO routeLog SET - changedModel = vChangedModel, - originFk = vOriginFk, - changedModelId = vChangedModelId, - `action` = vActionCode, - changedModelValue = vChangedModelValue, - oldInstance = vOldInstance, - newInstance = vNewInstance, - userFk = account.myUser_getId(); - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `routeMonitor_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65986,7 +65430,7 @@ BEGIN UPDATE routesMonitor rm JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk - SET rm.etd = et.ETD; + SET rm.etd = et.eta; DROP TEMPORARY TABLE tmp.routesMonitor; END ;; @@ -67107,7 +66551,7 @@ BEGIN * * @param vParam Identificador de ticket o collection */ - DECLARE vIsCollection BOOL; +DECLARE vIsCollection BOOL; SELECT COUNT(*) INTO vIsCollection FROM collection c @@ -67146,16 +66590,16 @@ BEGIN SELECT s.ticketFk, sgd.saleGroupFk, - s.id as saleFk, + s.id saleFk, s.itemFk, s.quantity, i.longName, i.size, s.reserved, - MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) as isPreviousPrepared, - MAX(IF(st.semaphore <=> 2, TRUE, FALSE)) as isPrepared, - MAX(IF(st.semaphore <=> 3, TRUE, FALSE)) as isControlled, - MAX(IF(st.semaphore <=> 4, TRUE, FALSE)) as isPreControlled, + MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) isPreviousPrepared, + MAX(IF(st.semaphore <=> 2, TRUE, FALSE)) isPrepared, + MAX(IF(st.semaphore <=> 3, TRUE, FALSE)) isControlled, + MAX(IF(st.semaphore <=> 4, TRUE, FALSE)) isPreControlled, ic.color, ip.productor, s.discount, @@ -67175,11 +66619,12 @@ BEGIN TRIM(CONCAT(ic.color)) line3, p.code cel3, s.isAdded, - sub2.originalQuantity as startQuantity, -- eliminar cuando tengamos la nueva apk - IFNULL(c.workerFk,getUser()) as workerFk, - IFNULL(SUM(iss.quantity),0) as pickedQuantity, + sub2.originalQuantity startQuantity, -- eliminar cuando tengamos la nueva apk + IF(c.workerFk IS NULL, getUser(), c.workerFk) workerFk, + IF(SUM(iss.quantity) IS NULL, 0, SUM(iss.quantity)) pickedQuantity, i.packingShelve, - MIN(iss.created) picked + MIN(iss.created) picked, + IF(sm.id, TRUE, FALSE) hasMistake FROM tmp.ticket t JOIN sale s ON s.ticketFk = t.id JOIN ticket tt ON tt.id = t.id @@ -67204,6 +66649,7 @@ BEGIN LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk LEFT JOIN parking p ON p.id = sg.parkingFk + LEFT JOIN saleMistake sm ON sm.saleFk = s.id GROUP BY s.id; DROP TEMPORARY TABLE @@ -67268,6 +66714,7 @@ BEGIN itemDelay VARCHAR(255), itemLost VARCHAR(255), hasComponentLack INTEGER(1), + hasRounding VARCHAR(255), isTooLittle BOOL DEFAULT FALSE, PRIMARY KEY (ticketFk, saleFk) ) ENGINE = MEMORY; @@ -67455,6 +66902,28 @@ BEGIN AND t.warehouseFk = vWarehouseFk GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; + + -- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra + CALL buyUltimate(vWarehouseFk, vDate); + INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) + SELECT ticketFk, problem, saleFk + FROM ( + SELECT + tl.ticketFk, + s.id saleFk , + LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,''), ' '), 250) problem, + MOD(s.quantity, b.`grouping`) hasRounding + FROM tmp.ticket_list tl + JOIN ticket t ON t.id = tl.ticketFk + AND t.warehouseFk = vWarehouseFk + JOIN sale s ON s.ticketFk = tl.ticketFk + JOIN item i ON i.id = s.itemFk + JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + JOIN buy b ON b.id = bu.buyFk + GROUP BY tl.ticketFk + HAVING hasRounding + ) sub + ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; END LOOP; CLOSE vCursor; @@ -68330,15 +67799,17 @@ proc: BEGIN * @param vShelvingCode code de la matrícula * @param vParkingFk id del parking */ - INSERT INTO vn.shelvingLog (originFk, userFk, action , description) - SELECT s.id, account.myUser_getId(), 'update', CONCAT("Cambio parking ",vShelvingCode," de ", p.code," a ", pNew.code) + INSERT INTO vn.shelvingLog (originFk, userFk, action , description,changedModel,changedModelId) + SELECT s.id, account.myUser_getId(), 'update', CONCAT("Cambio parking ",vShelvingCode," de ", p.code," a ", pNew.code),'Shelving',s.id FROM parking p JOIN shelving s ON s.parkingFk = p.id JOIN parking pNew ON pNew.id = vParkingFk WHERE s.code = vShelvingCode COLLATE utf8_unicode_ci; UPDATE vn.shelving - SET parkingFk = vParkingFk, parked = util.VN_NOW(), isPrinted = TRUE + SET parkingFk = vParkingFk, + parked = util.VN_NOW(), + isPrinted = TRUE WHERE code = vShelvingCode COLLATE utf8_unicode_ci; END ;; DELIMITER ; @@ -68452,7 +67923,7 @@ BEGIN / vVolume buyed, b.packageFk id_cubo, b.packing - FROM tmp_item ti + FROM tmp.item ti JOIN item i ON i.id = ti.item_id JOIN itemType it ON i.typeFk = it.id JOIN itemCategory ic ON ic.id = it.categoryFk @@ -68464,7 +67935,7 @@ BEGIN DROP TEMPORARY TABLE tmp.buyUltimate, - tmp_item; + tmp.item; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68499,7 +67970,7 @@ BEGIN SUM(( ti.amount / b.packing ) * vn.buy_getVolume(b.id)) / vc.palletM3 / 1000000 buyed, vDated, u.name - FROM tmp_item ti + FROM tmp.item ti JOIN vn.item i ON i.id = ti.item_id JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk @@ -68527,7 +67998,7 @@ BEGIN DROP TEMPORARY TABLE tmp.buyUltimate, - tmp_item; + tmp.item; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68559,8 +68030,8 @@ BEGIN SELECT warehouseFk INTO vAuctionWarehouseFk FROM auctionConfig; - DROP TEMPORARY TABLE IF EXISTS tmp_item; - CREATE TEMPORARY TABLE tmp_item + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item (UNIQUE INDEX i USING HASH (item_id)) ENGINE = MEMORY SELECT item_id, SUM(amount) amount @@ -68574,11 +68045,11 @@ BEGIN CALL `cache`.stock_refresh (FALSE); - INSERT INTO tmp_item (item_id,amount) + INSERT INTO tmp.item (item_id,amount) SELECT item_id,s.amount FROM `cache`.stock s WHERE warehouse_id = vAuctionWarehouseFk - ON DUPLICATE KEY UPDATE amount = tmp_item.amount + VALUES(amount); + ON DUPLICATE KEY UPDATE amount = tmp.item.amount + VALUES(amount); CALL buyUltimate(vAuctionWarehouseFk, vDate); @@ -69870,7 +69341,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTotal`() +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTotal`(vTaxArea VARCHAR(25)) BEGIN /** * Calcula el total con IVA para un conjunto de tickets. @@ -69878,7 +69349,7 @@ BEGIN * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular * @return tmp.ticketTotal Total para cada ticket */ - CALL ticket_getTax(NULL); + CALL ticket_getTax(vTaxArea); DROP TEMPORARY TABLE IF EXISTS tmp.ticketTotal; CREATE TEMPORARY TABLE tmp.ticketTotal @@ -70029,7 +69500,7 @@ BEGIN AND clientFk = vClientFk AND shipped > '2001-01-01'; - CALL vn.ticketGetTotal; + CALL vn.ticketGetTotal(NULL); SELECT c.id, c.name as Cliente, @@ -70331,7 +69802,7 @@ BEGIN SELECT COUNT(*) INTO vAlreadyExists FROM ticketRefund - WHERE originalTicketFk = vOriginalTicketFk; + WHERE refundTicketFk = vOriginalTicketFk; IF vAlreadyExists > 0 THEN CALL util.throw('This ticket is already a refund'); @@ -70795,81 +70266,83 @@ BEGIN ) t GROUP BY itemFk HAVING amount != 0; - DROP TEMPORARY TABLE IF EXISTS tmp.filter; - CREATE TEMPORARY TABLE tmp.filter - (INDEX (id)) - - SELECT - origin.ticketFk futureId, - dest.ticketFk id, - dest.state, - origin.futureState, - origin.futureIpt, - dest.ipt, - origin.workerFk, - origin.futureLiters, - origin.futureLines, - dest.shipped, - origin.shipped futureShipped, - dest.totalWithVat, - origin.totalWithVat futureTotalWithVat, - dest.agency, - origin.futureAgency, - dest.lines, - dest.liters, - origin.futureLines - origin.hasStock AS notMovableLines, - (origin.futureLines = origin.hasStock) AS isFullMovable - FROM ( - SELECT - s.ticketFk, - t.workerFk, - t.shipped, - t.totalWithVat, - st.name futureState, - t.addressFk, - am.name futureAgency, - count(s.id) futureLines, - GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, - CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, - SUM((s.quantity <= IFNULL(st.amount,0))) hasStock - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN saleVolume sv ON sv.saleFk = s.id - JOIN item i ON i.id = s.itemFk - JOIN ticketState ts ON ts.ticketFk = t.id - JOIN state st ON st.id = ts.stateFk - JOIN agencyMode am ON t.agencyModeFk = am.id - LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk - LEFT JOIN tmp.stock st ON st.itemFk = i.id - WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) - AND t.warehouseFk = vWarehouseFk - GROUP BY t.id - ) origin - JOIN ( - SELECT - t.id ticketFk, - t.addressFk, - st.name state, - GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, - t.shipped, - t.totalWithVat, - am.name agency, - CAST(SUM(litros) AS DECIMAL(10,0)) liters, - CAST(COUNT(*) AS DECIMAL(10,0)) `lines` - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN saleVolume sv ON sv.saleFk = s.id - JOIN item i ON i.id = s.itemFk - JOIN ticketState ts ON ts.ticketFk = t.id - JOIN state st ON st.id = ts.stateFk - JOIN agencyMode am ON t.agencyModeFk = am.id - LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk - WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) - AND t.warehouseFk = vWarehouseFk - AND st.order <= 5 - GROUP BY t.id - ) dest ON dest.addressFk = origin.addressFk - WHERE origin.hasStock != 0; + CREATE OR REPLACE TEMPORARY TABLE tmp.filter + (INDEX (id)) + SELECT + origin.ticketFk futureId, + dest.ticketFk id, + dest.state, + origin.futureState, + origin.futureIpt, + dest.ipt, + origin.workerFk, + origin.futureLiters, + origin.futureLines, + dest.shipped, + origin.shipped futureShipped, + dest.totalWithVat, + origin.totalWithVat futureTotalWithVat, + dest.agency, + origin.futureAgency, + dest.lines, + dest.liters, + origin.futureLines - origin.hasStock AS notMovableLines, + (origin.futureLines = origin.hasStock) AS isFullMovable, + origin.classColor futureClassColor, + dest.classColor + FROM ( + SELECT + s.ticketFk, + t.workerFk, + t.shipped, + t.totalWithVat, + st.name futureState, + t.addressFk, + am.name futureAgency, + count(s.id) futureLines, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, + CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, + SUM((s.quantity <= IFNULL(st.amount,0))) hasStock, + st.classColor + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + LEFT JOIN tmp.stock st ON st.itemFk = i.id + WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id + ) origin + JOIN ( + SELECT + t.id ticketFk, + t.addressFk, + st.name state, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, + t.shipped, + t.totalWithVat, + am.name agency, + CAST(SUM(litros) AS DECIMAL(10,0)) liters, + CAST(COUNT(*) AS DECIMAL(10,0)) `lines`, + st.classColor + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) + AND t.warehouseFk = vWarehouseFk + AND st.order <= 5 + GROUP BY t.id + ) dest ON dest.addressFk = origin.addressFk + WHERE origin.hasStock != 0; DROP TEMPORARY TABLE tmp.stock; END ;; @@ -70882,11 +70355,11 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT) BEGIN @@ -70897,10 +70370,9 @@ BEGIN * @param vFutureDated Fecha en el futuro a sondear * @param vWarehouseFk Identificador de vn.warehouse */ - DROP TEMPORARY TABLE IF EXISTS tmp.filter; - CREATE TEMPORARY TABLE tmp.filter - (INDEX (id)) - SELECT sv.ticketFk id, + CREATE OR REPLACE TEMPORARY TABLE tmp.filter + (INDEX (id)) + SELECT sv.ticketFk id, sub2.id futureId, GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, CAST(sum(litros) AS DECIMAL(10,0)) liters, @@ -70915,7 +70387,9 @@ BEGIN sub2.shipped futureShipped, t.workerFk, st.code stateCode, - sub2.code futureStateCode + sub2.code futureStateCode, + st.classColor, + sub2.classColor futureClassColor FROM vn.saleVolume sv JOIN vn.sale s ON s.id = sv.saleFk JOIN vn.item i ON i.id = s.itemFk @@ -70935,7 +70409,8 @@ BEGIN t.id, t.shipped, st.name state, - st.code code, + st.code, + st.classColor, GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd FROM vn.ticket t JOIN vn.ticketState ts ON ts.ticketFk = t.id @@ -71160,14 +70635,6 @@ BEGIN FROM ticketObservation o WHERE o.ticketFk = vOriginalTicket; - INSERT INTO ticketLog - SET originFk = vNewTicket, userFk = account.myUser_getId(), `action` = 'insert', - description = CONCAT('Ha creado el ticket:', ' ', vNewTicket, ' clonando el ', vOriginalTicket); - - INSERT INTO ticketLog - SET originFk = vOriginalTicket, userFk = account.myUser_getId(), `action` = 'insert', - description = CONCAT('Ha creado el ticket:', ' ', vNewTicket, ' clonando el ', vOriginalTicket); - INSERT INTO ticketTracking(ticketFk, stateFk, workerFk, created) SELECT vNewTicket, stateFk, workerFk , created FROM ticketTracking @@ -71381,13 +70848,12 @@ BEGIN LEAVE proc; END IF; - -- Fetch ticket data SELECT c.id, c.isTaxDataChecked, t.companyFk, t.shipped, - co.hasDailyInvoice, + IFNULL(a.hasDailyInvoice, co.hasDailyInvoice), w.isManaged, c.hasToInvoice INTO vClientFk, @@ -71400,6 +70866,7 @@ BEGIN FROM ticket t JOIN `client` c ON c.id = t.clientFk JOIN province p ON p.id = c.provinceFk + LEFT JOIN autonomy a ON a.id = p.autonomyFk JOIN country co ON co.id = p.countryFk JOIN warehouse w ON w.id = t.warehouseFk WHERE t.id = vCurTicketFk; @@ -71878,7 +71345,7 @@ proc: BEGIN LEAVE myLoop; END IF; - CALL ticket_recalc(vTicketFk); + CALL ticket_recalc(vTicketFk, NULL); END LOOP; CLOSE cCur; @@ -72118,17 +71585,18 @@ BEGIN ENGINE = MEMORY SELECT ticketFk, - MAX(p.isFreezed) AS isFreezed, - MAX(p.risk) AS risk, - MAX(p.hasHighRisk) AS hasHighRisk, - MAX(p.hasTicketRequest) AS hasTicketRequest, - MAX(p.itemShortage) AS itemShortage, - MIN(p.isTaxDataChecked) AS isTaxDataChecked, - MAX(p.hasComponentLack) AS hasComponentLack, - MAX(p.isTooLittle) AS isTooLittle, - MAX(p.itemDelay) AS itemDelay, - MAX(p.itemLost) AS itemLost, - 0 AS totalProblems + MAX(p.isFreezed) isFreezed, + MAX(p.risk) risk, + MAX(p.hasHighRisk) hasHighRisk, + MAX(p.hasTicketRequest) hasTicketRequest, + MAX(p.itemShortage) itemShortage, + MIN(p.isTaxDataChecked) isTaxDataChecked, + MAX(p.hasComponentLack) hasComponentLack, + MAX(p.isTooLittle) isTooLittle, + MAX(p.itemDelay) itemDelay, + MAX(p.hasRounding) hasRounding, + MAX(p.itemLost) itemLost, + 0 totalProblems FROM tmp.sale_problems p GROUP BY ticketFk; @@ -72143,6 +71611,7 @@ BEGIN (tp.itemDelay) + (tp.isTooLittle) + (tp.itemLost) + + (tp.hasRounding) + (tp.itemShortage) ); @@ -72334,14 +71803,14 @@ BEGIN CALL addressTaxArea (); - IF vTaxArea > '' THEN + IF vTaxArea IS NOT NULL THEN UPDATE tmp.addressTaxArea SET areaFk = vTaxArea; END IF; + /* Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente * No se debería cambiar el sistema por problemas con los decimales */ - DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; CREATE TEMPORARY TABLE tmp.ticketTax (PRIMARY KEY (ticketFk, code, rate)) @@ -72349,7 +71818,7 @@ BEGIN SELECT * FROM ( SELECT tmpTicket.ticketFk, bp.pgcFk, - SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, + SUM(s.quantity * s.price * (100 - s.discount)/100 ) taxableBase, pgc.rate, tc.code, bp.priority @@ -72369,7 +71838,7 @@ BEGIN JOIN pgc ON pgc.code = bp.pgcFk JOIN taxClass tc ON tc.id = bp.taxClassFk GROUP BY tmpTicket.ticketFk, pgc.code, pgc.rate - HAVING taxableBase != 0) t3 + HAVING taxableBase <> 0) t3 ORDER BY priority; DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; @@ -72378,7 +71847,7 @@ BEGIN ENGINE = MEMORY SELECT tt.ticketFk, pgc.code pgcFk, - SUM(ts.quantity * ts.price) AS taxableBase, + SUM(ts.quantity * ts.price) taxableBase, pgc.rate, tc.code FROM tmp.ticket tt @@ -72394,7 +71863,7 @@ BEGIN JOIN pgc ON pgc.code = bp.pgcFk JOIN taxClass tc ON tc.id = bp.taxClassFk GROUP BY tt.ticketFk, pgc.code - HAVING taxableBase != 0; + HAVING taxableBase <> 0; INSERT INTO tmp.ticketTax (ticketFk, pgcFk, taxableBase, rate, code) SELECT ts.ticketFk, ts.pgcFk, ts.taxableBase, ts.rate, ts.code @@ -72580,38 +72049,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ticket_merge` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_merge`(vSelf INT, vTicketTargetFk INT) -BEGIN -/** - * Fusiona el primer ticket al segundo. - * - * @param vSelf Número de ticket a fusionar - * @param vTicketTargetFk Ticket destino - * - */ - UPDATE vn.sale s - SET s.ticketFk = vTicketTargetFk - WHERE s.ticketFk = vSelf; - - UPDATE vn.ticket t - SET t.shipped = TIMESTAMPADD(YEAR, - YEAR(util.VN_NOW()) MOD 2000, t.shipped ) - WHERE t.id = vSelf; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_priceDifference` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72725,20 +72162,31 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalc`(vTicketId INT) -BEGIN +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalc`(vSelf INT, vTaxArea VARCHAR(25)) +proc:BEGIN /** * Calcula y guarda el total con/sin IVA en un ticket. * * @param vTicketId Identificador del ticket */ + DECLARE hasInvoice BOOL; + + SELECT COUNT(*) INTO hasInvoice + FROM ticket + WHERE id = vSelf + AND refFk IS NOT NULL; + + IF hasInvoice THEN + LEAVE proc; + END IF; + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; CREATE TEMPORARY TABLE tmp.ticket ENGINE = MEMORY - SELECT vTicketId ticketFk; + SELECT vSelf ticketFk; - CALL ticketGetTotal; + CALL ticketGetTotal(vTaxArea); UPDATE ticket t JOIN tmp.ticketTotal tt ON tt.ticketFk = t.id @@ -73393,10 +72841,10 @@ BEGIN b.id businessFk, w.userFk, b.departmentFk, - IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5) ORDER BY j.start ASC SEPARATOR ' - ')) hourStart , - IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) hourEnd, - IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5), " - ", LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) timeTable, - IF(j.start = NULL, 0, IFNULL(SUM(TIME_TO_SEC(j.end)) - SUM(TIME_TO_SEC(j.start)), 0)) timeWorkSeconds, + IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.started,5) ORDER BY bs.started ASC SEPARATOR ' - ')) hourStart , + IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.ended,5) ORDER BY bs.ended ASC SEPARATOR ' - ')) hourEnd, + IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.started,5), " - ", LEFT(bs.ended,5) ORDER BY bs.ended ASC SEPARATOR ' - ')) timeTable, + IF(bs.started = NULL, 0, IFNULL(SUM(TIME_TO_SEC(bs.ended)) - SUM(TIME_TO_SEC(bs.started)), 0)) timeWorkSeconds, at2.name, at2.permissionRate, at2.discountRate, @@ -73408,7 +72856,7 @@ BEGIN JOIN tmp.`user` u ON u.userFK = w.userFK LEFT JOIN workCenter wc ON wc.id = b.workcenterFK LEFT JOIN calendarType ct ON ct.id = b.calendarTypeFk - LEFT JOIN postgresql.journey j ON j.business_id = b.id AND j.day_id = WEEKDAY(t.dated) + 1 + LEFT JOIN businessSchedule bs ON bs.businessFk = b.id AND bs.weekday = WEEKDAY(t.dated) + 1 LEFT JOIN calendar c ON c.businessFk = b.id AND c.dated = t.dated LEFT JOIN absenceType at2 ON at2.id = c.dayOffTypeFk WHERE t.dated BETWEEN vDatedFrom AND vDatedTo @@ -73416,14 +72864,14 @@ BEGIN )sub; UPDATE tmp.timeBusinessCalculate t - LEFT JOIN postgresql.journey j ON j.business_id = t.businessFk + LEFT JOIN businessSchedule bs ON bs.businessFk = t.businessFk SET t.timeWorkSeconds = t.hoursWeek / 5 * 3600, t.timeWorkSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), t.timeWorkDecimal = t.hoursWeek / 5, t.timeBusinessSeconds = t.hoursWeek / 5 * 3600, t.timeBusinessSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), t.timeBusinessDecimal = t.hoursWeek / 5 - WHERE DAYOFWEEK(t.dated) IN(2,3,4,5,6) AND j.journey_id IS NULL ; + WHERE DAYOFWEEK(t.dated) IN(2,3,4,5,6) AND bs.id IS NULL ; UPDATE tmp.timeBusinessCalculate t SET t.timeWorkSeconds = t.timeWorkSeconds - (t.timeWorkSeconds * permissionRate) , @@ -73611,9 +73059,9 @@ BEGIN * @param vDatedFrom * @param vDatedTo * Cálculo de horas trabajadas por empleado y día, - * sin tener encuenta los días con fichadas incorrectas según la tabla tmp.timeControlError - * En el caso de haber hecho descanso y hacer jornada intensiva, - * se añade al tiempo de trabajo efectivo un descanso el valor de vBreakTime + * sin tener en cuenta los días con fichadas incorrectas (tabla tmp.timeControlError) + * En el caso de haber hecho descanso y trabajado un mínimo de tiempo (vTimeToBreakTime), + * se añade al tiempo de trabajo efectivo el descanso (vBreakTime) * @return tmp.timeControlCalculate * (workerFk, dated, timeWorkSeconds, timeWorkSexagesimal, timeWorkDecimal, timed) */ @@ -73622,15 +73070,13 @@ BEGIN DECLARE vDatedToTomorrow DATETIME; DECLARE vTimeToBreakTime INT; DECLARE vBreakTime INT; - DECLARE vBreakTimeSplitDay INT; - DECLARE vDateSplitDay DATE; SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) INTO vDatedFromYesterday, vDatedToTomorrow; - SELECT timeToBreakTime, breakTime, breakTimeSplitDay, dateSplitDay - INTO vTimeToBreakTime, vBreakTime, vBreakTimeSplitDay, vDateSplitDay - FROM workerTimeControlConfig LIMIT 1; + SELECT timeToBreakTime, breakTime INTO vTimeToBreakTime, vBreakTime + FROM workerTimeControlConfig + LIMIT 1; CALL timeControl_getError(vDatedFrom, vDatedTo); @@ -73661,7 +73107,6 @@ BEGIN `direction` enum('in', 'out','middle') ) ENGINE=MEMORY; - SET @counter := 0; SET @vIsOdd := FALSE; @@ -73749,27 +73194,19 @@ BEGIN (INDEX (userFk), INDEX (dated)) ENGINE = MEMORY SELECT sub.userFk, - sub.dated, - SUM(isSplitDay) isSplitDay + sub.dated FROM (SELECT (@vIsOdd := NOT @vIsOdd), IF(wtc.direction = 'in', @vIsOdd := TRUE, NULL), - IF(@vIsOdd AND direction <> 'in' - AND UNIX_TIMESTAMP(wtc.timed) - @previousTimed > vBreakTimeSplitDay, - TRUE, - FALSE - ) isSplitDay, IF(@vIsOdd, @vLastTimed := UNIX_TIMESTAMP(wtc.timed), NULL), IF(@vIsOdd, 0, UNIX_TIMESTAMP(wtc.timed) - @vLastTimed) timeWork, IF(direction='in', @vDated := DATE(wtc.timed), @vDated) dated, - @previousTimed := UNIX_TIMESTAMP(wtc.timed), wtc.userFk FROM tmp.workerTimeControl wtc ORDER BY wtc.userFk, wtc.timed, wtc.id LIMIT 10000000000000000000 )sub GROUP BY sub.userFk, sub.dated - HAVING SUM(sub.timeWork) >= vTimeToBreakTime - AND (NOT isSplitDay OR dated < vDateSplitDay); + HAVING SUM(sub.timeWork) >= vTimeToBreakTime; SET @vIsOdd := TRUE; SET @vDated := 0; @@ -74107,54 +73544,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `travelLog_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travelLog_add`( - vChangedModel VARCHAR(45), - vOriginFk INT, - vChangedModelId INT, - vActionCode VARCHAR(45), - vChangedModelValue VARCHAR(255), - vOldInstance JSON, - vNewInstance JSON) -BEGIN -/** - * Guarda las acciones realizadas por el usuario - * - * @param vChangedModel Nombre que hace referencia a la tabla que se modifica - * @param vOriginFk Id del registro de la tabla origen - * @param vChangedModelId Id del registro de la tabla a la que se realiza la acción - * @param vActionCode Código de la acción {insert | delete | update} - * @param vOldInstance JSON que contiene los valores viejos - * @param vNewInstance JSON que contiene los valores nuevos - */ - CALL util.log_cleanInstances(vActionCode, vOldInstance, vNewInstance); - - IF !(vOldInstance = '{}' AND vNewInstance = '{}') THEN - INSERT INTO travelLog SET - changedModel = vChangedModel, - originFk = vOriginFk, - changedModelId = vChangedModelId, - `action` = vActionCode, - changedModelValue = vChangedModelValue, - oldInstance = vOldInstance, - newInstance = vNewInstance, - userFk = account.myUser_getId(); - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `travelVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74301,6 +73690,36 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `travel_checkWarehouseIsFeedStock` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_checkWarehouseIsFeedStock`(vWarehouseFk INT) +proc: BEGIN +/* + * Check that the warehouse is not Feed Stock + * + * @vWarehouseFk param warehouse id + */ + IF vWarehouseFk IS NULL THEN + LEAVE proc; + END IF; + + IF (SELECT isFeedStock FROM warehouse WHERE id = vWarehouseFk) THEN + CALL util.throw('Cannot create a travel with a source warehouse marked isFeedStock'); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_clone` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74460,11 +73879,11 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_doRecalc`() BEGIN @@ -74598,10 +74017,6 @@ BEGIN JOIN tmp.travel ttr ON ttr.id = tr.id SET tr.landed = TIMESTAMPADD(DAY, 1, tr.landed); - INSERT INTO travelLog (originFk, userFk , action, description) - SELECT ttr.id, account.myUser_getId(), 'update', CONCAT('Se ha cambiado la fecha del travel al dia ', util.tomorrow()) - FROM tmp.travel ttr; - OPEN vCur; l: LOOP @@ -74872,6 +74287,36 @@ BEGIN UPDATE vn.item SET upToDown = 0 WHERE item.id = vItemFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `vehicle_checkNumberPlate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2)) +BEGIN +/** + * Comprueba si la matricula pasada tiene el formato correcto dependiendo del pais del vehiculo + */ + DECLARE vRegex VARCHAR(45); + + SELECT vp.regex INTO vRegex + FROM vehiclePlateRegex vp + WHERE vp.countryCodeFk = vCountryCodeFk; + + IF NOT vNumberPlate REGEXP BINARY (vRegex)THEN + CALL util.throw(CONCAT('Error: la matricula ', vNumberPlate, ' no es valida para ',vCountryCodeFk)); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75821,52 +75266,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerLog_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerLog_add`( - vChangedModel VARCHAR(45), - vOriginFk INT, - vChangedModelId INT, - vActionCode VARCHAR(45), - vOldInstance JSON, - vNewInstance JSON) -BEGIN -/** - * Guarda las acciones realizadas por el usuario - * - * @param vChangedModel Nombre que hace referencia a la tabla que se modifica - * @param vOriginFk Id del registro de la tabla origen - * @param vChangedModelId Id del registro de la tabla a la que se realiza la acción - * @param vActionCode Código de la acción {insert | delete | update} - * @param vOldInstance JSON que contiene los valores viejos - * @param vNewInstance JSON que contiene los valores nuevos - */ - CALL util.log_cleanInstances(vActionCode, vOldInstance, vNewInstance); - - IF !(vOldInstance = '{}' AND vNewInstance = '{}') THEN - INSERT INTO workerLog SET - changedModel = vChangedModel, - originFk = vOriginFk, - changedModelId = vChangedModelId, - `action` = vActionCode, - oldInstance = vOldInstance, - newInstance = vNewInstance, - userFk = account.myUser_getId(); - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerMistakeType_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78422,7 +77821,7 @@ BEGIN zoneFk INT, PRIMARY KEY zoneFkk (zoneFk, geoFk), INDEX(geoFk)) - ENGINE = MEMORY; + ENGINE = MyISAM; OPEN cur1; cur1Loop: LOOP @@ -79451,12 +78850,12 @@ USE `account`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 SET character_set_client = utf8mb3 */; +/*!50001 SET character_set_results = utf8mb3 */; +/*!50001 SET collation_connection = utf8mb3_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `accountDovecot` AS select `u`.`name` AS `name`,`u`.`bcryptPassword` AS `password` from (`user` `u` join `account` `a` on(`a`.`id` = `u`.`id`)) where `u`.`active` <> 0 */; +/*!50001 VIEW `accountDovecot` AS select `u`.`name` AS `name`,`u`.`password` AS `password` from (`user` `u` join `account` `a` on(`a`.`id` = `u`.`id`)) where `u`.`active` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -79733,6 +79132,25 @@ USE `hedera`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `messageL10n` +-- + +/*!50001 DROP TABLE IF EXISTS `messageL10n`*/; +/*!50001 DROP VIEW IF EXISTS `messageL10n`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `messageL10n` AS select `m`.`code` AS `code`,ifnull(`mi`.`description`,`m`.`description`) AS `description` from (`message` `m` left join `messageI18n` `mi` on(`mi`.`code` = `m`.`code` and `mi`.`lang` = `util`.`LANG`())) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `myAddress` -- @@ -80194,25 +79612,6 @@ USE `sage`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `invoiceInList` --- - -/*!50001 DROP TABLE IF EXISTS `invoiceInList`*/; -/*!50001 DROP VIEW IF EXISTS `invoiceInList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInList` AS select `vn`.`invoiceIn`.`id` AS `id`,`vn`.`invoiceIn`.`supplierRef` AS `supplierRef`,`vn`.`invoiceIn`.`serial` AS `serial`,`vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`issued` AS `issued`,if(`vn`.`invoiceIn`.`expenceFkDeductible` > 0,1,0) AS `isVatDeductible`,`vn`.`invoiceIn`.`serialNumber` AS `serialNumber` from `vn`.`invoiceIn` where `vn`.`invoiceIn`.`issued` >= date_format(`util`.`VN_CURDATE`(),'%Y-01-01') + interval -1 year union all select `vn`.`dua`.`id` AS `id`,`vn`.`dua`.`code` AS `code`,'D' AS `D`,`c`.`id` AS `supplierFk`,`vn`.`dua`.`issued` AS `issued`,0 AS `FALSE`,`vn`.`dua`.`id` AS `serialNumber` from (`vn`.`dua` join `vn`.`company` `c` on(`c`.`code` = 'VNL')) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `supplierLastThreeMonths` -- @@ -80304,12 +79703,12 @@ USE `salix`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 SET character_set_client = utf8mb3 */; +/*!50001 SET character_set_results = utf8mb3 */; +/*!50001 SET collation_connection = utf8mb3_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `User` AS select `account`.`user`.`id` AS `id`,`account`.`user`.`realm` AS `realm`,`account`.`user`.`name` AS `username`,`account`.`user`.`bcryptPassword` AS `password`,`account`.`user`.`email` AS `email`,`account`.`user`.`emailVerified` AS `emailVerified`,`account`.`user`.`verificationToken` AS `verificationToken` from `account`.`user` */; +/*!50001 VIEW `User` AS select `account`.`user`.`id` AS `id`,`account`.`user`.`realm` AS `realm`,`account`.`user`.`name` AS `username`,`account`.`user`.`password` AS `password`,`account`.`user`.`email` AS `email`,`account`.`user`.`emailVerified` AS `emailVerified`,`account`.`user`.`verificationToken` AS `verificationToken` from `account`.`user` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -80607,9 +80006,9 @@ USE `vn`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb3 */; -/*!50001 SET character_set_results = utf8mb3 */; -/*!50001 SET collation_connection = utf8mb3_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `companyL10n` AS select `c`.`id` AS `id`,ifnull(`ci`.`footnotes`,`c`.`footnotes`) AS `footnotes` from (`company` `c` left join `companyI18n` `ci` on(`ci`.`companyFk` = `c`.`id` and `ci`.`lang` = `util`.`LANG`())) */; @@ -80631,7 +80030,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `defaulter` AS select `d`.`clientFk` AS `clientFk`,`d`.`created` AS `created`,`d`.`amount` AS `amount`,`d`.`defaulterSinced` AS `defaulterSinced`,`d`.`hasChanged` AS `hasChanged` from `bs`.`defaulter` `d` */; +/*!50001 VIEW `defaulter` AS select `d`.`clientFk` AS `clientFk`,`d`.`created` AS `created`,`d`.`amount` AS `amount`,`d`.`defaulterSinced` AS `defaulterSinced`,`d`.`hasChanged` AS `hasChanged`,`c`.`countryFk` AS `country`,`c`.`payMethodFk` AS `payMethod` from (((`bs`.`defaulter` `d` join `vn`.`client` `c` on(`c`.`id` = `d`.`clientFk`)) join `vn`.`country` `co` on(`co`.`id` = `c`.`countryFk`)) join `vn`.`payMethod` `pm` on(`pm`.`id` = `c`.`payMethodFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -80802,7 +80201,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionCommon` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `etd`,ifnull(ucase(`et`.`description`),'SIN ESCANEAR') AS `description`,`es`.`palletFk` AS `palletFk`,`t`.`routeFk` AS `routeFk`,`es`.`id` AS `scanFk`,`e`.`id` AS `expeditionFk`,`r`.`expeditionTruckFk` AS `expeditionTruckFk`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `lastPacked`,`t`.`id` AS `ticketFk` from (((((`expeditionTruck` `et` left join `routesMonitor` `r` on(`et`.`id` = `r`.`expeditionTruckFk`)) left join `ticket` `t` on(`r`.`routeFk` = `t`.`routeFk`)) left join `expedition` `e` on(`t`.`id` = `e`.`ticketFk`)) left join `expeditionScan` `es` on(`e`.`id` = `es`.`expeditionFk`)) left join `expeditionPallet` `ep` on(`es`.`palletFk` = `ep`.`id`)) where `et`.`ETD` >= `util`.`VN_CURDATE`() */; +/*!50001 VIEW `expeditionCommon` AS select `et`.`id` AS `truckFk`,`et`.`eta` AS `eta`,ifnull(ucase(`et`.`description`),'SIN ESCANEAR') AS `description`,`es`.`palletFk` AS `palletFk`,`t`.`routeFk` AS `routeFk`,`es`.`id` AS `scanFk`,`e`.`id` AS `expeditionFk`,`r`.`expeditionTruckFk` AS `expeditionTruckFk`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `lastPacked`,`t`.`id` AS `ticketFk` from (((((`expeditionTruck` `et` left join `routesMonitor` `r` on(`et`.`id` = `r`.`expeditionTruckFk`)) left join `ticket` `t` on(`r`.`routeFk` = `t`.`routeFk`)) left join `expedition` `e` on(`t`.`id` = `e`.`ticketFk`)) left join `expeditionScan` `es` on(`e`.`id` = `es`.`expeditionFk`)) left join `expeditionPallet` `ep` on(`es`.`palletFk` = `ep`.`id`)) where `et`.`eta` >= `util`.`VN_CURDATE`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -80878,7 +80277,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionScan_Monitor` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `ETD`,`et`.`description` AS `description`,`ep`.`id` AS `palletFk`,`ep`.`position` AS `position`,`ep`.`built` AS `built`,`es`.`id` AS `scanFk`,`es`.`expeditionFk` AS `expeditionFk`,`es`.`scanned` AS `scanned` from ((`expeditionTruck` `et` left join `expeditionPallet` `ep` on(`ep`.`truckFk` = `et`.`id`)) left join `expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) */; +/*!50001 VIEW `expeditionScan_Monitor` AS select `et`.`id` AS `truckFk`,`et`.`eta` AS `ETD`,`et`.`description` AS `description`,`ep`.`id` AS `palletFk`,`ep`.`position` AS `position`,`ep`.`built` AS `built`,`es`.`id` AS `scanFk`,`es`.`expeditionFk` AS `expeditionFk`,`es`.`scanned` AS `scanned` from ((`expeditionTruck` `et` left join `expeditionPallet` `ep` on(`ep`.`truckFk` = `et`.`id`)) left join `expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -80916,7 +80315,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTicket_NoBoxes` AS select `t`.`id` AS `ticketFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`routeFk` AS `routeFk`,`et`.`description` AS `description` from (((`ticket` `t` left join `expedition` `e` on(`e`.`ticketFk` = `t`.`id`)) join `routesMonitor` `rm` on(`rm`.`routeFk` = `t`.`routeFk`)) join `expeditionTruck` `et` on(`et`.`id` = `rm`.`expeditionTruckFk`)) where `e`.`id` is null and `et`.`ETD` > `util`.`VN_CURDATE`() */; +/*!50001 VIEW `expeditionTicket_NoBoxes` AS select `t`.`id` AS `ticketFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`routeFk` AS `routeFk`,`et`.`description` AS `description` from (((`ticket` `t` left join `expedition` `e` on(`e`.`ticketFk` = `t`.`id`)) join `routesMonitor` `rm` on(`rm`.`routeFk` = `t`.`routeFk`)) join `expeditionTruck` `et` on(`et`.`id` = `rm`.`expeditionTruckFk`)) where `e`.`id` is null and `et`.`eta` > `util`.`VN_CURDATE`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -80954,7 +80353,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTruck_Control` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `description`,count(distinct if(`e`.`expeditionFk` is null,`e`.`ticketFk`,NULL)) AS `ticketsSinBultos`,count(distinct `e`.`palletFk`) AS `pallets`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionFk`) AS `expeditions`,sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk` order by sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) desc,`e`.`etd` */; +/*!50001 VIEW `expeditionTruck_Control` AS select `e`.`truckFk` AS `id`,`e`.`eta` AS `ETD`,`e`.`description` AS `description`,count(distinct if(`e`.`expeditionFk` is null,`e`.`ticketFk`,NULL)) AS `ticketsSinBultos`,count(distinct `e`.`palletFk`) AS `pallets`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionFk`) AS `expeditions`,sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk` order by sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) desc,`e`.`eta` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -80973,7 +80372,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTruck_Control_Detail` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionTruckFk`) AS `destinos`,sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk`,`e`.`palletFk` order by sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) desc,`e`.`etd`,`e`.`truckFk` */; +/*!50001 VIEW `expeditionTruck_Control_Detail` AS select `e`.`truckFk` AS `id`,`e`.`eta` AS `eta`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionTruckFk`) AS `destinos`,sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk`,`e`.`palletFk` order by sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) desc,`e`.`eta`,`e`.`truckFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -80992,7 +80391,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTruck_Control_Detail_Pallet` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,`e`.`routeFk` AS `route`,count(distinct `e`.`scanFk`) AS `scans`,`et`.`description` AS `destinos`,sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,`e`.`expeditionTruckFk` AS `expeditionTruckFk`,max(`e`.`lastPacked`) AS `lastPacked` from (`expeditionCommon` `e` left join `expeditionTruck` `et` on(`et`.`id` = `e`.`expeditionTruckFk`)) group by `e`.`truckFk`,`e`.`palletFk`,`e`.`routeFk` order by sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) desc,`e`.`palletFk` */; +/*!50001 VIEW `expeditionTruck_Control_Detail_Pallet` AS select `e`.`truckFk` AS `id`,`e`.`eta` AS `eta`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,`e`.`routeFk` AS `route`,count(distinct `e`.`scanFk`) AS `scans`,`et`.`description` AS `destinos`,sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,`e`.`expeditionTruckFk` AS `expeditionTruckFk`,max(`e`.`lastPacked`) AS `lastPacked` from (`expeditionCommon` `e` left join `expeditionTruck` `et` on(`et`.`id` = `e`.`expeditionTruckFk`)) group by `e`.`truckFk`,`e`.`palletFk`,`e`.`routeFk` order by sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) desc,`e`.`palletFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -81771,7 +81170,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `routesReduced` AS select `et`.`description` AS `description`,`rm`.`name` AS `name`,`t`.`routeFk` AS `routeFk`,`et`.`ETD` AS `ETD`,`rm`.`bufferFk` AS `bufferFk`,`rm`.`beachFk` AS `beachFk`,`i`.`itemPackingTypeFk` AS `itempackingTypeFk` from (((((((`expeditionTruck` `et` join `routesMonitor` `rm` on(`rm`.`expeditionTruckFk` = `et`.`id`)) join `ticket` `t` on(`t`.`routeFk` = `rm`.`routeFk`)) join `ticketState` `ts` on(`ts`.`ticketFk` = `t`.`id`)) join `state` `st` on(`st`.`id` = `ts`.`stateFk`)) join `sale` `s` on(`s`.`ticketFk` = `t`.`id`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `config` `c`) where `et`.`ETD` > `util`.`yesterday`() group by `t`.`routeFk` order by `et`.`ETD`,`t`.`routeFk` */; +/*!50001 VIEW `routesReduced` AS select `et`.`description` AS `description`,`rm`.`name` AS `name`,`t`.`routeFk` AS `routeFk`,`et`.`eta` AS `eta`,`rm`.`bufferFk` AS `bufferFk`,`rm`.`beachFk` AS `beachFk`,`i`.`itemPackingTypeFk` AS `itempackingTypeFk` from (((((((`expeditionTruck` `et` join `routesMonitor` `rm` on(`rm`.`expeditionTruckFk` = `et`.`id`)) join `ticket` `t` on(`t`.`routeFk` = `rm`.`routeFk`)) join `ticketState` `ts` on(`ts`.`ticketFk` = `t`.`id`)) join `state` `st` on(`st`.`id` = `ts`.`stateFk`)) join `sale` `s` on(`s`.`ticketFk` = `t`.`id`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `config` `c`) where `et`.`eta` > `util`.`yesterday`() group by `t`.`routeFk` order by `et`.`eta`,`t`.`routeFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -82393,12 +81792,12 @@ USE `vn`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 SET character_set_client = utf8mb3 */; +/*!50001 SET character_set_results = utf8mb3 */; +/*!50001 SET collation_connection = utf8mb3_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeControlUserInfo` AS select `u`.`id` AS `userFk`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`u`.`name` AS `user`,`u`.`password` AS `password`,`u`.`bcryptPassword` AS `bcryptPassword`,`wd`.`departmentFk` AS `departmentFk`,left(`c`.`fi`,8) AS `dni` from (((`account`.`user` `u` join `vn`.`worker` `w` on(`w`.`userFk` = `u`.`id`)) join `vn`.`client` `c` on(`c`.`id` = `u`.`id`)) left join `vn`.`workerDepartment` `wd` on(`wd`.`workerFk` = `w`.`id`)) */; +/*!50001 VIEW `workerTimeControlUserInfo` AS select `u`.`id` AS `userFk`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`u`.`name` AS `user`,`u`.`password` AS `password`,`wd`.`departmentFk` AS `departmentFk`,left(`c`.`fi`,8) AS `dni` from (((`account`.`user` `u` join `vn`.`worker` `w` on(`w`.`userFk` = `u`.`id`)) join `vn`.`client` `c` on(`c`.`id` = `u`.`id`)) left join `vn`.`workerDepartment` `wd` on(`wd`.`workerFk` = `w`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -82450,9 +81849,9 @@ USE `vn`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb3 */; -/*!50001 SET character_set_results = utf8mb3 */; -/*!50001 SET collation_connection = utf8mb3_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,cast(`util`.`VN_CURDATE`() + interval hour(ifnull(`zc`.`hour`,`z`.`hour`)) * 60 + minute(ifnull(`zc`.`hour`,`z`.`hour`)) minute as time) AS `hourTheoretical`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `totalVolume`,cast(sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) as decimal(5,1)) AS `remainingVolume`,greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) AS `speed`,cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) * 60 / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) minute as time) AS `hourEffective`,floor(-sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) * 60 / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) AS `minutesLess`,cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) * 60 / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) minute as time) AS `etc` from (((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() group by `t`.`zoneFk` */; @@ -82469,4 +81868,4 @@ USE `vn`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-05-16 8:23:56 +-- Dump completed on 2023-06-26 8:39:32 diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 640a224cb..d4a8a316f 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -312,8 +312,8 @@ export default { clientDefaulter: { anyClient: 'vn-client-defaulter tbody > tr', firstClientName: 'vn-client-defaulter tbody > tr:nth-child(2) > td:nth-child(2) > span', - firstSalesPersonName: 'vn-client-defaulter tbody > tr:nth-child(2) > td:nth-child(3) > span', - firstObservation: 'vn-client-defaulter tbody > tr:nth-child(2) > td:nth-child(8) > vn-textarea[ng-model="defaulter.observation"]', + firstSalesPersonName: 'vn-client-defaulter tbody > tr:nth-child(2) > td:nth-child(4) > span', + firstObservation: 'vn-client-defaulter tbody > tr:nth-child(2) > td:nth-child(9) > vn-textarea[ng-model="defaulter.observation"]', allDefaulterCheckbox: 'vn-client-defaulter thead vn-multi-check', addObservationButton: 'vn-client-defaulter vn-button[icon="icon-notes"]', observation: '.vn-dialog.shown vn-textarea[ng-model="$ctrl.defaulter.observation"]', diff --git a/e2e/paths/02-client/07_edit_web_access.spec.js b/e2e/paths/02-client/07_edit_web_access.spec.js index 3847ec7cd..c5e132ab7 100644 --- a/e2e/paths/02-client/07_edit_web_access.spec.js +++ b/e2e/paths/02-client/07_edit_web_access.spec.js @@ -39,9 +39,9 @@ describe('Client web access path', () => { const userName = await page.getValue($.userName); const email = await page.getValue($.email); - await page.accessToSection('client.card.log'); - const logName = await page.innerText($.nameValue); - const logActive = await page.innerText($.activeValue); + // await page.accessToSection('client.card.log'); + // const logName = await page.innerText($.nameValue); + // const logActive = await page.innerText($.activeValue); expect(enableMessage.type).toBe('success'); expect(modifyMessage.type).toBe('success'); @@ -50,7 +50,7 @@ describe('Client web access path', () => { expect(userName).toEqual('Legion'); expect(email).toEqual('legion@marvel.com'); - expect(logName).toEqual('Legion'); - expect(logActive).toEqual('✗'); + // expect(logName).toEqual('Legion'); + // expect(logActive).toEqual('✗'); }); }); diff --git a/e2e/paths/04-item/03_tax.spec.js b/e2e/paths/04-item/03_tax.spec.js index 83f4e6bee..16cc1667d 100644 --- a/e2e/paths/04-item/03_tax.spec.js +++ b/e2e/paths/04-item/03_tax.spec.js @@ -19,7 +19,6 @@ describe('Item edit tax path', () => { it(`should add the item tax to all countries`, async() => { await page.autocompleteSearch(selectors.itemTax.firstClass, 'General VAT'); await page.autocompleteSearch(selectors.itemTax.secondClass, 'General VAT'); - await page.autocompleteSearch(selectors.itemTax.thirdClass, 'General VAT'); await page.waitToClick(selectors.itemTax.submitTaxButton); const message = await page.waitForSnackbar(); @@ -40,13 +39,6 @@ describe('Item edit tax path', () => { expect(secondVatType).toEqual('General VAT'); }); - it(`should confirm the third item tax class was edited`, async() => { - const thirdVatType = await page - .waitToGetProperty(selectors.itemTax.thirdClass, 'value'); - - expect(thirdVatType).toEqual('General VAT'); - }); - it(`should edit the first class without saving the form`, async() => { await page.autocompleteSearch(selectors.itemTax.firstClass, 'Reduced VAT'); const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value'); diff --git a/e2e/paths/10-travel/03_descriptor.spec.js b/e2e/paths/10-travel/03_descriptor.spec.js index 3752400c6..4723cc4a3 100644 --- a/e2e/paths/10-travel/03_descriptor.spec.js +++ b/e2e/paths/10-travel/03_descriptor.spec.js @@ -9,7 +9,7 @@ describe('Travel descriptor path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'travel'); - await page.write(selectors.travelIndex.generalSearchFilter, '1'); + await page.write(selectors.travelIndex.generalSearchFilter, '3'); await page.keyboard.press('Enter'); await page.waitForState('travel.card.summary'); }); @@ -23,7 +23,7 @@ describe('Travel descriptor path', () => { await page.waitForState('travel.index'); const result = await page.countElement(selectors.travelIndex.anySearchResult); - expect(result).toBeGreaterThanOrEqual(7); + expect(result).toBeGreaterThanOrEqual(1); }); it('should navigate to the first search result', async() => { diff --git a/e2e/paths/14-account/03_role_create_and_basic_data.spec.js b/e2e/paths/14-account/03_role_create_and_basic_data.spec.js index 294a500ca..6acf82318 100644 --- a/e2e/paths/14-account/03_role_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/03_role_create_and_basic_data.spec.js @@ -81,6 +81,6 @@ describe('Account Role create and basic data path', () => { await page.accessToSection('account.role.card.inherited'); const rolesCount = await page.countElement(selectors.accountRoleInheritance.anyResult); - expect(rolesCount).toEqual(6); + expect(rolesCount).toEqual(7); }); }); diff --git a/front/core/services/auth.js b/front/core/services/auth.js index d3e590a74..844a5145d 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -59,8 +59,9 @@ export default class Auth { password: password || undefined }; - return this.$http.post('VnUsers/signin', params).then( - json => this.onLoginOk(json, remember)); + const now = new Date(); + return this.$http.post('VnUsers/sign-in', params).then( + json => this.onLoginOk(json, now, remember)); } validateCode(user, password, code, remember) { @@ -76,12 +77,13 @@ export default class Auth { code: code }; - return this.$http.post('VnUsers/validate-auth', params).then( - json => this.onLoginOk(json, remember)); + const now = new Date(); + return this.$http.post('VnUsers/validate-auth', params) + .then(json => this.onLoginOk(json, now, remember)); } - onLoginOk(json, remember) { - this.vnToken.set(json.data.token, json.data.created, remember); + onLoginOk(json, now, remember) { + this.vnToken.set(json.data.token, now, json.data.ttl, remember); return this.loadAcls().then(() => { let continueHash = this.$state.params.continue; diff --git a/front/core/services/interceptor.js b/front/core/services/interceptor.js index 3f3d9912b..0c3253c69 100644 --- a/front/core/services/interceptor.js +++ b/front/core/services/interceptor.js @@ -1,11 +1,16 @@ import ngModule from '../module'; import HttpError from 'core/lib/http-error'; -interceptor.$inject = ['$q', 'vnApp', 'vnToken', '$translate']; -function interceptor($q, vnApp, vnToken, $translate) { +interceptor.$inject = ['$q', 'vnApp', '$translate']; +function interceptor($q, vnApp, $translate) { let apiPath = 'api/'; + let token = sessionStorage.getItem('vnToken') + ?? localStorage.getItem('vnToken'); return { + setToken(newToken) { + token = newToken; + }, setApiPath(path) { apiPath = path; }, @@ -14,8 +19,8 @@ function interceptor($q, vnApp, vnToken, $translate) { if (config.url.charAt(0) !== '/' && apiPath) config.url = `${apiPath}${config.url}`; - if (vnToken.token) - config.headers.Authorization = vnToken.token; + if (token) + config.headers.Authorization = token; if ($translate.use()) config.headers['Accept-Language'] = $translate.use(); if (config.filter) { diff --git a/front/core/services/token.js b/front/core/services/token.js index c1bb5a173..c4b644a89 100644 --- a/front/core/services/token.js +++ b/front/core/services/token.js @@ -6,37 +6,117 @@ import ngModule from '../module'; * @property {String} token The current login token or %null */ export default class Token { - constructor() { - try { - this.token = sessionStorage.getItem('vnToken'); - this.created = sessionStorage.getItem('vnTokenCreated'); - if (!this.token) { - this.token = localStorage.getItem('vnToken'); - this.created = localStorage.getItem('vnTokenCreated'); - } - } catch (e) {} - } - set(token, created, remember) { - this.unset(); - try { - if (remember) { - localStorage.setItem('vnToken', token); - localStorage.setItem('vnTokenCreated', created); - } else { - sessionStorage.setItem('vnToken', token); - sessionStorage.setItem('vnTokenCreated', created); - } - } catch (e) {} + constructor(vnInterceptor, $http, $rootScope) { + Object.assign(this, { + vnInterceptor, + $http, + $rootScope + }); - this.token = token; - this.created = created; + try { + this.getStorage(sessionStorage); + this.remember = true; + + if (!this.token) { + this.getStorage(localStorage); + this.remember = false; + } + } catch (e) {} } + + set(token, created, ttl, remember) { + this.unset(); + + Object.assign(this, { + token, + created, + ttl, + remember + }); + this.vnInterceptor.setToken(token); + try { + if (remember) + this.setStorage(localStorage, token, created, ttl); + else + this.setStorage(sessionStorage, token, created, ttl); + } catch (err) { + console.error(err); + } + } + unset() { - localStorage.removeItem('vnToken'); - sessionStorage.removeItem('vnToken'); this.token = null; this.created = null; + this.ttl = null; + this.remember = null; + this.vnInterceptor.setToken(null); + + this.removeStorage(localStorage); + this.removeStorage(sessionStorage); + } + + getStorage(storage) { + this.token = storage.getItem('vnToken'); + if (!this.token) return; + const created = storage.getItem('vnTokenCreated'); + this.created = created && new Date(created); + this.renewPeriod = storage.getItem('vnTokenRenewPeriod'); + } + + setStorage(storage, token, created, ttl) { + storage.setItem('vnToken', token); + storage.setItem('vnTokenCreated', created.toJSON()); + storage.setItem('vnTokenTtl', ttl); + } + + removeStorage(storage) { + storage.removeItem('vnToken'); + storage.removeItem('vnTokenCreated'); + storage.removeItem('vnTokenTtl'); + } + + fetchConfig() { + const filter = {fields: ['renewInterval', 'renewPeriod']}; + this.$http.get('AccessTokenConfigs/findOne', {filter}).then(res => { + const data = res.data; + if (!data) return; + this.renewPeriod = data.renewPeriod; + this.stopRenewer(); + this.inservalId = setInterval(() => this.checkValidity(), data.renewInterval * 1000); + this.checkValidity(); + }); + } + + checkValidity() { + if (this.checking || !this.created) return; + this.checking = true; + const renewPeriod = Math.min(this.ttl, this.renewPeriod) * 1000; + const maxDate = this.created.getTime() + renewPeriod; + const now = new Date(); + + if (now.getTime() <= maxDate) { + this.checking = false; + return; + } + + this.$http.post('VnUsers/renewToken') + .then(res => { + const token = res.data; + this.set(token.id, now, token.ttl, this.remember); + }) + .catch(res => { + if (res.data?.error?.code !== 'periodNotExceeded') + throw res; + }) + .finally(() => { + this.checking = false; + }); + } + + stopRenewer() { + clearInterval(this.inservalId); } } +Token.$inject = ['vnInterceptor', '$http', '$rootScope']; ngModule.service('vnToken', Token); diff --git a/front/salix/components/change-password/index.js b/front/salix/components/change-password/index.js index 80784e5d0..797d4dc96 100644 --- a/front/salix/components/change-password/index.js +++ b/front/salix/components/change-password/index.js @@ -35,8 +35,6 @@ export default class Controller { throw new UserError(`You must fill all the fields`); if (newPassword != this.repeatPassword) throw new UserError(`Passwords don't match`); - if (newPassword == oldPassword) - throw new UserError(`You can not use the same password`); const headers = { Authorization: this.$state.params.id diff --git a/front/salix/components/layout/index.html b/front/salix/components/layout/index.html index 5a525ef77..972defaa1 100644 --- a/front/salix/components/layout/index.html +++ b/front/salix/components/layout/index.html @@ -42,7 +42,7 @@
- + @@ -33,6 +34,7 @@ ng-src="/api/Images/user/160x160/{{::userLog.userFk}}/download?access_token={{::$ctrl.vnToken.token}}"> +
diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index 3df367cae..176815eef 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -115,23 +115,21 @@ export default class Controller extends Section { // User const userChanged = originChanged - || log.userFk != prevLog.userFk - || nLogs >= 5; + || log.userFk != prevLog.userFk; if (userChanged) { originLog.logs.push(userLog = { user: log.user, userFk: log.userFk, logs: [] }); - nLogs = 0; } - nLogs++; // Model const modelChanged = userChanged || log.changedModel != prevLog.changedModel - || log.changedModelId != prevLog.changedModelId; + || log.changedModelId != prevLog.changedModelId + || nLogs >= 6; if (modelChanged) { userLog.logs.push(modelLog = { model: log.changedModel, @@ -140,7 +138,9 @@ export default class Controller extends Section { showValue: log.changedModelValue, logs: [] }); + nLogs = 0; } + nLogs++; modelLog.logs.push(log); diff --git a/front/salix/components/log/style.scss b/front/salix/components/log/style.scss index d729d09a3..09a762db3 100644 --- a/front/salix/components/log/style.scss +++ b/front/salix/components/log/style.scss @@ -44,11 +44,20 @@ vn-log { right: -4px; z-index: 1; } - & > vn-avatar { - cursor: pointer; + & > .user-avatar { + background-color: $color-bg; + padding: $spacing-sm 0; + margin-top: -$spacing-sm; + position: sticky; + top: 64px; - &.system { - background-color: $color-main !important; + & > vn-avatar { + cursor: pointer; + display: block; + + &.system { + background-color: $color-main !important; + } } } & > .line { @@ -57,8 +66,8 @@ vn-log { width: 2px; left: 18px; z-index: -1; - top: 44px; - bottom: -2px; + top: 0; + bottom: -$spacing-sm; } } &:last-child > .timeline > .line { diff --git a/front/salix/components/login/index.js b/front/salix/components/login/index.js index 13b075b88..be4fb3926 100644 --- a/front/salix/components/login/index.js +++ b/front/salix/components/login/index.js @@ -24,7 +24,7 @@ export default class Controller { this.loading = false; }) .catch(req => { - if (req.message === 'Forbidden') { + if (req?.data?.error?.code === 'REQUIRES_2FA') { this.outLayout.login = { user: this.user, password: this.password, diff --git a/front/salix/routes.js b/front/salix/routes.js index a0c216150..5a2c030bc 100644 --- a/front/salix/routes.js +++ b/front/salix/routes.js @@ -11,7 +11,8 @@ function config($stateProvider, $urlRouterProvider) { abstract: true, template: '', resolve: { - config: ['vnConfig', vnConfig => vnConfig.initialize()] + config: ['vnConfig', vnConfig => vnConfig.initialize()], + token: ['vnToken', vnToken => vnToken.fetchConfig()] } }) .state('outLayout', { diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 09069bc5e..542f48424 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -177,5 +177,6 @@ "Invalid quantity": "Invalid quantity", "Failed to upload delivery note": "Error to upload delivery note {{id}}", "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", - "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 3": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 3" + "The renew period has not been exceeded": "The renew period has not been exceeded", + "You can not use the same password": "You can not use the same password" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index c1d4115ff..578a54c06 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -177,7 +177,6 @@ "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria", "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas", "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", - "Sorts whole route": "Reordena ruta entera", "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*", "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*", "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío", diff --git a/modules/account/back/methods/account/change-password.js b/modules/account/back/methods/account/change-password.js index be795b704..a739f37d0 100644 --- a/modules/account/back/methods/account/change-password.js +++ b/modules/account/back/methods/account/change-password.js @@ -31,13 +31,17 @@ module.exports = Self => { Self.changePassword = async function(ctx, oldPassword, newPassword, code, options) { const userId = ctx.req.accessToken.userId; - const myOptions = {...(options || {})}; + const myOptions = {}; + if (typeof options == 'object') + Object.assign(myOptions, options); const {VnUser} = Self.app.models; + const user = await VnUser.findById(userId, {fields: ['name', 'twoFactor']}, myOptions); + await user.hasPassword(oldPassword); + if (oldPassword == newPassword) throw new UserError(`You can not use the same password`); - const user = await VnUser.findById(userId, {fields: ['name', 'twoFactor']}, myOptions); if (user.twoFactor) await VnUser.validateCode(user.name, code, myOptions); diff --git a/modules/account/back/methods/account/login.js b/modules/account/back/methods/account/login.js index 5178f9caf..205bf9526 100644 --- a/modules/account/back/methods/account/login.js +++ b/modules/account/back/methods/account/login.js @@ -23,5 +23,5 @@ module.exports = Self => { } }); - Self.login = async(ctx, user, password, options) => Self.app.models.VnUser.signin(ctx, user, password, options); + Self.login = async(ctx, user, password, options) => Self.app.models.VnUser.signIn(ctx, user, password, options); }; diff --git a/modules/account/back/methods/account/specs/change-password.spec.js b/modules/account/back/methods/account/specs/change-password.spec.js index 83e901cb2..045f98493 100644 --- a/modules/account/back/methods/account/specs/change-password.spec.js +++ b/modules/account/back/methods/account/specs/change-password.spec.js @@ -79,7 +79,7 @@ describe('account changePassword()', () => { passExpired: yesterday } , options); - await models.VnUser.signin(unauthCtx, 'trainee', 'nightmare', options); + await models.VnUser.signIn(unauthCtx, 'trainee', 'nightmare', options); } catch (e) { if (e.message != 'Pass expired') throw e; diff --git a/modules/claim/back/methods/claim/claimPickupEmail.js b/modules/claim/back/methods/claim/claimPickupEmail.js index c688d6ded..1fd8eb99e 100644 --- a/modules/claim/back/methods/claim/claimPickupEmail.js +++ b/modules/claim/back/methods/claim/claimPickupEmail.js @@ -77,14 +77,6 @@ module.exports = Self => { if (salesPersonId) await models.Chat.sendCheckingPresence(ctx, salesPersonId, message); - await models.ClaimLog.create({ - originFk: args.id, - userFk: userId, - action: 'insert', - description: 'Claim-pickup-order sent', - changedModel: 'Mail' - }); - const email = new Email('claim-pickup-order', params); return email.send(); diff --git a/modules/client/back/methods/client/confirmTransaction.js b/modules/client/back/methods/client/confirmTransaction.js index fcb33c4ca..17c50e7db 100644 --- a/modules/client/back/methods/client/confirmTransaction.js +++ b/modules/client/back/methods/client/confirmTransaction.js @@ -19,9 +19,6 @@ module.exports = Self => { }); Self.confirmTransaction = async(ctx, id, options) => { - const models = Self.app.models; - const userId = ctx.req.accessToken.userId; - let tx; const myOptions = {userId: ctx.req.accessToken.userId}; @@ -34,29 +31,8 @@ module.exports = Self => { } try { - const oldTpvTransaction = await models.TpvTransaction.findById(id, null, myOptions); - const confirm = await Self.rawSql('CALL hedera.tpvTransaction_confirmById(?)', [id], myOptions); - - const tpvTransaction = await models.TpvTransaction.findById(id, null, myOptions); - - const oldInstance = {status: oldTpvTransaction.status}; - const newInstance = {status: tpvTransaction.status}; - - const logRecord = { - originFk: tpvTransaction.clientFk, - userFk: userId, - action: 'update', - changedModel: 'TpvTransaction', - changedModelId: id, - oldInstance: oldInstance, - newInstance: newInstance - }; - - await models.ClientLog.create(logRecord, myOptions); - if (tx) await tx.commit(); - return confirm; } catch (e) { if (tx) await tx.rollback(); diff --git a/modules/client/back/methods/client/sendSms.js b/modules/client/back/methods/client/sendSms.js index 9d6a12416..83b7c8d6e 100644 --- a/modules/client/back/methods/client/sendSms.js +++ b/modules/client/back/methods/client/sendSms.js @@ -30,34 +30,9 @@ module.exports = Self => { } }); - Self.sendSms = async(ctx, id, destination, message, options) => { + Self.sendSms = async(ctx, id, destination, message) => { const models = Self.app.models; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - const userId = ctx.req.accessToken.userId; - const sms = await models.Sms.send(ctx, destination, message); - const logRecord = { - originFk: id, - userFk: userId, - action: 'insert', - changedModel: 'sms', - newInstance: { - destinationFk: id, - destination: destination, - message: message, - statusCode: sms.statusCode, - status: sms.status - } - }; - - const clientLog = await models.ClientLog.create(logRecord, myOptions); - - sms.logId = clientLog.id; - return sms; }; }; diff --git a/modules/client/back/methods/client/specs/sendSms.spec.js b/modules/client/back/methods/client/specs/sendSms.spec.js index 47e788184..df680c55f 100644 --- a/modules/client/back/methods/client/specs/sendSms.spec.js +++ b/modules/client/back/methods/client/specs/sendSms.spec.js @@ -13,10 +13,7 @@ describe('client sendSms()', () => { const sms = await models.Client.sendSms(ctx, id, destination, message, options); - const createdLog = await models.ClientLog.findById(sms.logId, null, options); - const json = JSON.parse(JSON.stringify(createdLog.newInstance)); - - expect(json.message).toEqual(message); + expect(sms).toBeDefined(); await tx.rollback(); } catch (e) { diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index 697c567a3..5fd886c32 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -144,20 +144,7 @@ module.exports = Self => { if (taxDataChecked && !hasSageData) throw new UserError(`You need to fill sage information before you check verified data`); - if (args.despiteOfClient) { - const logRecord = { - originFk: clientId, - userFk: userId, - action: 'update', - changedModel: 'Client', - changedModelId: clientId, - description: $t(`Client checked as validated despite of duplication`, { - clientId: args.despiteOfClient - }) - }; - await models.ClientLog.create(logRecord, myOptions); - } // Remove unwanted properties delete args.ctx; delete args.id; diff --git a/modules/client/back/methods/defaulter/filter.js b/modules/client/back/methods/defaulter/filter.js index 736c29f9c..56afb64db 100644 --- a/modules/client/back/methods/defaulter/filter.js +++ b/modules/client/back/methods/defaulter/filter.js @@ -60,6 +60,7 @@ module.exports = Self => { DISTINCT c.id clientFk, c.name clientName, c.salesPersonFk, + c.businessTypeFk, u.name salesPersonName, d.amount, co.created, diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 697129df0..e6e240931 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -401,22 +401,32 @@ module.exports = Self => { Self.changeCredit = async function changeCredit(ctx, finalState, changes) { const models = Self.app.models; const userId = ctx.options.accessToken.userId; - const accessToken = {req: {accessToken: ctx.options.accessToken} }; + const accessToken = {req: {accessToken: ctx.options.accessToken}}; const canEditCredit = await models.ACL.checkAccessAcl(accessToken, 'Client', 'editCredit', 'WRITE'); if (!canEditCredit) { const lastCredit = await models.ClientCredit.findOne({ + field: ['workerFk', 'amount'], where: { clientFk: finalState.id }, order: 'id DESC' }, ctx.options); - const lastAmount = lastCredit && lastCredit.amount; - const lastCreditIsNotEditable = !await models.ACL.checkAccessAcl(accessToken, 'Client', 'isNotEditableCredit', 'WRITE'); + if (lastCredit && lastCredit.amount == 0) { + const zeroCreditEditor = + await models.ACL.checkAccessAcl(accessToken, 'Client', 'zeroCreditEditor', 'WRITE'); + const lastCreditIsNotEditable = + await models.ACL.checkAccessAcl( + {req: {accessToken: {userId: lastCredit.workerFk}}}, + 'Client', + 'zeroCreditEditor', + 'WRITE' + ); - if (lastAmount == 0 && lastCreditIsNotEditable) - throw new UserError(`You can't change the credit set to zero from a financialBoss`); + if (lastCreditIsNotEditable && !zeroCreditEditor) + throw new UserError(`You can't change the credit set to zero from a financialBoss`); + } const creditLimits = await models.ClientCreditLimit.find({ fields: ['roleFk'], @@ -479,21 +489,6 @@ module.exports = Self => { hasChanges = oldData.name != changes.name || oldData.active != changes.active; if (!hasChanges) return; - - const isClient = await Self.app.models.Client.count({id: oldData.id}); - if (isClient) { - const loopBackContext = LoopBackContext.getCurrentContext(); - const userId = loopBackContext.active.accessToken.userId; - const logRecord = { - originFk: oldData.id, - userFk: userId, - action: 'update', - changedModel: 'VnUser', - oldInstance: {name: oldData.name, active: oldData.active}, - newInstance: {name: changes.name, active: changes.active} - }; - await Self.app.models.ClientLog.create(logRecord); - } } }); }); diff --git a/modules/client/back/models/specs/client.spec.js b/modules/client/back/models/specs/client.spec.js index 45debc08a..201d14bb4 100644 --- a/modules/client/back/models/specs/client.spec.js +++ b/modules/client/back/models/specs/client.spec.js @@ -60,22 +60,22 @@ describe('Client Model', () => { try { const options = {transaction: tx}; - const context = {options}; + const ctx = {options}; // Set credit to zero by a financialBoss const financialBoss = await models.VnUser.findOne({ where: {name: 'financialBoss'} }, options); - context.options.accessToken = {userId: financialBoss.id}; + ctx.options.accessToken = {userId: financialBoss.id}; - await models.Client.changeCredit(context, instance, {credit: 0}); + await models.Client.changeCredit(ctx, instance, {credit: 0}); const salesAssistant = await models.VnUser.findOne({ where: {name: 'salesAssistant'} }, options); - context.options.accessToken = {userId: salesAssistant.id}; + ctx.options.accessToken = {userId: salesAssistant.id}; - await models.Client.changeCredit(context, instance, {credit: 300}); + await models.Client.changeCredit(ctx, instance, {credit: 300}); await tx.rollback(); } catch (e) { @@ -93,14 +93,14 @@ describe('Client Model', () => { try { const options = {transaction: tx}; - const context = {options}; + const ctx = {options}; const salesAssistant = await models.VnUser.findOne({ where: {name: 'salesAssistant'} }, options); - context.options.accessToken = {userId: salesAssistant.id}; + ctx.options.accessToken = {userId: salesAssistant.id}; - await models.Client.changeCredit(context, instance, {credit: 99999}); + await models.Client.changeCredit(ctx, instance, {credit: 99999}); await tx.rollback(); } catch (e) { diff --git a/modules/client/front/defaulter/index.html b/modules/client/front/defaulter/index.html index 4f662b62b..3ea88088b 100644 --- a/modules/client/front/defaulter/index.html +++ b/modules/client/front/defaulter/index.html @@ -4,7 +4,7 @@ filter="::$ctrl.filter" limit="20" order="amount DESC" - data="defaulters" + data="$ctrl.defaulters" on-data-change="$ctrl.reCheck()" auto-load="true"> @@ -34,7 +34,7 @@
Client + + Es trabajador + Comercial @@ -94,7 +97,7 @@ - + + + + + { const options = {transaction: tx}; try { + await models.TicketRefund.destroyAll(null, options); const result = await models.InvoiceOut.refund(ctx, 'T1111111', withWarehouse, options); expect(result).toBeDefined(); diff --git a/modules/item/back/methods/item/specs/getBalance.spec.js b/modules/item/back/methods/item/specs/getBalance.spec.js index e013d8956..5e5148595 100644 --- a/modules/item/back/methods/item/specs/getBalance.spec.js +++ b/modules/item/back/methods/item/specs/getBalance.spec.js @@ -64,7 +64,7 @@ describe('item getBalance()', () => { const secondItemBalance = await models.Item.getBalance(ctx, secondFilter, options); expect(firstItemBalance[9].claimFk).toEqual(null); - expect(secondItemBalance[5].claimFk).toEqual(2); + expect(secondItemBalance[4].claimFk).toEqual(2); await tx.rollback(); } catch (e) { diff --git a/modules/item/back/methods/item/updateTaxes.js b/modules/item/back/methods/item/updateTaxes.js index 262f4dcb1..ae825ca6e 100644 --- a/modules/item/back/methods/item/updateTaxes.js +++ b/modules/item/back/methods/item/updateTaxes.js @@ -42,8 +42,9 @@ module.exports = Self => { promises.push(Self.app.models.ItemTaxCountry.updateAll( {id: tax.id}, - {taxClassFk: tax.taxClassFk} - ), myOptions); + {taxClassFk: tax.taxClassFk}, + myOptions + )); } await Promise.all(promises); diff --git a/modules/route/back/methods/route/guessPriority.js b/modules/route/back/methods/route/guessPriority.js index 67b68aa89..c6b2a9b74 100644 --- a/modules/route/back/methods/route/guessPriority.js +++ b/modules/route/back/methods/route/guessPriority.js @@ -21,7 +21,6 @@ module.exports = Self => { Self.guessPriority = async(ctx, id) => { const userId = ctx.req.accessToken.userId; - const $t = ctx.req.__; // $translate const query = `CALL vn.routeGuessPriority(?)`; const tx = await Self.beginTransaction({}); @@ -30,16 +29,6 @@ module.exports = Self => { const priority = await Self.rawSql(query, [id], options); - let logRecord = { - originFk: id, - userFk: userId, - action: 'update', - changedModel: 'Route', - description: $t('Sorts whole route') - }; - - await Self.app.models.RouteLog.create(logRecord, options); - await tx.commit(); return priority; } catch (e) { diff --git a/modules/route/back/methods/route/specs/updateVolume.spec.js b/modules/route/back/methods/route/specs/updateVolume.spec.js index fdcc1a6ec..a28dc4627 100644 --- a/modules/route/back/methods/route/specs/updateVolume.spec.js +++ b/modules/route/back/methods/route/specs/updateVolume.spec.js @@ -31,18 +31,6 @@ describe('route updateVolume()', () => { const updatedRoute = await app.models.Route.findById(routeId, null, options); expect(updatedRoute.m3).not.toEqual(route.m3); - - const logs = await app.models.RouteLog.find({ - fields: ['id', 'newInstance'] - }, options); - - const m3Log = logs.filter(log => { - if (log.newInstance) - return log.newInstance.m3 === updatedRoute.m3; - }); - - expect(m3Log.length).toEqual(1); - await tx.rollback(); } catch (e) { await tx.rollback(); diff --git a/modules/route/back/methods/route/updateVolume.js b/modules/route/back/methods/route/updateVolume.js index cdced3882..388364cff 100644 --- a/modules/route/back/methods/route/updateVolume.js +++ b/modules/route/back/methods/route/updateVolume.js @@ -35,24 +35,9 @@ module.exports = Self => { } try { - const originalRoute = await models.Route.findById(id, null, myOptions); - await Self.rawSql(`CALL vn.routeUpdateM3(?)`, [id], myOptions); - const updatedRoute = await models.Route.findById(id, null, myOptions); - - await models.RouteLog.create({ - originFk: id, - userFk: userId, - action: 'update', - changedModel: 'Route', - changedModelId: id, - oldInstance: {m3: originalRoute.m3}, - newInstance: {m3: updatedRoute.m3} - }, myOptions); - if (tx) await tx.commit(); - return updatedRoute; } catch (e) { if (tx) await tx.rollback(); diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 7abcedd90..a8191610a 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -106,7 +106,7 @@ module.exports = Self => { } } - const query = `CALL vn.ticket_recalc(?)`; + const query = `CALL vn.ticket_recalc(?, NULL)`; await Self.rawSql(query, [refundTicket.id], myOptions); if (tx) await tx.commit(); diff --git a/modules/ticket/back/methods/sale/updatePrice.js b/modules/ticket/back/methods/sale/updatePrice.js index 649395da6..62e4ebd42 100644 --- a/modules/ticket/back/methods/sale/updatePrice.js +++ b/modules/ticket/back/methods/sale/updatePrice.js @@ -96,7 +96,7 @@ module.exports = Self => { await sale.updateAttributes({price: newPrice}, myOptions); await Self.rawSql('CALL vn.manaSpellersRequery(?)', [userId], myOptions); - await Self.rawSql('CALL vn.ticket_recalc(?)', [sale.ticketFk], myOptions); + await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [sale.ticketFk], myOptions); const salesPerson = sale.ticket().client().salesPersonUser(); if (salesPerson) { diff --git a/modules/ticket/back/methods/ticket-request/confirm.js b/modules/ticket/back/methods/ticket-request/confirm.js index 2061ca355..9cd7f4d68 100644 --- a/modules/ticket/back/methods/ticket-request/confirm.js +++ b/modules/ticket/back/methods/ticket-request/confirm.js @@ -97,22 +97,6 @@ module.exports = Self => { }); await models.Chat.sendCheckingPresence(ctx, requesterId, message, myOptions); - const logRecord = { - originFk: sale.ticketFk, - userFk: userId, - action: 'update', - changedModel: 'ticketRequest', - newInstance: { - destinationFk: sale.ticketFk, - quantity: sale.quantity, - concept: sale.concept, - itemId: sale.itemFk, - ticketId: sale.ticketFk, - } - }; - - await Self.app.models.TicketLog.create(logRecord, myOptions); - if (tx) await tx.commit(); return sale; diff --git a/modules/ticket/back/methods/ticket/addSale.js b/modules/ticket/back/methods/ticket/addSale.js index 85b0510ae..2cd02a8a4 100644 --- a/modules/ticket/back/methods/ticket/addSale.js +++ b/modules/ticket/back/methods/ticket/addSale.js @@ -85,7 +85,7 @@ module.exports = Self => { }, myOptions); await Self.rawSql('CALL vn.sale_calculateComponent(?, NULL)', [newSale.id], myOptions); - await Self.rawSql('CALL vn.ticket_recalc(?)', [id], myOptions); + await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [id], myOptions); const sale = await models.Sale.findById(newSale.id, { include: { diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index a8b631d7c..48aee36d4 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -242,16 +242,6 @@ module.exports = Self => { const oldProperties = await loggable.translateValues(Self, changes.old); const newProperties = await loggable.translateValues(Self, changes.new); - await models.TicketLog.create({ - originFk: args.id, - userFk: userId, - action: 'update', - changedModel: 'Ticket', - changedModelId: args.id, - oldInstance: oldProperties, - newInstance: newProperties - }, myOptions); - const salesPersonId = originalTicket.client().salesPersonFk; if (salesPersonId) { const origin = ctx.req.headers.origin; diff --git a/modules/ticket/back/methods/ticket/merge.js b/modules/ticket/back/methods/ticket/merge.js index 9a6f859f7..3c0da077f 100644 --- a/modules/ticket/back/methods/ticket/merge.js +++ b/modules/ticket/back/methods/ticket/merge.js @@ -52,22 +52,9 @@ module.exports = Self => { }); if (!ticket.originId || !ticket.destinationId) continue; - const ticketDestinationLogRecord = { - originFk: ticket.destinationId, - userFk: ctx.req.accessToken.userId, - action: 'update', - changedModel: 'Ticket', - changedModelId: ticket.destinationId, - changedModelValue: ticket.destinationId, - oldInstance: {}, - newInstance: {mergedTicket: ticket.originId} - }; - await models.Sale.updateAll({ticketFk: ticket.originId}, {ticketFk: ticket.destinationId}, myOptions); - if (await models.Ticket.setDeleted(ctx, ticket.originId, myOptions)) { - await models.TicketLog.create(ticketDestinationLogRecord, myOptions); + if (await models.Ticket.setDeleted(ctx, ticket.originId, myOptions)) await models.Chat.sendCheckingPresence(ctx, ticket.workerFk, message); - } } if (tx) await tx.commit(); diff --git a/modules/ticket/back/methods/ticket/sendSms.js b/modules/ticket/back/methods/ticket/sendSms.js index 2336ae859..ffc95c6b4 100644 --- a/modules/ticket/back/methods/ticket/sendSms.js +++ b/modules/ticket/back/methods/ticket/sendSms.js @@ -30,54 +30,12 @@ module.exports = Self => { } }); - Self.sendSms = async(ctx, id, destination, message, options) => { + Self.sendSms = async(ctx, id, destination, message) => { const models = Self.app.models; - const myOptions = {}; - let tx; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - const userId = ctx.req.accessToken.userId; - - try { - const sms = await models.Sms.send(ctx, destination, message); - - const newTicketSms = { - ticketFk: id, - smsFk: sms.id - }; - await models.TicketSms.create(newTicketSms); - - const logRecord = { - originFk: id, - userFk: userId, - action: 'insert', - changedModel: 'sms', - newInstance: { - destinationFk: id, - destination: destination, - message: message, - statusCode: sms.statusCode, - status: sms.status - } - }; - - const ticketLog = await models.TicketLog.create(logRecord, myOptions); - - sms.logId = ticketLog.id; - - if (tx) await tx.commit(); - - return sms; - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } + const sms = await models.Sms.send(ctx, destination, message); + await models.TicketSms.create({ + ticketFk: id, + smsFk: sms.id + }); }; }; diff --git a/modules/ticket/back/methods/ticket/specs/merge.spec.js b/modules/ticket/back/methods/ticket/specs/merge.spec.js index 3254e58a8..3be6b8bac 100644 --- a/modules/ticket/back/methods/ticket/specs/merge.spec.js +++ b/modules/ticket/back/methods/ticket/specs/merge.spec.js @@ -43,12 +43,10 @@ describe('ticket merge()', () => { await models.Ticket.merge(ctx, [tickets], options); - const createdTicketLog = await models.TicketLog.find({where: {originFk: tickets.destinationId}}, options); const deletedTicket = await models.Ticket.findOne({where: {id: tickets.originId}}, options); const salesTicketFuture = await models.Sale.find({where: {ticketFk: tickets.destinationId}}, options); const chatNotificationAfterMerge = await models.Chat.find(null, options); - expect(createdTicketLog.length).toEqual(1); expect(deletedTicket.isDeleted).toEqual(true); expect(salesTicketFuture.length).toEqual(2); expect(chatNotificationBeforeMerge.length).toEqual(chatNotificationAfterMerge.length - 2); diff --git a/modules/ticket/back/methods/ticket/specs/sendSms.spec.js b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js index f94b8be2a..3f93198d1 100644 --- a/modules/ticket/back/methods/ticket/specs/sendSms.spec.js +++ b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js @@ -12,19 +12,14 @@ describe('ticket sendSms()', () => { const destination = 222222222; const message = 'this is the message created in a test'; - const sms = await models.Ticket.sendSms(ctx, id, destination, message, options); - - const createdLog = await models.TicketLog.findById(sms.logId, null, options); + await models.Ticket.sendSms(ctx, id, destination, message, options); const filter = { - ticketFk: createdLog.originFk + ticketFk: id }; const ticketSms = await models.TicketSms.findOne(filter, options); - const json = JSON.parse(JSON.stringify(createdLog.newInstance)); - - expect(json.message).toEqual(message); - expect(ticketSms.ticketFk).toEqual(createdLog.originFk); + expect(ticketSms.ticketFk).toEqual(id); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 01ada49d0..0eee50d5f 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -84,13 +84,6 @@ module.exports = Self => { for (const sale of sales) { const originalSale = map.get(sale.id); - const originalSaleData = { // <-- Loopback modifies original instance on save - itemFk: originalSale.itemFk, - quantity: originalSale.quantity, - concept: originalSale.concept, - ticketFk: originalSale.ticketFk - }; - if (sale.quantity == originalSale.quantity) { query = `UPDATE sale SET ticketFk = ? @@ -100,48 +93,6 @@ module.exports = Self => { await transferPartialSale( ticketId, originalSale, sale, myOptions); } - - // Log to original ticket - await models.TicketLog.create({ - originFk: id, - userFk: userId, - action: 'update', - changedModel: 'Sale', - changedModelId: sale.id, - oldInstance: { - item: originalSaleData.itemFk, - quantity: originalSaleData.quantity, - concept: originalSaleData.concept, - ticket: originalSaleData.ticketFk - }, - newInstance: { - item: sale.itemFk, - quantity: sale.quantity, - concept: sale.concept, - ticket: ticketId - } - }, myOptions); - - // Log to destination ticket - await models.TicketLog.create({ - originFk: ticketId, - userFk: userId, - action: 'update', - changedModel: 'Sale', - changedModelId: sale.id, - oldInstance: { - item: originalSaleData.itemFk, - quantity: originalSaleData.quantity, - concept: originalSaleData.concept, - ticket: originalSaleData.ticketFk - }, - newInstance: { - item: sale.itemFk, - quantity: sale.quantity, - concept: sale.concept, - ticket: ticketId - } - }, myOptions); } const isTicketEmpty = await models.Ticket.isEmpty(id, myOptions); diff --git a/modules/ticket/back/methods/ticket/updateDiscount.js b/modules/ticket/back/methods/ticket/updateDiscount.js index 6feeafa1a..e092ee4ed 100644 --- a/modules/ticket/back/methods/ticket/updateDiscount.js +++ b/modules/ticket/back/methods/ticket/updateDiscount.js @@ -147,7 +147,7 @@ module.exports = Self => { await Promise.all(promises); await Self.rawSql('CALL vn.manaSpellersRequery(?)', [userId], myOptions); - await Self.rawSql('CALL vn.ticket_recalc(?)', [id], myOptions); + await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [id], myOptions); const ticket = await models.Ticket.findById(id, { include: { diff --git a/modules/ticket/back/models/ticket.js b/modules/ticket/back/models/ticket.js index c05130552..ea068ef8a 100644 --- a/modules/ticket/back/models/ticket.js +++ b/modules/ticket/back/models/ticket.js @@ -1,30 +1,4 @@ - -const LoopBackContext = require('loopback-context'); - module.exports = Self => { // Methods require('./ticket-methods')(Self); - - Self.observe('before save', async function(ctx) { - const loopBackContext = LoopBackContext.getCurrentContext(); - const httpCtx = loopBackContext.active; - - if (ctx.isNewInstance) return; - - let changes = ctx.data || ctx.instance; - - if (changes.routeFk === null && ctx.currentInstance.routeFk != null) { - let instance = JSON.parse(JSON.stringify(ctx.currentInstance)); - let userId = httpCtx.accessToken.userId; - let logRecord = { - originFk: ctx.currentInstance.routeFk, - userFk: userId, - action: 'delete', - changedModel: 'Route', - oldInstance: {ticket: instance.id}, - newInstance: null - }; - await Self.app.models.RouteLog.create(logRecord); - } - }); }; diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index d6e230ebe..59b8e8953 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -156,7 +156,7 @@ icon="install_mobile" ng-show="$ctrl.totalChecked > 0" ng-click="$ctrl.sendDocuware()" - vn-tooltip="Set as delivered and open delivery note(s)" + vn-tooltip="Set as delivered and send delivery note(s) to the tablet" tooltip-position="left"> { }); Self.cloneWithEntries = async(ctx, id) => { - const userId = ctx.req.accessToken.userId; const conn = Self.dataSource.connector; - const models = Self.app.models; const travel = await Self.findById(id, { fields: [ 'id', @@ -81,18 +79,6 @@ module.exports = Self => { ] }); - const oldProperties = await loggable.translateValues(Self, travel); - const newProperties = await loggable.translateValues(Self, newTravel); - await models.TravelLog.create({ - originFk: newTravel.id, - userFk: userId, - action: 'insert', - changedModel: 'Travel', - changedModelId: newTravel.id, - oldInstance: oldProperties, - newInstance: newProperties - }); - return newTravel.id; }; }; diff --git a/modules/travel/back/methods/travel/deleteThermograph.js b/modules/travel/back/methods/travel/deleteThermograph.js index d22fc8b29..254dc45aa 100644 --- a/modules/travel/back/methods/travel/deleteThermograph.js +++ b/modules/travel/back/methods/travel/deleteThermograph.js @@ -30,24 +30,8 @@ module.exports = Self => { SET travelFk = NULL, dmsFk = NULL WHERE id = ?`, [id], {userId}); - const oldInstance = { - travelFk: travelThermograph.travelFk, - dmsFk: travelThermograph.dmsFk - }; - - await models.TravelLog.create({ - originFk: travelThermograph.travelFk, - userFk: userId, - action: 'delete', - changedModel: 'TravelThermograph', - changedModelId: id, - oldInstance: oldInstance, - newInstance: {} - }); - travelThermograph.travelFk = null; travelThermograph.dmsFk = null; - return travelThermograph; }; }; diff --git a/modules/travel/front/search-panel/index.js b/modules/travel/front/search-panel/index.js index 9cf417da1..089953127 100644 --- a/modules/travel/front/search-panel/index.js +++ b/modules/travel/front/search-panel/index.js @@ -37,6 +37,16 @@ class Controller extends SearchPanel { } applyFilters(param) { + if (typeof this.filter.scopeDays === 'number') { + const shippedFrom = Date.vnNew(); + shippedFrom.setHours(0, 0, 0, 0); + + const shippedTo = new Date(shippedFrom.getTime()); + shippedTo.setDate(shippedTo.getDate() + this.filter.scopeDays); + shippedTo.setHours(23, 59, 59, 999); + Object.assign(this.filter, {shippedFrom, shippedTo}); + } + this.model.applyFilter({}, this.filter) .then(() => { if (param && this.model._orgData.length === 1) diff --git a/modules/travel/front/summary/index.html b/modules/travel/front/summary/index.html index 5d38ed08f..d9dbb0f90 100644 --- a/modules/travel/front/summary/index.html +++ b/modules/travel/front/summary/index.html @@ -92,7 +92,7 @@ {{entry.supplierName}} - {{entry.ref}} + {{entry.reference}} {{entry.hb}} {{entry.freightValue | currency: 'EUR': 2}} {{entry.packageValue | currency: 'EUR': 2}} diff --git a/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js b/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js index 6f794511f..6fe30de91 100644 --- a/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js +++ b/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js @@ -40,7 +40,6 @@ module.exports = Self => { Self.updateWorkerTimeControlMail = async(ctx, options) => { const models = Self.app.models; const args = ctx.args; - const userId = ctx.req.accessToken.userId; const myOptions = {}; @@ -57,9 +56,6 @@ module.exports = Self => { if (!workerTimeControlMail) throw new UserError(`There aren't records for this week`); - const oldState = workerTimeControlMail.state; - const oldReason = workerTimeControlMail.reason; - await workerTimeControlMail.updateAttributes({ state: args.state, reason: args.reason || null @@ -70,22 +66,5 @@ module.exports = Self => { sendedCounter: workerTimeControlMail.sendedCounter + 1 }, myOptions); } - - const logRecord = { - originFk: args.workerId, - userFk: userId, - action: 'update', - changedModel: 'WorkerTimeControlMail', - oldInstance: { - state: oldState, - reason: oldReason - }, - newInstance: { - state: args.state, - reason: args.reason - } - }; - - return models.WorkerLog.create(logRecord, myOptions); }; }; diff --git a/package-lock.json b/package-lock.json index e8176bebf..97a326669 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.26.01", + "version": "23.28.01", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/print/templates/email/auth-code/auth-code.html b/print/templates/email/auth-code/auth-code.html index 06b59c500..0d303682a 100644 --- a/print/templates/email/auth-code/auth-code.html +++ b/print/templates/email/auth-code/auth-code.html @@ -2,18 +2,22 @@

{{ $t('title') }}

-

-

-

+

{{ $t('description') }}

+

+ {{ $t('device') }}: {{ device }} +

+

+ {{$t('ip')}}: {{ ip }} +

-

{{$t('Enter the following code to continue to your account')}}

+

{{ $t('Enter the following code to continue to your account') }}

{{ code }}
-

{{$t('It expires in 5 minutes')}}

+

{{ $t('It expires in 5 minutes') }}

diff --git a/print/templates/email/auth-code/locale/en.yml b/print/templates/email/auth-code/locale/en.yml index b52a73e93..27b493e20 100644 --- a/print/templates/email/auth-code/locale/en.yml +++ b/print/templates/email/auth-code/locale/en.yml @@ -1,7 +1,7 @@ subject: Verification code title: Verification code description: Somebody did request a verification code for login. If you didn't request it, please ignore this email. -device: 'Device: {0}' -ip: 'IP: {0}' +device: 'Device' +ip: 'IP' Enter the following code to continue to your account: Enter the following code to continue to your account It expires in 5 minutes: It expires in 5 minutes diff --git a/print/templates/email/auth-code/locale/es.yml b/print/templates/email/auth-code/locale/es.yml index f49b2511f..463ea95fa 100644 --- a/print/templates/email/auth-code/locale/es.yml +++ b/print/templates/email/auth-code/locale/es.yml @@ -1,7 +1,7 @@ subject: Código de verificación title: Código de verificación description: Alguien ha solicitado un código de verificación para poder iniciar sesión. Si no lo has solicitado tu, ignora este email. -device: 'Dispositivo: {0}' -ip: 'IP: {0}' +device: 'Dispositivo' +ip: 'IP' Enter the following code to continue to your account: Introduce el siguiente código para poder continuar con tu cuenta It expires in 5 minutes: Expira en 5 minutos diff --git a/print/templates/email/auth-code/locale/fr.yml b/print/templates/email/auth-code/locale/fr.yml index 12606fcda..454bb80ae 100644 --- a/print/templates/email/auth-code/locale/fr.yml +++ b/print/templates/email/auth-code/locale/fr.yml @@ -1,7 +1,7 @@ subject: Code de vérification title: Code de vérification description: Quelqu'un a demandé un code de vérification pour se connecter. Si ce n'était pas toi, ignore cet email. -device: 'Appareil: {0}' -ip: 'IP: {0}' +device: 'Appareil' +ip: 'IP' Enter the following code to continue to your account: Entrez le code suivant pour continuer avec votre compte It expires in 5 minutes: Il expire dans 5 minutes. diff --git a/print/templates/email/auth-code/locale/pt.yml b/print/templates/email/auth-code/locale/pt.yml index e73f5e39a..7f9eb85f5 100644 --- a/print/templates/email/auth-code/locale/pt.yml +++ b/print/templates/email/auth-code/locale/pt.yml @@ -1,7 +1,7 @@ subject: Código de verificação title: Código de verificação description: Alguém solicitou um código de verificação para entrar. Se você não fez essa solicitação, ignore este e-mail. -device: 'Dispositivo: {0}' -ip: 'IP: {0}' +device: 'Dispositivo' +ip: 'IP' Enter the following code to continue to your account: Insira o seguinte código para continuar com sua conta. It expires in 5 minutes: Expira em 5 minutos. From 4f616397a2d1c513f5e051872fb7468de28e5978 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 3 Jul 2023 15:05:39 +0200 Subject: [PATCH 084/311] refs #5712 use dmsType readRole --- db/changes/232401/00-workerDocuware.sql | 7 ---- db/changes/232801/00-workerDocuware.sql | 10 +++++ .../{docuware.js => docuwareDownload.js} | 0 .../worker/back/methods/worker-dms/filter.js | 38 +++++++++++-------- modules/worker/back/models/worker-dms.js | 2 +- 5 files changed, 34 insertions(+), 23 deletions(-) delete mode 100644 db/changes/232401/00-workerDocuware.sql create mode 100644 db/changes/232801/00-workerDocuware.sql rename modules/worker/back/methods/worker-dms/{docuware.js => docuwareDownload.js} (100%) diff --git a/db/changes/232401/00-workerDocuware.sql b/db/changes/232401/00-workerDocuware.sql deleted file mode 100644 index c8d4e4f23..000000000 --- a/db/changes/232401/00-workerDocuware.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO `vn`.`docuware` (code, fileCabinetName, `action`, dialogName, findById) - VALUES - ('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO'); - -INSERT INTO `salix`.`url` (appName, environment, url) - VALUES - ('docuware', 'production', 'https://verdnatura.docuware.cloud/DocuWare/Platform/'); diff --git a/db/changes/232801/00-workerDocuware.sql b/db/changes/232801/00-workerDocuware.sql new file mode 100644 index 000000000..2d0ce3c33 --- /dev/null +++ b/db/changes/232801/00-workerDocuware.sql @@ -0,0 +1,10 @@ +ALTER TABLE `vn`.`docuware` ADD dmsTypeFk INT(11) DEFAULT NULL NULL; +ALTER TABLE `vn`.`docuware` ADD CONSTRAINT docuware_FK FOREIGN KEY (dmsTypeFk) REFERENCES `vn`.`dmsType`(id) ON DELETE RESTRICT ON UPDATE CASCADE; +INSERT INTO `vn`.`docuware` (code, fileCabinetName, `action`, dialogName, findById, dmsTypeFk) + VALUES + ('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO', NULL); + +INSERT INTO `salix`.`url` (appName, environment, url) + VALUES + ('docuware', 'production', 'https://verdnatura.docuware.cloud/DocuWare/Platform/'); + diff --git a/modules/worker/back/methods/worker-dms/docuware.js b/modules/worker/back/methods/worker-dms/docuwareDownload.js similarity index 100% rename from modules/worker/back/methods/worker-dms/docuware.js rename to modules/worker/back/methods/worker-dms/docuwareDownload.js diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index 0b89cc883..1343038b7 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -57,23 +57,31 @@ module.exports = Self => { const workerDms = await conn.executeStmt(stmt); // Get docuware info - const worker = await models.Worker.findById(id, {fields: ['fi', 'firstName', 'lastName']}); - const docuwareParse = { - 'Filename': 'dmsFk', - 'Tipo Documento': 'description', - 'Stored on': 'created', - }; - const workerDocuware = await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse); - for (document of workerDocuware) { - const defaultData = { - file: document.dmsFk + '.png', - isDocuware: true, - hardCopyNumber: null, - hasFile: false, - reference: worker.fi + const docuware = await models.Docuware.findOne({ + fields: ['dmsTypeFk'], + where: {code: 'hr', action: 'find'} + }); + const docuwareDmsType = docuware.dmsTypeFk; + if (!(docuwareDmsType && !await models.DmsType.hasReadRole(ctx, docuwareDmsType))) { + const worker = await models.Worker.findById(id, {fields: ['fi', 'firstName', 'lastName']}); + const docuwareParse = { + 'Filename': 'dmsFk', + 'Tipo Documento': 'description', + 'Stored on': 'created', }; + const workerDocuware = + await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse); + for (document of workerDocuware) { + const defaultData = { + file: document.dmsFk + '.png', + isDocuware: true, + hardCopyNumber: null, + hasFile: false, + reference: worker.fi + }; - document = Object.assign(document, defaultData); + document = Object.assign(document, defaultData); + } } return workerDms.concat(workerDocuware); diff --git a/modules/worker/back/models/worker-dms.js b/modules/worker/back/models/worker-dms.js index 1712383b3..6343e902e 100644 --- a/modules/worker/back/models/worker-dms.js +++ b/modules/worker/back/models/worker-dms.js @@ -2,7 +2,7 @@ module.exports = Self => { require('../methods/worker-dms/downloadFile')(Self); require('../methods/worker-dms/removeFile')(Self); require('../methods/worker-dms/filter')(Self); - require('../methods/worker-dms/docuware')(Self); + require('../methods/worker-dms/docuwareDownload')(Self); Self.isMine = async function(ctx, dmsId) { const myUserId = ctx.req.accessToken.userId; From e58d4e5db3451316308d2e2bb196676d0da5ce7e Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 4 Jul 2023 14:42:51 +0200 Subject: [PATCH 085/311] =?UTF-8?q?refs=20#4770=20feat:=20a=C3=B1adida=20s?= =?UTF-8?q?ecci=C3=B3n=20'Troncales'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/232801/00-roadmap.sql | 10 + db/changes/232801/00-roadmapACL.sql | 4 + db/dump/fixtures.sql | 15 +- front/core/styles/icons/salixfont.css | 805 +++++++++--------- front/core/styles/icons/salixfont.eot | Bin 46420 -> 49176 bytes front/core/styles/icons/salixfont.svg | 7 +- front/core/styles/icons/salixfont.ttf | Bin 46248 -> 49004 bytes front/core/styles/icons/salixfont.woff | Bin 46324 -> 49080 bytes modules/client/front/summary/style.scss | 4 +- modules/entry/front/buy/index/style.scss | 9 +- modules/route/back/methods/roadmap/clone.js | 81 ++ modules/route/back/model-config.json | 14 +- .../route/back/models/expedition-truck.json | 43 + modules/route/back/models/roadmap.js | 3 + modules/route/back/models/roadmap.json | 63 ++ modules/route/front/index.js | 1 + .../route/front/roadmap/basic-data/index.html | 98 +++ .../route/front/roadmap/basic-data/index.js | 16 + modules/route/front/roadmap/card/index.html | 5 + modules/route/front/roadmap/card/index.js | 19 + modules/route/front/roadmap/create/index.html | 37 + modules/route/front/roadmap/create/index.js | 23 + modules/route/front/roadmap/create/style.scss | 6 + .../route/front/roadmap/descriptor/index.html | 39 + .../route/front/roadmap/descriptor/index.js | 26 + .../front/roadmap/descriptor/locale/es.yml | 3 + modules/route/front/roadmap/index.js | 9 + modules/route/front/roadmap/index/index.html | 112 +++ modules/route/front/roadmap/index/index.js | 62 ++ .../route/front/roadmap/index/locale/es.yml | 3 + modules/route/front/roadmap/locale/es.yml | 14 + modules/route/front/roadmap/main/index.html | 20 + modules/route/front/roadmap/main/index.js | 61 ++ .../route/front/roadmap/main/locale/es.yml | 1 + .../front/roadmap/search-panel/index.html | 74 ++ .../route/front/roadmap/search-panel/index.js | 7 + modules/route/front/roadmap/stops/index.html | 71 ++ modules/route/front/roadmap/stops/index.js | 39 + .../route/front/roadmap/stops/locale/es.yml | 4 + .../route/front/roadmap/summary/index.html | 113 +++ modules/route/front/roadmap/summary/index.js | 68 ++ .../route/front/roadmap/summary/locale/es.yml | 3 + .../route/front/roadmap/summary/style.scss | 11 + modules/route/front/routes.json | 47 +- modules/shelving/front/descriptor/index.html | 8 +- .../shelving/front/descriptor/locale/es.yml | 3 + modules/worker/front/create/index.html | 2 +- modules/worker/front/create/locale/es.yml | 2 +- 48 files changed, 1643 insertions(+), 422 deletions(-) create mode 100644 db/changes/232801/00-roadmap.sql create mode 100644 db/changes/232801/00-roadmapACL.sql create mode 100644 modules/route/back/methods/roadmap/clone.js create mode 100644 modules/route/back/models/expedition-truck.json create mode 100644 modules/route/back/models/roadmap.js create mode 100644 modules/route/back/models/roadmap.json create mode 100644 modules/route/front/roadmap/basic-data/index.html create mode 100644 modules/route/front/roadmap/basic-data/index.js create mode 100644 modules/route/front/roadmap/card/index.html create mode 100644 modules/route/front/roadmap/card/index.js create mode 100644 modules/route/front/roadmap/create/index.html create mode 100644 modules/route/front/roadmap/create/index.js create mode 100644 modules/route/front/roadmap/create/style.scss create mode 100644 modules/route/front/roadmap/descriptor/index.html create mode 100644 modules/route/front/roadmap/descriptor/index.js create mode 100644 modules/route/front/roadmap/descriptor/locale/es.yml create mode 100644 modules/route/front/roadmap/index.js create mode 100644 modules/route/front/roadmap/index/index.html create mode 100644 modules/route/front/roadmap/index/index.js create mode 100644 modules/route/front/roadmap/index/locale/es.yml create mode 100644 modules/route/front/roadmap/locale/es.yml create mode 100644 modules/route/front/roadmap/main/index.html create mode 100644 modules/route/front/roadmap/main/index.js create mode 100644 modules/route/front/roadmap/main/locale/es.yml create mode 100644 modules/route/front/roadmap/search-panel/index.html create mode 100644 modules/route/front/roadmap/search-panel/index.js create mode 100644 modules/route/front/roadmap/stops/index.html create mode 100644 modules/route/front/roadmap/stops/index.js create mode 100644 modules/route/front/roadmap/stops/locale/es.yml create mode 100644 modules/route/front/roadmap/summary/index.html create mode 100644 modules/route/front/roadmap/summary/index.js create mode 100644 modules/route/front/roadmap/summary/locale/es.yml create mode 100644 modules/route/front/roadmap/summary/style.scss create mode 100644 modules/shelving/front/descriptor/locale/es.yml diff --git a/db/changes/232801/00-roadmap.sql b/db/changes/232801/00-roadmap.sql new file mode 100644 index 000000000..a2835160f --- /dev/null +++ b/db/changes/232801/00-roadmap.sql @@ -0,0 +1,10 @@ +ALTER TABLE `vn`.`roadmap` COMMENT='Troncales diarios que se contratan'; +ALTER TABLE `vn`.`roadmap` ADD price decimal(10,2) NULL; +ALTER TABLE `vn`.`roadmap` ADD driverName varchar(45) NULL; +ALTER TABLE `vn`.`roadmap` ADD name varchar(45) NOT NULL; +ALTER TABLE `vn`.`roadmap` CHANGE name name varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL AFTER id; +ALTER TABLE `vn`.`roadmap` MODIFY COLUMN etd datetime NOT NULL; + +ALTER TABLE `vn`.`expeditionTruck` COMMENT='Distintas paradas que hacen los trocales'; +ALTER TABLE `vn`.`expeditionTruck` DROP FOREIGN KEY expeditionTruck_FK_2; +ALTER TABLE `vn`.`expeditionTruck` ADD CONSTRAINT expeditionTruck_FK_2 FOREIGN KEY (roadmapFk) REFERENCES vn.roadmap(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/changes/232801/00-roadmapACL.sql b/db/changes/232801/00-roadmapACL.sql new file mode 100644 index 000000000..8954ecb27 --- /dev/null +++ b/db/changes/232801/00-roadmapACL.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'employee'), + ('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 208eb2c21..a5cc2ddbe 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2593,7 +2593,7 @@ UPDATE `vn`.`ticket` UPDATE `vn`.`ticket` SET refFk = 'A1111111' - WHERE id = 6; + WHERE id = 6; INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) VALUES @@ -2602,9 +2602,18 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) (3, 6, 5), (4, 7, 1); -INSERT INTO `vn`.`expeditionTruck` (`id`, `eta`, `description`) +INSERT INTO `vn`.`roadmap` (`id`, `name`, `tractorPlate`, `trailerPlate`, `phone`, `supplierFk`, `etd`, `observations`, `userFk`, `price`, `driverName`) VALUES - (1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet'); + (1, 'val-algemesi', 'RE-001', 'PO-001', '111111111', 1, util.VN_NOW(), 'this is test observation', 1, 15, 'Batman'), + (2, 'alg-valencia', 'RE-002', 'PO-002', '111111111', 1, util.VN_NOW(), 'test observation', 1, 20, 'Robin'), + (3, 'alz-algemesi', 'RE-003', 'PO-003', '222222222', 2, DATE_ADD(util.VN_NOW(), INTERVAL 2 DAY), 'observations...', 2, 25, 'Driverman'); + +INSERT INTO `vn`.`expeditionTruck` (`id`, `roadmapFk`, `warehouseFk`, `eta`, `description`, `userFk`) + VALUES + (1, 1, 1, DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY), 'Best truck in fleet', 1), + (2, 1, 2, DATE_ADD(util.VN_NOW(), INTERVAL '1 2' DAY_HOUR), 'Second truck in fleet', 1), + (3, 1, 3, DATE_ADD(util.VN_NOW(), INTERVAL '1 4' DAY_HOUR), 'Third truck in fleet', 1), + (4, 2, 1, DATE_ADD(util.VN_NOW(), INTERVAL 3 DAY), 'Truck red', 1); INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPrint`) VALUES diff --git a/front/core/styles/icons/salixfont.css b/front/core/styles/icons/salixfont.css index 6f9b1fe15..37f489fe2 100644 --- a/front/core/styles/icons/salixfont.css +++ b/front/core/styles/icons/salixfont.css @@ -1,402 +1,411 @@ @font-face { - font-family: 'salixfont'; - src: - url('./salixfont.ttf?wtrl3') format('truetype'), - url('./salixfont.woff?wtrl3') format('woff'), - url('./salixfont.svg?wtrl3#salixfont') format('svg'); - font-weight: normal; - font-style: normal; -} + font-family: 'salixfont'; + src: + url('./salixfont.ttf?wtrl3') format('truetype'), + url('./salixfont.woff?wtrl3') format('woff'), + url('./salixfont.svg?wtrl3#salixfont') format('svg'); + font-weight: normal; + font-style: normal; + } -[class^="icon-"], [class*=" icon-"] { - /* use !important to prevent issues with browser extensions that change fonts */ - font-family: 'salixfont' !important; - speak: none; - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; + [class^="icon-"], [class*=" icon-"] { + /* use !important to prevent issues with browser extensions that change fonts */ + font-family: 'salixfont' !important; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; - /* Better Font Rendering =========== */ - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } -.icon-agency-term:before { - content: "\e950"; -} -.icon-defaulter:before { - content: "\e94b"; -} -.icon-100:before { - content: "\e95a"; -} -.icon-clientUnpaid:before { - content: "\e95b"; -} -.icon-history:before { - content: "\e968"; -} -.icon-Person:before { - content: "\e901"; -} -.icon-accessory:before { - content: "\e90a"; -} -.icon-account:before { - content: "\e92a"; -} -.icon-actions:before { - content: "\e960"; -} -.icon-addperson:before { - content: "\e90e"; -} -.icon-agency:before { - content: "\e938"; -} -.icon-albaran:before { - content: "\e94d"; -} -.icon-anonymous:before { - content: "\e930"; -} -.icon-apps:before { - content: "\e951"; -} -.icon-artificial:before { - content: "\e90b"; -} -.icon-attach:before { - content: "\e92e"; -} -.icon-barcode:before { - content: "\e971"; -} -.icon-basket:before { - content: "\e914"; -} -.icon-basketadd:before { - content: "\e913"; -} -.icon-bin:before { - content: "\e96f"; -} -.icon-botanical:before { - content: "\e972"; -} -.icon-bucket:before { - content: "\e97a"; -} -.icon-buscaman:before { - content: "\e93b"; -} -.icon-buyrequest:before { - content: "\e932"; -} -.icon-calc_volum .path1:before { - content: "\e915"; -} -.icon-calc_volum .path2:before { - content: "\e916"; - margin-left: -1em; -} -.icon-calc_volum .path3:before { - content: "\e917"; - margin-left: -1em; -} -.icon-calc_volum .path4:before { - content: "\e918"; - margin-left: -1em; -} -.icon-calc_volum .path5:before { - content: "\e919"; - margin-left: -1em; -} -.icon-calc_volum .path6:before { - content: "\e91a"; - margin-left: -1em; -} -.icon-calendar:before { - content: "\e93d"; -} -.icon-catalog:before { - content: "\e937"; -} -.icon-claims:before { - content: "\e963"; -} -.icon-client:before { - content: "\e928"; -} -.icon-clone:before { - content: "\e973"; -} -.icon-columnadd:before { - content: "\e954"; -} -.icon-columndelete:before { - content: "\e953"; -} -.icon-components:before { - content: "\e946"; -} -.icon-consignatarios:before { - content: "\e93f"; -} -.icon-control:before { - content: "\e949"; -} -.icon-credit:before { - content: "\e927"; -} -.icon-deletedTicket:before { - content: "\e935"; -} -.icon-deleteline:before { - content: "\e955"; -} -.icon-delivery:before { - content: "\e939"; -} -.icon-deliveryprices:before { - content: "\e91c"; -} -.icon-details:before { - content: "\e961"; -} -.icon-dfiscales:before { - content: "\e984"; -} -.icon-disabled:before { - content: "\e921"; -} -.icon-doc:before { - content: "\e977"; -} -.icon-entry:before { - content: "\e934"; -} -.icon-exit:before { - content: "\e92f"; -} -.icon-eye:before { - content: "\e976"; -} -.icon-fixedPrice:before { - content: "\e90d"; -} -.icon-flower:before { - content: "\e90c"; -} -.icon-frozen:before { - content: "\e900"; -} -.icon-fruit:before { - content: "\e903"; -} -.icon-funeral:before { - content: "\e904"; -} -.icon-greenery:before { - content: "\e907"; -} -.icon-greuge:before { - content: "\e944"; -} -.icon-grid:before { - content: "\e980"; -} -.icon-handmade:before { - content: "\e909"; -} -.icon-handmadeArtificial:before { - content: "\e902"; -} -.icon-headercol:before { - content: "\e958"; -} -.icon-info:before { - content: "\e952"; -} -.icon-inventory:before { - content: "\e92b"; -} -.icon-invoice:before { - content: "\e923"; -} -.icon-invoice-in:before { - content: "\e911"; -} -.icon-invoice-in-create:before { - content: "\e912"; -} -.icon-invoice-out:before { - content: "\e910"; -} -.icon-isTooLittle:before { - content: "\e91b"; -} -.icon-item:before { - content: "\e956"; -} -.icon-languaje:before { - content: "\e926"; -} -.icon-lines:before { - content: "\e942"; -} -.icon-linesprepaired:before { - content: "\e948"; -} -.icon-logout:before { - content: "\e936"; -} -.icon-mana:before { - content: "\e96a"; -} -.icon-mandatory:before { - content: "\e97b"; -} -.icon-net:before { - content: "\e931"; -} -.icon-niche:before { - content: "\e96c"; -} -.icon-no036:before { - content: "\e920"; -} -.icon-noPayMethod:before { - content: "\e905"; -} -.icon-notes:before { - content: "\e941"; -} -.icon-noweb:before { - content: "\e91f"; -} -.icon-onlinepayment:before { - content: "\e91d"; -} -.icon-package:before { - content: "\e978"; -} -.icon-payment:before { - content: "\e97e"; -} -.icon-pbx:before { - content: "\e93c"; -} -.icon-pets:before { - content: "\e947"; -} -.icon-photo:before { - content: "\e924"; -} -.icon-plant:before { - content: "\e908"; -} -.icon-polizon:before { - content: "\e95e"; -} -.icon-preserved:before { - content: "\e906"; -} -.icon-recovery:before { - content: "\e97c"; -} -.icon-regentry:before { - content: "\e964"; -} -.icon-reserva:before { - content: "\e959"; -} -.icon-revision:before { - content: "\e94a"; -} -.icon-risk:before { - content: "\e91e"; -} -.icon-services:before { - content: "\e94c"; -} -.icon-settings:before { - content: "\e979"; -} -.icon-shipment-01:before { - content: "\e929"; -} -.icon-sign:before { - content: "\e95d"; -} -.icon-sms:before { - content: "\e975"; -} -.icon-solclaim:before { - content: "\e95f"; -} -.icon-solunion:before { - content: "\e94e"; -} -.icon-stowaway:before { - content: "\e94f"; -} -.icon-splitline:before { - content: "\e93e"; -} -.icon-splur:before { - content: "\e970"; -} -.icon-supplier:before { - content: "\e925"; -} -.icon-supplierfalse:before { - content: "\e90f"; -} -.icon-tags:before { - content: "\e96d"; -} -.icon-tax:before { - content: "\e940"; -} -.icon-thermometer:before { - content: "\e933"; -} -.icon-ticket:before { - content: "\e96b"; -} -.icon-ticketAdd:before { - content: "\e945"; -} -.icon-traceability:before { - content: "\e962"; -} -.icon-transaction:before { - content: "\e966"; -} -.icon-treatments:before { - content: "\e922"; -} -.icon-unavailable:before { - content: "\e92c"; -} -.icon-volume:before { - content: "\e96e"; -} -.icon-wand:before { - content: "\e93a"; -} -.icon-web:before { - content: "\e982"; -} -.icon-wiki:before { - content: "\e92d"; -} -.icon-worker:before { - content: "\e957"; -} -.icon-zone:before { - content: "\e943"; -} + .icon-trailer:before { + content: "\e967"; + } + .icon-grafana:before { + content: "\e965"; + } + .icon-trolley:before { + content: "\e95c"; + } + .icon-agency-term:before { + content: "\e950"; + } + .icon-defaulter:before { + content: "\e94b"; + } + .icon-100:before { + content: "\e95a"; + } + .icon-clientUnpaid:before { + content: "\e95b"; + } + .icon-history:before { + content: "\e968"; + } + .icon-Person:before { + content: "\e901"; + } + .icon-accessory:before { + content: "\e90a"; + } + .icon-account:before { + content: "\e92a"; + } + .icon-actions:before { + content: "\e960"; + } + .icon-addperson:before { + content: "\e90e"; + } + .icon-agency:before { + content: "\e938"; + } + .icon-albaran:before { + content: "\e94d"; + } + .icon-anonymous:before { + content: "\e930"; + } + .icon-apps:before { + content: "\e951"; + } + .icon-artificial:before { + content: "\e90b"; + } + .icon-attach:before { + content: "\e92e"; + } + .icon-barcode:before { + content: "\e971"; + } + .icon-basket:before { + content: "\e914"; + } + .icon-basketadd:before { + content: "\e913"; + } + .icon-bin:before { + content: "\e96f"; + } + .icon-botanical:before { + content: "\e972"; + } + .icon-bucket:before { + content: "\e97a"; + } + .icon-buscaman:before { + content: "\e93b"; + } + .icon-buyrequest:before { + content: "\e932"; + } + .icon-calc_volum .path1:before { + content: "\e915"; + } + .icon-calc_volum .path2:before { + content: "\e916"; + margin-left: -1em; + } + .icon-calc_volum .path3:before { + content: "\e917"; + margin-left: -1em; + } + .icon-calc_volum .path4:before { + content: "\e918"; + margin-left: -1em; + } + .icon-calc_volum .path5:before { + content: "\e919"; + margin-left: -1em; + } + .icon-calc_volum .path6:before { + content: "\e91a"; + margin-left: -1em; + } + .icon-calendar:before { + content: "\e93d"; + } + .icon-catalog:before { + content: "\e937"; + } + .icon-claims:before { + content: "\e963"; + } + .icon-client:before { + content: "\e928"; + } + .icon-clone:before { + content: "\e973"; + } + .icon-columnadd:before { + content: "\e954"; + } + .icon-columndelete:before { + content: "\e953"; + } + .icon-components:before { + content: "\e946"; + } + .icon-consignatarios:before { + content: "\e93f"; + } + .icon-control:before { + content: "\e949"; + } + .icon-credit:before { + content: "\e927"; + } + .icon-deletedTicket:before { + content: "\e935"; + } + .icon-deleteline:before { + content: "\e955"; + } + .icon-delivery:before { + content: "\e939"; + } + .icon-deliveryprices:before { + content: "\e91c"; + } + .icon-details:before { + content: "\e961"; + } + .icon-dfiscales:before { + content: "\e984"; + } + .icon-disabled:before { + content: "\e921"; + } + .icon-doc:before { + content: "\e977"; + } + .icon-entry:before { + content: "\e934"; + } + .icon-exit:before { + content: "\e92f"; + } + .icon-eye:before { + content: "\e976"; + } + .icon-fixedPrice:before { + content: "\e90d"; + } + .icon-flower:before { + content: "\e90c"; + } + .icon-frozen:before { + content: "\e900"; + } + .icon-fruit:before { + content: "\e903"; + } + .icon-funeral:before { + content: "\e904"; + } + .icon-greenery:before { + content: "\e907"; + } + .icon-greuge:before { + content: "\e944"; + } + .icon-grid:before { + content: "\e980"; + } + .icon-handmade:before { + content: "\e909"; + } + .icon-handmadeArtificial:before { + content: "\e902"; + } + .icon-headercol:before { + content: "\e958"; + } + .icon-info:before { + content: "\e952"; + } + .icon-inventory:before { + content: "\e92b"; + } + .icon-invoice:before { + content: "\e923"; + } + .icon-invoice-in:before { + content: "\e911"; + } + .icon-invoice-in-create:before { + content: "\e912"; + } + .icon-invoice-out:before { + content: "\e910"; + } + .icon-isTooLittle:before { + content: "\e91b"; + } + .icon-item:before { + content: "\e956"; + } + .icon-languaje:before { + content: "\e926"; + } + .icon-lines:before { + content: "\e942"; + } + .icon-linesprepaired:before { + content: "\e948"; + } + .icon-logout:before { + content: "\e936"; + } + .icon-mana:before { + content: "\e96a"; + } + .icon-mandatory:before { + content: "\e97b"; + } + .icon-net:before { + content: "\e931"; + } + .icon-niche:before { + content: "\e96c"; + } + .icon-no036:before { + content: "\e920"; + } + .icon-noPayMethod:before { + content: "\e905"; + } + .icon-notes:before { + content: "\e941"; + } + .icon-noweb:before { + content: "\e91f"; + } + .icon-onlinepayment:before { + content: "\e91d"; + } + .icon-package:before { + content: "\e978"; + } + .icon-payment:before { + content: "\e97e"; + } + .icon-pbx:before { + content: "\e93c"; + } + .icon-pets:before { + content: "\e947"; + } + .icon-photo:before { + content: "\e924"; + } + .icon-plant:before { + content: "\e908"; + } + .icon-polizon:before { + content: "\e95e"; + } + .icon-preserved:before { + content: "\e906"; + } + .icon-recovery:before { + content: "\e97c"; + } + .icon-regentry:before { + content: "\e964"; + } + .icon-reserva:before { + content: "\e959"; + } + .icon-revision:before { + content: "\e94a"; + } + .icon-risk:before { + content: "\e91e"; + } + .icon-services:before { + content: "\e94c"; + } + .icon-settings:before { + content: "\e979"; + } + .icon-shipment-01:before { + content: "\e929"; + } + .icon-sign:before { + content: "\e95d"; + } + .icon-sms:before { + content: "\e975"; + } + .icon-solclaim:before { + content: "\e95f"; + } + .icon-solunion:before { + content: "\e94e"; + } + .icon-stowaway:before { + content: "\e94f"; + } + .icon-splitline:before { + content: "\e93e"; + } + .icon-splur:before { + content: "\e970"; + } + .icon-supplier:before { + content: "\e925"; + } + .icon-supplierfalse:before { + content: "\e90f"; + } + .icon-tags:before { + content: "\e96d"; + } + .icon-tax:before { + content: "\e940"; + } + .icon-thermometer:before { + content: "\e933"; + } + .icon-ticket:before { + content: "\e96b"; + } + .icon-ticketAdd:before { + content: "\e945"; + } + .icon-traceability:before { + content: "\e962"; + } + .icon-transaction:before { + content: "\e966"; + } + .icon-treatments:before { + content: "\e922"; + } + .icon-unavailable:before { + content: "\e92c"; + } + .icon-volume:before { + content: "\e96e"; + } + .icon-wand:before { + content: "\e93a"; + } + .icon-web:before { + content: "\e982"; + } + .icon-wiki:before { + content: "\e92d"; + } + .icon-worker:before { + content: "\e957"; + } + .icon-zone:before { + content: "\e943"; + } diff --git a/front/core/styles/icons/salixfont.eot b/front/core/styles/icons/salixfont.eot index 61a3be8b7a499b5ad3f597168c821e1139893db8..6a158c806f3d7e215af3cca22ba80fed7ad300b4 100644 GIT binary patch delta 3142 zcmZuzU2Ggz6~5>G&Hv2qdUn@d|L?BXPMo+q`{%?>q6oE3D3%&GaSUn;7*djlgoZY% z(gDnF_a^r?Ly4~QooP(>r8A|B$xcW3OxL9EWq z+_`h^Io~<=-0$qWf9K!-iqM1C7(4ss72T80=EetC4nNa>@7^mjjL`^V?CI01Pn^dy zhxe;^+NaMx^@Zo2eR%`#uQ2wD3uhi(Jyrkmk6vPI!|3eWMU$Bg~zY1pvOtzJCOe!!n(?AOmgf8vX)=Y}5r^va))VB%FM zymgR8eSXalM)lOw#4K0&++0n`rd!8i4Vm! zR%H#ghq0-AtvK1Oy;7Mf=f&ZC zd8$&WmkOBOvqv1h`Tm0V`U@}Iykt$pm8q#pJYhM`?J@t|N53a~Ve>4tK6;0(KmM&@ zr%!AKc&>|U{5WE2#&B%yltwja=tP&w*<`Gtkc?5X&)mxpT}n#5`E0yEcN4xHqHfac zBnN0eH9OryG@nVSm(0<0(yS)c=6>o_q0sI3ItS?hB?qa~=pLYhG!2zIWtOmFma4i| z)ptM}q2dUQ5+0fN?R$HH+Rc`^r-P*3>|rzyY4zF}lvWRz;K%BRRLdfR{oR!8CftoQ zt8HAhYNNIjO``*l-MEuD&0nX z3;UR<%>S8(ab)6-o$57EDb`NxY4Q@(3;j`Qp=>1`sfv!Bvx$yf(ruf|K39&Q`+J8j zxJ6&Nx;%W(ierUVakiv96;7_qHx)A;oAX-9c_U?xT`>*tS*<;ElJ>BEnRIg2aOn(iv^?%(ei zhol25tmXlh&orCZNR*4K@JVWH5{xU2;)tj7h4COL+LmiljIX}ql>J~Nibf;k(99rI zE7IYR>*Xz|38R>zk{AhWvsnk5S*)@zg{xKQ*aZh0Xgry0DG@hd5Ea0)OqwN*_UmPD z&_^l5D&p0q;w*{uLy#SR$Sc*&R>O#v(zC)w*&7Oi;V>Kx3otCnicIA|!eO)5%I+)R z#&T39RuNa`o?$Zs{J4;j>y`uK(ZrXEF%*u3>GyOJ1_W8YcCaUsP|O847|Z2r1BK}V z+|3>qC9}bZ3;{uv7CQAMw5#=RKevziHrq=~yvM)FX4nbVXK%2#Kwt-H4J{!fDBZ}; zx?!MZ3k<(SLSPo~glPryAondQO?%f)!f2yIq)WPU1eu-|}^Pej5Pz zIGfzb=1IHTM&r1X_Dq;}!E6%^EU6Vs{j|x9845L$Amp~n;3l=Ew$LM?xE-Z|fM%Jt z_^ou99L23R^xCav=DyuaeIg3eywZ+|DETi<`S?yW7Fiw+35tbl99~H{7N8yF$spiw zJF($VI{=G80Y4lEEu@ygkcXPLaiD~2Z$6JoO4p$jxZ|Yd26NDsU@#DktGtkl!O{xK z8}$}VL|E;(P)rL5XESx$$C>d_k-&!Aclm3k9ygcFoA@Cd!Hzj@lG}p=SQ3^ToE>~E z?uv1Oys_9VI68G3mICKOyn&z4H=${&noHYY;8Kj&azrhtp?*^YeIV6EuEgd` zIMDCP4t+{m<9dMkae0b z!R4{5X;LVBE0HxExRPl~Vq=J`)mMn2fsbUqUu_>g(h{4HjGeX8@l?dRIQ z*XQZ-`uW!{6M1Vl-l#blQ$lE@}ajL SwjW-=A8*DkuU}ffPX7fLBU>&2 delta 408 zcmbQyz22kEC11P|u$Fc^ReZG3%;fng(%&&ZUUSW&<*i>Zu(VbckqdWF2iT*=h9@SE;Hffqmp z^9u5dOBk4eQVd%GNMGC&70Gw?7lGAO)^ewp$z?PbQx;+Hiq>s~gzY25MxS%y>Y2vcLhh&Av=Rots~Gi*auLI?IA_ zbLE0?DH*$|9QpD5HeVUIS-^%o;A}bwVu0w$Z+4k8Hf&be-OM<7^&SOA=FM03$T51j z*0~k9Gr1?ZZ}5=vSm7z)xyFmno5v@_XOgd#?;XDozY4z<{u=%b{^tTL0x|-60!0E# c0#5{Yg$abkge?lY0yLcwh#NNB?YqSY0AsU==>Px# diff --git a/front/core/styles/icons/salixfont.svg b/front/core/styles/icons/salixfont.svg index d6bfd5d74..da5404842 100644 --- a/front/core/styles/icons/salixfont.svg +++ b/front/core/styles/icons/salixfont.svg @@ -98,7 +98,8 @@ - + + @@ -107,7 +108,9 @@ + + @@ -131,4 +134,4 @@ - + \ No newline at end of file diff --git a/front/core/styles/icons/salixfont.ttf b/front/core/styles/icons/salixfont.ttf index 89d3bd57d3429a743fb9421dd39b7ae8a38b38e7..b484f2a6022b2897ea5e4eff21768a430dce4a00 100644 GIT binary patch delta 3124 zcmZ8jU2I%O6`nIQcjo@z-SypFd;Pz=UORE(?%h8(&W|FLl29Twe@;McfrysmA)zUa zsw6_XLMcd86|^#~)Cbytgp`M(D43r%0ufcEsu1LfK9C30CnTf@5K<8jN#L7%ZO6en zJ9mE0ob#PCXTI^(zwtZw`Kwdu$B(@>#~6(<#$Gyg@`ZEw7BIeouYKyw#jpL~)gRx$ z_$p)Xo5q{QZc=eD@Xk0PXY499x2 zwCYJqC8|=*Cu0SLWP*}MOUjt=KUqwNm$!M{iNMXcF_)M_xgKiF_+39S)kdZ zT~F%m9n`Bsp`Q+VyJ;6CyQ$ae@1or_3zdgup0Hz{>Z(y!4?!EF@)(U1KDqbxw!1{# zcE_|?C+W5a=q*AzgKiF`GXN&|(P>DHJTlndO37A2YouN8;@7CR8k^CydH~svdr80D z>-Gi@V$02DE_YI=Zqi_qlS^DFR{=GFl##$(a<2>dCu`@iF)_Y3d(8X&N0AzMUU}_e zIb9E7BNlW_AJOHqIOweP0BF%Vy6um9T6}I?^gTcEKh(bV+q>F1h6hdVH|wyj%7yS5-&%op5xh%kve> zv%={Ub46$u#(d(mu%x$Gl>c$E3a(d+qUmBOZI;}UtuRG`q$^AHD5`mGQCXTuaOvB2 z$#pBPS9Un(>-%94tAvjL2wMsp1Ck_!7G_cjp(Ga^{d|vU^PetgJJiaTmNM2-5f@Bg zjs?idvxJpff;HtUuj*AAp0YC|*?uXkz%I_${LxT_Ixt?fjK;%oET}D%+=9}sl+suR z5a4%}KQ$!Xb?ZtXCb5v;MkWr3MMg~; zOI``N%EHV1S|qVz2?4WGT7lz?L^{yk_?Di_1tEGnvUR~mKR%f5Xo$}vv9JgTl5^Jr zW}2K`KIK@R8k&od%;vfM6NSl0d1~*|VnK6@l%hwfTOW6fLsEeb>qTJYbL}?H5!K>a zSdz*l0Zxz;z7u^^cM&+J5z5pKo#p$m+FjP9+wg7X(|lna5%@UQ-puAnx8KFX@h}gX zxF3PtHXg8~QLbcf%mg7NMiQi;Yvu5hMq6n-ks6uX^v z?!G(7d?F0mU#faJcsh zOjgd4Pz<8Uf^y*{M*Io{PNk_R3eC-TK>`Xtq8)(XL`stbelX@C4ibovjYr`ON82=r zl3SsT96{hh06c<3j&0a*%08~Q9V!aZ$h(yDNIk_yeAo2*TYK{c>mpT2(q!-QPw~;IYisEoaBEamR!+8Ng3#Env1YmT% zGEP&%rf>ZMsdX%Q#I@YA2a7sT&eKOStO$|l8K35URQS|B~7 z@ca)b;Ub(hNmsdZycA3aq z*>}C+%t1-uw|({W^$9w-@Ar>=@Y!GPKd}Gm{(m3%%7MRs?)bq&2k$&ldgA<{ZydgH z_&-Ok9R1AE8%O_gEIjtTV}D)lEx)yVYx!TtFCD*qV&Mz_eDcL7-+#(}Y6<^$Gj@6P J*3WL!{{Z7KRgeGx delta 379 zcmaF!k7>nArU?r56LThIGcYj9FfcI8Nlz>;0MY_L{th6`k)BhTb~uOa6_9^`fnn{6 zjMT&w<++|;85q`Q0OidxfC3zPENg)L1wg(^Ms7*Pw?c_Z}XLbn+0Sx!voHygD`rs!!C2ihRqebni(hm z->tyNyjf$99Al7com+uBlY5f;1`jEZ6`lf~YrOcpd3-{ACizFyx(_b_RgKn?Dx#<>?WIR=g!wA+av^OlUM^unrx!9RYO~oABl}N z)HVo%qzYQlgl&rjZ9}2p4<&}J8iS>wR4Jmx9~NqUh`$6O_(d!Ik+eSVy}QXq9L{^^ zopaB7&U4Ot-sfdL_#3aua3g;lh1q!x(_Vt${91BKmY306OSKz%(AYYfKA_w#@B!H$_Xf;yNKTn zGwgYB>BOlsPeb>%Wij6j_LbpZoP6R@*!}7c@QD~?U)yKdfCU0ZLSozzQP-E=!`qgJ=KlNNGG`sqB)q^(+7Yi*-$4F92TY~_WFqVytfslLFBH%{r_cMZb;JP2~92w{r2h%02fSE7Fz9kR-gfO zZo|Z+o!miv8~eEF%>U8DIVy42PW7AU6ulmMR=gDbLcbG=OIr#@$g*P>Y@!2aRmWyx zz@)?Jf&R`jZrPWvs*K!s)X||X&n426;ndODBFqb;J~5hK)Egz`A4am^detbJDwY~0 zw`415h?8(dsTM_5&n+sci8vF!ZI@g(alNv`7+YHoe|Sp+d~?C1Ex6605yZLXMyWVg zf^mjvGOFBxg$7JzVa$wQumad`N)R&J8@y3}9g_G1vKw34BB@E|#dUm;}RI2$4zXm4y|*JYfL zy&c)QU}GNd+g9hFL1Ez$5Cmhc1Z0|+Svu}WPYun+sAc2yp7Fv&q&&6j5k9Y(B&Fz{ z%BH~sjtNLA&|$3zuxz%~!bYN9T!~jgVUyroDl|ttQ!GscLD|->DKXyqj#Kf2(I^^= zP(!0Zsyb5P2G=WUm~ms6p%R#JY_nMhpLwogAh@e!=-4F(8)zb#YDpe9;Se3b@=BT| zj`AB7Z`emG!z=PtrsK3g`5~x|zrjlyW~<>u3E}CmS@AXm!AKa6g(Wx^q$ATgkZ{E8 zwX_EkxUn3aiB-g;dFI&61RuslL^SzjVjP8|VfH>#!T~4kD+hZb2+dq_gYiPK zK2(}1A>7<9o|p|rW=II8wAgJN#C5f@<@v2Nu&pg*@%Pv_tXb=@HLxyQZ-Kye&@!%s zoS;-QKkJ5pT5T}=DhYvEz!T;wSOB@NQfYQ~ttX5QZisA2Z=N7C)3s(DT(QP|9i8#Z z9U4#CYwnvf+FTltW-YfjTm(X0K7Y16$lmm3rrLdTf7GXHYK(A+PUDU;JX%`?jpesv z-O;ZB03YYd^=zJYdL3LGchjCp^B%Zu;Q~wR)3ATd%0Vb_zd+cMygKIvjKb<|=1JC9V!93~AphKmDA+mzOc18gI}!G+nlRYMhlMa`A~{t}})@l7oUoB*RZ zoRJ1VJD4z5K+;^Pp#T{eW3PE)sI0RnP9OWT}>xNJsXUr`k65NwyE04bLx$5XYuHJIK5N-d^@&vfWvi|Z+ z_rCb4pVH#Y`G1|Zn-g@GGPuV7%Dyl}tRL>>A1IY5Cq6LThIrzaK{FfcH& z0QnqHERdd4nFbW&VPIIh0)!9eu)WGiO-x~6Sic3R#tej&=X!q4015)d-T?V3Ak3l1 zvL++9q=JEAg8)!JP>6})TcJdFPJS{_-6o(IBT$f$Nou3f>sz^r6+nwOivU$AfblG* zvb@CHRG^p%P|-XPjtjr(UXWj00`$X`iGR9H8-NOB7z7xY8F+wRQ+OHuGUa93%Z!)B zFKb@by=-{d^s?pu-~a!Cs(^;RWOx}1lAXMPQHe|Juh<{4-$0F^5D=fdVL#jEw~Rua zo4dQkI5$t7Wx=>vazVJ1jNMd@{CIwwuMFIv0AXNwz}a*VMo;e9WzN{J`N*zj#>w7$ z6d0K|m+X;a^l+_nD{yCWPjcVjA?2~cQ^0eL7oRtePl(SXUn}1`ej$Dpek=Sn{2Tnw m1y}@R1oQ-o1eOGz2<{3K2#X0@6m|t@JR=Y{Y`(Ym79#)x`HcDi diff --git a/modules/client/front/summary/style.scss b/modules/client/front/summary/style.scss index 77fc020ef..7dc1cc928 100644 --- a/modules/client/front/summary/style.scss +++ b/modules/client/front/summary/style.scss @@ -8,7 +8,7 @@ vn-client-summary .summary { } vn-horizontal h4 .grafana:after { - content: 'contact_support'; - font-size: 17px; + font-family: 'salixfont' !important; + content: "\e965"; } } diff --git a/modules/entry/front/buy/index/style.scss b/modules/entry/front/buy/index/style.scss index 04c8d130a..3fad252df 100644 --- a/modules/entry/front/buy/index/style.scss +++ b/modules/entry/front/buy/index/style.scss @@ -3,14 +3,13 @@ vn-entry-buy-index vn-card { max-width: $width-xl; - + .dark-row { background-color: lighten($color-marginal, 10%); } thead tr { - border-left: 1px solid white; - border-right: 1px solid white; + border: 1px solid white;; } tbody tr:nth-child(1), @@ -22,7 +21,7 @@ vn-entry-buy-index vn-card { tbody tr:nth-child(2) { border-bottom: 1px solid $color-spacer; } - + tbody{ border-bottom: 1px solid $color-spacer; } @@ -40,4 +39,4 @@ vn-entry-buy-index vn-card { } } -$color-font-link-medium: lighten($color-font-link, 20%) \ No newline at end of file +$color-font-link-medium: lighten($color-font-link, 20%) diff --git a/modules/route/back/methods/roadmap/clone.js b/modules/route/back/methods/roadmap/clone.js new file mode 100644 index 000000000..456ed823d --- /dev/null +++ b/modules/route/back/methods/roadmap/clone.js @@ -0,0 +1,81 @@ +const UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.remoteMethod('clone', { + description: 'Clones the selected routes', + accessType: 'WRITE', + accepts: [ + { + arg: 'ids', + type: ['number'], + required: true, + description: 'The routes ids to clone' + }, + { + arg: 'etd', + type: 'date', + required: true, + description: 'The estimated time of departure for all roadmaps' + } + ], + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/clone`, + verb: 'POST' + } + }); + + Self.clone = async(ids, etd) => { + const tx = await Self.beginTransaction({}); + try { + const models = Self.app.models; + const options = {transaction: tx}; + const originalRoadmaps = await models.Roadmap.find({ + where: {id: {inq: ids}}, + fields: [ + 'id', + 'name', + 'tractorPlate', + 'trailerPlate', + 'phone', + 'supplierFk', + 'etd', + 'observations', + 'price'], + include: [{ + relation: 'expeditionTruck', + scope: { + fields: ['roadmapFk', 'warehouseFk', 'eta', 'description'] + } + }] + + }, options); + + if (ids.length != originalRoadmaps.length) + throw new UserError(`The amount of roadmaps found don't match`); + + for (const roadmap of originalRoadmaps) { + roadmap.id = undefined; + roadmap.etd = etd; + + const clone = await models.Roadmap.create(roadmap, options); + + const expeditionTrucks = roadmap.expeditionTruck(); + expeditionTrucks.map(expeditionTruck => { + expeditionTruck.roadmapFk = clone.id; + return expeditionTruck; + }); + await models.ExpeditionTruck.create(expeditionTrucks, options); + } + + await tx.commit(); + + return true; + } catch (e) { + await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/route/back/model-config.json b/modules/route/back/model-config.json index 31aaad9f5..6688a243a 100644 --- a/modules/route/back/model-config.json +++ b/modules/route/back/model-config.json @@ -5,18 +5,22 @@ "AgencyTermConfig": { "dataSource": "vn" }, - "Route": { + "DeliveryPoint": { "dataSource": "vn" }, - "Vehicle": { + "ExpeditionTruck": { + "dataSource": "vn" + }, + "Roadmap": { + "dataSource": "vn" + }, + "Route": { "dataSource": "vn" }, "RouteLog": { "dataSource": "vn" }, - "DeliveryPoint": { + "Vehicle": { "dataSource": "vn" } } - - diff --git a/modules/route/back/models/expedition-truck.json b/modules/route/back/models/expedition-truck.json new file mode 100644 index 000000000..8edc7347f --- /dev/null +++ b/modules/route/back/models/expedition-truck.json @@ -0,0 +1,43 @@ +{ + "name": "ExpeditionTruck", + "base": "VnModel", + "options": { + "mysql": { + "table": "expeditionTruck" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "roadmapFk": { + "type": "number" + }, + "warehouseFk": { + "type": "number" + }, + "eta": { + "type": "date" + }, + "description": { + "type": "string" + }, + "userFk": { + "type": "number" + } + }, + "relations": { + "roadmap": { + "type": "belongsTo", + "model": "Roadmap", + "foreignKey": "roadmapFk" + }, + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + } + } +} diff --git a/modules/route/back/models/roadmap.js b/modules/route/back/models/roadmap.js new file mode 100644 index 000000000..4a2a02022 --- /dev/null +++ b/modules/route/back/models/roadmap.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/roadmap/clone')(Self); +}; diff --git a/modules/route/back/models/roadmap.json b/modules/route/back/models/roadmap.json new file mode 100644 index 000000000..7ca8fe0f6 --- /dev/null +++ b/modules/route/back/models/roadmap.json @@ -0,0 +1,63 @@ +{ + "name": "Roadmap", + "base": "VnModel", + "options": { + "mysql": { + "table": "roadmap" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string" + }, + "tractorPlate": { + "type": "string" + }, + "trailerPlate": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "supplierFk": { + "type": "number" + }, + "etd": { + "type": "date" + }, + "observations": { + "type": "string" + }, + "userFk": { + "type": "number" + }, + "price": { + "type": "number" + }, + "driverName": { + "type": "string" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "userFk" + }, + "supplier": { + "type": "belongsTo", + "model": "Supplier", + "foreignKey": "supplierFk" + }, + "expeditionTruck": { + "type": "hasMany", + "model": "ExpeditionTruck", + "foreignKey": "roadmapFk" + } + } +} diff --git a/modules/route/front/index.js b/modules/route/front/index.js index c43048df5..803fc1045 100644 --- a/modules/route/front/index.js +++ b/modules/route/front/index.js @@ -16,3 +16,4 @@ import './agency-term/createInvoiceIn'; import './agency-term-search-panel'; import './ticket-popup'; import './sms'; +import './roadmap'; diff --git a/modules/route/front/roadmap/basic-data/index.html b/modules/route/front/roadmap/basic-data/index.html new file mode 100644 index 000000000..28c67eb47 --- /dev/null +++ b/modules/route/front/roadmap/basic-data/index.html @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + {{::id}} - {{::nickname}} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/route/front/roadmap/basic-data/index.js b/modules/route/front/roadmap/basic-data/index.js new file mode 100644 index 000000000..d5b39b76e --- /dev/null +++ b/modules/route/front/roadmap/basic-data/index.js @@ -0,0 +1,16 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + onSubmit() { + this.$.watcher.submit(); + } +} + +ngModule.component('vnRoadmapBasicData', { + template: require('./index.html'), + controller: Controller, + bindings: { + roadmap: '<' + } +}); diff --git a/modules/route/front/roadmap/card/index.html b/modules/route/front/roadmap/card/index.html new file mode 100644 index 000000000..97ca40f95 --- /dev/null +++ b/modules/route/front/roadmap/card/index.html @@ -0,0 +1,5 @@ + + + + + diff --git a/modules/route/front/roadmap/card/index.js b/modules/route/front/roadmap/card/index.js new file mode 100644 index 000000000..ff2d13616 --- /dev/null +++ b/modules/route/front/roadmap/card/index.js @@ -0,0 +1,19 @@ +import ngModule from '../../module'; +import ModuleCard from 'salix/components/module-card'; + +class Controller extends ModuleCard { + reload() { + const filter = { + include: [ + {relation: 'supplier'} + ] + }; + this.$http.get(`Roadmaps/${this.$params.id}`, {filter}) + .then(res => this.roadmap = res.data); + } +} + +ngModule.vnComponent('vnRoadmapCard', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/route/front/roadmap/create/index.html b/modules/route/front/roadmap/create/index.html new file mode 100644 index 000000000..f5a26566e --- /dev/null +++ b/modules/route/front/roadmap/create/index.html @@ -0,0 +1,37 @@ + + +
+ + + + + + + + + + + + + + + + +
diff --git a/modules/route/front/roadmap/create/index.js b/modules/route/front/roadmap/create/index.js new file mode 100644 index 000000000..7e638da94 --- /dev/null +++ b/modules/route/front/roadmap/create/index.js @@ -0,0 +1,23 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; +import './style.scss'; + +class Controller extends Section { + constructor($element, $, $transclude, vnReport, vnEmail) { + super($element, $, $transclude); + this.roadmap = {etd: Date.vnNew()}; + } + + onSubmit() { + this.$.watcher.submit().then( + res => this.$state.go('route.roadmap.card.summary', {id: res.data.id}) + ); + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnRoadmapCreate', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/route/front/roadmap/create/style.scss b/modules/route/front/roadmap/create/style.scss new file mode 100644 index 000000000..8ee7ecb09 --- /dev/null +++ b/modules/route/front/roadmap/create/style.scss @@ -0,0 +1,6 @@ +vn-ticket-request { + .vn-textfield { + margin: 0!important; + max-width: 100px; + } +} diff --git a/modules/route/front/roadmap/descriptor/index.html b/modules/route/front/roadmap/descriptor/index.html new file mode 100644 index 000000000..92ae8eab1 --- /dev/null +++ b/modules/route/front/roadmap/descriptor/index.html @@ -0,0 +1,39 @@ + + + + Delete roadmap + + + +
+ + + + + + + {{$ctrl.roadmap.supplier.nickname}} + + +
+
+
+ + + + diff --git a/modules/route/front/roadmap/descriptor/index.js b/modules/route/front/roadmap/descriptor/index.js new file mode 100644 index 000000000..2846b073a --- /dev/null +++ b/modules/route/front/roadmap/descriptor/index.js @@ -0,0 +1,26 @@ +import ngModule from '../../module'; +import Descriptor from 'salix/components/descriptor'; + +class Controller extends Descriptor { + get roadmap() { + return this.entity; + } + + set roadmap(value) { + this.entity = value; + } + + onDelete() { + return this.$http.delete(`Roadmaps/${this.roadmap.id}`) + .then(() => this.$state.go('route.roadmap')) + .then(() => this.vnApp.showSuccess(this.$t('Roadmap removed'))); + } +} + +ngModule.component('vnRoadmapDescriptor', { + template: require('./index.html'), + controller: Controller, + bindings: { + roadmap: '<' + } +}); diff --git a/modules/route/front/roadmap/descriptor/locale/es.yml b/modules/route/front/roadmap/descriptor/locale/es.yml new file mode 100644 index 000000000..376209694 --- /dev/null +++ b/modules/route/front/roadmap/descriptor/locale/es.yml @@ -0,0 +1,3 @@ +Delete roadmap: Eliminar troncal +The roadmap will be removed: La troncal será eliminada +Roadmap removed: Troncal eliminada diff --git a/modules/route/front/roadmap/index.js b/modules/route/front/roadmap/index.js new file mode 100644 index 000000000..91b782a9b --- /dev/null +++ b/modules/route/front/roadmap/index.js @@ -0,0 +1,9 @@ +import './main'; +import './index/'; +import './summary'; +import './card'; +import './descriptor'; +import './create'; +import './basic-data'; +import './search-panel'; +import './stops'; diff --git a/modules/route/front/roadmap/index/index.html b/modules/route/front/roadmap/index/index.html new file mode 100644 index 000000000..6f8cbecc4 --- /dev/null +++ b/modules/route/front/roadmap/index/index.html @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + Roadmap + ETD + Carrier + Plate + Price + Observations + + + + + + + + + + {{::roadmap.name}} + {{::roadmap.etd | date:'dd/MM/yyyy HH:mm'}} + + + {{::roadmap.supplier.nickname}} + + + {{::roadmap.tractorPlate | dashIfEmpty}} + {{::roadmap.price | currency: 'EUR':2 | dashIfEmpty}} + {{::roadmap.observations | dashIfEmpty}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/route/front/roadmap/index/index.js b/modules/route/front/roadmap/index/index.js new file mode 100644 index 000000000..3ffc5b4b1 --- /dev/null +++ b/modules/route/front/roadmap/index/index.js @@ -0,0 +1,62 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; + +class Controller extends Section { + get checked() { + const roadmaps = this.$.model.data || []; + const checkedRoadmap = []; + for (let roadmap of roadmaps) { + if (roadmap.checked) + checkedRoadmap.push(roadmap); + } + + return checkedRoadmap; + } + + get totalChecked() { + return this.checked.length; + } + + preview(roadmap) { + this.roadmapSelected = roadmap; + this.$.summary.show(); + } + + openClonationDialog() { + this.$.clonationDialog.show(); + this.etd = Date.vnNew(); + } + + cloneSelectedRoadmaps() { + try { + if (!this.etd) + throw new Error(`The date can't be empty`); + + const roadmapsIds = []; + for (let roadmap of this.checked) + roadmapsIds.push(roadmap.id); + + return this.$http.post('Roadmaps/clone', {ids: roadmapsIds, etd: this.etd}).then(() => { + this.$.model.refresh(); + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + } + } + + deleteRoadmaps() { + console.log(this.checked); + + for (const roadmap of this.checked) { + this.$http.delete(`Roadmaps/${roadmap.id}`) + .then(() => this.$.model.refresh()) + .then(() => this.vnApp.showSuccess(this.$t('Roadmaps removed'))); + } + } +} + +ngModule.vnComponent('vnRoadmapIndex', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/route/front/roadmap/index/locale/es.yml b/modules/route/front/roadmap/index/locale/es.yml new file mode 100644 index 000000000..dd93eac6e --- /dev/null +++ b/modules/route/front/roadmap/index/locale/es.yml @@ -0,0 +1,3 @@ +Delete roadmap(s): Eliminar troncal(es) +Selected roadmaps will be removed: Los troncales seleccionados serán eliminados +Roadmaps removed: Troncales eliminados diff --git a/modules/route/front/roadmap/locale/es.yml b/modules/route/front/roadmap/locale/es.yml new file mode 100644 index 000000000..e136eca31 --- /dev/null +++ b/modules/route/front/roadmap/locale/es.yml @@ -0,0 +1,14 @@ +Roadmaps: Troncales +Roadmap: Troncal +Driver name: Nombre conductor +Plate: Matrícula +Price: Precio +Observations: Observaciones +Clone selected roadmaps: Clonar troncales seleccionadas +Select the estimated time of departure (ETD): Seleccione la hora estimada de salida (ETD) +Create roadmap: Crear troncal +Tractor plate: Matrícula tractor +Trailer plate: Matrícula trailer +Carrier: Transportista +ETD date: Fecha ETD +ETD hour: Hora ETD diff --git a/modules/route/front/roadmap/main/index.html b/modules/route/front/roadmap/main/index.html new file mode 100644 index 000000000..3a8eb2599 --- /dev/null +++ b/modules/route/front/roadmap/main/index.html @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/modules/route/front/roadmap/main/index.js b/modules/route/front/roadmap/main/index.js new file mode 100644 index 000000000..e7b3366f2 --- /dev/null +++ b/modules/route/front/roadmap/main/index.js @@ -0,0 +1,61 @@ +import ngModule from '../../module'; +import ModuleMain from 'salix/components/module-main'; + +export default class Roadmap extends ModuleMain { + constructor($element, $) { + super($element, $); + + this.include = { + relation: 'supplier', + scope: { + fields: ['nickname'] + } + }; + } + + $postLink() { + const from = Date.vnNew(); + from.setHours(0, 0, 0, 0); + + const to = Date.vnNew(); + to.setHours(23, 59, 59, 999); + + this.filterParams = { + from: from, + to: to + }; + + this.$.model.addFilter({where: { + and: [ + {etd: {gte: from}}, + {etd: {lte: to}} + ] + }}); + } + + exprBuilder(param, value) { + switch (param) { + case 'search': + return /^\d+$/.test(value) + ? {id: value} + : {name: {like: `%${value}%`}}; + case 'from': + return {etd: {gte: value}}; + case 'to': + return {etd: {lte: value}}; + case 'supplierFk': + case 'price': + return {[param]: value}; + case 'tractorPlate': + case 'trailerPlate': + case 'phone': + case 'driverName': + return {[param]: {like: `%${value}%`}}; + } + } +} + +ngModule.vnComponent('vnRoadmap', { + controller: Roadmap, + template: require('./index.html') +}); diff --git a/modules/route/front/roadmap/main/locale/es.yml b/modules/route/front/roadmap/main/locale/es.yml new file mode 100644 index 000000000..78342bce8 --- /dev/null +++ b/modules/route/front/roadmap/main/locale/es.yml @@ -0,0 +1 @@ +Search roadmap by id or trunk: Buscar troncales por id o troncal diff --git a/modules/route/front/roadmap/search-panel/index.html b/modules/route/front/roadmap/search-panel/index.html new file mode 100644 index 000000000..53fd37344 --- /dev/null +++ b/modules/route/front/roadmap/search-panel/index.html @@ -0,0 +1,74 @@ +
+
+ + + + +
+ + + + + + +
+ + + + + + + + + + {{::id}} - {{::nickname}} + + + + + + + + + + + + + + +
+
diff --git a/modules/route/front/roadmap/search-panel/index.js b/modules/route/front/roadmap/search-panel/index.js new file mode 100644 index 000000000..499027d14 --- /dev/null +++ b/modules/route/front/roadmap/search-panel/index.js @@ -0,0 +1,7 @@ +import ngModule from '../../module'; +import SearchPanel from 'core/components/searchbar/search-panel'; + +ngModule.component('vnRoadmapSearchPanel', { + template: require('./index.html'), + controller: SearchPanel +}); diff --git a/modules/route/front/roadmap/stops/index.html b/modules/route/front/roadmap/stops/index.html new file mode 100644 index 000000000..b69492a21 --- /dev/null +++ b/modules/route/front/roadmap/stops/index.html @@ -0,0 +1,71 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/modules/route/front/roadmap/stops/index.js b/modules/route/front/roadmap/stops/index.js new file mode 100644 index 000000000..075a1c8a4 --- /dev/null +++ b/modules/route/front/roadmap/stops/index.js @@ -0,0 +1,39 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + add() { + const filter = { + fields: ['etd'] + }; + this.$http.get(`Roadmaps/${this.$params.id}`, {filter}) + .then(res => { + this.roadmap = res.data; + + const eta = new Date(this.roadmap.etd); + eta.setDate(eta.getDate() + 1); + + this.$.model.insert({ + roadmapFk: this.$params.id, + eta: eta + }); + }); + } + + onSubmit() { + this.$.watcher.check(); + this.$.model.save().then(() => { + this.$.watcher.notifySaved(); + this.$.watcher.updateOriginalData(); + this.$.model.refresh(); + }); + } +} + +ngModule.component('vnRoadmapStops', { + template: require('./index.html'), + controller: Controller, + bindings: { + roadmap: '<' + } +}); diff --git a/modules/route/front/roadmap/stops/locale/es.yml b/modules/route/front/roadmap/stops/locale/es.yml new file mode 100644 index 000000000..1db275949 --- /dev/null +++ b/modules/route/front/roadmap/stops/locale/es.yml @@ -0,0 +1,4 @@ +Remove stop: Eliminar parada +Add stop: Añadir parada +ETA date: Fecha ETA +ETA hour: Hora ETA diff --git a/modules/route/front/roadmap/summary/index.html b/modules/route/front/roadmap/summary/index.html new file mode 100644 index 000000000..e6b50601e --- /dev/null +++ b/modules/route/front/roadmap/summary/index.html @@ -0,0 +1,113 @@ + +
+ {{summary.id}} - {{summary.name}} +
+ + + + + {{summary.supplier.nickname}} + + + + + + + + + + + + + + + + + + +

+ + Stops + + + +

+ + + + Wharehouse + ETA + + + + + {{expeditionTruck.warehouse.name}} + {{expeditionTruck.eta | date:'dd/MM/yyyy HH:mm'}} + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/route/front/roadmap/summary/index.js b/modules/route/front/roadmap/summary/index.js new file mode 100644 index 000000000..041b43ce3 --- /dev/null +++ b/modules/route/front/roadmap/summary/index.js @@ -0,0 +1,68 @@ +import ngModule from '../../module'; +import Component from 'core/lib/component'; +import './style.scss'; + +class Controller extends Component { + set roadmap(value) { + this._roadmap = value; + this.$.summary = null; + if (!value) return; + + this.loadData(); + } + + get roadmap() { + return this._roadmap; + } + + loadData() { + const filter = { + include: [ + {relation: 'supplier'}, + {relation: 'worker'}, + {relation: 'expeditionTruck', + scope: { + include: [ + {relation: 'warehouse'} + ] + }} + ] + }; + this.$http.get(`Roadmaps/${this.roadmap.id}`, {filter}) + .then(res => this.$.summary = res.data); + } + + getETD() { + const eta = new Date(this.roadmap.etd); + eta.setDate(eta.getDate() + 1); + + this.expeditionTruck = {eta: eta}; + } + + onAddAccept() { + try { + const data = { + roadmapFk: this.roadmap.id, + warehouseFk: this.expeditionTruck.warehouseFk, + eta: this.expeditionTruck.eta, + description: this.expeditionTruck.description + }; + + this.$http.post(`ExpeditionTrucks`, data) + .then(() => { + this.loadData(); + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + } + } +} + +ngModule.component('vnRoadmapSummary', { + template: require('./index.html'), + controller: Controller, + bindings: { + roadmap: '<' + } +}); diff --git a/modules/route/front/roadmap/summary/locale/es.yml b/modules/route/front/roadmap/summary/locale/es.yml new file mode 100644 index 000000000..f2d82438a --- /dev/null +++ b/modules/route/front/roadmap/summary/locale/es.yml @@ -0,0 +1,3 @@ +Stops: Paradas +Wharehouse: Almacén +You must fill all the fields: Debes rellenar todos los campos diff --git a/modules/route/front/roadmap/summary/style.scss b/modules/route/front/roadmap/summary/style.scss new file mode 100644 index 000000000..8e75d3e0b --- /dev/null +++ b/modules/route/front/roadmap/summary/style.scss @@ -0,0 +1,11 @@ +@import "variables"; + + +vn-roadmap-summary .summary { + a { + display: flex; + align-items: center; + height: 18.328px; + } + +} diff --git a/modules/route/front/routes.json b/modules/route/front/routes.json index 75e1fdc57..3b866581d 100644 --- a/modules/route/front/routes.json +++ b/modules/route/front/routes.json @@ -7,12 +7,17 @@ "menus": { "main": [ {"state": "route.index", "icon": "icon-delivery"}, - {"state": "route.agencyTerm.index", "icon": "icon-agency-term"} + {"state": "route.agencyTerm.index", "icon": "icon-agency-term"}, + {"state": "route.roadmap", "icon": "icon-trailer"} ], "card": [ {"state": "route.card.basicData", "icon": "settings"}, {"state": "route.card.tickets", "icon": "icon-ticket"}, {"state": "route.card.log", "icon": "history"} + ], + "roadmap": [ + {"state": "route.roadmap.card.basicData", "icon": "settings"}, + {"state": "route.roadmap.card.stops", "icon": "icon-lines"} ] }, "routes": [ @@ -90,6 +95,46 @@ "route": "$ctrl.route" }, "acl": ["delivery"] + }, { + "url": "/roadmap?q", + "state": "route.roadmap", + "component": "vn-roadmap", + "description": "Roadmaps" + }, { + "url": "/create", + "state": "route.roadmap.create", + "component": "vn-roadmap-create", + "description": "Create roadmap" + },{ + "url": "/:id", + "state": "route.roadmap.card", + "component": "vn-roadmap-card", + "abstract": true, + "description": "Detail" + },{ + "url": "/summary", + "state": "route.roadmap.card.summary", + "component": "vn-roadmap-summary", + "description": "Summary", + "params": { + "roadmap": "$ctrl.roadmap" + } + },{ + "url": "/basic-data", + "state": "route.roadmap.card.basicData", + "component": "vn-roadmap-basic-data", + "description": "Basic data", + "params": { + "roadmap": "$ctrl.roadmap" + } + }, { + "url": "/stops", + "state": "route.roadmap.card.stops", + "component": "vn-roadmap-stops", + "description": "Stops", + "params": { + "route": "$ctrl.roadmap" + } } ] } diff --git a/modules/shelving/front/descriptor/index.html b/modules/shelving/front/descriptor/index.html index 1344bb52a..53dd37258 100644 --- a/modules/shelving/front/descriptor/index.html +++ b/modules/shelving/front/descriptor/index.html @@ -7,7 +7,7 @@ ng-click="deleteShelving.show()" name="deleteShelving" translate> - Delete + Delete shelving @@ -32,7 +32,7 @@ @@ -40,6 +40,6 @@ - - \ No newline at end of file + diff --git a/modules/shelving/front/descriptor/locale/es.yml b/modules/shelving/front/descriptor/locale/es.yml new file mode 100644 index 000000000..e7fafc320 --- /dev/null +++ b/modules/shelving/front/descriptor/locale/es.yml @@ -0,0 +1,3 @@ +Delete shelving: Eliminar carro +Shelving will be removed: El carro será eliminado +Shelving removed: Carro eliminado diff --git a/modules/worker/front/create/index.html b/modules/worker/front/create/index.html index eb45704a7..481746761 100644 --- a/modules/worker/front/create/index.html +++ b/modules/worker/front/create/index.html @@ -38,7 +38,7 @@ Date: Tue, 4 Jul 2023 15:04:32 +0200 Subject: [PATCH 086/311] refs #4770 feat: add test --- .../back/methods/roadmap/specs/clone.spec.js | 109 ++++++++++++++++++ .../route/front/roadmap/card/index.spec.js | 27 +++++ .../route/front/roadmap/create/index.spec.js | 107 +++++++++++++++++ .../route/front/roadmap/index/index.spec.js | 94 +++++++++++++++ .../route/front/roadmap/main/index.spec.js | 31 +++++ 5 files changed, 368 insertions(+) create mode 100644 modules/route/back/methods/roadmap/specs/clone.spec.js create mode 100644 modules/route/front/roadmap/card/index.spec.js create mode 100644 modules/route/front/roadmap/create/index.spec.js create mode 100644 modules/route/front/roadmap/index/index.spec.js create mode 100644 modules/route/front/roadmap/main/index.spec.js diff --git a/modules/route/back/methods/roadmap/specs/clone.spec.js b/modules/route/back/methods/roadmap/specs/clone.spec.js new file mode 100644 index 000000000..41e696157 --- /dev/null +++ b/modules/route/back/methods/roadmap/specs/clone.spec.js @@ -0,0 +1,109 @@ +const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; + +describe('AgencyTerm filter()', () => { + const authUserId = 9; + const today = Date.vnNew(); + today.setHours(2, 0, 0, 0); + + it('should return all results matching the filter', async() => { + const tx = await models.AgencyTerm.beginTransaction({}); + + try { + const options = {transaction: tx}; + const filter = {}; + const ctx = {req: {accessToken: {userId: authUserId}}}; + + const agencyTerms = await models.AgencyTerm.filter(ctx, filter, options); + const firstAgencyTerm = agencyTerms[0]; + + expect(firstAgencyTerm.routeFk).toEqual(1); + expect(agencyTerms.length).toEqual(5); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return results matching "search" searching by integer', async() => { + let ctx = { + args: { + search: 1, + } + }; + + let result = await app.models.AgencyTerm.filter(ctx); + + expect(result.length).toEqual(1); + expect(result[0].routeFk).toEqual(1); + }); + + it('should return results matching "search" searching by string', async() => { + let ctx = { + args: { + search: 'Plants SL', + } + }; + + let result = await app.models.AgencyTerm.filter(ctx); + + expect(result.length).toEqual(2); + }); + + it('should return results matching "from" and "to"', async() => { + const tx = await models.Buy.beginTransaction({}); + const options = {transaction: tx}; + + try { + const from = Date.vnNew(); + from.setHours(0, 0, 0, 0); + + const to = Date.vnNew(); + to.setHours(23, 59, 59, 999); + + const ctx = { + args: { + from: from, + to: to + } + }; + + const results = await models.AgencyTerm.filter(ctx, options); + + expect(results.length).toBe(5); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return results matching "agencyModeFk"', async() => { + let ctx = { + args: { + agencyModeFk: 1, + } + }; + + let result = await app.models.AgencyTerm.filter(ctx); + + expect(result.length).toEqual(1); + expect(result[0].routeFk).toEqual(1); + }); + + it('should return results matching "agencyFk"', async() => { + let ctx = { + args: { + agencyFk: 2, + } + }; + + let result = await app.models.AgencyTerm.filter(ctx); + + expect(result.length).toEqual(1); + expect(result[0].routeFk).toEqual(2); + }); +}); diff --git a/modules/route/front/roadmap/card/index.spec.js b/modules/route/front/roadmap/card/index.spec.js new file mode 100644 index 000000000..ab2314bb9 --- /dev/null +++ b/modules/route/front/roadmap/card/index.spec.js @@ -0,0 +1,27 @@ +import './index'; + +describe('component vnItemTypeCard', () => { + let controller; + let $httpBackend; + + beforeEach(ngModule('item')); + + beforeEach(inject(($componentController, _$httpBackend_) => { + $httpBackend = _$httpBackend_; + controller = $componentController('vnItemTypeCard', {$element: null}); + })); + + describe('reload()', () => { + it('should reload the controller data', () => { + controller.$params.id = 1; + + const itemType = {id: 1}; + + $httpBackend.expectGET('ItemTypes/1').respond(itemType); + controller.reload(); + $httpBackend.flush(); + + expect(controller.itemType).toEqual(itemType); + }); + }); +}); diff --git a/modules/route/front/roadmap/create/index.spec.js b/modules/route/front/roadmap/create/index.spec.js new file mode 100644 index 000000000..d6d9883a7 --- /dev/null +++ b/modules/route/front/roadmap/create/index.spec.js @@ -0,0 +1,107 @@ +import './index'; +import watcher from 'core/mocks/watcher.js'; + +describe('AgencyTerm', () => { + describe('Component vnAgencyTermCreateInvoiceIn', () => { + let controller; + let $scope; + let $httpBackend; + let $httpParamSerializer; + + beforeEach(ngModule('route')); + + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + $scope = $rootScope.$new(); + $httpBackend = _$httpBackend_; + $httpParamSerializer = _$httpParamSerializer_; + const $element = angular.element(''); + controller = $componentController('vnAgencyTermCreateInvoiceIn', {$element}); + controller._route = { + id: 1 + }; + })); + + describe('$onChanges()', () => { + it('should update the params data when $params.q is defined', () => { + controller.$params = {q: '{"supplierName": "Plants SL","rows": null}'}; + + const params = {q: '{"supplierName": "Plants SL", "rows": null}'}; + const json = JSON.parse(params.q); + + controller.$onChanges(); + + expect(controller.params).toEqual(json); + }); + }); + + describe('route() setter', () => { + it('should set the ticket data and then call setDefaultParams() and getAllowedContentTypes()', () => { + jest.spyOn(controller, 'setDefaultParams'); + jest.spyOn(controller, 'getAllowedContentTypes'); + controller.route = { + id: 1 + }; + + expect(controller.route).toBeDefined(); + expect(controller.setDefaultParams).toHaveBeenCalledWith(); + expect(controller.getAllowedContentTypes).toHaveBeenCalledWith(); + }); + }); + + describe('getAllowedContentTypes()', () => { + it('should make an HTTP GET request to get the allowed content types', () => { + const expectedResponse = ['image/png', 'image/jpg']; + $httpBackend.expect('GET', `DmsContainers/allowedContentTypes`).respond(expectedResponse); + controller.getAllowedContentTypes(); + $httpBackend.flush(); + + expect(controller.allowedContentTypes).toBeDefined(); + expect(controller.allowedContentTypes).toEqual('image/png, image/jpg'); + }); + }); + + describe('setDefaultParams()', () => { + it('should perform a GET query and define the dms property on controller', () => { + const params = {filter: { + where: {code: 'invoiceIn'} + }}; + const serializedParams = $httpParamSerializer(params); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 1, code: 'invoiceIn'}); + controller.params = {supplierName: 'Plants SL'}; + controller.setDefaultParams(); + $httpBackend.flush(); + + expect(controller.dms).toBeDefined(); + expect(controller.dms.dmsTypeId).toEqual(1); + }); + }); + + describe('onSubmit()', () => { + it('should make an HTTP POST request to save the form data', () => { + controller.$.watcher = watcher; + + jest.spyOn(controller.$.watcher, 'updateOriginalData'); + const files = [{id: 1, name: 'MyFile'}]; + controller.dms = {files}; + const serializedParams = $httpParamSerializer(controller.dms); + const query = `dms/uploadFile?${serializedParams}`; + controller.params = {rows: null}; + + $httpBackend.expect('POST', query).respond({}); + $httpBackend.expect('POST', 'AgencyTerms/createInvoiceIn').respond({}); + controller.onSubmit(); + $httpBackend.flush(); + }); + }); + + describe('onFileChange()', () => { + it('should set dms hasFileAttached property to true if has any files', () => { + const files = [{id: 1, name: 'MyFile'}]; + controller.onFileChange(files); + $scope.$apply(); + + expect(controller.dms.hasFileAttached).toBeTruthy(); + }); + }); + }); +}); diff --git a/modules/route/front/roadmap/index/index.spec.js b/modules/route/front/roadmap/index/index.spec.js new file mode 100644 index 000000000..55c40daa5 --- /dev/null +++ b/modules/route/front/roadmap/index/index.spec.js @@ -0,0 +1,94 @@ +import './index.js'; +import crudModel from 'core/mocks/crud-model'; + +describe('AgencyTerm', () => { + describe('Component vnAgencyTermIndex', () => { + let controller; + let $window; + + beforeEach(ngModule('route')); + + beforeEach(inject(($componentController, _$window_) => { + $window = _$window_; + const $element = angular.element(''); + controller = $componentController('vnAgencyTermIndex', {$element}); + controller.$.model = crudModel; + controller.$.model.data = [ + {supplierFk: 1, totalPrice: null}, + {supplierFk: 1}, + {supplierFk: 2} + ]; + })); + + describe('checked() getter', () => { + it('should return the checked lines', () => { + const data = controller.$.model.data; + data[0].checked = true; + + const checkedRows = controller.checked; + + const firstCheckedRow = checkedRows[0]; + + expect(firstCheckedRow.supplierFk).toEqual(1); + }); + }); + + describe('totalCheked() getter', () => { + it('should return the total checked lines', () => { + const data = controller.$.model.data; + data[0].checked = true; + + const checkedRows = controller.totalChecked; + + expect(checkedRows).toEqual(1); + }); + }); + + describe('preview()', () => { + it('should show the summary dialog', () => { + controller.$.summary = {show: () => {}}; + jest.spyOn(controller.$.summary, 'show'); + + let event = new MouseEvent('click', { + view: $window, + bubbles: true, + cancelable: true + }); + const route = {id: 1}; + + controller.preview(event, route); + + expect(controller.$.summary.show).toHaveBeenCalledWith(); + }); + }); + + describe('createInvoiceIn()', () => { + it('should throw an error if more than one autonomous are checked', () => { + jest.spyOn(controller.vnApp, 'showError'); + const data = controller.$.model.data; + data[0].checked = true; + data[2].checked = true; + + controller.createInvoiceIn(); + + expect(controller.vnApp.showError).toHaveBeenCalled(); + }); + + it('should call the function go() on $state to go to the file management', () => { + jest.spyOn(controller.$state, 'go'); + const data = controller.$.model.data; + data[0].checked = true; + + controller.createInvoiceIn(); + + delete data[0].checked; + const params = JSON.stringify({ + supplierName: data[0].supplierName, + rows: [data[0]] + }); + + expect(controller.$state.go).toHaveBeenCalledWith('route.agencyTerm.createInvoiceIn', {q: params}); + }); + }); + }); +}); diff --git a/modules/route/front/roadmap/main/index.spec.js b/modules/route/front/roadmap/main/index.spec.js new file mode 100644 index 000000000..dcb14ec0e --- /dev/null +++ b/modules/route/front/roadmap/main/index.spec.js @@ -0,0 +1,31 @@ +import './index'; + +describe('Item', () => { + describe('Component vnItemType', () => { + let controller; + + beforeEach(ngModule('item')); + + beforeEach(inject($componentController => { + const $element = angular.element(''); + controller = $componentController('vnItemType', {$element}); + })); + + describe('exprBuilder()', () => { + it('should return a filter based on a search by id', () => { + const filter = controller.exprBuilder('search', '123'); + + expect(filter).toEqual({id: '123'}); + }); + + it('should return a filter based on a search by name or code', () => { + const filter = controller.exprBuilder('search', 'Alstroemeria'); + + expect(filter).toEqual({or: [ + {name: {like: '%Alstroemeria%'}}, + {code: {like: '%Alstroemeria%'}}, + ]}); + }); + }); + }); +}); From 1a18ba66a940959bdae82335289ccd1a39a1fac8 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 4 Jul 2023 15:18:57 +0200 Subject: [PATCH 087/311] refs #5712 fix(workerDms): filter --- back/models/docuware.json | 7 +++++++ modules/worker/back/methods/worker-dms/filter.js | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/back/models/docuware.json b/back/models/docuware.json index dec20eede..b1a6a8bce 100644 --- a/back/models/docuware.json +++ b/back/models/docuware.json @@ -28,5 +28,12 @@ "findById": { "type": "string" } + }, + "relations": { + "dmsType": { + "type": "belongsTo", + "model": "DmsType", + "foreignKey": "dmsTypeFk" + } } } diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index 1343038b7..e19010988 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -62,22 +62,25 @@ module.exports = Self => { where: {code: 'hr', action: 'find'} }); const docuwareDmsType = docuware.dmsTypeFk; + let workerDocuware; if (!(docuwareDmsType && !await models.DmsType.hasReadRole(ctx, docuwareDmsType))) { const worker = await models.Worker.findById(id, {fields: ['fi', 'firstName', 'lastName']}); const docuwareParse = { 'Filename': 'dmsFk', 'Tipo Documento': 'description', 'Stored on': 'created', + 'Document ID': 'id' }; - const workerDocuware = + workerDocuware = await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse); for (document of workerDocuware) { const defaultData = { - file: document.dmsFk + '.png', + file: 'dw' + document.id + '.png', isDocuware: true, hardCopyNumber: null, hasFile: false, - reference: worker.fi + reference: worker.fi, + dmsFk: 'DW' + document.id }; document = Object.assign(document, defaultData); From 444b08c566c18e0b716b38ff4f6f45b76116f921 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 5 Jul 2023 12:09:52 +0200 Subject: [PATCH 088/311] refs #5712 test(docuware) --- back/methods/docuware/checkFile.js | 15 +- back/methods/docuware/core.js | 18 ++- back/methods/docuware/specs/checkFile.spec.js | 74 ++-------- back/methods/docuware/specs/core.spec.js | 135 ++++++++++++++++++ back/methods/docuware/specs/download.spec.js | 2 +- db/changes/232801/00-workerDocuware.sql | 2 +- .../back/methods/ticket/docuwareDownload.js | 6 +- .../methods/worker-dms/docuwareDownload.js | 6 +- .../worker/back/methods/worker-dms/filter.js | 5 +- 9 files changed, 176 insertions(+), 87 deletions(-) create mode 100644 back/methods/docuware/specs/core.spec.js diff --git a/back/methods/docuware/checkFile.js b/back/methods/docuware/checkFile.js index 18d169085..19224057c 100644 --- a/back/methods/docuware/checkFile.js +++ b/back/methods/docuware/checkFile.js @@ -1,5 +1,3 @@ -const axios = require('axios'); - module.exports = Self => { Self.remoteMethod('checkFile', { description: 'Check if exist docuware file', @@ -73,17 +71,8 @@ module.exports = Self => { } try { - const options = await Self.getOptions(); - - const fileCabinetId = await Self.getFileCabinet(fileCabinet); - const dialogId = await Self.getDialog(fileCabinet, action, fileCabinetId); - - const response = await axios.post( - `${options.url}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, - filter, - options.headers - ); - const [documents] = response.data.Items; + const response = await Self.get(fileCabinet, filter); + const [documents] = response.Items; if (!documents) return false; return {id: documents.Id}; diff --git a/back/methods/docuware/core.js b/back/methods/docuware/core.js index 7bb3e617a..74d922236 100644 --- a/back/methods/docuware/core.js +++ b/back/methods/docuware/core.js @@ -32,10 +32,13 @@ module.exports = Self => { * @return {number} - The fileCabinet id */ Self.getDialog = async(code, action, fileCabinetId) => { + if (!process.env.NODE_ENV) + return Math.floor(Math.random() + 100); + const docuwareInfo = await Self.app.models.Docuware.findOne({ where: { - code: code, - action: action + code, + action } }); if (!fileCabinetId) fileCabinetId = await Self.getFileCabinet(code); @@ -56,10 +59,13 @@ module.exports = Self => { * @return {number} - The fileCabinet id */ Self.getFileCabinet = async code => { + if (!process.env.NODE_ENV) + return Math.floor(Math.random() + 100); + const options = await Self.getOptions(); const docuwareInfo = await Self.app.models.Docuware.findOne({ where: { - code: code + code } }); @@ -79,6 +85,8 @@ module.exports = Self => { * @return {object} - The data */ Self.get = async(code, filter, parse) => { + if (!process.env.NODE_ENV) return; + const options = await Self.getOptions(); const fileCabinetId = await Self.getFileCabinet(code); const dialogId = await Self.getDialog(code, 'find', fileCabinetId); @@ -100,10 +108,12 @@ module.exports = Self => { * @return {object} - The data */ Self.getById = async(code, id, parse) => { + if (!process.env.NODE_ENV) return; + const docuwareInfo = await Self.app.models.Docuware.findOne({ fields: ['findById'], where: { - code: code, + code, action: 'find' } }); diff --git a/back/methods/docuware/specs/checkFile.spec.js b/back/methods/docuware/specs/checkFile.spec.js index dd11951cc..8460bb561 100644 --- a/back/methods/docuware/specs/checkFile.spec.js +++ b/back/methods/docuware/specs/checkFile.spec.js @@ -1,57 +1,15 @@ const models = require('vn-loopback/server/server').models; -const axios = require('axios'); describe('docuware download()', () => { const ticketId = 1; - const userId = 9; - const ctx = { - req: { - - accessToken: {userId: userId}, - headers: {origin: 'http://localhost:5000'}, - } - }; const docuwareModel = models.Docuware; const fileCabinetName = 'deliveryNote'; - beforeAll(() => { - spyOn(docuwareModel, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random())))); - spyOn(docuwareModel, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random())))); - }); - it('should return false if there are no documents', async() => { - const response = { - data: { - Items: [] - } - }; - spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(response))); + spyOn(docuwareModel, 'get').and.returnValue((new Promise(resolve => resolve({Items: []})))); - const result = await models.Docuware.checkFile(ctx, ticketId, fileCabinetName, true); - - expect(result).toEqual(false); - }); - - it('should return false if the document is unsigned', async() => { - const response = { - data: { - Items: [ - { - Id: 1, - Fields: [ - { - FieldName: 'ESTADO', - Item: 'Unsigned' - } - ] - } - ] - } - }; - spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(response))); - - const result = await models.Docuware.checkFile(ctx, ticketId, fileCabinetName, true); + const result = await models.Docuware.checkFile(ticketId, fileCabinetName, null, true); expect(result).toEqual(false); }); @@ -59,23 +17,21 @@ describe('docuware download()', () => { it('should return the document data', async() => { const docuwareId = 1; const response = { - data: { - Items: [ - { - Id: docuwareId, - Fields: [ - { - FieldName: 'ESTADO', - Item: 'Firmado' - } - ] - } - ] - } + Items: [ + { + Id: docuwareId, + Fields: [ + { + FieldName: 'ESTADO', + Item: 'Firmado' + } + ] + } + ] }; - spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(response))); + spyOn(docuwareModel, 'get').and.returnValue((new Promise(resolve => resolve(response)))); - const result = await models.Docuware.checkFile(ctx, ticketId, fileCabinetName, true); + const result = await models.Docuware.checkFile(ticketId, fileCabinetName, null, true); expect(result.id).toEqual(docuwareId); }); diff --git a/back/methods/docuware/specs/core.spec.js b/back/methods/docuware/specs/core.spec.js new file mode 100644 index 000000000..cdf8a3b62 --- /dev/null +++ b/back/methods/docuware/specs/core.spec.js @@ -0,0 +1,135 @@ +const axios = require('axios'); +const models = require('vn-loopback/server/server').models; + +describe('Docuware core', () => { + beforeAll(() => { + process.env.NODE_ENV = 'testing'; + }); + + afterAll(() => { + delete process.env.NODE_ENV; + }); + + describe('getOptions()', () => { + it('should return url and headers', async() => { + const result = await models.Docuware.getOptions(); + + expect(result.url).toBeDefined(); + expect(result.headers).toBeDefined(); + }); + }); + + describe('getDialog()', () => { + it('should return dialogId', async() => { + const dialogs = { + data: { + Dialog: [ + { + DisplayName: 'find', + Id: 'getDialogTest' + } + ] + } + }; + spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs))); + const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId'); + + expect(result).toEqual('getDialogTest'); + }); + }); + + describe('getFileCabinet()', () => { + it('should return fileCabinetId', async() => { + const code = 'deliveryNote'; + const docuwareInfo = await models.Docuware.findOne({ + where: { + code + } + }); + const dialogs = { + data: { + FileCabinet: [ + { + Name: docuwareInfo.fileCabinetName, + Id: 'getFileCabinetTest' + } + ] + } + }; + spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs))); + const result = await models.Docuware.getFileCabinet(code); + + expect(result).toEqual('getFileCabinetTest'); + }); + }); + + describe('get()', () => { + it('should return data without parse', async() => { + spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random())))); + spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random())))); + const data = { + data: { + id: 1 + } + }; + spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data))); + const result = await models.Docuware.get('deliveryNote'); + + expect(result.id).toEqual(1); + }); + + it('should return data with parse', async() => { + spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random())))); + spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random())))); + const data = { + data: { + Items: [{ + Fields: [ + { + ItemElementName: 'integer', + FieldLabel: 'firstRequiredField', + Item: 1 + }, + { + ItemElementName: 'string', + FieldLabel: 'secondRequiredField', + Item: 'myName' + }, + { + ItemElementName: 'integer', + FieldLabel: 'notRequiredField', + Item: 2 + } + ] + }] + } + }; + const parse = { + 'firstRequiredField': 'id', + 'secondRequiredField': 'name', + }; + spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data))); + const [result] = await models.Docuware.get('deliveryNote', null, parse); + + expect(result.id).toEqual(1); + expect(result.name).toEqual('myName'); + expect(result.notRequiredField).not.toBeDefined(); + }); + }); + + describe('getById()', () => { + it('should return data', async() => { + spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random())))); + spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random())))); + const data = { + data: { + id: 1 + } + }; + spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data))); + const result = await models.Docuware.getById('deliveryNote', 1); + + expect(result.id).toEqual(1); + }); + }); +}); diff --git a/back/methods/docuware/specs/download.spec.js b/back/methods/docuware/specs/download.spec.js index fcc1671a6..bc580a079 100644 --- a/back/methods/docuware/specs/download.spec.js +++ b/back/methods/docuware/specs/download.spec.js @@ -39,7 +39,7 @@ describe('docuware download()', () => { spyOn(docuwareModel, 'checkFile').and.returnValue({}); spyOn(axios, 'get').and.returnValue(new stream.PassThrough({objectMode: true})); - const result = await models.Docuware.download(ctx, ticketId, fileCabinetName); + const result = await models.Docuware.download(ticketId, fileCabinetName); expect(result[1]).toEqual('application/pdf'); expect(result[2]).toEqual(`filename="${ticketId}.pdf"`); diff --git a/db/changes/232801/00-workerDocuware.sql b/db/changes/232801/00-workerDocuware.sql index 2d0ce3c33..2f2c4a1cd 100644 --- a/db/changes/232801/00-workerDocuware.sql +++ b/db/changes/232801/00-workerDocuware.sql @@ -2,7 +2,7 @@ ALTER TABLE `vn`.`docuware` ADD dmsTypeFk INT(11) DEFAULT NULL NULL; ALTER TABLE `vn`.`docuware` ADD CONSTRAINT docuware_FK FOREIGN KEY (dmsTypeFk) REFERENCES `vn`.`dmsType`(id) ON DELETE RESTRICT ON UPDATE CASCADE; INSERT INTO `vn`.`docuware` (code, fileCabinetName, `action`, dialogName, findById, dmsTypeFk) VALUES - ('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO', NULL); + ('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO', NULL); -- set dmsTypeFk 3 when deploy in production INSERT INTO `salix`.`url` (appName, environment, url) VALUES diff --git a/modules/ticket/back/methods/ticket/docuwareDownload.js b/modules/ticket/back/methods/ticket/docuwareDownload.js index bc74e0d21..e9b74b1a9 100644 --- a/modules/ticket/back/methods/ticket/docuwareDownload.js +++ b/modules/ticket/back/methods/ticket/docuwareDownload.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethodCtx('docuwareDownload', { + Self.remoteMethod('docuwareDownload', { description: 'Download a ticket delivery note document', accessType: 'READ', accepts: [ @@ -31,7 +31,7 @@ module.exports = Self => { } }); - Self.docuwareDownload = async function(ctx, id) { + Self.docuwareDownload = async id => { const filter = { condition: [ { @@ -50,6 +50,6 @@ module.exports = Self => { } ] }; - return await Self.app.models.Docuware.download(id, 'deliveryNote', filter); + return Self.app.models.Docuware.download(id, 'deliveryNote', filter); }; }; diff --git a/modules/worker/back/methods/worker-dms/docuwareDownload.js b/modules/worker/back/methods/worker-dms/docuwareDownload.js index 764b7633c..c64c159ed 100644 --- a/modules/worker/back/methods/worker-dms/docuwareDownload.js +++ b/modules/worker/back/methods/worker-dms/docuwareDownload.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethodCtx('docuwareDownload', { + Self.remoteMethod('docuwareDownload', { description: 'Download a worker document', accessType: 'READ', accepts: [ @@ -31,7 +31,7 @@ module.exports = Self => { } }); - Self.docuwareDownload = async function(ctx, id) { + Self.docuwareDownload = async id => { const filter = { condition: [ { @@ -40,6 +40,6 @@ module.exports = Self => { } ] }; - return await Self.app.models.Docuware.download(id, 'hr', filter); + return Self.app.models.Docuware.download(id, 'hr', filter); }; }; diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index e19010988..55db68d5d 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -62,8 +62,8 @@ module.exports = Self => { where: {code: 'hr', action: 'find'} }); const docuwareDmsType = docuware.dmsTypeFk; - let workerDocuware; - if (!(docuwareDmsType && !await models.DmsType.hasReadRole(ctx, docuwareDmsType))) { + let workerDocuware = []; + if (!docuwareDmsType || (docuwareDmsType && await models.DmsType.hasReadRole(ctx, docuwareDmsType))) { const worker = await models.Worker.findById(id, {fields: ['fi', 'firstName', 'lastName']}); const docuwareParse = { 'Filename': 'dmsFk', @@ -86,7 +86,6 @@ module.exports = Self => { document = Object.assign(document, defaultData); } } - return workerDms.concat(workerDocuware); }; }; From 5d933da28af0c03b33095375748664c9424b7612 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 5 Jul 2023 12:14:26 +0200 Subject: [PATCH 089/311] refs #5712 fix empty data --- modules/worker/back/methods/worker-dms/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index 55db68d5d..5f55f1bd7 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -72,7 +72,7 @@ module.exports = Self => { 'Document ID': 'id' }; workerDocuware = - await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse); + await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse) ?? []; for (document of workerDocuware) { const defaultData = { file: 'dw' + document.id + '.png', From 6530e87508b0ea3040fe551346db1667a8dc2776 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 5 Jul 2023 15:20:51 +0200 Subject: [PATCH 090/311] refs #4614 feat(ticket): prevent invoice without weight --- db/changes/232801/00-ticketWeight.sql | 8 +-- .../ticket/front/descriptor-menu/index.html | 51 ++++++++++++------- modules/ticket/front/descriptor-menu/index.js | 14 ++--- .../front/descriptor-menu/locale/es.yml | 8 ++- modules/ticket/front/descriptor/locale/es.yml | 2 - 5 files changed, 50 insertions(+), 33 deletions(-) diff --git a/db/changes/232801/00-ticketWeight.sql b/db/changes/232801/00-ticketWeight.sql index 188804348..0b727b434 100644 --- a/db/changes/232801/00-ticketWeight.sql +++ b/db/changes/232801/00-ticketWeight.sql @@ -1,7 +1,7 @@ -UPDATE vn.ticket t - JOIN vn.ticketObservation o ON o.ticketFk = t.id +UPDATE `vn`.`ticket` t + JOIN `vn`.`ticketObservation` o ON o.ticketFk = t.id SET t.weight = cast(REPLACE(o.description, ',', '.') as decimal(10,2)) WHERE o.observationTypeFk = 6; -DELETE FROM vn.ticketObservation WHERE observationTypeFk = 6; -DELETE FROM vn.observationType WHERE id = 6; +DELETE FROM `vn`.`ticketObservation` WHERE observationTypeFk = 6; +DELETE FROM `vn`.`observationType` WHERE id = 6; diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index 6b4f967ac..5c76df97a 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -101,23 +101,32 @@ translate> Change shipped hour - - SMS Pending payment - - - SMS Minimum import - - - SMS Notify changes + Send SMS... + + + + Pending payment + + + Minimum import + + + Notify changes + + + Set ticket weight @@ -371,3 +380,11 @@ + + + + diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 71a0c782f..c849b59eb 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -249,16 +249,11 @@ class Controller extends Section { this.$.sms.open(); } - makeInvoice() { - const params = {ticketsIds: [this.id]}; - /* - This should call the notification sistem to insert a new notification - in te queue, yet to check how to handle user permissions, - as of 08-11-2022 every employee can insert a new notification in the queue + makeInvoice(force) { + if (this.ticket.address.incotermsFk && !this.ticket.weight && !force) + return this.$.withoutWeightConfirmation.show(); - */ const client = this.ticket.client; - if (client.hasElectronicInvoice) { this.$http.post(`NotificationQueues`, { notificationFk: 'invoice-electronic', @@ -275,7 +270,8 @@ class Controller extends Section { }); } - return this.$http.post(`Tickets/makeInvoice`, params) + return this.$http.post(`Tickets/makeInvoice`, {ticketsIds: [this.id]}) + .then(() => this.reload()) .then(() => this.reload()) .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); } diff --git a/modules/ticket/front/descriptor-menu/locale/es.yml b/modules/ticket/front/descriptor-menu/locale/es.yml index 3830523cf..3181a753c 100644 --- a/modules/ticket/front/descriptor-menu/locale/es.yml +++ b/modules/ticket/front/descriptor-menu/locale/es.yml @@ -16,8 +16,14 @@ without warehouse: sin almacén Invoice sent: Factura enviada The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}" Transfer client: Transferir cliente -SMS Notify changes: SMS Notificar cambios +Send SMS...: Enviar SMS... +Notify changes: Notificar cambios +Minimum import: Importe mínimo +Pending payment: Pago pendiente PDF sent!: ¡PDF enviado! Already exist signed delivery note: Ya existe albarán de entrega firmado Are you sure you want to replace this delivery note?: ¿Seguro que quieres reemplazar este albarán de entrega? Create a single ticket with all the content of the current ticket: Crea un ticket único con todo el contenido del ticket actual +Set ticket weight: Establecer peso al ticket +Ticket weight: Peso del ticket +This address has incoterms, you should set the weight before invoice it: Este consigatario tiene incoterms, deberías establecer el peso antes de facturar diff --git a/modules/ticket/front/descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml index 3da013467..86b1a6b57 100644 --- a/modules/ticket/front/descriptor/locale/es.yml +++ b/modules/ticket/front/descriptor/locale/es.yml @@ -17,8 +17,6 @@ Shipped hour updated: Hora de envio modificada Deleted ticket: Ticket eliminado Recalculate components: Recalcular componentes Are you sure you want to recalculate the components?: ¿Seguro que quieres recalcular los componentes? -SMS Minimum import: 'SMS Importe minimo' -SMS Pending payment: 'SMS Pago pendiente' Restore ticket: Restaurar ticket You are going to restore this ticket: Vas a restaurar este ticket Are you sure you want to restore this ticket?: ¿Seguro que quieres restaurar el ticket? From ea71e980cc757287fc39517d744a968d65070bd5 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 6 Jul 2023 11:45:08 +0200 Subject: [PATCH 091/311] refs #5970 add changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cec86f478..d0d172a3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2328.01] - 2023-07-13 ### Added +- (Clientes -> Morosos) Añadida columna "es trabajador" +- (Trabajadores -> Departamentos) Nueva sección +- (Trabajadores -> Departamentos) Añadido listado de Trabajadores por departamento +- (Trabajadores -> Departamentos) Añadido características de departamento e información ### Changed ### Fixed +- (Trabajadores -> Departamentos) Arreglado búscador ## [2326.01] - 2023-06-29 From a665b6c0600e4b717178d1c78bdf7cad472d70c5 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 6 Jul 2023 11:51:04 +0200 Subject: [PATCH 092/311] refs #5970 fix sql --- db/changes/232801/00-client_create.sql | 20 ++++++++++---------- db/changes/232801/00-client_create2.sql | 20 ++++++++++---------- db/changes/232801/00-department.sql | 2 +- db/dump/fixtures.sql | 14 +++++++------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/db/changes/232801/00-client_create.sql b/db/changes/232801/00-client_create.sql index 0728ba05e..d21094dad 100644 --- a/db/changes/232801/00-client_create.sql +++ b/db/changes/232801/00-client_create.sql @@ -1,11 +1,11 @@ -DROP PROCEDURE IF EXISTS vn.clientCreate; +DROP PROCEDURE IF EXISTS `vn`.`clientCreate`; DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_create`( vFirstname VARCHAR(50), - vSurnames VARCHAR(50), - vFi VARCHAR(9), - vAddress TEXT, + vSurnames VARCHAR(50), + vFi VARCHAR(9), + vAddress TEXT, vPostcode CHAR(5), vCity VARCHAR(25), vProvinceFk SMALLINT(5), @@ -61,7 +61,7 @@ BEGIN provinceFk = vProvinceFk, city = vCity, postcode = vPostcode, - socialName = CONCAT(vSurnames, ' ', vFirstname), + socialName = CONCAT(vSurnames, ' ', vFirstname), payMethodFk = vPayMethodFk, dueDay = vDueDay, credit = vDefaultCredit, @@ -75,14 +75,14 @@ BEGIN isTaxDataChecked = vIsTaxDataChecked, hasCoreVnl = vHasCoreVnl, isActive = TRUE; - + INSERT INTO mandate (clientFk, companyFk, mandateTypeFk) SELECT vUserFk, vCompanyFk, vMandateTypeFk WHERE NOT EXISTS ( - SELECT id - FROM mandate - WHERE clientFk = vUserFk - AND companyFk = vCompanyFk + SELECT id + FROM mandate + WHERE clientFk = vUserFk + AND companyFk = vCompanyFk AND mandateTypeFk = vMandateTypeFk ); END$$ diff --git a/db/changes/232801/00-client_create2.sql b/db/changes/232801/00-client_create2.sql index 8ba4e78e5..f2e660351 100644 --- a/db/changes/232801/00-client_create2.sql +++ b/db/changes/232801/00-client_create2.sql @@ -1,17 +1,17 @@ -ALTER TABLE vn.clientConfig ADD defaultPayMethodFk tinyint(3) unsigned NULL; -ALTER TABLE vn.clientConfig ADD defaultDueDay int unsigned NULL; -ALTER TABLE vn.clientConfig ADD defaultCredit decimal(10, 2) NULL; -ALTER TABLE vn.clientConfig ADD defaultIsTaxDataChecked tinyint(1) NULL; -ALTER TABLE vn.clientConfig ADD defaultHasCoreVnl boolean NULL; -ALTER TABLE vn.clientConfig ADD defaultMandateTypeFk smallint(5) NULL; -ALTER TABLE vn.clientConfig ADD CONSTRAINT clientNewConfigPayMethod_FK FOREIGN KEY (dafaultPayMethodFk) REFERENCES vn.payMethod(id); -ALTER TABLE vn.clientConfig ADD CONSTRAINT clientNewConfigMandateType_FK FOREIGN KEY (defaultMandateTypeFk) REFERENCES vn.mandateType(id); +ALTER TABLE `vn`.`clientConfig` ADD defaultPayMethodFk tinyint(3) unsigned NULL; +ALTER TABLE `vn`.`clientConfig` ADD defaultDueDay int unsigned NULL; +ALTER TABLE `vn`.`clientConfig` ADD defaultCredit decimal(10, 2) NULL; +ALTER TABLE `vn`.`clientConfig` ADD defaultIsTaxDataChecked tinyint(1) NULL; +ALTER TABLE `vn`.`clientConfig` ADD defaultHasCoreVnl boolean NULL; +ALTER TABLE `vn`.`clientConfig` ADD defaultMandateTypeFk smallint(5) NULL; +ALTER TABLE `vn`.`clientConfig` ADD CONSTRAINT clientNewConfigPayMethod_FK FOREIGN KEY (defaultPayMethodFk) REFERENCES vn.payMethod(id); +ALTER TABLE `vn`.`clientConfig` ADD CONSTRAINT clientNewConfigMandateType_FK FOREIGN KEY (defaultMandateTypeFk) REFERENCES vn.mandateType(id); -UPDATE vn.clientConfig +UPDATE `vn`.`clientConfig` SET defaultPayMethodFk = 4, defaultDueDay = 5, defaultCredit = 300.0, defaultIsTaxDataChecked = 1, defaultHasCoreVnl = 1, defaultMandateTypeFk = 2 - WHERE id = 1; \ No newline at end of file + WHERE id = 1; diff --git a/db/changes/232801/00-department.sql b/db/changes/232801/00-department.sql index d9a91ee30..3dcb8501d 100644 --- a/db/changes/232801/00-department.sql +++ b/db/changes/232801/00-department.sql @@ -5,7 +5,7 @@ drop trigger `vn`.`department_afterUpdate`; DELIMITER $$ $$ -create definer = root@localhost trigger department_afterUpdate +create definer = root@localhost trigger `vn`.`department_afterUpdate` after update on department for each row diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 14c9fba5d..475a4992f 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -385,6 +385,12 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`) (1103, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), (1104, -30, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)); +INSERT INTO `vn`.`mandateType`(`id`, `name`) + VALUES + (1, 'B2B'), + (2, 'CORE'), + (3, 'LCR'); + INSERT INTO `vn`.`clientConfig`(`id`, `riskTolerance`, `maxCreditRows`, `maxPriceIncreasingRatio`, `riskScope`, `defaultPayMethodFk`, `defaultDueDay`, `defaultCredit`, `defaultIsTaxDataChecked`, `defaultHasCoreVnl`, `defaultMandateTypeFk`) VALUES (1, 200, 10, 0.25, 2, 4, 5, 300.00, 1, 1, 2); @@ -828,12 +834,6 @@ INSERT INTO `vn`.`greuge`(`id`, `clientFk`, `description`, `amount`, `shipped`, (11, 1101, 'some heritage charges', -15.99, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 5, 1), (12, 1101, 'some miscellaneous charges', 58.00, DATE_ADD(util.VN_CURDATE(), INTERVAL 1 MONTH), util.VN_CURDATE(), 6, 1); -INSERT INTO `vn`.`mandateType`(`id`, `name`) - VALUES - (1, 'B2B'), - (2, 'CORE'), - (3, 'LCR'); - INSERT INTO `vn`.`mandate`(`id`, `clientFk`, `companyFk`, `code`, `created`, `mandateTypeFk`) VALUES (1, 1102, 442, '1-1', util.VN_CURDATE(), 2); @@ -2597,7 +2597,7 @@ UPDATE `vn`.`ticket` UPDATE `vn`.`ticket` SET refFk = 'A1111111' - WHERE id = 6; + WHERE id = 6; INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) VALUES From d9d4441d59d2e12505dff4d0573f89688d1ebb5a Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 6 Jul 2023 13:38:59 +0200 Subject: [PATCH 093/311] refs #5970 deploy: 233001 init --- CHANGELOG.md | 9 +++++++++ db/changes/233001/.gitkeep | 0 package-lock.json | 2 +- package.json | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 db/changes/233001/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index d0d172a3f..76527ac83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2330.01] - 2023-07-27 + +### Added + +### Changed + +### Fixed + + ## [2328.01] - 2023-07-13 ### Added diff --git a/db/changes/233001/.gitkeep b/db/changes/233001/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/package-lock.json b/package-lock.json index 97a326669..ee6d4e0fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.28.01", + "version": "23.30.01", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 64c374841..66e341ad5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.28.01", + "version": "23.30.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 8fe9b387ce5b00d287b0a3f08e31d41e2969dbe3 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 6 Jul 2023 15:16:52 +0200 Subject: [PATCH 094/311] refs #4614 test: front and correct folder --- db/changes/{232801 => 233001}/00-ticketWeight.sql | 0 modules/ticket/front/descriptor-menu/index.spec.js | 11 +++++++++++ 2 files changed, 11 insertions(+) rename db/changes/{232801 => 233001}/00-ticketWeight.sql (100%) diff --git a/db/changes/232801/00-ticketWeight.sql b/db/changes/233001/00-ticketWeight.sql similarity index 100% rename from db/changes/232801/00-ticketWeight.sql rename to db/changes/233001/00-ticketWeight.sql diff --git a/modules/ticket/front/descriptor-menu/index.spec.js b/modules/ticket/front/descriptor-menu/index.spec.js index 0aef956db..953de3962 100644 --- a/modules/ticket/front/descriptor-menu/index.spec.js +++ b/modules/ticket/front/descriptor-menu/index.spec.js @@ -198,6 +198,17 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { expect(controller.reload).toHaveBeenCalledWith(); expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); + + it('should show withoutWeightConfirmation', () => { + controller.$.withoutWeightConfirmation = {show: () => {}}; + jest.spyOn(controller.$.withoutWeightConfirmation, 'show'); + controller.ticket.address.incotermsFk = true; + + controller.makeInvoice(); + controller.ticket.address.incotermsFk = false; + + expect(controller.$.withoutWeightConfirmation.show).toHaveBeenCalled(); + }); }); describe('createPdfInvoice()', () => { From 7030be3efa7f0df9dd0fc9f0680a7147f17820ba Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 7 Jul 2023 09:30:04 +0200 Subject: [PATCH 095/311] fix --- front/core/services/token.js | 1 - modules/worker/back/models/worker.json | 8 -------- modules/worker/front/calendar/index.html | 2 +- modules/worker/front/card/index.js | 11 ++++++----- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/front/core/services/token.js b/front/core/services/token.js index c4b644a89..c16cc3c4f 100644 --- a/front/core/services/token.js +++ b/front/core/services/token.js @@ -83,7 +83,6 @@ export default class Token { this.renewPeriod = data.renewPeriod; this.stopRenewer(); this.inservalId = setInterval(() => this.checkValidity(), data.renewInterval * 1000); - this.checkValidity(); }); } diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 978d613e9..6d23c1b66 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -43,9 +43,6 @@ "SSN": { "type" : "string" }, - "labelerFk": { - "type" : "number" - }, "mobileExtension": { "type" : "number" }, @@ -86,11 +83,6 @@ "type": "hasMany", "model": "WorkerTeamCollegues", "foreignKey": "workerFk" - }, - "sector": { - "type": "belongsTo", - "model": "Sector", - "foreignKey": "sectorFk" } } } diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index ace2f4e27..877add57b 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -31,7 +31,7 @@
-
{{'Contract' | translate}} #{{$ctrl.card.worker.hasWorkCenter}}
+
{{'Contract' | translate}} #{{$ctrl.businessId}}
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js index e1eb97327..35f331764 100644 --- a/modules/worker/front/card/index.js +++ b/modules/worker/front/card/index.js @@ -33,11 +33,12 @@ class Controller extends ModuleCard { }; this.$http.get(`Workers/${this.$params.id}`, {filter}) - .then(res => this.worker = res.data); - this.$http.get(`Workers/${this.$params.id}/activeContract`) - .then(res => { - if (res.data) this.worker.hasWorkCenter = res.data.workCenterFk; - }); + .then(res => this.worker = res.data) + .then(() => + this.$http.get(`Workers/${this.$params.id}/activeContract`) + .then(res => { + if (res.data) this.worker.hasWorkCenter = res.data.workCenterFk; + })); } } From 6fa6c21cb1c086ce7c23e0a9a5bae7fb3c0a3af1 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 7 Jul 2023 09:31:26 +0200 Subject: [PATCH 096/311] remove fixtures --- db/dump/fixtures.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 475a4992f..3de5f15ab 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -188,13 +188,13 @@ INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`, `sectorFk`, `ipAd UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1; -INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`, `sectorFk`, `labelerFk`) +INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`) VALUES - (1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106, NULL, NULL), - (1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107, NULL, NULL), - (1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108, 1, NULL), - (1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109, 1, NULL), - (1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, NULL); + (1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106), + (1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107), + (1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108), + (1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109), + (1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110); INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`) VALUES From d9a5868ce422c083be4872ec7f26c62dcd927c4c Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 7 Jul 2023 10:55:45 +0200 Subject: [PATCH 097/311] refs #5930 fix(claim_updateClaim) options --- modules/claim/back/methods/claim/updateClaim.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/claim/back/methods/claim/updateClaim.js b/modules/claim/back/methods/claim/updateClaim.js index cc7392e39..5486b8eff 100644 --- a/modules/claim/back/methods/claim/updateClaim.js +++ b/modules/claim/back/methods/claim/updateClaim.js @@ -95,7 +95,7 @@ module.exports = Self => { // When claimState has been changed if (args.claimStateFk) { - const newState = await models.ClaimState.findById(args.claimStateFk, null, options); + const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions); if (newState.hasToNotify) { if (newState.code == 'incomplete') notifyStateChange(ctx, salesPerson.id, claim, newState.code); From 8922d27f20cfcc3106a3914d5345b5aba0cdca20 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 7 Jul 2023 12:25:02 +0200 Subject: [PATCH 098/311] refs #4614 fix e2e --- db/dump/fixtures.sql | 2 +- e2e/helpers/selectors.js | 1 + e2e/paths/05-ticket/12_descriptor.spec.js | 4 ++-- modules/ticket/front/descriptor-menu/index.html | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 5b4b64437..7649e3594 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -729,7 +729,7 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF (15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), (16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), (17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL), - (18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, util.VN_CURDATE(), NULL), + (18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL), (19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL), (20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL), (21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL), diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index b10813488..977c8a837 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -547,6 +547,7 @@ export default { moreMenuMakeInvoice: '.vn-menu [name="makeInvoice"]', moreMenuRegenerateInvoice: '.vn-menu [name="regenerateInvoice"]', moreMenuChangeShippedHour: '.vn-menu [name="changeShipped"]', + moreMenuSMSOptions: '.vn-menu [name="smsOptions"]', moreMenuPaymentSMS: '.vn-menu [name="sendPaymentSms"]', moreMenuSendImportSms: '.vn-menu [name="sendImportSms"]', SMStext: 'textarea[name="message"]', diff --git a/e2e/paths/05-ticket/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js index ca6fb8290..95a114c45 100644 --- a/e2e/paths/05-ticket/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -124,6 +124,7 @@ describe('Ticket descriptor path', () => { describe('SMS', () => { it('should send the payment SMS using the descriptor menu', async() => { await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitToClick(selectors.ticketDescriptor.moreMenuSMSOptions); await page.waitToClick(selectors.ticketDescriptor.moreMenuPaymentSMS); await page.waitForSelector(selectors.ticketDescriptor.SMStext); await page.waitPropertyLength(selectors.ticketDescriptor.SMStext, 'value', 128); @@ -134,8 +135,7 @@ describe('Ticket descriptor path', () => { }); it('should send the import SMS using the descriptor menu', async() => { - await page.waitToClick(selectors.ticketDescriptor.moreMenu); - await page.waitForContentLoaded(); + await page.waitToClick(selectors.ticketDescriptor.moreMenuSMSOptions); await page.waitToClick(selectors.ticketDescriptor.moreMenuSendImportSms); await page.waitForSelector(selectors.ticketDescriptor.SMStext); await page.waitPropertyLength(selectors.ticketDescriptor.SMStext, 'value', 144); diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index 5c76df97a..d55b8a462 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -103,6 +103,7 @@ Send SMS... From 9f2ef5c2c0835237e621e28e4fba908bd2d6516c Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 10 Jul 2023 07:22:23 +0200 Subject: [PATCH 099/311] change ref master --- modules/travel/front/extra-community/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html index c888f97da..8132bddb1 100644 --- a/modules/travel/front/extra-community/index.html +++ b/modules/travel/front/extra-community/index.html @@ -163,7 +163,7 @@ {{::entry.invoiceAmount | currency: 'EUR': 2}} - {{::entry.invoiceNumber}} + {{::entry.reference}} {{::entry.stickers}} {{::entry.loadedkg}} From d1c8f0ff11ef80c2769dec1f6e6ca8d6a7c620f0 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 11 Jul 2023 07:37:51 +0200 Subject: [PATCH 100/311] refs #5949 itemRecycle --- db/changes/233001/00-itemRecycle.sql | 2 + modules/item/back/methods/item/filter.js | 4 +- modules/item/back/models/item.json | 6 ++ modules/item/front/basic-data/index.html | 78 ++++++++++++++---------- modules/item/front/summary/index.html | 12 ++++ 5 files changed, 70 insertions(+), 32 deletions(-) create mode 100644 db/changes/233001/00-itemRecycle.sql diff --git a/db/changes/233001/00-itemRecycle.sql b/db/changes/233001/00-itemRecycle.sql new file mode 100644 index 000000000..c191e5d1c --- /dev/null +++ b/db/changes/233001/00-itemRecycle.sql @@ -0,0 +1,2 @@ +ALTER TABLE `vn`.`item` ADD recycledPlastic INT NULL; +ALTER TABLE `vn`.`item` ADD nonRecycledPlastic INT NULL; diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index c0b1cc0d9..d5de6a954 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -145,7 +145,7 @@ module.exports = Self => { const stmts = []; const stmt = new ParameterizedSQL( - `SELECT + `SELECT i.id, i.image, i.name, @@ -164,6 +164,8 @@ module.exports = Self => { i.stemMultiplier, i.typeFk, i.isFloramondo, + i.recycledPlastic, + i.nonRecycledPlastic, pr.name AS producer, it.name AS typeName, it.workerFk AS buyerFk, diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index 4a7e04002..e99dcd996 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -125,6 +125,12 @@ "minPrice": { "type": "number" }, + "recycledPlastic": { + "type": "number" + }, + "nonRecycledPlastic": { + "type": "number" + }, "packingOut": { "type": "number" }, diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index a7e603bd1..61456f154 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -82,6 +82,8 @@ vn-name="expence" initial-data="$ctrl.item.expense"> + + - - - - - - + + + + + + - - - - - - + + + + + + + + + + + + + + + + + +

From 1bcd3039cdf58af87eff7d0c2f8004db9be4cb95 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 11 Jul 2023 07:41:05 +0200 Subject: [PATCH 101/311] refs #5475 redesign 2FA email --- .../email/auth-code/assets/css/style.css | 5 +- .../templates/email/auth-code/auth-code.html | 68 ++++++++++++------- print/templates/email/auth-code/auth-code.js | 4 +- print/templates/email/auth-code/locale/en.yml | 3 +- print/templates/email/auth-code/locale/es.yml | 3 +- print/templates/email/auth-code/locale/fr.yml | 3 +- print/templates/email/auth-code/locale/pt.yml | 3 +- 7 files changed, 54 insertions(+), 35 deletions(-) diff --git a/print/templates/email/auth-code/assets/css/style.css b/print/templates/email/auth-code/assets/css/style.css index d3bfa2aea..7fbccdc3f 100644 --- a/print/templates/email/auth-code/assets/css/style.css +++ b/print/templates/email/auth-code/assets/css/style.css @@ -1,5 +1,6 @@ .code { border: 2px dashed #8dba25; border-radius: 3px; - text-align: center -} \ No newline at end of file + text-align: center; + font-size: 24px; +} diff --git a/print/templates/email/auth-code/auth-code.html b/print/templates/email/auth-code/auth-code.html index 0d303682a..ae9aa6478 100644 --- a/print/templates/email/auth-code/auth-code.html +++ b/print/templates/email/auth-code/auth-code.html @@ -1,23 +1,45 @@ - -
-
-

{{ $t('title') }}

-

{{ $t('description') }}

-

- {{ $t('device') }}: {{ device }} -

-

- {{$t('ip')}}: {{ ip }} -

-
-
-
-
-

{{ $t('Enter the following code to continue to your account') }}

-
- {{ code }} -
-

{{ $t('It expires in 5 minutes') }}

-
-
-
+ + + + + + + + + + + + + +
+
+
+
+
+
+ +
+
+
+
+

{{ $t('title') }}

+

{{ $t('description') }}

+

+ {{ $t('device') }}: {{ device }} +

+

+ {{$t('ip')}}: {{ ip }} +

+
+
+
+
+

{{ $t('Enter the following code to continue to your account. It expires in 5 minutes.') }}

+
+ {{ code }} +
+
+
+
+ + diff --git a/print/templates/email/auth-code/auth-code.js b/print/templates/email/auth-code/auth-code.js index 362b307d8..b16833036 100755 --- a/print/templates/email/auth-code/auth-code.js +++ b/print/templates/email/auth-code/auth-code.js @@ -1,10 +1,10 @@ const Component = require(`vn-print/core/component`); -const emailBody = new Component('email-body'); +const emailHeader = new Component('email-header'); module.exports = { name: 'auth-code', components: { - 'email-body': emailBody.build(), + 'email-header': emailHeader.build(), }, props: { code: { diff --git a/print/templates/email/auth-code/locale/en.yml b/print/templates/email/auth-code/locale/en.yml index 27b493e20..74ea87e32 100644 --- a/print/templates/email/auth-code/locale/en.yml +++ b/print/templates/email/auth-code/locale/en.yml @@ -3,5 +3,4 @@ title: Verification code description: Somebody did request a verification code for login. If you didn't request it, please ignore this email. device: 'Device' ip: 'IP' -Enter the following code to continue to your account: Enter the following code to continue to your account -It expires in 5 minutes: It expires in 5 minutes +Enter the following code to continue to your account. It expires in 5 minutes.: Enter the following code to continue to your account. It expires in 5 minutes. diff --git a/print/templates/email/auth-code/locale/es.yml b/print/templates/email/auth-code/locale/es.yml index 463ea95fa..0de99f5be 100644 --- a/print/templates/email/auth-code/locale/es.yml +++ b/print/templates/email/auth-code/locale/es.yml @@ -3,5 +3,4 @@ title: Código de verificación description: Alguien ha solicitado un código de verificación para poder iniciar sesión. Si no lo has solicitado tu, ignora este email. device: 'Dispositivo' ip: 'IP' -Enter the following code to continue to your account: Introduce el siguiente código para poder continuar con tu cuenta -It expires in 5 minutes: Expira en 5 minutos +Enter the following code to continue to your account. It expires in 5 minutes: Introduce el siguiente código para poder continuar con tu cuenta. Expira en 5 minutos. diff --git a/print/templates/email/auth-code/locale/fr.yml b/print/templates/email/auth-code/locale/fr.yml index 454bb80ae..0b71d4228 100644 --- a/print/templates/email/auth-code/locale/fr.yml +++ b/print/templates/email/auth-code/locale/fr.yml @@ -3,5 +3,4 @@ title: Code de vérification description: Quelqu'un a demandé un code de vérification pour se connecter. Si ce n'était pas toi, ignore cet email. device: 'Appareil' ip: 'IP' -Enter the following code to continue to your account: Entrez le code suivant pour continuer avec votre compte -It expires in 5 minutes: Il expire dans 5 minutes. +Enter the following code to continue to your account. It expires in 5 minutes.: Entrez le code suivant pour continuer avec votre compte. Il expire dans 5 minutes. diff --git a/print/templates/email/auth-code/locale/pt.yml b/print/templates/email/auth-code/locale/pt.yml index 7f9eb85f5..cea27dce7 100644 --- a/print/templates/email/auth-code/locale/pt.yml +++ b/print/templates/email/auth-code/locale/pt.yml @@ -3,5 +3,4 @@ title: Código de verificação description: Alguém solicitou um código de verificação para entrar. Se você não fez essa solicitação, ignore este e-mail. device: 'Dispositivo' ip: 'IP' -Enter the following code to continue to your account: Insira o seguinte código para continuar com sua conta. -It expires in 5 minutes: Expira em 5 minutos. +Enter the following code to continue to your account. It expires in 5 minutes: Insira o seguinte código para continuar com sua conta. Expira em 5 minutos. From ba109dccc5fec9f636fbd76178d42ffbc5d38e06 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 11 Jul 2023 07:58:18 +0200 Subject: [PATCH 102/311] refs #5949 trad --- modules/item/front/basic-data/index.html | 6 +++--- modules/item/front/basic-data/locale/es.yml | 10 ++++++---- modules/item/front/summary/index.html | 8 ++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 61456f154..285ad11f9 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -170,14 +170,14 @@ diff --git a/modules/item/front/basic-data/locale/es.yml b/modules/item/front/basic-data/locale/es.yml index 747dfe792..b6f3c9f75 100644 --- a/modules/item/front/basic-data/locale/es.yml +++ b/modules/item/front/basic-data/locale/es.yml @@ -1,7 +1,7 @@ Reference: Referencia -Full name calculates based on tags 1-3. Is not recommended to change it manually: >- - El nombre completo se calcula - basado en los tags 1-3. +Full name calculates based on tags 1-3. Is not recommended to change it manually: >- + El nombre completo se calcula + basado en los tags 1-3. No se recomienda cambiarlo manualmente Is active: Activo Expense: Gasto @@ -13,4 +13,6 @@ Is shown at website, app that this item cannot travel (wreath, palms, ...): Se m Multiplier: Multiplicador Generic: Genérico This item does need a photo: Este artículo necesita una foto -Do photo: Hacer foto \ No newline at end of file +Do photo: Hacer foto +Recyled Plastic: Plástico reciclado +No recycled plastic: Plástico no reciclado diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index 78b7af355..af8752b5f 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -113,19 +113,19 @@ - - - - From 6978339fd3f2d3f13c7161f14c74769cd1117c77 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 11 Jul 2023 08:03:36 +0200 Subject: [PATCH 103/311] refs #5475 fix email translations --- print/templates/email/auth-code/locale/es.yml | 2 +- print/templates/email/auth-code/locale/pt.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/print/templates/email/auth-code/locale/es.yml b/print/templates/email/auth-code/locale/es.yml index 0de99f5be..92150c4ed 100644 --- a/print/templates/email/auth-code/locale/es.yml +++ b/print/templates/email/auth-code/locale/es.yml @@ -3,4 +3,4 @@ title: Código de verificación description: Alguien ha solicitado un código de verificación para poder iniciar sesión. Si no lo has solicitado tu, ignora este email. device: 'Dispositivo' ip: 'IP' -Enter the following code to continue to your account. It expires in 5 minutes: Introduce el siguiente código para poder continuar con tu cuenta. Expira en 5 minutos. +Enter the following code to continue to your account. It expires in 5 minutes.: Introduce el siguiente código para poder continuar con tu cuenta. Expira en 5 minutos. diff --git a/print/templates/email/auth-code/locale/pt.yml b/print/templates/email/auth-code/locale/pt.yml index cea27dce7..1cf5d23be 100644 --- a/print/templates/email/auth-code/locale/pt.yml +++ b/print/templates/email/auth-code/locale/pt.yml @@ -3,4 +3,4 @@ title: Código de verificação description: Alguém solicitou um código de verificação para entrar. Se você não fez essa solicitação, ignore este e-mail. device: 'Dispositivo' ip: 'IP' -Enter the following code to continue to your account. It expires in 5 minutes: Insira o seguinte código para continuar com sua conta. Expira em 5 minutos. +Enter the following code to continue to your account. It expires in 5 minutes.: Insira o seguinte código para continuar com sua conta. Expira em 5 minutos. From 7291b793ae6cdf80b7d5ab394564711eb7629284 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 11 Jul 2023 08:41:43 +0200 Subject: [PATCH 104/311] refs #5949 fix traduct --- modules/item/front/basic-data/index.html | 4 ++-- modules/item/front/basic-data/locale/es.yml | 4 ++-- modules/item/front/summary/index.html | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 285ad11f9..fba4d679c 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -170,14 +170,14 @@ diff --git a/modules/item/front/basic-data/locale/es.yml b/modules/item/front/basic-data/locale/es.yml index b6f3c9f75..8f459c417 100644 --- a/modules/item/front/basic-data/locale/es.yml +++ b/modules/item/front/basic-data/locale/es.yml @@ -14,5 +14,5 @@ Multiplier: Multiplicador Generic: Genérico This item does need a photo: Este artículo necesita una foto Do photo: Hacer foto -Recyled Plastic: Plástico reciclado -No recycled plastic: Plástico no reciclado +Recycled Plastic: Plástico reciclado +Non recycled plastic: Plástico no reciclado diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index af8752b5f..fcc267b4d 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -122,10 +122,10 @@ - - From 93e70e699a4821e1a91b6f2adc5fa5910c6ab820 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 09:19:15 +0200 Subject: [PATCH 105/311] =?UTF-8?q?refs=20#5874=20feat:=20refactorizado=20?= =?UTF-8?q?proceso=20facturaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- loopback/locale/en.json | 5 +- loopback/locale/es.json | 3 +- modules/client/back/models/client.js | 6 +- modules/client/front/summary/index.html | 5 +- .../back/methods/invoiceOut/invoiceClient.js | 56 ++------- .../methods/invoiceOut/makePdfAndNotify.js | 5 +- .../back/methods/ticket/canBeInvoiced.js | 47 ++++--- .../back/methods/ticket/invoiceTickets.js | 105 ++++++++++++++++ .../ticket/back/methods/ticket/makeInvoice.js | 91 ++++++-------- .../ticket/specs/canBeInvoiced.spec.js | 76 +++++++++--- .../ticket/specs/invoiceTickets.spec.js | 115 ++++++++++++++++++ .../methods/ticket/specs/makeInvoice.spec.js | 92 +++----------- modules/ticket/back/models/ticket-methods.js | 1 + modules/ticket/front/descriptor-menu/index.js | 2 +- .../front/descriptor-menu/index.spec.js | 2 +- modules/ticket/front/index/index.js | 2 +- 16 files changed, 390 insertions(+), 223 deletions(-) create mode 100644 modules/ticket/back/methods/ticket/invoiceTickets.js create mode 100644 modules/ticket/back/methods/ticket/specs/invoiceTickets.spec.js diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 9b1b04600..d7d31a3dc 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -177,5 +177,6 @@ "Invalid quantity": "Invalid quantity", "Failed to upload delivery note": "Error to upload delivery note {{id}}", "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", - "The renew period has not been exceeded": "The renew period has not been exceeded" -} \ No newline at end of file + "The renew period has not been exceeded": "The renew period has not been exceeded", + "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}" +} diff --git a/loopback/locale/es.json b/loopback/locale/es.json index ed036331f..20a9557e9 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -297,5 +297,6 @@ "Error while generating PDF": "Error al generar PDF", "Error when sending mail to client": "Error al enviar el correo al cliente", "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico", - "The renew period has not been exceeded": "El periodo de renovación no ha sido superado" + "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", + "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}" } diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 51157e15d..046138725 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -14,7 +14,7 @@ module.exports = Self => { Self.validatesPresenceOf('street', { message: 'Street cannot be empty' }); - + Self.validatesPresenceOf('city', { message: 'City cannot be empty' }); @@ -89,7 +89,7 @@ module.exports = Self => { }; const country = await Self.app.models.Country.findOne(filter); const code = country ? country.code.toLowerCase() : null; - const countryCode = this.fi.toLowerCase().substring(0, 2); + const countryCode = this.fi?.toLowerCase().substring(0, 2); if (!this.fi || !validateTin(this.fi, code) || (this.isVies && countryCode == code)) err(); @@ -401,7 +401,7 @@ module.exports = Self => { Self.changeCredit = async function changeCredit(ctx, finalState, changes) { const models = Self.app.models; const userId = ctx.options.accessToken.userId; - const accessToken = {req: {accessToken: ctx.options.accessToken} }; + const accessToken = {req: {accessToken: ctx.options.accessToken}}; const canEditCredit = await models.ACL.checkAccessAcl(accessToken, 'Client', 'editCredit', 'WRITE'); if (!canEditCredit) { diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html index a0d4b918a..0a15efcd1 100644 --- a/modules/client/front/summary/index.html +++ b/modules/client/front/summary/index.html @@ -64,7 +64,7 @@ - @@ -296,6 +296,9 @@ value="{{$ctrl.summary.rating}}" info="Value from 1 to 20. The higher the better value"> + + diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js index ddd008942..fa22dab1e 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js @@ -1,5 +1,3 @@ -const UserError = require('vn-loopback/util/user-error'); - module.exports = Self => { Self.remoteMethodCtx('invoiceClient', { description: 'Make a invoice of a client', @@ -56,7 +54,6 @@ module.exports = Self => { const minShipped = Date.vnNew(); minShipped.setFullYear(args.maxShipped.getFullYear() - 1); - let invoiceId; try { const client = await models.Client.findById(args.clientId, { fields: ['id', 'hasToInvoiceByAddress'] @@ -77,56 +74,21 @@ module.exports = Self => { ], options); } - // Check negative bases - - let query = - `SELECT COUNT(*) isSpanishCompany - FROM supplier s - JOIN country c ON c.id = s.countryFk - AND c.code = 'ES' - WHERE s.id = ?`; - const [supplierCompany] = await Self.rawSql(query, [ - args.companyFk - ], options); - - const isSpanishCompany = supplierCompany?.isSpanishCompany; - - query = 'SELECT hasAnyNegativeBase() AS base'; - const [result] = await Self.rawSql(query, null, options); - - const hasAnyNegativeBase = result?.base; - if (hasAnyNegativeBase && isSpanishCompany) - throw new UserError('Negative basis'); - - // Invoicing - - query = `SELECT invoiceSerial(?, ?, ?) AS serial`; - const [invoiceSerial] = await Self.rawSql(query, [ - client.id, + const invoiceType = 'G'; + const invoiceId = await models.Ticket.makeInvoice( + ctx, + invoiceType, args.companyFk, - 'G' - ], options); - const serialLetter = invoiceSerial.serial; - - query = `CALL invoiceOut_new(?, ?, NULL, @invoiceId)`; - await Self.rawSql(query, [ - serialLetter, - args.invoiceDate - ], options); - - const [newInvoice] = await Self.rawSql(`SELECT @invoiceId id`, null, options); - if (!newInvoice) - throw new UserError('No tickets to invoice', 'notInvoiced'); - - await Self.rawSql('CALL invoiceOutBooking(?)', [newInvoice.id], options); - invoiceId = newInvoice.id; + args.invoiceDate, + options + ); if (tx) await tx.commit(); + + return invoiceId; } catch (e) { if (tx) await tx.rollback(); throw e; } - - return invoiceId; }; }; diff --git a/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js b/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js index a999437c0..a48664b30 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js +++ b/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js @@ -14,8 +14,7 @@ module.exports = Self => { }, { arg: 'printerFk', type: 'number', - description: 'The printer to print', - required: true + description: 'The printer to print' } ], http: { @@ -51,7 +50,7 @@ module.exports = Self => { const ref = invoiceOut.ref; const client = invoiceOut.client(); - if (client.isToBeMailed) { + if (client.isToBeMailed || !printerFk) { try { ctx.args = { reference: ref, diff --git a/modules/ticket/back/methods/ticket/canBeInvoiced.js b/modules/ticket/back/methods/ticket/canBeInvoiced.js index 6b8f9e71a..0f6cb476b 100644 --- a/modules/ticket/back/methods/ticket/canBeInvoiced.js +++ b/modules/ticket/back/methods/ticket/canBeInvoiced.js @@ -1,3 +1,5 @@ +const UserError = require('vn-loopback/util/user-error'); + module.exports = function(Self) { Self.remoteMethodCtx('canBeInvoiced', { description: 'Whether the ticket can or not be invoiced', @@ -21,8 +23,9 @@ module.exports = function(Self) { } }); - Self.canBeInvoiced = async(ticketsIds, options) => { + Self.canBeInvoiced = async(ctx, ticketsIds, options) => { const myOptions = {}; + const $t = ctx.req.__; // $translate if (typeof options == 'object') Object.assign(myOptions, options); @@ -31,29 +34,43 @@ module.exports = function(Self) { where: { id: {inq: ticketsIds} }, - fields: ['id', 'refFk', 'shipped', 'totalWithVat'] + fields: ['id', 'refFk', 'shipped', 'totalWithVat', 'companyFk'] }, myOptions); + const [firstTicket] = tickets; + const companyFk = firstTicket.companyFk; - const query = ` - SELECT vn.hasSomeNegativeBase(t.id) AS hasSomeNegativeBase - FROM ticket t - WHERE id IN(?)`; - const ticketBases = await Self.rawSql(query, [ticketsIds], myOptions); - const hasSomeNegativeBase = ticketBases.some( - ticketBases => ticketBases.hasSomeNegativeBase - ); + const query = + `SELECT COUNT(*) isSpanishCompany + FROM supplier s + JOIN country c ON c.id = s.countryFk + AND c.code = 'ES' + WHERE s.id = ?`; + const [supplierCompany] = await Self.rawSql(query, [companyFk], options); + + const isSpanishCompany = supplierCompany?.isSpanishCompany; + + const [result] = await Self.rawSql('SELECT hasAnyNegativeBase() AS base', null, options); + const hasAnyNegativeBase = result?.base && isSpanishCompany; + if (hasAnyNegativeBase) + throw new UserError($t('Negative basis of tickets', {ticketsIds: ticketsIds})); const today = Date.vnNew(); - const invalidTickets = tickets.some(ticket => { + tickets.some(ticket => { const shipped = new Date(ticket.shipped); const shippingInFuture = shipped.getTime() > today.getTime(); - const isInvoiced = ticket.refFk; - const priceZero = ticket.totalWithVat == 0; + if (shippingInFuture) + throw new UserError(`Can't invoice to future`); - return isInvoiced || priceZero || shippingInFuture; + const isInvoiced = ticket.refFk; + if (isInvoiced) + throw new UserError(`This ticket is already invoiced`); + + const priceZero = ticket.totalWithVat == 0; + if (priceZero) + throw new UserError(`A ticket with an amount of zero can't be invoiced`); }); - return !(invalidTickets || hasSomeNegativeBase); + return true; }; }; diff --git a/modules/ticket/back/methods/ticket/invoiceTickets.js b/modules/ticket/back/methods/ticket/invoiceTickets.js new file mode 100644 index 000000000..780e9eb57 --- /dev/null +++ b/modules/ticket/back/methods/ticket/invoiceTickets.js @@ -0,0 +1,105 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = function(Self) { + Self.remoteMethodCtx('invoiceTickets', { + description: 'Make out an invoice from one or more tickets', + accessType: 'WRITE', + accepts: [ + { + arg: 'ticketsIds', + description: 'The tickets id', + type: ['number'], + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/invoiceTickets`, + verb: 'POST' + } + }); + + Self.invoiceTickets = async(ctx, ticketsIds, options) => { + const models = Self.app.models; + const date = Date.vnNew(); + date.setHours(0, 0, 0, 0); + + const myOptions = {userId: ctx.req.accessToken.userId}; + let tx; + + if (typeof options === 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + let invoicesIds = []; + try { + const tickets = await models.Ticket.find({ + where: { + id: {inq: ticketsIds} + }, + fields: ['id', 'clientFk', 'companyFk'] + }, myOptions); + + const [firstTicket] = tickets; + const clientId = firstTicket.clientFk; + const companyId = firstTicket.companyFk; + + const isSameClient = tickets.every(ticket => ticket.clientFk === clientId); + if (!isSameClient) + throw new UserError(`You can't invoice tickets from multiple clients`); + + const client = await models.Client.findById(clientId, { + fields: ['id', 'hasToInvoiceByAddress'] + }, myOptions); + + if (client.hasToInvoiceByAddress) { + const query = ` + SELECT DISTINCT addressFk + FROM ticket t + WHERE id IN (?)`; + const result = await Self.rawSql(query, [ticketsIds], myOptions); + + const addressIds = result.map(address => address.addressFk); + for (const address of addressIds) + await createInvoice(ctx, companyId, ticketsIds, address, invoicesIds, myOptions); + } else + await createInvoice(ctx, companyId, ticketsIds, null, invoicesIds, myOptions); + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + + for (const invoiceId of invoicesIds) + await models.InvoiceOut.makePdfAndNotify(ctx, invoiceId, null); + + return invoicesIds; + }; + + async function createInvoice(ctx, companyId, ticketsIds, address, invoicesIds, myOptions) { + const models = Self.app.models; + + await models.Ticket.rawSql(` + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; + CREATE TEMPORARY TABLE tmp.ticketToInvoice + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT id + FROM vn.ticket + WHERE id IN (?) + ${address ? `AND addressFk = ${address}` : ''} + `, [ticketsIds], myOptions); + + const invoiceId = await models.Ticket.makeInvoice(ctx, 'R', companyId, Date.vnNew(), myOptions); + invoicesIds.push(invoiceId); + } +}; + diff --git a/modules/ticket/back/methods/ticket/makeInvoice.js b/modules/ticket/back/methods/ticket/makeInvoice.js index ee82b874f..22fe7b3f5 100644 --- a/modules/ticket/back/methods/ticket/makeInvoice.js +++ b/modules/ticket/back/methods/ticket/makeInvoice.js @@ -6,15 +6,26 @@ module.exports = function(Self) { accessType: 'WRITE', accepts: [ { - arg: 'ticketsIds', - description: 'The tickets id', - type: ['number'], + arg: 'invoiceType', + description: 'The invoice type', + type: 'string', + required: true + }, + { + arg: 'companyFk', + description: 'The company id', + type: 'string', + required: true + }, + { + arg: 'invoiceDate', + description: 'The invoice date', + type: 'date', required: true } ], returns: { - arg: 'data', - type: 'boolean', + type: ['object'], root: true }, http: { @@ -23,10 +34,9 @@ module.exports = function(Self) { } }); - Self.makeInvoice = async(ctx, ticketsIds, options) => { + Self.makeInvoice = async(ctx, invoiceType, companyFk, invoiceDate, options) => { const models = Self.app.models; - const date = Date.vnNew(); - date.setHours(0, 0, 0, 0); + invoiceDate.setHours(0, 0, 0, 0); const myOptions = {userId: ctx.req.accessToken.userId}; let tx; @@ -40,81 +50,50 @@ module.exports = function(Self) { } let serial; - let invoiceId; - let invoiceOut; try { + const ticketToInvoice = await Self.rawSql(` + SELECT id + FROM tmp.ticketToInvoice`, null, myOptions); + + const ticketsIds = ticketToInvoice.map(ticket => ticket.id); const tickets = await models.Ticket.find({ where: { id: {inq: ticketsIds} }, - fields: ['id', 'clientFk', 'companyFk'] + fields: ['id', 'clientFk'] }, myOptions); + await models.Ticket.canBeInvoiced(ctx, ticketsIds, myOptions); + const [firstTicket] = tickets; const clientId = firstTicket.clientFk; - const companyId = firstTicket.companyFk; - - const isSameClient = tickets.every(ticket => ticket.clientFk == clientId); - if (!isSameClient) - throw new UserError(`You can't invoice tickets from multiple clients`); - const clientCanBeInvoiced = await models.Client.canBeInvoiced(clientId, myOptions); if (!clientCanBeInvoiced) throw new UserError(`This client can't be invoiced`); - const ticketCanBeInvoiced = await models.Ticket.canBeInvoiced(ticketsIds, myOptions); - if (!ticketCanBeInvoiced) - throw new UserError(`Some of the selected tickets are not billable`); - const query = `SELECT vn.invoiceSerial(?, ?, ?) AS serial`; const [result] = await Self.rawSql(query, [ clientId, - companyId, - 'R' + companyFk, + invoiceType, ], myOptions); serial = result.serial; - await Self.rawSql(` - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; - CREATE TEMPORARY TABLE tmp.ticketToInvoice - (PRIMARY KEY (id)) - ENGINE = MEMORY - SELECT id FROM vn.ticket - WHERE id IN(?) AND refFk IS NULL - `, [ticketsIds], myOptions); - - await Self.rawSql('CALL invoiceOut_new(?, ?, null, @invoiceId)', [serial, date], myOptions); + await Self.rawSql('CALL invoiceOut_new(?, ?, null, @invoiceId)', [serial, invoiceDate], myOptions); const [resultInvoice] = await Self.rawSql('SELECT @invoiceId id', [], myOptions); + if (!resultInvoice) + throw new UserError('No tickets to invoice', 'notInvoiced'); - invoiceId = resultInvoice.id; + if (serial != 'R' && resultInvoice.id) + await Self.rawSql('CALL invoiceOutBooking(?)', [resultInvoice.id], myOptions); - if (serial != 'R' && invoiceId) - await Self.rawSql('CALL invoiceOutBooking(?)', [invoiceId], myOptions); - - invoiceOut = await models.InvoiceOut.findById(invoiceId, { - include: { - relation: 'client' - } - }, myOptions); if (tx) await tx.commit(); + + return resultInvoice.id; } catch (e) { if (tx) await tx.rollback(); throw e; } - - if (serial != 'R' && invoiceId) - await models.InvoiceOut.createPdf(ctx, invoiceId); - - if (invoiceId) { - ctx.args = { - reference: invoiceOut.ref, - recipientId: invoiceOut.clientFk, - recipient: invoiceOut.client().email - }; - await models.InvoiceOut.invoiceEmail(ctx, invoiceOut.ref); - } - - return {invoiceFk: invoiceId, serial: serial}; }; }; diff --git a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js index 806f80227..42f9b5a9e 100644 --- a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js +++ b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js @@ -1,61 +1,83 @@ const models = require('vn-loopback/server/server').models; -const LoopBackContext = require('loopback-context'); describe('ticket canBeInvoiced()', () => { const userId = 19; const ticketId = 11; - const activeCtx = { - accessToken: {userId: userId} + const ctx = {req: {accessToken: {userId: userId}}}; + ctx.req.__ = value => { + return value; }; - beforeAll(async() => { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); - }); - it('should return falsy for an already invoiced ticket', async() => { const tx = await models.Ticket.beginTransaction({}); + let error; try { const options = {transaction: tx}; const ticket = await models.Ticket.findById(ticketId, null, options); await ticket.updateAttribute('refFk', 'T1111111', options); - const canBeInvoiced = await models.Ticket.canBeInvoiced([ticketId], options); + await models.Ticket.rawSql(` + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; + CREATE TEMPORARY TABLE tmp.ticketToInvoice + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT id + FROM vn.ticket + WHERE id IN (?) + `, [ticketId], options); + + const canBeInvoiced = await models.Ticket.canBeInvoiced(ctx, [ticketId], options); expect(canBeInvoiced).toEqual(false); await tx.rollback(); } catch (e) { + error = e; await tx.rollback(); - throw e; } + + expect(error.message).toEqual(`This ticket is already invoiced`); }); it('should return falsy for a ticket with a price of zero', async() => { const tx = await models.Ticket.beginTransaction({}); + let error; try { const options = {transaction: tx}; const ticket = await models.Ticket.findById(ticketId, null, options); await ticket.updateAttribute('totalWithVat', 0, options); - const canBeInvoiced = await models.Ticket.canBeInvoiced([ticketId], options); + await models.Ticket.rawSql(` + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; + CREATE TEMPORARY TABLE tmp.ticketToInvoice + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT id + FROM vn.ticket + WHERE id IN (?) + `, [ticketId], options); + + const canBeInvoiced = await models.Ticket.canBeInvoiced(ctx, [ticketId], options); expect(canBeInvoiced).toEqual(false); await tx.rollback(); } catch (e) { + error = e; await tx.rollback(); - throw e; } + + expect(error.message).toEqual(`A ticket with an amount of zero can't be invoiced`); }); it('should return falsy for a ticket shipping in future', async() => { const tx = await models.Ticket.beginTransaction({}); + + let error; try { const options = {transaction: tx}; @@ -66,15 +88,27 @@ describe('ticket canBeInvoiced()', () => { await ticket.updateAttribute('shipped', shipped, options); - const canBeInvoiced = await models.Ticket.canBeInvoiced([ticketId], options); + await models.Ticket.rawSql(` + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; + CREATE TEMPORARY TABLE tmp.ticketToInvoice + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT id + FROM vn.ticket + WHERE id IN (?) + `, [ticketId], options); + + const canBeInvoiced = await models.Ticket.canBeInvoiced(ctx, [ticketId], options); expect(canBeInvoiced).toEqual(false); await tx.rollback(); } catch (e) { + error = e; await tx.rollback(); - throw e; } + + expect(error.message).toEqual(`Can't invoice to future`); }); it('should return truthy for an invoiceable ticket', async() => { @@ -83,7 +117,17 @@ describe('ticket canBeInvoiced()', () => { try { const options = {transaction: tx}; - const canBeInvoiced = await models.Ticket.canBeInvoiced([ticketId], options); + await models.Ticket.rawSql(` + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; + CREATE TEMPORARY TABLE tmp.ticketToInvoice + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT id + FROM vn.ticket + WHERE id IN (?) + `, [ticketId], options); + + const canBeInvoiced = await models.Ticket.canBeInvoiced(ctx, [ticketId], options); expect(canBeInvoiced).toEqual(true); diff --git a/modules/ticket/back/methods/ticket/specs/invoiceTickets.spec.js b/modules/ticket/back/methods/ticket/specs/invoiceTickets.spec.js new file mode 100644 index 000000000..8971fb24a --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/invoiceTickets.spec.js @@ -0,0 +1,115 @@ +const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); + +describe('ticket invoiceTickets()', () => { + const userId = 19; + const clientId = 1102; + const activeCtx = { + getLocale: () => { + return 'en'; + }, + accessToken: {userId: userId}, + headers: {origin: 'http://localhost:5000'}, + }; + const ctx = {req: activeCtx}; + + beforeAll(async() => { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + + it('should throw an error when invoicing tickets from multiple clients', async() => { + const invoiceOutModel = models.InvoiceOut; + spyOn(invoiceOutModel, 'makePdfAndNotify'); + + const tx = await models.Ticket.beginTransaction({}); + + let error; + + try { + const options = {transaction: tx}; + + const ticketsIds = [11, 16]; + await models.Ticket.invoiceTickets(ctx, ticketsIds, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual(`You can't invoice tickets from multiple clients`); + }); + + it(`should throw an error when invoicing a client without tax data checked`, async() => { + const invoiceOutModel = models.InvoiceOut; + spyOn(invoiceOutModel, 'makePdfAndNotify'); + + const tx = await models.Ticket.beginTransaction({}); + + let error; + + try { + const options = {transaction: tx}; + + const client = await models.Client.findById(clientId, null, options); + await client.updateAttribute('isTaxDataChecked', false, options); + + const ticketsIds = [11]; + await models.Ticket.invoiceTickets(ctx, ticketsIds, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual(`This client can't be invoiced`); + }); + + it('should invoice a ticket, then try again to fail', async() => { + const invoiceOutModel = models.InvoiceOut; + spyOn(invoiceOutModel, 'makePdfAndNotify'); + + const tx = await models.Ticket.beginTransaction({}); + + let error; + + try { + const options = {transaction: tx}; + + const ticketsIds = [11]; + await models.Ticket.invoiceTickets(ctx, ticketsIds, options); + await models.Ticket.invoiceTickets(ctx, ticketsIds, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual(`This ticket is already invoiced`); + }); + + it('should success to invoice a ticket', async() => { + const invoiceOutModel = models.InvoiceOut; + spyOn(invoiceOutModel, 'makePdfAndNotify'); + + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ticketsIds = [11]; + const invoicesIds = await models.Ticket.invoiceTickets(ctx, ticketsIds, options); + + expect(invoicesIds.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js b/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js index 270ba5c93..9af6ad557 100644 --- a/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js +++ b/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js @@ -3,8 +3,9 @@ const LoopBackContext = require('loopback-context'); describe('ticket makeInvoice()', () => { const userId = 19; - const ticketId = 11; - const clientId = 1102; + const invoiceType = 'R'; + const companyFk = 442; + const invoiceDate = Date.vnNew(); const activeCtx = { getLocale: () => { return 'en'; @@ -20,77 +21,6 @@ describe('ticket makeInvoice()', () => { }); }); - it('should throw an error when invoicing tickets from multiple clients', async() => { - const invoiceOutModel = models.InvoiceOut; - spyOn(invoiceOutModel, 'createPdf'); - - const tx = await models.Ticket.beginTransaction({}); - - let error; - - try { - const options = {transaction: tx}; - const otherClientTicketId = 16; - await models.Ticket.makeInvoice(ctx, [ticketId, otherClientTicketId], options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toEqual(`You can't invoice tickets from multiple clients`); - }); - - it(`should throw an error when invoicing a client without tax data checked`, async() => { - const invoiceOutModel = models.InvoiceOut; - spyOn(invoiceOutModel, 'createPdf'); - - const tx = await models.Ticket.beginTransaction({}); - - let error; - - try { - const options = {transaction: tx}; - - const client = await models.Client.findById(clientId, null, options); - await client.updateAttribute('isTaxDataChecked', false, options); - - await models.Ticket.makeInvoice(ctx, [ticketId], options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toEqual(`This client can't be invoiced`); - }); - - it('should invoice a ticket, then try again to fail', async() => { - const invoiceOutModel = models.InvoiceOut; - spyOn(invoiceOutModel, 'createPdf'); - spyOn(invoiceOutModel, 'invoiceEmail'); - - const tx = await models.Ticket.beginTransaction({}); - - let error; - - try { - const options = {transaction: tx}; - - await models.Ticket.makeInvoice(ctx, [ticketId], options); - await models.Ticket.makeInvoice(ctx, [ticketId], options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toEqual(`Some of the selected tickets are not billable`); - }); - it('should success to invoice a ticket', async() => { const invoiceOutModel = models.InvoiceOut; spyOn(invoiceOutModel, 'createPdf'); @@ -101,10 +31,20 @@ describe('ticket makeInvoice()', () => { try { const options = {transaction: tx}; - const invoice = await models.Ticket.makeInvoice(ctx, [ticketId], options); + const ticketsIds = [11, 16]; + await models.Ticket.rawSql(` + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; + CREATE TEMPORARY TABLE tmp.ticketToInvoice + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT id + FROM vn.ticket + WHERE id IN (?) + `, [ticketsIds], options); - expect(invoice.invoiceFk).toBeDefined(); - expect(invoice.serial).toEqual('T'); + const invoiceId = await models.Ticket.makeInvoice(ctx, invoiceType, companyFk, invoiceDate, options); + + expect(invoiceId).toBeDefined(); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index e5a8e8d94..f0c85ecc4 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -39,4 +39,5 @@ module.exports = function(Self) { require('../methods/ticket/collectionLabel')(Self); require('../methods/ticket/expeditionPalletLabel')(Self); require('../methods/ticket/saveSign')(Self); + require('../methods/ticket/invoiceTickets')(Self); }; diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 17a34ad59..dd518671b 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -275,7 +275,7 @@ class Controller extends Section { }); } - return this.$http.post(`Tickets/makeInvoice`, params) + return this.$http.post(`Tickets/invoiceTickets`, params) .then(() => this.reload()) .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); } diff --git a/modules/ticket/front/descriptor-menu/index.spec.js b/modules/ticket/front/descriptor-menu/index.spec.js index 0aef956db..fbe67d21a 100644 --- a/modules/ticket/front/descriptor-menu/index.spec.js +++ b/modules/ticket/front/descriptor-menu/index.spec.js @@ -191,7 +191,7 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { jest.spyOn(controller.vnApp, 'showSuccess'); const expectedParams = {ticketsIds: [ticket.id]}; - $httpBackend.expectPOST(`Tickets/makeInvoice`, expectedParams).respond(); + $httpBackend.expectPOST(`Tickets/invoiceTickets`, expectedParams).respond(); controller.makeInvoice(); $httpBackend.flush(); diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index 55229eabb..b3afc838c 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -163,7 +163,7 @@ export default class Controller extends Section { makeInvoice() { const ticketsIds = this.checked.map(ticket => ticket.id); - return this.$http.post(`Tickets/makeInvoice`, {ticketsIds}) + return this.$http.post(`Tickets/invoiceTickets`, {ticketsIds}) .then(() => this.$.model.refresh()) .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); } From 56247b50127df6d878d61bf081a2ef1b709c1019 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 09:33:45 +0200 Subject: [PATCH 106/311] add acl --- db/changes/232601/00-aclInvoiceTickets.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 db/changes/232601/00-aclInvoiceTickets.sql diff --git a/db/changes/232601/00-aclInvoiceTickets.sql b/db/changes/232601/00-aclInvoiceTickets.sql new file mode 100644 index 000000000..2c221950e --- /dev/null +++ b/db/changes/232601/00-aclInvoiceTickets.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES('Ticket', 'invoiceTickets', 'WRITE', 'ALLOW', 'ROLE', 'employee'); From da13f0811cf793b115bdd7bc3180162592391f79 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 09:59:11 +0200 Subject: [PATCH 107/311] refs 5887 cambiado drop y create por create or replace --- modules/client/front/credit-management/index.html | 2 +- modules/client/front/summary/index.html | 4 ++-- modules/ticket/back/methods/ticket/invoiceTickets.js | 3 +-- .../back/methods/ticket/specs/canBeInvoiced.spec.js | 12 ++++-------- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/modules/client/front/credit-management/index.html b/modules/client/front/credit-management/index.html index b9064ff69..f66b988f5 100644 --- a/modules/client/front/credit-management/index.html +++ b/modules/client/front/credit-management/index.html @@ -68,7 +68,7 @@ {{::clientInforma.rating}} - {{::clientInforma.recommendedCredit | currency: 'EUR': 2}} + {{::clientInforma.recommendedCredit | currency: 'EUR'}} diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html index 0a15efcd1..15a55ec8c 100644 --- a/modules/client/front/summary/index.html +++ b/modules/client/front/summary/index.html @@ -270,7 +270,7 @@ info="Invoices minus payments plus orders not yet invoiced"> @@ -297,7 +297,7 @@ info="Value from 1 to 20. The higher the better value"> + value="{{$ctrl.summary.recommendedCredit | currency: 'EUR'}}"> diff --git a/modules/ticket/back/methods/ticket/invoiceTickets.js b/modules/ticket/back/methods/ticket/invoiceTickets.js index 780e9eb57..ca1bf15fb 100644 --- a/modules/ticket/back/methods/ticket/invoiceTickets.js +++ b/modules/ticket/back/methods/ticket/invoiceTickets.js @@ -88,8 +88,7 @@ module.exports = function(Self) { const models = Self.app.models; await models.Ticket.rawSql(` - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; - CREATE TEMPORARY TABLE tmp.ticketToInvoice + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketToInvoice (PRIMARY KEY (id)) ENGINE = MEMORY SELECT id diff --git a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js index 42f9b5a9e..538dbc49f 100644 --- a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js +++ b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js @@ -19,8 +19,7 @@ describe('ticket canBeInvoiced()', () => { await ticket.updateAttribute('refFk', 'T1111111', options); await models.Ticket.rawSql(` - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; - CREATE TEMPORARY TABLE tmp.ticketToInvoice + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketToInvoice (PRIMARY KEY (id)) ENGINE = MEMORY SELECT id @@ -52,8 +51,7 @@ describe('ticket canBeInvoiced()', () => { await ticket.updateAttribute('totalWithVat', 0, options); await models.Ticket.rawSql(` - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; - CREATE TEMPORARY TABLE tmp.ticketToInvoice + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketToInvoice (PRIMARY KEY (id)) ENGINE = MEMORY SELECT id @@ -89,8 +87,7 @@ describe('ticket canBeInvoiced()', () => { await ticket.updateAttribute('shipped', shipped, options); await models.Ticket.rawSql(` - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; - CREATE TEMPORARY TABLE tmp.ticketToInvoice + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketToInvoice (PRIMARY KEY (id)) ENGINE = MEMORY SELECT id @@ -118,8 +115,7 @@ describe('ticket canBeInvoiced()', () => { const options = {transaction: tx}; await models.Ticket.rawSql(` - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToInvoice; - CREATE TEMPORARY TABLE tmp.ticketToInvoice + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketToInvoice (PRIMARY KEY (id)) ENGINE = MEMORY SELECT id From d4a4e04f2590d7da33da070f1476a19484e20e22 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 12:33:34 +0200 Subject: [PATCH 108/311] =?UTF-8?q?refs=20#5887=20feat:=20cambiados=20perm?= =?UTF-8?q?isos=20para=20a=C3=B1adir/quitar=20alias=20de=20correo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/methods/vn-user/addAlias.js | 68 ++++++++++++++++++++++++++++ back/methods/vn-user/removeAlias.js | 55 ++++++++++++++++++++++ db/changes/232601/00-aclAddAlias.sql | 11 +++++ 3 files changed, 134 insertions(+) create mode 100644 back/methods/vn-user/addAlias.js create mode 100644 back/methods/vn-user/removeAlias.js create mode 100644 db/changes/232601/00-aclAddAlias.sql diff --git a/back/methods/vn-user/addAlias.js b/back/methods/vn-user/addAlias.js new file mode 100644 index 000000000..a9a5dcb85 --- /dev/null +++ b/back/methods/vn-user/addAlias.js @@ -0,0 +1,68 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethod('addAlias', { + description: 'Add alias if user has grant', + accessType: 'WRITE', + accepts: [ + { + arg: 'ctx', + type: 'Object', + http: {source: 'context'} + }, + { + arg: 'id', + type: 'number', + required: true, + description: 'The user id', + http: {source: 'path'} + }, + { + arg: 'mailAlias', + type: 'number', + description: 'The new alias for user', + required: true + } + ], + http: { + path: `/:id/addAlias`, + verb: 'POST' + } + }); + + Self.addAlias = async function(ctx, id, mailAlias, options) { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const user = await Self.findById(userId, {fields: ['hasGrant']}, myOptions); + + if (!user.hasGrant) + throw new UserError(`You don't have grant privilege`); + + const account = await models.Account.findById(userId, { + fields: ['id'], + include: { + relation: 'aliases', + scope: { + fields: ['mailAlias'] + } + } + }, myOptions); + + const aliases = account.aliases().map(alias => alias.mailAlias); + + const hasAlias = aliases.includes(mailAlias); + if (!hasAlias) + throw new UserError(`You don't have the alias assigned and you can't assign it to another user`); + + return models.MailAliasAccount.create({ + mailAlias: mailAlias, + account: id + }, myOptions); + }; +}; diff --git a/back/methods/vn-user/removeAlias.js b/back/methods/vn-user/removeAlias.js new file mode 100644 index 000000000..4c402cc54 --- /dev/null +++ b/back/methods/vn-user/removeAlias.js @@ -0,0 +1,55 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethod('removeAlias', { + description: 'Add alias if user has grant', + accessType: 'WRITE', + accepts: [ + { + arg: 'ctx', + type: 'Object', + http: {source: 'context'} + }, + { + arg: 'id', + type: 'number', + required: true, + description: 'The user id', + http: {source: 'path'} + }, + { + arg: 'mailAlias', + type: 'number', + description: 'The alias to delete', + required: true + } + ], + http: { + path: `/:id/removeAlias`, + verb: 'POST' + } + }); + + Self.removeAlias = async function(ctx, id, mailAlias, options) { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const canRemoveAlias = await models.ACL.checkAccessAcl(ctx, 'VnUser', 'canRemoveAlias', 'WRITE'); + + if (userId != id && !canRemoveAlias) throw new UserError(`You don't have grant privilege`); + + const mailAliasAccount = await models.MailAliasAccount.findOne({ + where: { + mailAlias: mailAlias, + account: id + } + }, myOptions); + + await mailAliasAccount.destroy(myOptions); + }; +}; diff --git a/db/changes/232601/00-aclAddAlias.sql b/db/changes/232601/00-aclAddAlias.sql new file mode 100644 index 000000000..cc96f5ad8 --- /dev/null +++ b/db/changes/232601/00-aclAddAlias.sql @@ -0,0 +1,11 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('VnUser', 'addAlias', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('VnUser', 'removeAlias', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('VnUser', 'canRemoveAlias', 'WRITE', 'ALLOW', 'ROLE', 'itManagement'); From e1f12bea020fc367cd8002241f5e950680770fe4 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 12:33:44 +0200 Subject: [PATCH 109/311] a --- back/models/vn-user.js | 2 ++ loopback/locale/es.json | 5 +++-- modules/account/front/aliases/index.html | 8 ++------ modules/account/front/aliases/index.js | 16 +++++++++------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/back/models/vn-user.js b/back/models/vn-user.js index b58395acc..12aab585c 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -11,6 +11,8 @@ module.exports = function(Self) { require('../methods/vn-user/validate-token')(Self); require('../methods/vn-user/privileges')(Self); require('../methods/vn-user/renew-token')(Self); + require('../methods/vn-user/addAlias')(Self); + require('../methods/vn-user/removeAlias')(Self); Self.definition.settings.acls = Self.definition.settings.acls.filter(acl => acl.property !== 'create'); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 20a9557e9..63b20995d 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -296,7 +296,8 @@ "Fecha fuera de rango": "Fecha fuera de rango", "Error while generating PDF": "Error al generar PDF", "Error when sending mail to client": "Error al enviar el correo al cliente", - "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico", + "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico", "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", - "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}" + "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", + "You don't have the alias assigned and you can't assign it to another user": "No tienes el alias asignado y no puedes asignarlo a otro usuario" } diff --git a/modules/account/front/aliases/index.html b/modules/account/front/aliases/index.html index 11d546afb..4a73ec873 100644 --- a/modules/account/front/aliases/index.html +++ b/modules/account/front/aliases/index.html @@ -17,9 +17,7 @@ + ng-click="removeConfirm.show(row)"> @@ -32,9 +30,7 @@ translate-attr="{title: 'Add'}" vn-bind="+" ng-click="$ctrl.onAddClick()" - fixed-bottom-right - vn-acl="itManagement" - vn-acl-action="remove"> + fixed-bottom-right> this.refresh()) .then(() => this.vnApp.showSuccess( this.$t('Subscribed to alias!')) @@ -34,11 +33,14 @@ export default class Controller extends Section { } onRemove(row) { - return this.$http.delete(`MailAliasAccounts/${row.id}`) - .then(() => { - this.$.data.splice(this.$.data.indexOf(row), 1); - this.vnApp.showSuccess(this.$t('Unsubscribed from alias!')); - }); + const params = { + mailAlias: row.mailAlias + }; + return this.$http.post(`VnUsers/${this.$params.id}/removeAlias`, params) + .then(() => this.refresh()) + .then(() => this.vnApp.showSuccess( + this.$t('Subscribed to alias!')) + ); } } From 5a5a1ed20bebc4bee8be651903980fe5f4e3c778 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 13:22:54 +0200 Subject: [PATCH 110/311] refs #5887 feat: addback test --- back/methods/vn-user/specs/addAlias.spec.js | 68 +++++++++++++++++++++ modules/account/front/aliases/index.js | 4 +- modules/account/front/aliases/index.spec.js | 9 ++- 3 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 back/methods/vn-user/specs/addAlias.spec.js diff --git a/back/methods/vn-user/specs/addAlias.spec.js b/back/methods/vn-user/specs/addAlias.spec.js new file mode 100644 index 000000000..239d09c94 --- /dev/null +++ b/back/methods/vn-user/specs/addAlias.spec.js @@ -0,0 +1,68 @@ +const {models} = require('vn-loopback/server/server'); + +describe('VnUser addAlias()', () => { + const employeeId = 1; + const sysadminId = 66; + const developerId = 9; + const customerId = 2; + const mailAlias = 1; + it('should throw an error when user not has privileges', async() => { + const ctx = {req: {accessToken: {userId: employeeId}}}; + const tx = await models.VnUser.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + + await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toContain(`You don't have grant privilege`); + }); + + it('should throw an error when user has privileges but not has the role from user', async() => { + const ctx = {req: {accessToken: {userId: sysadminId}}}; + const tx = await models.VnUser.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + + await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toContain(`You don't have the alias assigned and you can't assign it to another user`); + }); + + it('should add an alias', async() => { + const ctx = {req: {accessToken: {userId: developerId}}}; + const tx = await models.VnUser.beginTransaction({}); + + let result; + try { + const options = {transaction: tx}; + + const user = await models.VnUser.findById(developerId, null, options); + await user.updateAttribute('hasGrant', true, options); + + result = await models.VnUser.addAlias(ctx, customerId, mailAlias, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + } + + expect(result.mailAlias).toBe(mailAlias); + expect(result.account).toBe(customerId); + }); +}); diff --git a/modules/account/front/aliases/index.js b/modules/account/front/aliases/index.js index 91d0c6e7c..e0c738ee4 100644 --- a/modules/account/front/aliases/index.js +++ b/modules/account/front/aliases/index.js @@ -38,9 +38,7 @@ export default class Controller extends Section { }; return this.$http.post(`VnUsers/${this.$params.id}/removeAlias`, params) .then(() => this.refresh()) - .then(() => this.vnApp.showSuccess( - this.$t('Subscribed to alias!')) - ); + .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); } } diff --git a/modules/account/front/aliases/index.spec.js b/modules/account/front/aliases/index.spec.js index 466f1e1e9..61f71949c 100644 --- a/modules/account/front/aliases/index.spec.js +++ b/modules/account/front/aliases/index.spec.js @@ -25,8 +25,9 @@ describe('component vnUserAliases', () => { describe('onAddSave()', () => { it('should add the new row', () => { controller.addData = {account: 1}; + controller.$params = {id: 1}; - $httpBackend.expectPOST('MailAliasAccounts').respond(); + $httpBackend.expectPOST('VnUsers/1/addAlias').respond(); $httpBackend.expectGET('MailAliasAccounts').respond('foo'); controller.onAddSave(); $httpBackend.flush(); @@ -41,12 +42,14 @@ describe('component vnUserAliases', () => { {id: 1, alias: 'foo'}, {id: 2, alias: 'bar'} ]; + controller.$params = {id: 1}; - $httpBackend.expectDELETE('MailAliasAccounts/1').respond(); + $httpBackend.expectPOST('VnUsers/1/removeAlias').respond(); + $httpBackend.expectGET('MailAliasAccounts').respond(controller.$.data[1]); controller.onRemove(controller.$.data[0]); $httpBackend.flush(); - expect(controller.$.data).toEqual([{id: 2, alias: 'bar'}]); + expect(controller.$.data).toEqual({id: 2, alias: 'bar'}); expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); From d4217ff8d3c812fc4f42ee04c96aef494843b052 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 13:38:48 +0200 Subject: [PATCH 111/311] refs #5887 correct translations --- back/methods/vn-user/addAlias.js | 4 ++-- loopback/locale/es.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/back/methods/vn-user/addAlias.js b/back/methods/vn-user/addAlias.js index a9a5dcb85..9fe43e713 100644 --- a/back/methods/vn-user/addAlias.js +++ b/back/methods/vn-user/addAlias.js @@ -2,7 +2,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('addAlias', { - description: 'Add alias if user has grant', + description: 'Add an alias if the user has the grant', accessType: 'WRITE', accepts: [ { @@ -58,7 +58,7 @@ module.exports = Self => { const hasAlias = aliases.includes(mailAlias); if (!hasAlias) - throw new UserError(`You don't have the alias assigned and you can't assign it to another user`); + throw new UserError(`You cannot assign an alias that you are not assigned to`); return models.MailAliasAccount.create({ mailAlias: mailAlias, diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 63b20995d..809ed5874 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -299,5 +299,5 @@ "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico", "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", - "You don't have the alias assigned and you can't assign it to another user": "No tienes el alias asignado y no puedes asignarlo a otro usuario" + "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado" } From a215797390f0b2601a51b4e5a21dd30c456ce70f Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 13:39:22 +0200 Subject: [PATCH 112/311] tranalstion --- back/methods/vn-user/removeAlias.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/vn-user/removeAlias.js b/back/methods/vn-user/removeAlias.js index 4c402cc54..0424c3e96 100644 --- a/back/methods/vn-user/removeAlias.js +++ b/back/methods/vn-user/removeAlias.js @@ -2,7 +2,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('removeAlias', { - description: 'Add alias if user has grant', + description: 'Remove alias if the user has the grant', accessType: 'WRITE', accepts: [ { From 6655807d8042cb99de271d40330ebfd6eb652e3f Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 13:50:38 +0200 Subject: [PATCH 113/311] refs #4770 refactor: change acl --- db/changes/232801/00-roadmapACL.sql | 6 ++++-- modules/route/front/roadmap/summary/style.scss | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/db/changes/232801/00-roadmapACL.sql b/db/changes/232801/00-roadmapACL.sql index 8954ecb27..4fc116f86 100644 --- a/db/changes/232801/00-roadmapACL.sql +++ b/db/changes/232801/00-roadmapACL.sql @@ -1,4 +1,6 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES - ('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'employee'), - ('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'employee'); + ('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'palletizerBoss'), + ('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'productionBoss'), + ('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'palletizerBoss'), + ('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'productionBoss'); diff --git a/modules/route/front/roadmap/summary/style.scss b/modules/route/front/roadmap/summary/style.scss index 8e75d3e0b..63b3f625a 100644 --- a/modules/route/front/roadmap/summary/style.scss +++ b/modules/route/front/roadmap/summary/style.scss @@ -1,6 +1,5 @@ @import "variables"; - vn-roadmap-summary .summary { a { display: flex; From 808a9976abcb5ef86115902641a1c8d6337189c7 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 13:53:25 +0200 Subject: [PATCH 114/311] refs #5887 fix: back etst --- back/methods/vn-user/specs/addAlias.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/vn-user/specs/addAlias.spec.js b/back/methods/vn-user/specs/addAlias.spec.js index 239d09c94..ef657a3a8 100644 --- a/back/methods/vn-user/specs/addAlias.spec.js +++ b/back/methods/vn-user/specs/addAlias.spec.js @@ -41,7 +41,7 @@ describe('VnUser addAlias()', () => { await tx.rollback(); } - expect(error.message).toContain(`You don't have the alias assigned and you can't assign it to another user`); + expect(error.message).toContain(`You cannot assign an alias that you are not assigned to`); }); it('should add an alias', async() => { From d7ac20dc6a7df1fe92db107a463e399baf812cd7 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 12 Jul 2023 13:02:27 +0200 Subject: [PATCH 115/311] hotFix(supplier): fix accessToken in before save --- modules/supplier/back/models/supplier.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index 9c78e8590..e88fadc0b 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -103,7 +103,7 @@ module.exports = Self => { const changes = ctx.data || ctx.instance; const orgData = ctx.currentInstance; const loopBackContext = LoopBackContext.getCurrentContext(); - const accessToken = {req: loopBackContext.active.accessToken}; + const accessToken = {req: loopBackContext.active}; const editPayMethodCheck = await Self.app.models.ACL.checkAccessAcl(accessToken, 'Supplier', 'editPayMethodCheck', 'WRITE'); From 510b78c7035eabcef9d51c78816fe3349968f9c5 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 12 Jul 2023 13:08:46 +0200 Subject: [PATCH 116/311] refs #6006 mod dias anteriores --- modules/travel/front/search-panel/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/travel/front/search-panel/index.js b/modules/travel/front/search-panel/index.js index 089953127..f53c15ca8 100644 --- a/modules/travel/front/search-panel/index.js +++ b/modules/travel/front/search-panel/index.js @@ -38,10 +38,12 @@ class Controller extends SearchPanel { applyFilters(param) { if (typeof this.filter.scopeDays === 'number') { - const shippedFrom = Date.vnNew(); + const today = Date.vnNew(); + const shippedFrom = new Date(today.getTime()); + shippedFrom.setDate(today.getDate() - 30); shippedFrom.setHours(0, 0, 0, 0); - const shippedTo = new Date(shippedFrom.getTime()); + const shippedTo = new Date(today.getTime()); shippedTo.setDate(shippedTo.getDate() + this.filter.scopeDays); shippedTo.setHours(23, 59, 59, 999); Object.assign(this.filter, {shippedFrom, shippedTo}); From 954c2f5435518e7b8493d04de2eb312c1ee3f1ed Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 12 Jul 2023 13:12:51 +0200 Subject: [PATCH 117/311] refs #5244 feat: carga valor inicial --- .../core/components/worker-autocomplete/index.js | 10 ++++++---- modules/claim/front/basic-data/index.html | 3 +++ modules/worker/back/methods/worker/search.js | 15 +++++++++------ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/front/core/components/worker-autocomplete/index.js b/front/core/components/worker-autocomplete/index.js index 436959c5d..24cc02797 100755 --- a/front/core/components/worker-autocomplete/index.js +++ b/front/core/components/worker-autocomplete/index.js @@ -7,6 +7,8 @@ export default class WorkerAutocomplete extends Autocomplete { } $onInit() { + super.$onInit(); + let url = 'Workers/search'; if (this.departments) { const parameter = encodeURIComponent(JSON.stringify(this.departments)); @@ -17,11 +19,11 @@ export default class WorkerAutocomplete extends Autocomplete { url: url, searchFunction: function({$search}) { return {and: [ - {'u.active': {neq: false}}, + {'active': {neq: false}}, {or: [ - {'u.name': $search}, - {'u.nickname': {like: '%' + $search + '%'}}, - {'w.code': {like: $search + '%'}} + {'name': $search}, + {'nickname': {like: '%' + $search + '%'}}, + {'code': {like: $search + '%'}} ]} ]}; }, diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index 16e134c60..70be85a8f 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -34,6 +34,9 @@ where="{role: 'salesPerson'}" label="Attended by"> + + { filter = mergeFilters(filter, {where}); } - const stmt = new ParameterizedSQL( - `SELECT DISTINCT w.id, w.code, u.name, u.nickname - FROM worker w - JOIN account.user u ON u.id = w.id - JOIN business b ON b.workerFk = w.id - JOIN department d ON d.id = b.departmentFk`); + const stmt = new ParameterizedSQL(` + SELECT * + FROM( + SELECT DISTINCT w.id, w.code, u.name, u.nickname, u.active + FROM worker w + JOIN account.user u ON u.id = w.id + JOIN business b ON b.workerFk = w.id + JOIN department d ON d.id = b.departmentFk + ) w`); stmt.merge(conn.makeSuffix(filter)); return conn.executeStmt(stmt); From 551d06ee8358554f2c83dbeaf6a1f054e634e2af Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 12 Jul 2023 13:55:57 +0200 Subject: [PATCH 118/311] =?UTF-8?q?refs=20#5887=20para=20eliminar=20sigue?= =?UTF-8?q?=20las=20mismas=20reglas=20que=20para=20a=C3=B1adir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/methods/vn-user/specs/addAlias.spec.js | 8 +-- back/models/vn-user.js | 2 - db/changes/232402/00-hotFix_travelConfig.sql | 32 +++++------ db/changes/232601/00-aclAddAlias.sql | 12 ++--- loopback/locale/es.json | 2 +- .../methods/mail-alias-account}/addAlias.js | 25 +-------- .../mail-alias-account}/removeAlias.js | 6 +-- .../account/back/models/mail-alias-account.js | 53 +++++++++++++++++++ modules/account/front/aliases/index.js | 4 +- modules/account/front/aliases/index.spec.js | 4 +- 10 files changed, 83 insertions(+), 65 deletions(-) rename {back/methods/vn-user => modules/account/back/methods/mail-alias-account}/addAlias.js (58%) rename {back/methods/vn-user => modules/account/back/methods/mail-alias-account}/removeAlias.js (83%) create mode 100644 modules/account/back/models/mail-alias-account.js diff --git a/back/methods/vn-user/specs/addAlias.spec.js b/back/methods/vn-user/specs/addAlias.spec.js index ef657a3a8..880c08139 100644 --- a/back/methods/vn-user/specs/addAlias.spec.js +++ b/back/methods/vn-user/specs/addAlias.spec.js @@ -14,7 +14,7 @@ describe('VnUser addAlias()', () => { try { const options = {transaction: tx}; - await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); + await models.MailAliasAccount.addAlias(ctx, employeeId, mailAlias, options); await tx.rollback(); } catch (e) { @@ -33,7 +33,7 @@ describe('VnUser addAlias()', () => { try { const options = {transaction: tx}; - await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); + await models.MailAliasAccount.addAlias(ctx, employeeId, mailAlias, options); await tx.rollback(); } catch (e) { @@ -41,7 +41,7 @@ describe('VnUser addAlias()', () => { await tx.rollback(); } - expect(error.message).toContain(`You cannot assign an alias that you are not assigned to`); + expect(error.message).toContain(`You cannot assign/remove an alias that you are not assigned to`); }); it('should add an alias', async() => { @@ -55,7 +55,7 @@ describe('VnUser addAlias()', () => { const user = await models.VnUser.findById(developerId, null, options); await user.updateAttribute('hasGrant', true, options); - result = await models.VnUser.addAlias(ctx, customerId, mailAlias, options); + result = await models.MailAliasAccount.addAlias(ctx, customerId, mailAlias, options); await tx.rollback(); } catch (e) { diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 12aab585c..b58395acc 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -11,8 +11,6 @@ module.exports = function(Self) { require('../methods/vn-user/validate-token')(Self); require('../methods/vn-user/privileges')(Self); require('../methods/vn-user/renew-token')(Self); - require('../methods/vn-user/addAlias')(Self); - require('../methods/vn-user/removeAlias')(Self); Self.definition.settings.acls = Self.definition.settings.acls.filter(acl => acl.property !== 'create'); diff --git a/db/changes/232402/00-hotFix_travelConfig.sql b/db/changes/232402/00-hotFix_travelConfig.sql index 65450a74d..2691999dc 100644 --- a/db/changes/232402/00-hotFix_travelConfig.sql +++ b/db/changes/232402/00-hotFix_travelConfig.sql @@ -1,19 +1,19 @@ -CREATE TABLE `vn`.`travelConfig` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `warehouseInFk` smallint(6) unsigned NOT NULL DEFAULT 8 COMMENT 'Warehouse de origen', - `warehouseOutFk` smallint(6) unsigned NOT NULL DEFAULT 60 COMMENT 'Warehouse destino', - `agencyFk` int(11) NOT NULL DEFAULT 1378 COMMENT 'Agencia por defecto', - `companyFk` int(10) unsigned NOT NULL DEFAULT 442 COMMENT 'Compañía por defecto', - PRIMARY KEY (`id`), - KEY `travelConfig_FK` (`warehouseInFk`), - KEY `travelConfig_FK_1` (`warehouseOutFk`), - KEY `travelConfig_FK_2` (`agencyFk`), - KEY `travelConfig_FK_3` (`companyFk`), - CONSTRAINT `travelConfig_FK` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `travelConfig_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `travelConfig_FK_2` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `travelConfig_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +-- CREATE TABLE `vn`.`travelConfig` ( +-- `id` int(11) unsigned NOT NULL AUTO_INCREMENT, +-- `warehouseInFk` smallint(6) unsigned NOT NULL DEFAULT 8 COMMENT 'Warehouse de origen', +-- `warehouseOutFk` smallint(6) unsigned NOT NULL DEFAULT 60 COMMENT 'Warehouse destino', +-- `agencyFk` int(11) NOT NULL DEFAULT 1378 COMMENT 'Agencia por defecto', +-- `companyFk` int(10) unsigned NOT NULL DEFAULT 442 COMMENT 'Compañía por defecto', +-- PRIMARY KEY (`id`), +-- KEY `travelConfig_FK` (`warehouseInFk`), +-- KEY `travelConfig_FK_1` (`warehouseOutFk`), +-- KEY `travelConfig_FK_2` (`agencyFk`), +-- KEY `travelConfig_FK_3` (`companyFk`), +-- CONSTRAINT `travelConfig_FK` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, +-- CONSTRAINT `travelConfig_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, +-- CONSTRAINT `travelConfig_FK_2` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, +-- CONSTRAINT `travelConfig_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES diff --git a/db/changes/232601/00-aclAddAlias.sql b/db/changes/232601/00-aclAddAlias.sql index cc96f5ad8..db2100bed 100644 --- a/db/changes/232601/00-aclAddAlias.sql +++ b/db/changes/232601/00-aclAddAlias.sql @@ -1,11 +1,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES - ('VnUser', 'addAlias', 'WRITE', 'ALLOW', 'ROLE', 'employee'); - -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES - ('VnUser', 'removeAlias', 'WRITE', 'ALLOW', 'ROLE', 'employee'); - -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES - ('VnUser', 'canRemoveAlias', 'WRITE', 'ALLOW', 'ROLE', 'itManagement'); + ('MailAliasAccount', 'addAlias', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('MailAliasAccount', 'removeAlias', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('MailAliasAccount', 'canEditAlias', 'WRITE', 'ALLOW', 'ROLE', 'itManagement'); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 809ed5874..4408b48b5 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -299,5 +299,5 @@ "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico", "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", - "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado" + "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado" } diff --git a/back/methods/vn-user/addAlias.js b/modules/account/back/methods/mail-alias-account/addAlias.js similarity index 58% rename from back/methods/vn-user/addAlias.js rename to modules/account/back/methods/mail-alias-account/addAlias.js index 9fe43e713..74624b63c 100644 --- a/back/methods/vn-user/addAlias.js +++ b/modules/account/back/methods/mail-alias-account/addAlias.js @@ -1,5 +1,3 @@ -const UserError = require('vn-loopback/util/user-error'); - module.exports = Self => { Self.remoteMethod('addAlias', { description: 'Add an alias if the user has the grant', @@ -32,33 +30,12 @@ module.exports = Self => { Self.addAlias = async function(ctx, id, mailAlias, options) { const models = Self.app.models; - const userId = ctx.req.accessToken.userId; - const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - const user = await Self.findById(userId, {fields: ['hasGrant']}, myOptions); - - if (!user.hasGrant) - throw new UserError(`You don't have grant privilege`); - - const account = await models.Account.findById(userId, { - fields: ['id'], - include: { - relation: 'aliases', - scope: { - fields: ['mailAlias'] - } - } - }, myOptions); - - const aliases = account.aliases().map(alias => alias.mailAlias); - - const hasAlias = aliases.includes(mailAlias); - if (!hasAlias) - throw new UserError(`You cannot assign an alias that you are not assigned to`); + await Self.hasGrant(ctx, mailAlias, myOptions); return models.MailAliasAccount.create({ mailAlias: mailAlias, diff --git a/back/methods/vn-user/removeAlias.js b/modules/account/back/methods/mail-alias-account/removeAlias.js similarity index 83% rename from back/methods/vn-user/removeAlias.js rename to modules/account/back/methods/mail-alias-account/removeAlias.js index 0424c3e96..c32911f4d 100644 --- a/back/methods/vn-user/removeAlias.js +++ b/modules/account/back/methods/mail-alias-account/removeAlias.js @@ -32,16 +32,12 @@ module.exports = Self => { Self.removeAlias = async function(ctx, id, mailAlias, options) { const models = Self.app.models; - const userId = ctx.req.accessToken.userId; - const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - const canRemoveAlias = await models.ACL.checkAccessAcl(ctx, 'VnUser', 'canRemoveAlias', 'WRITE'); - - if (userId != id && !canRemoveAlias) throw new UserError(`You don't have grant privilege`); + await Self.hasGrant(ctx, mailAlias, myOptions); const mailAliasAccount = await models.MailAliasAccount.findOne({ where: { diff --git a/modules/account/back/models/mail-alias-account.js b/modules/account/back/models/mail-alias-account.js new file mode 100644 index 000000000..21c70c32e --- /dev/null +++ b/modules/account/back/models/mail-alias-account.js @@ -0,0 +1,53 @@ + +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + require('../methods/account/sync')(Self); + require('../methods/account/sync-by-id')(Self); + require('../methods/account/sync-all')(Self); + require('../methods/account/login')(Self); + require('../methods/account/logout')(Self); + require('../methods/account/change-password')(Self); + require('../methods/account/set-password')(Self); + require('../methods/mail-alias-account/addAlias')(Self); + require('../methods/mail-alias-account/removeAlias')(Self); + + /** + * Checks if current user has + * read privileges over a dms + * + * @param {Object} ctx - Request context + * @param {Interger} mailAlias - mailAlias id + * @param {Object} options - Query options + * @return {Boolean} True for user with grant + */ + Self.hasGrant = async function(ctx, mailAlias, options) { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + + const canEditAlias = await models.ACL.checkAccessAcl(ctx, 'MailAliasAccount', 'canEditAlias', 'WRITE'); + if (canEditAlias) return true; + + const user = await models.VnUser.findById(userId, {fields: ['hasGrant']}, options); + if (!user.hasGrant) + throw new UserError(`You don't have grant privilege`); + + const account = await models.Account.findById(userId, { + fields: ['id'], + include: { + relation: 'aliases', + scope: { + fields: ['mailAlias'] + } + } + }, options); + + const aliases = account.aliases().map(alias => alias.mailAlias); + + const hasAlias = aliases.includes(mailAlias); + if (!hasAlias) + throw new UserError(`You cannot assign/remove an alias that you are not assigned to`); + + return true; + }; +}; diff --git a/modules/account/front/aliases/index.js b/modules/account/front/aliases/index.js index e0c738ee4..b4ada07e5 100644 --- a/modules/account/front/aliases/index.js +++ b/modules/account/front/aliases/index.js @@ -25,7 +25,7 @@ export default class Controller extends Section { } onAddSave() { - return this.$http.post(`VnUsers/${this.$params.id}/addAlias`, this.addData) + return this.$http.post(`MailAliasAccounts/${this.$params.id}/addAlias`, this.addData) .then(() => this.refresh()) .then(() => this.vnApp.showSuccess( this.$t('Subscribed to alias!')) @@ -36,7 +36,7 @@ export default class Controller extends Section { const params = { mailAlias: row.mailAlias }; - return this.$http.post(`VnUsers/${this.$params.id}/removeAlias`, params) + return this.$http.post(`MailAliasAccounts/${this.$params.id}/removeAlias`, params) .then(() => this.refresh()) .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); } diff --git a/modules/account/front/aliases/index.spec.js b/modules/account/front/aliases/index.spec.js index 61f71949c..f72c06ab4 100644 --- a/modules/account/front/aliases/index.spec.js +++ b/modules/account/front/aliases/index.spec.js @@ -27,7 +27,7 @@ describe('component vnUserAliases', () => { controller.addData = {account: 1}; controller.$params = {id: 1}; - $httpBackend.expectPOST('VnUsers/1/addAlias').respond(); + $httpBackend.expectPOST('MailAliasAccounts/1/addAlias').respond(); $httpBackend.expectGET('MailAliasAccounts').respond('foo'); controller.onAddSave(); $httpBackend.flush(); @@ -44,7 +44,7 @@ describe('component vnUserAliases', () => { ]; controller.$params = {id: 1}; - $httpBackend.expectPOST('VnUsers/1/removeAlias').respond(); + $httpBackend.expectPOST('MailAliasAccounts/1/removeAlias').respond(); $httpBackend.expectGET('MailAliasAccounts').respond(controller.$.data[1]); controller.onRemove(controller.$.data[0]); $httpBackend.flush(); From aea5133f399837a4281c446e059f910be9b0530b Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 12 Jul 2023 14:01:39 +0200 Subject: [PATCH 119/311] refs #5877 fix: aply changes --- db/changes/232601/{00-aclAddAlias.sql => 01-aclAddAlias.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/232601/{00-aclAddAlias.sql => 01-aclAddAlias.sql} (100%) diff --git a/db/changes/232601/00-aclAddAlias.sql b/db/changes/232601/01-aclAddAlias.sql similarity index 100% rename from db/changes/232601/00-aclAddAlias.sql rename to db/changes/232601/01-aclAddAlias.sql From c0d329edcab295b2277b1bece04bd344b661a1ab Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 12 Jul 2023 14:04:17 +0200 Subject: [PATCH 120/311] a --- db/changes/232402/00-hotFix_travelConfig.sql | 32 +++++++++---------- .../account/back/models/mail-alias-account.js | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/db/changes/232402/00-hotFix_travelConfig.sql b/db/changes/232402/00-hotFix_travelConfig.sql index 2691999dc..65450a74d 100644 --- a/db/changes/232402/00-hotFix_travelConfig.sql +++ b/db/changes/232402/00-hotFix_travelConfig.sql @@ -1,19 +1,19 @@ --- CREATE TABLE `vn`.`travelConfig` ( --- `id` int(11) unsigned NOT NULL AUTO_INCREMENT, --- `warehouseInFk` smallint(6) unsigned NOT NULL DEFAULT 8 COMMENT 'Warehouse de origen', --- `warehouseOutFk` smallint(6) unsigned NOT NULL DEFAULT 60 COMMENT 'Warehouse destino', --- `agencyFk` int(11) NOT NULL DEFAULT 1378 COMMENT 'Agencia por defecto', --- `companyFk` int(10) unsigned NOT NULL DEFAULT 442 COMMENT 'Compañía por defecto', --- PRIMARY KEY (`id`), --- KEY `travelConfig_FK` (`warehouseInFk`), --- KEY `travelConfig_FK_1` (`warehouseOutFk`), --- KEY `travelConfig_FK_2` (`agencyFk`), --- KEY `travelConfig_FK_3` (`companyFk`), --- CONSTRAINT `travelConfig_FK` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, --- CONSTRAINT `travelConfig_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, --- CONSTRAINT `travelConfig_FK_2` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, --- CONSTRAINT `travelConfig_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE --- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +CREATE TABLE `vn`.`travelConfig` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `warehouseInFk` smallint(6) unsigned NOT NULL DEFAULT 8 COMMENT 'Warehouse de origen', + `warehouseOutFk` smallint(6) unsigned NOT NULL DEFAULT 60 COMMENT 'Warehouse destino', + `agencyFk` int(11) NOT NULL DEFAULT 1378 COMMENT 'Agencia por defecto', + `companyFk` int(10) unsigned NOT NULL DEFAULT 442 COMMENT 'Compañía por defecto', + PRIMARY KEY (`id`), + KEY `travelConfig_FK` (`warehouseInFk`), + KEY `travelConfig_FK_1` (`warehouseOutFk`), + KEY `travelConfig_FK_2` (`agencyFk`), + KEY `travelConfig_FK_3` (`companyFk`), + CONSTRAINT `travelConfig_FK` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `travelConfig_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `travelConfig_FK_2` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `travelConfig_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES diff --git a/modules/account/back/models/mail-alias-account.js b/modules/account/back/models/mail-alias-account.js index 21c70c32e..78ec75326 100644 --- a/modules/account/back/models/mail-alias-account.js +++ b/modules/account/back/models/mail-alias-account.js @@ -14,7 +14,7 @@ module.exports = Self => { /** * Checks if current user has - * read privileges over a dms + * grant to add/remove alias * * @param {Object} ctx - Request context * @param {Interger} mailAlias - mailAlias id From ef6a2ae578988ac536f91fcc7994a0483318983e Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 12 Jul 2023 14:06:28 +0200 Subject: [PATCH 121/311] refs #5887 fix: delete requires --- modules/account/back/models/mail-alias-account.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/account/back/models/mail-alias-account.js b/modules/account/back/models/mail-alias-account.js index 78ec75326..0875bf79a 100644 --- a/modules/account/back/models/mail-alias-account.js +++ b/modules/account/back/models/mail-alias-account.js @@ -2,13 +2,6 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - require('../methods/account/sync')(Self); - require('../methods/account/sync-by-id')(Self); - require('../methods/account/sync-all')(Self); - require('../methods/account/login')(Self); - require('../methods/account/logout')(Self); - require('../methods/account/change-password')(Self); - require('../methods/account/set-password')(Self); require('../methods/mail-alias-account/addAlias')(Self); require('../methods/mail-alias-account/removeAlias')(Self); From 7aaaf5492cebb382e1474ad6a6384843f9ca17e1 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 12 Jul 2023 15:07:06 +0200 Subject: [PATCH 122/311] refs #5887 refacotr: move code to hook --- back/methods/vn-user/specs/addAlias.spec.js | 68 ------------------- db/changes/232601/01-aclAddAlias.sql | 7 +- .../methods/mail-alias-account/addAlias.js | 45 ------------ .../methods/mail-alias-account/removeAlias.js | 51 -------------- .../account/back/models/mail-alias-account.js | 25 ++++--- modules/account/front/aliases/index.js | 14 ++-- modules/account/front/aliases/index.spec.js | 9 +-- 7 files changed, 32 insertions(+), 187 deletions(-) delete mode 100644 back/methods/vn-user/specs/addAlias.spec.js delete mode 100644 modules/account/back/methods/mail-alias-account/addAlias.js delete mode 100644 modules/account/back/methods/mail-alias-account/removeAlias.js diff --git a/back/methods/vn-user/specs/addAlias.spec.js b/back/methods/vn-user/specs/addAlias.spec.js deleted file mode 100644 index 880c08139..000000000 --- a/back/methods/vn-user/specs/addAlias.spec.js +++ /dev/null @@ -1,68 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -describe('VnUser addAlias()', () => { - const employeeId = 1; - const sysadminId = 66; - const developerId = 9; - const customerId = 2; - const mailAlias = 1; - it('should throw an error when user not has privileges', async() => { - const ctx = {req: {accessToken: {userId: employeeId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - await models.MailAliasAccount.addAlias(ctx, employeeId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toContain(`You don't have grant privilege`); - }); - - it('should throw an error when user has privileges but not has the role from user', async() => { - const ctx = {req: {accessToken: {userId: sysadminId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - await models.MailAliasAccount.addAlias(ctx, employeeId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toContain(`You cannot assign/remove an alias that you are not assigned to`); - }); - - it('should add an alias', async() => { - const ctx = {req: {accessToken: {userId: developerId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let result; - try { - const options = {transaction: tx}; - - const user = await models.VnUser.findById(developerId, null, options); - await user.updateAttribute('hasGrant', true, options); - - result = await models.MailAliasAccount.addAlias(ctx, customerId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - } - - expect(result.mailAlias).toBe(mailAlias); - expect(result.account).toBe(customerId); - }); -}); diff --git a/db/changes/232601/01-aclAddAlias.sql b/db/changes/232601/01-aclAddAlias.sql index db2100bed..d4df3cd44 100644 --- a/db/changes/232601/01-aclAddAlias.sql +++ b/db/changes/232601/01-aclAddAlias.sql @@ -1,5 +1,8 @@ +DELETE FROM `salix`.`ACL` WHERE model = 'MailAliasAccount'; + INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES - ('MailAliasAccount', 'addAlias', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - ('MailAliasAccount', 'removeAlias', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('MailAliasAccount', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('MailAliasAccount', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('MailAliasAccount', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'employee'), ('MailAliasAccount', 'canEditAlias', 'WRITE', 'ALLOW', 'ROLE', 'itManagement'); diff --git a/modules/account/back/methods/mail-alias-account/addAlias.js b/modules/account/back/methods/mail-alias-account/addAlias.js deleted file mode 100644 index 74624b63c..000000000 --- a/modules/account/back/methods/mail-alias-account/addAlias.js +++ /dev/null @@ -1,45 +0,0 @@ -module.exports = Self => { - Self.remoteMethod('addAlias', { - description: 'Add an alias if the user has the grant', - accessType: 'WRITE', - accepts: [ - { - arg: 'ctx', - type: 'Object', - http: {source: 'context'} - }, - { - arg: 'id', - type: 'number', - required: true, - description: 'The user id', - http: {source: 'path'} - }, - { - arg: 'mailAlias', - type: 'number', - description: 'The new alias for user', - required: true - } - ], - http: { - path: `/:id/addAlias`, - verb: 'POST' - } - }); - - Self.addAlias = async function(ctx, id, mailAlias, options) { - const models = Self.app.models; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - await Self.hasGrant(ctx, mailAlias, myOptions); - - return models.MailAliasAccount.create({ - mailAlias: mailAlias, - account: id - }, myOptions); - }; -}; diff --git a/modules/account/back/methods/mail-alias-account/removeAlias.js b/modules/account/back/methods/mail-alias-account/removeAlias.js deleted file mode 100644 index c32911f4d..000000000 --- a/modules/account/back/methods/mail-alias-account/removeAlias.js +++ /dev/null @@ -1,51 +0,0 @@ -const UserError = require('vn-loopback/util/user-error'); - -module.exports = Self => { - Self.remoteMethod('removeAlias', { - description: 'Remove alias if the user has the grant', - accessType: 'WRITE', - accepts: [ - { - arg: 'ctx', - type: 'Object', - http: {source: 'context'} - }, - { - arg: 'id', - type: 'number', - required: true, - description: 'The user id', - http: {source: 'path'} - }, - { - arg: 'mailAlias', - type: 'number', - description: 'The alias to delete', - required: true - } - ], - http: { - path: `/:id/removeAlias`, - verb: 'POST' - } - }); - - Self.removeAlias = async function(ctx, id, mailAlias, options) { - const models = Self.app.models; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - await Self.hasGrant(ctx, mailAlias, myOptions); - - const mailAliasAccount = await models.MailAliasAccount.findOne({ - where: { - mailAlias: mailAlias, - account: id - } - }, myOptions); - - await mailAliasAccount.destroy(myOptions); - }; -}; diff --git a/modules/account/back/models/mail-alias-account.js b/modules/account/back/models/mail-alias-account.js index 0875bf79a..6f5213f24 100644 --- a/modules/account/back/models/mail-alias-account.js +++ b/modules/account/back/models/mail-alias-account.js @@ -2,8 +2,17 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - require('../methods/mail-alias-account/addAlias')(Self); - require('../methods/mail-alias-account/removeAlias')(Self); + Self.observe('before save', async ctx => { + const changes = ctx.currentInstance || ctx.instance; + + await Self.hasGrant(ctx, changes.mailAlias); + }); + + Self.observe('before delete', async ctx => { + const mailAliasAccount = await Self.findById(ctx.where.id); + + await Self.hasGrant(ctx, mailAliasAccount.mailAlias); + }); /** * Checks if current user has @@ -11,17 +20,17 @@ module.exports = Self => { * * @param {Object} ctx - Request context * @param {Interger} mailAlias - mailAlias id - * @param {Object} options - Query options * @return {Boolean} True for user with grant */ - Self.hasGrant = async function(ctx, mailAlias, options) { + Self.hasGrant = async function(ctx, mailAlias) { const models = Self.app.models; - const userId = ctx.req.accessToken.userId; + const accessToken = {req: {accessToken: ctx.options.accessToken}}; + const userId = accessToken.req.accessToken.userId; - const canEditAlias = await models.ACL.checkAccessAcl(ctx, 'MailAliasAccount', 'canEditAlias', 'WRITE'); + const canEditAlias = await models.ACL.checkAccessAcl(accessToken, 'MailAliasAccount', 'canEditAlias', 'WRITE'); if (canEditAlias) return true; - const user = await models.VnUser.findById(userId, {fields: ['hasGrant']}, options); + const user = await models.VnUser.findById(userId, {fields: ['hasGrant']}); if (!user.hasGrant) throw new UserError(`You don't have grant privilege`); @@ -33,7 +42,7 @@ module.exports = Self => { fields: ['mailAlias'] } } - }, options); + }); const aliases = account.aliases().map(alias => alias.mailAlias); diff --git a/modules/account/front/aliases/index.js b/modules/account/front/aliases/index.js index b4ada07e5..0fc806a71 100644 --- a/modules/account/front/aliases/index.js +++ b/modules/account/front/aliases/index.js @@ -21,11 +21,12 @@ export default class Controller extends Section { } onAddClick() { + this.addData = {account: this.$params.id}; this.$.dialog.show(); } onAddSave() { - return this.$http.post(`MailAliasAccounts/${this.$params.id}/addAlias`, this.addData) + return this.$http.post(`MailAliasAccounts`, this.addData) .then(() => this.refresh()) .then(() => this.vnApp.showSuccess( this.$t('Subscribed to alias!')) @@ -33,12 +34,11 @@ export default class Controller extends Section { } onRemove(row) { - const params = { - mailAlias: row.mailAlias - }; - return this.$http.post(`MailAliasAccounts/${this.$params.id}/removeAlias`, params) - .then(() => this.refresh()) - .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); + return this.$http.delete(`MailAliasAccounts/${row.id}`) + .then(() => { + this.$.data.splice(this.$.data.indexOf(row), 1); + this.vnApp.showSuccess(this.$t('Unsubscribed from alias!')); + }); } } diff --git a/modules/account/front/aliases/index.spec.js b/modules/account/front/aliases/index.spec.js index f72c06ab4..466f1e1e9 100644 --- a/modules/account/front/aliases/index.spec.js +++ b/modules/account/front/aliases/index.spec.js @@ -25,9 +25,8 @@ describe('component vnUserAliases', () => { describe('onAddSave()', () => { it('should add the new row', () => { controller.addData = {account: 1}; - controller.$params = {id: 1}; - $httpBackend.expectPOST('MailAliasAccounts/1/addAlias').respond(); + $httpBackend.expectPOST('MailAliasAccounts').respond(); $httpBackend.expectGET('MailAliasAccounts').respond('foo'); controller.onAddSave(); $httpBackend.flush(); @@ -42,14 +41,12 @@ describe('component vnUserAliases', () => { {id: 1, alias: 'foo'}, {id: 2, alias: 'bar'} ]; - controller.$params = {id: 1}; - $httpBackend.expectPOST('MailAliasAccounts/1/removeAlias').respond(); - $httpBackend.expectGET('MailAliasAccounts').respond(controller.$.data[1]); + $httpBackend.expectDELETE('MailAliasAccounts/1').respond(); controller.onRemove(controller.$.data[0]); $httpBackend.flush(); - expect(controller.$.data).toEqual({id: 2, alias: 'bar'}); + expect(controller.$.data).toEqual([{id: 2, alias: 'bar'}]); expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); From 69c3a49cce42c1f0d2d07c5b1a24b245a004d3e5 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 13 Jul 2023 08:05:10 +0200 Subject: [PATCH 124/311] warnFix: smtp prevents the sending of emails depending on the condition --- print/core/smtp.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/print/core/smtp.js b/print/core/smtp.js index 276b85401..8c07e7eca 100644 --- a/print/core/smtp.js +++ b/print/core/smtp.js @@ -10,16 +10,17 @@ module.exports = { async send(options) { options.from = `${config.app.senderName} <${config.app.senderEmail}>`; - if (!process.env.NODE_ENV) - options.to = config.app.senderEmail; + const env = process.env.NODE_ENV; + const canSend = env === 'production' || !env || options.force; - if (process.env.NODE_ENV !== 'production' && !options.force) { + if (!canSend || !config.smtp.auth.user) { const notProductionError = {message: 'This not production, this email not sended'}; await this.mailLog(options, notProductionError); + return Promise.resolve(true); } - if (!config.smtp.auth.user) - return Promise.resolve(true); + if (!env) + options.to = config.app.senderEmail; let res; let error; From 3a61bc6052a2137f6590e7092aac6a9d8c4f76b3 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 13 Jul 2023 08:21:17 +0200 Subject: [PATCH 125/311] refs #5887 move changes sql --- db/changes/{232601 => 232602}/01-aclAddAlias.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{232601 => 232602}/01-aclAddAlias.sql (100%) diff --git a/db/changes/232601/01-aclAddAlias.sql b/db/changes/232602/01-aclAddAlias.sql similarity index 100% rename from db/changes/232601/01-aclAddAlias.sql rename to db/changes/232602/01-aclAddAlias.sql From 337ce56a60e7296e49143455f2784de28fe0b68d Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 13 Jul 2023 08:37:11 +0200 Subject: [PATCH 126/311] refs #5887 test exlcuido --- modules/ticket/back/methods/ticket/specs/filter.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index 6cc1a3ad2..510446cab 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -141,6 +141,7 @@ describe('ticket filter()', () => { }); it('should return the tickets that are not pending', async() => { + pending('#6010 test intermitente'); const tx = await models.Ticket.beginTransaction({}); try { From 112d7a84e336b6242ff04a845faf256bb81b71b2 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 13 Jul 2023 09:32:08 +0200 Subject: [PATCH 127/311] solved test --- back/methods/vn-user/specs/addAlias.spec.js | 68 ------------------- modules/ticket/front/descriptor-menu/index.js | 2 +- 2 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 back/methods/vn-user/specs/addAlias.spec.js diff --git a/back/methods/vn-user/specs/addAlias.spec.js b/back/methods/vn-user/specs/addAlias.spec.js deleted file mode 100644 index ef657a3a8..000000000 --- a/back/methods/vn-user/specs/addAlias.spec.js +++ /dev/null @@ -1,68 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -describe('VnUser addAlias()', () => { - const employeeId = 1; - const sysadminId = 66; - const developerId = 9; - const customerId = 2; - const mailAlias = 1; - it('should throw an error when user not has privileges', async() => { - const ctx = {req: {accessToken: {userId: employeeId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toContain(`You don't have grant privilege`); - }); - - it('should throw an error when user has privileges but not has the role from user', async() => { - const ctx = {req: {accessToken: {userId: sysadminId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toContain(`You cannot assign an alias that you are not assigned to`); - }); - - it('should add an alias', async() => { - const ctx = {req: {accessToken: {userId: developerId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let result; - try { - const options = {transaction: tx}; - - const user = await models.VnUser.findById(developerId, null, options); - await user.updateAttribute('hasGrant', true, options); - - result = await models.VnUser.addAlias(ctx, customerId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - } - - expect(result.mailAlias).toBe(mailAlias); - expect(result.account).toBe(customerId); - }); -}); diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 0b47102ac..0fc8488ca 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -270,7 +270,7 @@ class Controller extends Section { }); } - return this.$http.post(`Tickets/invoiceTickets`, params) + return this.$http.post(`Tickets/invoiceTickets`, {ticketsIds: [this.id]}) .then(() => this.reload()) .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); } From 392dc5060a7707c4fa288c7b1b85b67e503903de Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 13 Jul 2023 10:19:12 +0200 Subject: [PATCH 128/311] refs #4770 delete test --- .../route/front/roadmap/card/index.spec.js | 27 ----- .../route/front/roadmap/create/index.spec.js | 107 ------------------ .../route/front/roadmap/index/index.spec.js | 94 --------------- .../route/front/roadmap/main/index.spec.js | 31 ----- modules/ticket/front/descriptor-menu/index.js | 2 +- 5 files changed, 1 insertion(+), 260 deletions(-) delete mode 100644 modules/route/front/roadmap/card/index.spec.js delete mode 100644 modules/route/front/roadmap/create/index.spec.js delete mode 100644 modules/route/front/roadmap/index/index.spec.js delete mode 100644 modules/route/front/roadmap/main/index.spec.js diff --git a/modules/route/front/roadmap/card/index.spec.js b/modules/route/front/roadmap/card/index.spec.js deleted file mode 100644 index ab2314bb9..000000000 --- a/modules/route/front/roadmap/card/index.spec.js +++ /dev/null @@ -1,27 +0,0 @@ -import './index'; - -describe('component vnItemTypeCard', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('item')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - controller = $componentController('vnItemTypeCard', {$element: null}); - })); - - describe('reload()', () => { - it('should reload the controller data', () => { - controller.$params.id = 1; - - const itemType = {id: 1}; - - $httpBackend.expectGET('ItemTypes/1').respond(itemType); - controller.reload(); - $httpBackend.flush(); - - expect(controller.itemType).toEqual(itemType); - }); - }); -}); diff --git a/modules/route/front/roadmap/create/index.spec.js b/modules/route/front/roadmap/create/index.spec.js deleted file mode 100644 index d6d9883a7..000000000 --- a/modules/route/front/roadmap/create/index.spec.js +++ /dev/null @@ -1,107 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher.js'; - -describe('AgencyTerm', () => { - describe('Component vnAgencyTermCreateInvoiceIn', () => { - let controller; - let $scope; - let $httpBackend; - let $httpParamSerializer; - - beforeEach(ngModule('route')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { - $scope = $rootScope.$new(); - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - const $element = angular.element(''); - controller = $componentController('vnAgencyTermCreateInvoiceIn', {$element}); - controller._route = { - id: 1 - }; - })); - - describe('$onChanges()', () => { - it('should update the params data when $params.q is defined', () => { - controller.$params = {q: '{"supplierName": "Plants SL","rows": null}'}; - - const params = {q: '{"supplierName": "Plants SL", "rows": null}'}; - const json = JSON.parse(params.q); - - controller.$onChanges(); - - expect(controller.params).toEqual(json); - }); - }); - - describe('route() setter', () => { - it('should set the ticket data and then call setDefaultParams() and getAllowedContentTypes()', () => { - jest.spyOn(controller, 'setDefaultParams'); - jest.spyOn(controller, 'getAllowedContentTypes'); - controller.route = { - id: 1 - }; - - expect(controller.route).toBeDefined(); - expect(controller.setDefaultParams).toHaveBeenCalledWith(); - expect(controller.getAllowedContentTypes).toHaveBeenCalledWith(); - }); - }); - - describe('getAllowedContentTypes()', () => { - it('should make an HTTP GET request to get the allowed content types', () => { - const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.expect('GET', `DmsContainers/allowedContentTypes`).respond(expectedResponse); - controller.getAllowedContentTypes(); - $httpBackend.flush(); - - expect(controller.allowedContentTypes).toBeDefined(); - expect(controller.allowedContentTypes).toEqual('image/png, image/jpg'); - }); - }); - - describe('setDefaultParams()', () => { - it('should perform a GET query and define the dms property on controller', () => { - const params = {filter: { - where: {code: 'invoiceIn'} - }}; - const serializedParams = $httpParamSerializer(params); - $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 1, code: 'invoiceIn'}); - controller.params = {supplierName: 'Plants SL'}; - controller.setDefaultParams(); - $httpBackend.flush(); - - expect(controller.dms).toBeDefined(); - expect(controller.dms.dmsTypeId).toEqual(1); - }); - }); - - describe('onSubmit()', () => { - it('should make an HTTP POST request to save the form data', () => { - controller.$.watcher = watcher; - - jest.spyOn(controller.$.watcher, 'updateOriginalData'); - const files = [{id: 1, name: 'MyFile'}]; - controller.dms = {files}; - const serializedParams = $httpParamSerializer(controller.dms); - const query = `dms/uploadFile?${serializedParams}`; - controller.params = {rows: null}; - - $httpBackend.expect('POST', query).respond({}); - $httpBackend.expect('POST', 'AgencyTerms/createInvoiceIn').respond({}); - controller.onSubmit(); - $httpBackend.flush(); - }); - }); - - describe('onFileChange()', () => { - it('should set dms hasFileAttached property to true if has any files', () => { - const files = [{id: 1, name: 'MyFile'}]; - controller.onFileChange(files); - $scope.$apply(); - - expect(controller.dms.hasFileAttached).toBeTruthy(); - }); - }); - }); -}); diff --git a/modules/route/front/roadmap/index/index.spec.js b/modules/route/front/roadmap/index/index.spec.js deleted file mode 100644 index 55c40daa5..000000000 --- a/modules/route/front/roadmap/index/index.spec.js +++ /dev/null @@ -1,94 +0,0 @@ -import './index.js'; -import crudModel from 'core/mocks/crud-model'; - -describe('AgencyTerm', () => { - describe('Component vnAgencyTermIndex', () => { - let controller; - let $window; - - beforeEach(ngModule('route')); - - beforeEach(inject(($componentController, _$window_) => { - $window = _$window_; - const $element = angular.element(''); - controller = $componentController('vnAgencyTermIndex', {$element}); - controller.$.model = crudModel; - controller.$.model.data = [ - {supplierFk: 1, totalPrice: null}, - {supplierFk: 1}, - {supplierFk: 2} - ]; - })); - - describe('checked() getter', () => { - it('should return the checked lines', () => { - const data = controller.$.model.data; - data[0].checked = true; - - const checkedRows = controller.checked; - - const firstCheckedRow = checkedRows[0]; - - expect(firstCheckedRow.supplierFk).toEqual(1); - }); - }); - - describe('totalCheked() getter', () => { - it('should return the total checked lines', () => { - const data = controller.$.model.data; - data[0].checked = true; - - const checkedRows = controller.totalChecked; - - expect(checkedRows).toEqual(1); - }); - }); - - describe('preview()', () => { - it('should show the summary dialog', () => { - controller.$.summary = {show: () => {}}; - jest.spyOn(controller.$.summary, 'show'); - - let event = new MouseEvent('click', { - view: $window, - bubbles: true, - cancelable: true - }); - const route = {id: 1}; - - controller.preview(event, route); - - expect(controller.$.summary.show).toHaveBeenCalledWith(); - }); - }); - - describe('createInvoiceIn()', () => { - it('should throw an error if more than one autonomous are checked', () => { - jest.spyOn(controller.vnApp, 'showError'); - const data = controller.$.model.data; - data[0].checked = true; - data[2].checked = true; - - controller.createInvoiceIn(); - - expect(controller.vnApp.showError).toHaveBeenCalled(); - }); - - it('should call the function go() on $state to go to the file management', () => { - jest.spyOn(controller.$state, 'go'); - const data = controller.$.model.data; - data[0].checked = true; - - controller.createInvoiceIn(); - - delete data[0].checked; - const params = JSON.stringify({ - supplierName: data[0].supplierName, - rows: [data[0]] - }); - - expect(controller.$state.go).toHaveBeenCalledWith('route.agencyTerm.createInvoiceIn', {q: params}); - }); - }); - }); -}); diff --git a/modules/route/front/roadmap/main/index.spec.js b/modules/route/front/roadmap/main/index.spec.js deleted file mode 100644 index dcb14ec0e..000000000 --- a/modules/route/front/roadmap/main/index.spec.js +++ /dev/null @@ -1,31 +0,0 @@ -import './index'; - -describe('Item', () => { - describe('Component vnItemType', () => { - let controller; - - beforeEach(ngModule('item')); - - beforeEach(inject($componentController => { - const $element = angular.element(''); - controller = $componentController('vnItemType', {$element}); - })); - - describe('exprBuilder()', () => { - it('should return a filter based on a search by id', () => { - const filter = controller.exprBuilder('search', '123'); - - expect(filter).toEqual({id: '123'}); - }); - - it('should return a filter based on a search by name or code', () => { - const filter = controller.exprBuilder('search', 'Alstroemeria'); - - expect(filter).toEqual({or: [ - {name: {like: '%Alstroemeria%'}}, - {code: {like: '%Alstroemeria%'}}, - ]}); - }); - }); - }); -}); diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 0b47102ac..0fc8488ca 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -270,7 +270,7 @@ class Controller extends Section { }); } - return this.$http.post(`Tickets/invoiceTickets`, params) + return this.$http.post(`Tickets/invoiceTickets`, {ticketsIds: [this.id]}) .then(() => this.reload()) .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); } From c91db1b42922acaccfe7dd562f2b006997b7b8a0 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 13 Jul 2023 10:19:57 +0200 Subject: [PATCH 129/311] a --- back/methods/vn-user/specs/addAlias.spec.js | 68 --------------------- 1 file changed, 68 deletions(-) delete mode 100644 back/methods/vn-user/specs/addAlias.spec.js diff --git a/back/methods/vn-user/specs/addAlias.spec.js b/back/methods/vn-user/specs/addAlias.spec.js deleted file mode 100644 index ef657a3a8..000000000 --- a/back/methods/vn-user/specs/addAlias.spec.js +++ /dev/null @@ -1,68 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -describe('VnUser addAlias()', () => { - const employeeId = 1; - const sysadminId = 66; - const developerId = 9; - const customerId = 2; - const mailAlias = 1; - it('should throw an error when user not has privileges', async() => { - const ctx = {req: {accessToken: {userId: employeeId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toContain(`You don't have grant privilege`); - }); - - it('should throw an error when user has privileges but not has the role from user', async() => { - const ctx = {req: {accessToken: {userId: sysadminId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toContain(`You cannot assign an alias that you are not assigned to`); - }); - - it('should add an alias', async() => { - const ctx = {req: {accessToken: {userId: developerId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let result; - try { - const options = {transaction: tx}; - - const user = await models.VnUser.findById(developerId, null, options); - await user.updateAttribute('hasGrant', true, options); - - result = await models.VnUser.addAlias(ctx, customerId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - } - - expect(result.mailAlias).toBe(mailAlias); - expect(result.account).toBe(customerId); - }); -}); From 660612cb849e9615e09c5fb98abd424b9d37493a Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 13 Jul 2023 10:22:41 +0200 Subject: [PATCH 130/311] refs #5999 url --- modules/client/front/defaulter/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/client/front/defaulter/index.js b/modules/client/front/defaulter/index.js index 95c7622f9..a2efdcb5c 100644 --- a/modules/client/front/defaulter/index.js +++ b/modules/client/front/defaulter/index.js @@ -32,6 +32,7 @@ export default class Controller extends Section { }, { field: 'country', autocomplete: { + url: 'Countries', showField: 'country', valueField: 'country' } From 2627cafc229aa0910e07198e7f19f99d44883c07 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 13 Jul 2023 10:54:22 +0200 Subject: [PATCH 131/311] refs #5999 defaulter country autocomplete --- modules/client/back/methods/defaulter/filter.js | 3 ++- modules/client/back/models/defaulter.json | 4 ++-- modules/client/front/defaulter/index.html | 4 ++-- modules/client/front/defaulter/index.js | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/client/back/methods/defaulter/filter.js b/modules/client/back/methods/defaulter/filter.js index 736c29f9c..ec6088ff0 100644 --- a/modules/client/back/methods/defaulter/filter.js +++ b/modules/client/back/methods/defaulter/filter.js @@ -69,11 +69,12 @@ module.exports = Self => { c.creditInsurance, d.defaulterSinced, cn.country, + c.countryFk, pm.name payMethod FROM vn.defaulter d JOIN vn.client c ON c.id = d.clientFk JOIN vn.country cn ON cn.id = c.countryFk - JOIN vn.payMethod pm ON pm.id = c.payMethodFk + JOIN vn.payMethod pm ON pm.id = c.payMethodFk LEFT JOIN vn.clientObservation co ON co.clientFk = c.id LEFT JOIN account.user u ON u.id = c.salesPersonFk LEFT JOIN account.user uw ON uw.id = co.workerFk diff --git a/modules/client/back/models/defaulter.json b/modules/client/back/models/defaulter.json index 03d68ea71..ef22c2429 100644 --- a/modules/client/back/models/defaulter.json +++ b/modules/client/back/models/defaulter.json @@ -33,7 +33,7 @@ "country": { "type": "belongsTo", "model": "Country", - "foreignKey": "country" + "foreignKey": "countryFk" }, "payMethod": { "type": "belongsTo", @@ -41,4 +41,4 @@ "foreignKey": "payMethod" } } -} \ No newline at end of file +} diff --git a/modules/client/front/defaulter/index.html b/modules/client/front/defaulter/index.html index 4f662b62b..3c66e6459 100644 --- a/modules/client/front/defaulter/index.html +++ b/modules/client/front/defaulter/index.html @@ -57,7 +57,7 @@ Comercial - + Country {{::defaulter.payMethod}} - + {{::defaulter.amount | currency: 'EUR': 2}} Date: Thu, 13 Jul 2023 12:59:02 +0200 Subject: [PATCH 132/311] refs #5244 fix: corregidos errores --- front/core/components/autocomplete/index.js | 9 +++- .../worker-autocomplete/index.spec.js | 54 ------------------- modules/worker/back/methods/worker/search.js | 5 +- 3 files changed, 10 insertions(+), 58 deletions(-) delete mode 100644 front/core/components/worker-autocomplete/index.spec.js diff --git a/front/core/components/autocomplete/index.js b/front/core/components/autocomplete/index.js index b8a0617b3..c78c29398 100755 --- a/front/core/components/autocomplete/index.js +++ b/front/core/components/autocomplete/index.js @@ -152,7 +152,14 @@ export default class Autocomplete extends Field { filter.include = this.include; let json = encodeURIComponent(JSON.stringify(filter)); - this.$http.get(`${this.url}?filter=${json}`).then( + + let url; + if (this.url.includes('?')) + url = `${this.url}&filter=${json}`; + else + url = `${this.url}?filter=${json}`; + + this.$http.get(url).then( json => this.onSelectionRequest(json.data), () => this.onSelectionRequest() ); diff --git a/front/core/components/worker-autocomplete/index.spec.js b/front/core/components/worker-autocomplete/index.spec.js deleted file mode 100644 index 847761179..000000000 --- a/front/core/components/worker-autocomplete/index.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -describe('Component vnAutocomplete', () => { - let $element; - let controller; - let data = {id: 1, name: 'Bruce Wayne'}; - - beforeEach(ngModule('vnCore')); - - beforeEach(inject(($compile, $rootScope) => { - $element = $compile(``)($rootScope); - controller = $element.controller('vnAutocomplete'); - })); - - afterEach(() => { - $element.remove(); - }); - - describe('url() setter', () => { - it(`should set the url property`, () => { - controller.url = '/TestModels'; - - expect(controller.url).toEqual('/TestModels'); - }); - }); - - describe('field() setter/getter', () => { - it(`should set the field property`, () => { - controller.field = 'id'; - - expect(controller.field).toEqual('id'); - }); - }); - - describe('selection property', () => { - beforeEach(() => { - controller.field = data.id; - }); - - it(`should set selection finding an existing item in the initialData property`, () => { - controller.initialData = data; - - expect(controller.selection).toEqual(data); - }); - - it(`should set selection finding an existing item in the data property`, () => { - controller.data = [data]; - - expect(controller.selection).toEqual(data); - }); - - it(`should set selection to null when can't find an existing item in the data property`, () => { - expect(controller.selection).toEqual(null); - }); - }); -}); diff --git a/modules/worker/back/methods/worker/search.js b/modules/worker/back/methods/worker/search.js index 8be9ecc5e..50fe71235 100644 --- a/modules/worker/back/methods/worker/search.js +++ b/modules/worker/back/methods/worker/search.js @@ -36,18 +36,17 @@ module.exports = Self => { }); const allLeaves = await getAllLeaves(ctx, departments); - const where = {'d.id': {inq: allLeaves}}; + const where = {'departmentFk': {inq: allLeaves}}; filter = mergeFilters(filter, {where}); } const stmt = new ParameterizedSQL(` SELECT * FROM( - SELECT DISTINCT w.id, w.code, u.name, u.nickname, u.active + SELECT DISTINCT w.id, w.code, u.name, u.nickname, u.active, b.departmentFk FROM worker w JOIN account.user u ON u.id = w.id JOIN business b ON b.workerFk = w.id - JOIN department d ON d.id = b.departmentFk ) w`); stmt.merge(conn.makeSuffix(filter)); From 75a66571baa3be6244e36b9e7877eaebf8930b76 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 13 Jul 2023 12:59:39 +0200 Subject: [PATCH 133/311] refs #5244 refactor: modificados todos los url='activeWith...' --- modules/claim/front/basic-data/index.html | 15 +++++-------- modules/claim/front/development/index.html | 13 ++++-------- modules/claim/front/search-panel/index.html | 20 ++++++------------ modules/client/front/basic-data/index.html | 21 ++++++++----------- modules/client/front/create/index.html | 21 ++++++++----------- modules/client/front/search-panel/index.html | 11 +++------- .../front/request-search-panel/index.html | 13 ++++-------- .../front/index/search-panel/index.html | 14 +++++-------- modules/order/front/search-panel/index.html | 11 ++++------ modules/route/front/basic-data/index.html | 13 ++---------- modules/route/front/create/index.html | 12 ++++------- modules/route/front/search-panel/index.html | 15 +++++-------- modules/supplier/front/basic-data/index.html | 18 +++++++--------- modules/ticket/front/search-panel/index.html | 14 +++++-------- modules/ticket/front/tracking/edit/index.html | 9 +------- modules/worker/front/basic-data/index.html | 7 ++----- modules/worker/front/create/index.html | 7 ++----- .../front/department/basic-data/index.html | 14 ++++++------- 18 files changed, 83 insertions(+), 165 deletions(-) diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index 70be85a8f..10aa7623a 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -25,17 +25,12 @@ - - + disabled="false" + show-field="nickname" + ng-model="$ctrl.claim.workerFk" + departments="['VT']" + label="Attended by"> - +
@@ -66,16 +66,11 @@ show-field="description" rule> - - + --> - \ No newline at end of file + diff --git a/modules/claim/front/search-panel/index.html b/modules/claim/front/search-panel/index.html index 151a06c8e..fbc527d60 100644 --- a/modules/claim/front/search-panel/index.html +++ b/modules/claim/front/search-panel/index.html @@ -22,26 +22,18 @@ - - {{firstName}} {{name}} - - + - {{firstName}} {{name}} - + - @@ -59,18 +59,15 @@ - - - + - - {{firstName}} {{lastName}} - + departments="['VT']" + show-field="nickname"> + - - {{code}} - {{town.name}} ({{town.province.name}}, + {{code}} - {{town.name}} ({{town.province.name}}, {{town.province.country.country}}) @@ -82,7 +79,7 @@ - {{name}}, {{province.name}} + {{name}}, {{province.name}} ({{province.country.country}}) @@ -150,4 +147,4 @@ - \ No newline at end of file + diff --git a/modules/client/front/search-panel/index.html b/modules/client/front/search-panel/index.html index a02f93882..2105d3a65 100644 --- a/modules/client/front/search-panel/index.html +++ b/modules/client/front/search-panel/index.html @@ -14,17 +14,12 @@ vn-one label="Name" ng-model="filter.name"> - - {{firstName}} {{name}} - + - - {{firstName}} {{lastName}} - + departments="['VT']" + label="Salesperson"> + -
@@ -43,16 +43,12 @@ label="Nickname" ng-model="filter.nickname"> - - {{firstName}} {{name}} - + - - + -

\ No newline at end of file +
diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index c63fee53b..a51a3dbdb 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -8,20 +8,11 @@
- - -
{{::nickname}}
-
{{::name}}
-
-
+ - - + show-field="nickname"> + diff --git a/modules/route/front/search-panel/index.html b/modules/route/front/search-panel/index.html index a78d88d1c..f3d392580 100644 --- a/modules/route/front/search-panel/index.html +++ b/modules/route/front/search-panel/index.html @@ -1,7 +1,7 @@
@@ -15,16 +15,11 @@ - - + show-field="nickname"> + - - + @@ -45,7 +41,7 @@ @@ -63,4 +59,4 @@ ng-click="watcher.loadOriginalData()"> - \ No newline at end of file + diff --git a/modules/ticket/front/search-panel/index.html b/modules/ticket/front/search-panel/index.html index 52bede97f..d80f21531 100644 --- a/modules/ticket/front/search-panel/index.html +++ b/modules/ticket/front/search-panel/index.html @@ -1,7 +1,7 @@
@@ -62,16 +62,12 @@ label="Nickname" ng-model="filter.nickname"> - - {{firstName}} {{name}} - + + ng-model="$ctrl.workerFk"> - - diff --git a/modules/worker/front/basic-data/index.html b/modules/worker/front/basic-data/index.html index d89d88f2e..2d85d018d 100644 --- a/modules/worker/front/basic-data/index.html +++ b/modules/worker/front/basic-data/index.html @@ -37,14 +37,11 @@ - - + - - + - - + - + @@ -78,12 +76,12 @@ label="Fill in days without physical check-ins" ng-model="$ctrl.department.hasToRefill"> - - + + - + From 173ed251c35f3988438754d6bb54db0c9549461f Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 13 Jul 2023 13:45:07 +0200 Subject: [PATCH 134/311] refs #5964 fix supply --- modules/supplier/back/models/supplier.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index 9c78e8590..488b03b0f 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -68,9 +68,9 @@ module.exports = Self => { }; const country = await Self.app.models.Country.findOne(filter); const code = country ? country.code.toLowerCase() : null; - const countryCode = this.nif.toLowerCase().substring(0, 2); + const countryCode = this.nif?.toLowerCase().substring(0, 2); - if (!this.nif || !validateTin(this.nif, code) || (this.isVies && countryCode == code)) + if (!validateTin(this.nif, code) || (this.isVies && countryCode == code)) err(); done(); } @@ -122,7 +122,7 @@ module.exports = Self => { }); async function hasSupplierSameName(err, done) { - if (!this.name || !this.countryFk) done(); + if (!this.name || !this.countryFk) return done(); const supplier = await Self.app.models.Supplier.findOne( { where: { From 765a84e2eb9ec325fc892994d18361796f6dfd7e Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 14 Jul 2023 07:27:04 +0200 Subject: [PATCH 135/311] refs #5819 Added param to call zone_getLeaves --- modules/zone/back/methods/zone/getLeaves.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/zone/back/methods/zone/getLeaves.js b/modules/zone/back/methods/zone/getLeaves.js index a6db3b711..aeed9f3a2 100644 --- a/modules/zone/back/methods/zone/getLeaves.js +++ b/modules/zone/back/methods/zone/getLeaves.js @@ -38,7 +38,7 @@ module.exports = Self => { Object.assign(myOptions, options); const [res] = await Self.rawSql( - `CALL zone_getLeaves(?, ?, ?)`, + `CALL zone_getLeaves(?, ?, ?, FALSE)`, [id, parentId, search], myOptions ); From 6d8b3e346dc99043d23af1c771d3483b80aef386 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 14 Jul 2023 09:40:16 +0200 Subject: [PATCH 136/311] refs #5837 fix filter existingClient France --- modules/client/back/models/client.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index ca279ef71..dc48f9d3d 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -50,9 +50,14 @@ module.exports = Self => { ] } }; - const client = await Self.app.models.Client.findOne(filter); - if (client) - err(); + + const existingClient = await Self.app.models.Client.findOne(filter); + + if (existingClient) { + if (this.countryFk !== 19 && this.socialName === existingClient.socialName) + err(); + } + done(); } From 765c22df969a5ebd8c73907cd30f503a7934ca5e Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 14 Jul 2023 11:30:13 +0200 Subject: [PATCH 137/311] refs #5837 new table --- back/models/country.json | 5 ++++- db/changes/233001/00-noUniqueSocialName.sql | 2 ++ modules/client/back/models/client.js | 3 ++- modules/client/back/models/client.json | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 db/changes/233001/00-noUniqueSocialName.sql diff --git a/back/models/country.json b/back/models/country.json index 8fa25b88e..fd540d819 100644 --- a/back/models/country.json +++ b/back/models/country.json @@ -22,6 +22,9 @@ }, "isUeeMember": { "type": "boolean" + }, + "isSocialNameUnique": { + "type": "boolean" } }, "relations": { @@ -39,4 +42,4 @@ "permission": "ALLOW" } ] -} \ No newline at end of file +} diff --git a/db/changes/233001/00-noUniqueSocialName.sql b/db/changes/233001/00-noUniqueSocialName.sql new file mode 100644 index 000000000..0dc4c832f --- /dev/null +++ b/db/changes/233001/00-noUniqueSocialName.sql @@ -0,0 +1,2 @@ +ALTER TABLE `vn`.`country` +ADD COLUMN `isSocialNameUnique` tinyint(1) NOT NULL DEFAULT 1; diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index dc48f9d3d..089500149 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -54,7 +54,8 @@ module.exports = Self => { const existingClient = await Self.app.models.Client.findOne(filter); if (existingClient) { - if (this.countryFk !== 19 && this.socialName === existingClient.socialName) + console.log(this.isSocialNameUnique); + if (!this.isSocialNameUnique && this.socialName === existingClient.socialName) err(); } diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index 5f56a1ed2..66a67ec2e 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -181,6 +181,11 @@ "model": "Country", "foreignKey": "countryFk" }, + "isSocialNameUnique": { + "type": "belongsTo", + "model": "Country", + "foreignKey": "countryFk" + }, "contactChannel": { "type": "belongsTo", "model": "ContactChannel", From 4a7cfe912204156944dc354db1eb256ef101bfb6 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 14 Jul 2023 11:51:15 +0200 Subject: [PATCH 138/311] fix: workCenter --- modules/worker/front/calendar/index.html | 142 ++++++------ modules/worker/front/calendar/index.js | 7 +- modules/worker/front/card/index.js | 15 +- modules/worker/front/time-control/index.html | 222 ++++++++++--------- modules/worker/front/time-control/index.js | 6 +- 5 files changed, 201 insertions(+), 191 deletions(-) diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index 877add57b..d264e0ebc 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -1,9 +1,9 @@ - - -
+
+ +
-
-
- Autonomous worker -
- -
-
-
{{'Contract' | translate}} #{{$ctrl.businessId}}
-
- {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} + +
+
+
{{'Contract' | translate}} #{{$ctrl.businessId}}
+
+ {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} +
+
+ {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}} +
+
+ {{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}} +
-
- {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}} -
-
- {{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}} -
-
-
-
{{'Year' | translate}} {{$ctrl.year}}
-
- {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}} +
+
{{'Year' | translate}} {{$ctrl.year}}
+
+ {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}} +
+
+ {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}} +
-
- {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}} -
-
-
- + - - + +
- - - - {{absenceType.name}} - -
-
- - - - Festive - - - - - Current day - -
+ ng-click="$ctrl.pick(absenceType)"> + + + + {{absenceType.name}} +
- - - +
+ + + + Festive + + + + + Current day + +
+
+
+ + +
+
+ Autonomous worker +
diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index 87e806cc3..5606ad0ce 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -31,6 +31,8 @@ class Controller extends Section { } set businessId(value) { + if (!this.card.hasWorkCenter) return; + this._businessId = value; if (value) { this.refresh() @@ -64,7 +66,7 @@ class Controller extends Section { set worker(value) { this._worker = value; - if (value && value.hasWorkCenter) { + if (value) { this.getIsSubordinate(); this.getActiveContract(); } @@ -293,5 +295,8 @@ ngModule.vnComponent('vnWorkerCalendar', { controller: Controller, bindings: { worker: '<' + }, + require: { + card: '^vnWorkerCard' } }); diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js index 35f331764..0bf9ae5c4 100644 --- a/modules/worker/front/card/index.js +++ b/modules/worker/front/card/index.js @@ -3,7 +3,7 @@ import ModuleCard from 'salix/components/module-card'; class Controller extends ModuleCard { reload() { - let filter = { + const filter = { include: [ { relation: 'user', @@ -32,13 +32,12 @@ class Controller extends ModuleCard { ] }; - this.$http.get(`Workers/${this.$params.id}`, {filter}) - .then(res => this.worker = res.data) - .then(() => - this.$http.get(`Workers/${this.$params.id}/activeContract`) - .then(res => { - if (res.data) this.worker.hasWorkCenter = res.data.workCenterFk; - })); + return Promise.all([ + this.$http.get(`Workers/${this.$params.id}`, {filter}) + .then(res => this.worker = res.data), + this.$http.get(`Workers/${this.$params.id}/activeContract`) + .then(res => this.hasWorkCenter = res.data.workCenterFk) + ]); } } diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index 5f0855ee6..5d8d2c503 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -4,7 +4,7 @@ filter="::$ctrl.filter" data="$ctrl.hours"> -
+
@@ -105,118 +105,120 @@ ng-show="::$ctrl.isHr"> + + + +
+
+
Hours
+ + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + +
+ + + + Are you sure you want to send it? + + + + + +
Autonomous worker
- - -
-
-
Hours
- - - - -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
- - - - -
- - - - Are you sure you want to send it? - - - - - - diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 90ec33293..38e6721d6 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -141,6 +141,8 @@ class Controller extends Section { ]} }; this.$.model.applyFilter(filter, params).then(() => { + if (!this.card.hasWorkCenter) return; + this.getWorkedHours(this.started, this.ended); this.getAbsences(); }); @@ -151,7 +153,6 @@ class Controller extends Section { } getAbsences() { - if (!this.worker.hasWorkerCenter) return; const fullYear = this.started.getFullYear(); let params = { workerFk: this.$params.id, @@ -486,5 +487,8 @@ ngModule.vnComponent('vnWorkerTimeControl', { controller: Controller, bindings: { worker: '<' + }, + require: { + card: '^vnWorkerCard' } }); From 4f183d1c6a6d52d2cf4f55b7b15baff616e3c830 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 14 Jul 2023 12:18:41 +0200 Subject: [PATCH 139/311] fix: worker.basic-data el boton guardar estava activo al hacer F5 --- db/changes/232802/01-aclAddAlias.sql | 4 +++ modules/worker/front/descriptor/index.html | 37 +++++++++------------- modules/worker/front/descriptor/index.js | 25 +++++---------- 3 files changed, 27 insertions(+), 39 deletions(-) create mode 100644 db/changes/232802/01-aclAddAlias.sql diff --git a/db/changes/232802/01-aclAddAlias.sql b/db/changes/232802/01-aclAddAlias.sql new file mode 100644 index 000000000..149dd6f15 --- /dev/null +++ b/db/changes/232802/01-aclAddAlias.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('WorkerDisableExcluded', '*', 'READ', 'ALLOW', 'ROLE', 'itManagement'), + ('WorkerDisableExcluded', '*', 'WRITE', 'ALLOW', 'ROLE', 'itManagement'); diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index 58ac3d9e6..ea005e1a2 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -5,8 +5,8 @@
- - Click to exclude the user from getting disabled - - - Click to allow the user to be disabled - + + {{$ctrl.workerExcluded + ? 'Click to allow the user to be disabled' + : 'Click to exclude the user from getting disabled'}} +
@@ -84,7 +77,7 @@ - - \ No newline at end of file + diff --git a/modules/worker/front/descriptor/index.js b/modules/worker/front/descriptor/index.js index ef2f64e85..a53528ef2 100644 --- a/modules/worker/front/descriptor/index.js +++ b/modules/worker/front/descriptor/index.js @@ -18,28 +18,19 @@ class Controller extends Descriptor { this.getIsExcluded(); } - get excluded() { - return this.entity.excluded; - } - - set excluded(value) { - this.entity.excluded = value; - } - getIsExcluded() { - this.$http.get(`workerDisableExcludeds/${this.entity.id}/exists`).then(data => { - this.excluded = data.data.exists; + this.$http.get(`WorkerDisableExcludeds/${this.entity.id}/exists`).then(data => { + this.workerExcluded = data.data.exists; }); } handleExcluded() { - if (this.excluded) { - this.$http.delete(`workerDisableExcludeds/${this.entity.id}`); - this.excluded = false; - } else { - this.$http.post(`workerDisableExcludeds`, {workerFk: this.entity.id, dated: new Date}); - this.excluded = true; - } + if (this.workerExcluded) + this.$http.delete(`WorkerDisableExcludeds/${this.entity.id}`); + else + this.$http.post(`WorkerDisableExcludeds`, {workerFk: this.entity.id, dated: new Date}); + + this.workerExcluded = !this.workerExcluded; } loadData() { From 5716acaa3c94b9396553acac874bd9cb58d5c39c Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 14 Jul 2023 13:01:31 +0200 Subject: [PATCH 140/311] fix: test --- modules/worker/front/calendar/index.html | 174 +++++++------- modules/worker/front/calendar/index.spec.js | 5 +- modules/worker/front/time-control/index.html | 219 +++++++++--------- .../worker/front/time-control/index.spec.js | 5 +- 4 files changed, 202 insertions(+), 201 deletions(-) diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index d264e0ebc..1b0560185 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -1,9 +1,9 @@ + +
- -
- -
-
-
{{'Contract' | translate}} #{{$ctrl.businessId}}
-
- {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} -
-
- {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}} -
-
- {{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}} -
-
- -
-
{{'Year' | translate}} {{$ctrl.year}}
-
- {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}} -
-
- {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} - {{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}} -
-
- -
- - - - -
#{{businessFk}}
-
- {{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}} -
-
-
-
-
- - - - - {{absenceType.name}} - -
-
- - - - Festive - - - - - Current day - -
-
-
- -
Autonomous worker
+ +
+
+
{{'Contract' | translate}} #{{$ctrl.businessId}}
+
+ {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}} +
+
+ {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}} +
+
+ {{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays || 0}} {{'days' | translate}} +
+
+
+
{{'Year' | translate}} {{$ctrl.year}}
+
+ {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}} +
+
+ {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} + {{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}} +
+
+ +
+ + + + +
#{{businessFk}}
+
+ {{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}} +
+
+
+
+
+ + + + + {{absenceType.name}} + +
+
+ + + + Festive + + + + + Current day + +
+
+
+ + + diff --git a/modules/worker/front/calendar/index.spec.js b/modules/worker/front/calendar/index.spec.js index 4b78d883b..5d7ae0795 100644 --- a/modules/worker/front/calendar/index.spec.js +++ b/modules/worker/front/calendar/index.spec.js @@ -20,6 +20,9 @@ describe('Worker', () => { controller.absenceType = {id: 1, name: 'Holiday', code: 'holiday', rgb: 'red'}; controller.$params.id = 1106; controller._worker = {id: 1106}; + controller.card = { + hasWorkCenter: true + }; })); describe('year() getter', () => { @@ -74,7 +77,7 @@ describe('Worker', () => { let yesterday = new Date(today.getTime()); yesterday.setDate(yesterday.getDate() - 1); - controller.worker = {id: 1107, hasWorkCenter: true}; + controller.worker = {id: 1107}; expect(controller.getIsSubordinate).toHaveBeenCalledWith(); expect(controller.getActiveContract).toHaveBeenCalledWith(); diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index 5d8d2c503..760b0dafc 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -105,116 +105,6 @@ ng-show="::$ctrl.isHr"> - - - -
-
-
Hours
- - - - -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
- - - - -
- - - - Are you sure you want to send it? - - - - - -
Autonomous worker
+ + +
+
+
Hours
+ + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + +
+ + + + Are you sure you want to send it? + + + + + + diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 0132f50fe..6d8510ba8 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -16,9 +16,8 @@ describe('Component vnWorkerTimeControl', () => { $scope = $rootScope.$new(); $element = angular.element(''); controller = $componentController('vnWorkerTimeControl', {$element, $scope}); - controller.worker = { - hasWorkerCenter: true - + controller.card = { + hasWorkCenter: true }; })); From 93387cae62aed6a12f860fe3207bf656b84d73ac Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 14 Jul 2023 13:07:40 +0200 Subject: [PATCH 141/311] refs #5837 if isSocialNameUnique --- modules/client/back/models/client.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 089500149..163d51fc5 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -42,6 +42,14 @@ module.exports = Self => { async function socialNameIsUnique(err, done) { const filter = { + include: { + relation: 'country', + scope: { + fields: { + isSocialNameUnique: true, + }, + }, + }, where: { and: [ {socialName: this.socialName}, @@ -54,8 +62,8 @@ module.exports = Self => { const existingClient = await Self.app.models.Client.findOne(filter); if (existingClient) { - console.log(this.isSocialNameUnique); - if (!this.isSocialNameUnique && this.socialName === existingClient.socialName) + // eslint-disable-next-line max-len + if (existingClient.country().isSocialNameUnique && this.socialName === existingClient.socialName) err(); } From 6980392ba1a44925b198806c4ec80ee31803a5f1 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 14 Jul 2023 13:11:09 +0200 Subject: [PATCH 142/311] fix: tabulacion --- ...clAddAlias.sql => 01-aclWorkerDisable.sql} | 0 modules/worker/front/calendar/index.html | 24 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) rename db/changes/232802/{01-aclAddAlias.sql => 01-aclWorkerDisable.sql} (100%) diff --git a/db/changes/232802/01-aclAddAlias.sql b/db/changes/232802/01-aclWorkerDisable.sql similarity index 100% rename from db/changes/232802/01-aclAddAlias.sql rename to db/changes/232802/01-aclWorkerDisable.sql diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index 1b0560185..08f63ddf9 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -59,20 +59,20 @@
+ url="Workers/{{$ctrl.$params.id}}/contracts" + fields="['started', 'ended']" + ng-model="$ctrl.businessId" + search-function="{businessFk: $search}" + value-field="businessFk" + order="businessFk DESC" + limit="5">
#{{businessFk}}
@@ -82,10 +82,8 @@
- - + + {{absenceType.name}} From 87f125453d976fbaf9382f0f3a6aaaf484660b35 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 14 Jul 2023 13:35:13 +0200 Subject: [PATCH 143/311] refs #5640 fix mayus quit function --- loopback/locale/es.json | 6 ++++-- modules/client/back/models/client.js | 14 ++++++++++++++ modules/client/front/fiscal-data/index.html | 4 ++-- modules/client/front/fiscal-data/index.js | 6 ------ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 784ff5e6e..55a7e2f82 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -305,5 +305,7 @@ "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", "Valid priorities": "Prioridades válidas: %d", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", - "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado" -} + "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", + "Social name should be uppercase": "Social name should be uppercase", + "Street should be uppercase": "Street should be uppercase" +} \ No newline at end of file diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index ca279ef71..9302d81c7 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -36,6 +36,20 @@ module.exports = Self => { min: 3, max: 10 }); + Self.validatesFormatOf('street', { + message: 'Street should be uppercase', + allowNull: false, + allowBlank: false, + with: /^[^a-z]*$/ + }); + + Self.validatesFormatOf('socialName', { + message: 'Social name should be uppercase', + allowNull: false, + allowBlank: false, + with: /^[^a-z]*$/ + }); + Self.validateAsync('socialName', socialNameIsUnique, { message: 'The company name must be unique' }); diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index 4d001e226..d1de87309 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -33,7 +33,7 @@ ng-model="$ctrl.client.socialName" info="Only letters, numbers and spaces can be used" required="true" - ng-keyup="$ctrl.mayus($event)" + ng-keyup="$ctrl.client.socialName = $ctrl.client.socialName.toUpperCase()" rule> diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index 1599c917b..acad38185 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -177,12 +177,6 @@ export default class Controller extends Section { this.client.provinceFk = response.provinceFk; this.client.countryFk = response.countryFk; } - - mayus(event) { - let input = event.target; - let inputValue = input.value; - input.value = inputValue.toUpperCase(); - } } ngModule.vnComponent('vnClientFiscalData', { From b113052b5c631d1582160deb71f0e6d8388bc81e Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 14 Jul 2023 13:48:36 +0200 Subject: [PATCH 144/311] refs #5640 fixtures and test fix --- db/dump/fixtures.sql | 4 ++-- e2e/paths/03-worker/06_create.spec.js | 2 +- .../client/back/methods/client/specs/createWithUser.spec.js | 4 ++-- modules/worker/back/methods/worker/specs/new.spec.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index fe11d5b64..2e3122c89 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -360,8 +360,8 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`) VALUES - (1101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), diff --git a/e2e/paths/03-worker/06_create.spec.js b/e2e/paths/03-worker/06_create.spec.js index 11d36b3cf..07eb57fe4 100644 --- a/e2e/paths/03-worker/06_create.spec.js +++ b/e2e/paths/03-worker/06_create.spec.js @@ -23,7 +23,7 @@ describe('Worker create path', () => { await page.write(selectors.workerCreate.fi, '78457139E'); await page.write(selectors.workerCreate.phone, '12356789'); await page.write(selectors.workerCreate.postcode, '46680'); - await page.write(selectors.workerCreate.street, 'S/ Doomstadt'); + await page.write(selectors.workerCreate.street, 'S/ DOOMSTADT'); await page.write(selectors.workerCreate.email, 'doctorDoom@marvel.com'); await page.write(selectors.workerCreate.iban, 'ES9121000418450200051332'); diff --git a/modules/client/back/methods/client/specs/createWithUser.spec.js b/modules/client/back/methods/client/specs/createWithUser.spec.js index 69440c1d1..03106acc1 100644 --- a/modules/client/back/methods/client/specs/createWithUser.spec.js +++ b/modules/client/back/methods/client/specs/createWithUser.spec.js @@ -7,8 +7,8 @@ describe('Client Create', () => { email: 'Deadpool@marvel.com', fi: '16195279J', name: 'Wade', - socialName: 'Deadpool Marvel', - street: 'Wall Street', + socialName: 'DEADPOOL MARVEL', + street: 'WALL STREET', city: 'New York', businessTypeFk: 'florist', provinceFk: 1 diff --git a/modules/worker/back/methods/worker/specs/new.spec.js b/modules/worker/back/methods/worker/specs/new.spec.js index b2804c203..1c41d666b 100644 --- a/modules/worker/back/methods/worker/specs/new.spec.js +++ b/modules/worker/back/methods/worker/specs/new.spec.js @@ -24,7 +24,7 @@ describe('Worker new', () => { firstName: 'default', lastNames: 'worker', email: 'defaultWorker@mydomain.com', - street: 'S/ defaultWorkerStreet', + street: 'S/ DEFAULTWORKERSTREET', city: 'defaultWorkerCity', provinceFk: 1, companyFk: 442, From 9097a1dc289decb4e585f14afa3a8408d12d5eb2 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 14 Jul 2023 14:30:08 +0200 Subject: [PATCH 145/311] refs #5941 feat: sendToSuppor component and fix CSS and JSON format --- back/methods/osticket/sendToSupport.js | 34 ++++++++--------- front/core/components/index.js | 1 + front/core/components/snackbar/snackbar.html | 38 ++----------------- front/core/components/snackbar/snackbar.js | 23 ++--------- front/core/components/snackbar/style.scss | 12 ++++++ .../core/components/support-dialog/index.html | 22 +++++++++++ front/core/components/support-dialog/index.js | 27 +++++++++++++ front/core/locale/es.yml | 2 + front/salix/module.js | 3 +- modules/item/back/methods/item/filter.js | 2 - modules/route/front/roadmap/index/index.js | 2 - modules/worker/front/time-control/index.html | 2 +- 12 files changed, 91 insertions(+), 77 deletions(-) create mode 100644 front/core/components/support-dialog/index.html create mode 100644 front/core/components/support-dialog/index.js diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js index 516313ac6..320691e23 100644 --- a/back/methods/osticket/sendToSupport.js +++ b/back/methods/osticket/sendToSupport.js @@ -6,12 +6,6 @@ module.exports = Self => { description: 'Send mail to support', accessType: 'WRITE', accepts: [ - { - arg: 'subject', - type: 'string', - required: true, - description: 'The subject' - }, { arg: 'reason', type: 'string', @@ -34,29 +28,35 @@ module.exports = Self => { } }); - Self.sendToSupport = async(ctx, subject, reason, additionalData) => { + Self.sendToSupport = async(ctx, reason, additionalData) => { const emailUser = await Self.app.models.EmailUser.findById(ctx.req.accessToken.userId, {fields: ['email']}); let html = `Motivo:
${reason}
`; - for (const data in additionalData) { - tryJson(additionalData[data]); - html += `${data}:
${tryJson(additionalData[data])}
`; - } - console.log(subject, reason, additionalData); - console.log(html); + + for (const data in additionalData) + html += `${data}:
${tryParse(additionalData[data])}
`; + + const subjectReason = JSON.parse(additionalData?.httpRequest)?.data?.error; smtp.send({ to: config.app.reportEmail, replyTo: emailUser.email, - subject: '[Support-Salix] ' + subject, + subject: + '[Support-Salix] ' + + additionalData?.frontPath + ' ' + + subjectReason?.name + ':' + + subjectReason?.message, html }); }; - function tryJson(value) { + function tryParse(value) { try { - return JSON.parse(value); - } catch (e) { + try { + value = JSON.parse(value); + } catch {} + return JSON.stringify(value, null, ' ').split('\n').join('
'); + } catch { return value; } } diff --git a/front/core/components/index.js b/front/core/components/index.js index 45d182121..e1b58374e 100644 --- a/front/core/components/index.js +++ b/front/core/components/index.js @@ -55,3 +55,4 @@ import './datalist'; import './contextmenu'; import './rating'; import './smart-table'; +import './support-dialog'; diff --git a/front/core/components/snackbar/snackbar.html b/front/core/components/snackbar/snackbar.html index 41ae6ddbd..a822badc3 100644 --- a/front/core/components/snackbar/snackbar.html +++ b/front/core/components/snackbar/snackbar.html @@ -1,35 +1,5 @@
- - -
-
Open CAU
- - - - - - - - - - - {{'Este cau contiene más información relevante para el equipo de informática' | translate}}: - - -
-
- - - - -
+ + diff --git a/front/core/components/snackbar/snackbar.js b/front/core/components/snackbar/snackbar.js index 19ce4ea54..7f4583188 100644 --- a/front/core/components/snackbar/snackbar.js +++ b/front/core/components/snackbar/snackbar.js @@ -28,15 +28,15 @@ export default class Controller extends Component { shape.element = element; if (data.additionalData) { + this.additionalData = data.additionalData; let supportButton = document.createElement('i'); - supportButton.setAttribute('class', 'material-icons'); - supportButton.addEventListener('click', () => this.onButtonClick(this.$.supportDialog.show())); + supportButton.setAttribute('class', 'material-icons clickable'); + supportButton.addEventListener('click', () => this.$.supportDialog.show()); element.appendChild(supportButton); let buttonIcon = 'support_agent'; buttonIcon = document.createTextNode(buttonIcon); supportButton.appendChild(buttonIcon); - this.$.supportDialog.additionalData = data.additionalData; } if (shape.type) @@ -154,23 +154,6 @@ export default class Controller extends Component { else this.hide(shape); } - - sendToSupport() { - const supportDialog = this.$.supportDialog; - console.log(this.$.supportDialog.subject); - console.log(this.$.supportDialog.reason); - console.log(this.$.supportDialog.additionalData); - console.log({ - subject: supportDialog.subject, - reason: supportDialog.reason, - additionalData: supportDialog.additionalData - }); - this.$http.post('Ostickets/send-to-support', { - subject: supportDialog.subject, - reason: supportDialog.reason, - additionalData: supportDialog.additionalData - }); - } } ngModule.vnComponent('vnSnackbar', { diff --git a/front/core/components/snackbar/style.scss b/front/core/components/snackbar/style.scss index d02886fd1..aed41c4cf 100644 --- a/front/core/components/snackbar/style.scss +++ b/front/core/components/snackbar/style.scss @@ -20,6 +20,10 @@ vn-snackbar .shape { margin-bottom: 15px; color: white; padding: 12px 25px 12px 12px; + display: flex ; + flex-direction: row; + justify-content: center; + align-items: center; & > .text { text-align: center; @@ -64,4 +68,12 @@ vn-snackbar .shape { top: 0; right: 0 } + + .clickable{ + background-color: $color-main; + padding: 6px; + border-radius: 50%; + cursor: pointer; + margin-right: 7px; + } } diff --git a/front/core/components/support-dialog/index.html b/front/core/components/support-dialog/index.html new file mode 100644 index 000000000..87887aa6f --- /dev/null +++ b/front/core/components/support-dialog/index.html @@ -0,0 +1,22 @@ + +
+
Send cau
+ + + + + + + {{'This email contains more relevant information for the IT team' | translate}} + + +
+
+ + + + diff --git a/front/core/components/support-dialog/index.js b/front/core/components/support-dialog/index.js new file mode 100644 index 000000000..eaaab047f --- /dev/null +++ b/front/core/components/support-dialog/index.js @@ -0,0 +1,27 @@ +import ngModule from '../../module'; +import Dialog from '../dialog'; + +export default class Controller extends Dialog { + constructor($element, $, $transclude) { + super($element, $, $transclude); + } + + responseHandler(response) { + this.$http.post('Ostickets/send-to-support', { + reason: this.reason, + additionalData: this.additionalData + }) + .then(() => super.responseHandler(response)) + .then(() => this.vnApp.showSuccess(this.$t('Email sended!'))); + } +} + +Controller.$inject = ['$element', '$scope', '$transclude']; + +ngModule.vnComponent('vnSupportDialog', { + slotTemplate: require('./index.html'), + controller: Controller, + bindings: { + additionalData: ' { Self.remoteMethodCtx('filter', { @@ -89,7 +88,6 @@ module.exports = Self => { const conn = Self.dataSource.connector; const models = Self.app.models; const myOptions = {}; - throw new UserError(`You don't have enough privileges`); if (typeof options == 'object') Object.assign(myOptions, options); diff --git a/modules/route/front/roadmap/index/index.js b/modules/route/front/roadmap/index/index.js index 3ffc5b4b1..c5f5ef9d1 100644 --- a/modules/route/front/roadmap/index/index.js +++ b/modules/route/front/roadmap/index/index.js @@ -46,8 +46,6 @@ class Controller extends Section { } deleteRoadmaps() { - console.log(this.checked); - for (const roadmap of this.checked) { this.$http.delete(`Roadmaps/${roadmap.id}`) .then(() => this.$.model.refresh()) diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index 5f0855ee6..0dc85f144 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -24,7 +24,7 @@ ng-style="::{backgroundColor: weekday.event.color}">
- {{::weekday.event.name}} + {{::weekday.event}}
From 858a3a3a452bc1e9732d52a1bb50f8a95aeea018 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 17 Jul 2023 07:09:31 +0200 Subject: [PATCH 146/311] refs #5941 typo --- modules/worker/front/time-control/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index 0dc85f144..5f0855ee6 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -24,7 +24,7 @@ ng-style="::{backgroundColor: weekday.event.color}">
- {{::weekday.event}} + {{::weekday.event.name}}
From ad5c0218320045413ee44b2d7b7d34accf07d77e Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 17 Jul 2023 07:10:26 +0200 Subject: [PATCH 147/311] refs #5941 duplicate code --- front/salix/module.js | 1 - 1 file changed, 1 deletion(-) diff --git a/front/salix/module.js b/front/salix/module.js index f22ca8a60..2bcac89f9 100644 --- a/front/salix/module.js +++ b/front/salix/module.js @@ -149,7 +149,6 @@ function $exceptionHandler(vnApp, $window, $state, $injector) { if (messageT) message = $translate.instant(messageT); - cause = cause.replace('Possibly unhandled rejection: ', ''); const additonalData = { frontPath: $state.current.name, httpRequest: cause.replace('Possibly unhandled rejection: ', ''), From 6f3cdd3508566050b73c691f29edd92e951b62a7 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 17 Jul 2023 12:30:48 +0200 Subject: [PATCH 148/311] refs #5640 fix e2e back --- db/dump/fixtures.sql | 4 ++-- e2e/paths/02-client/01_create_client.spec.js | 4 ++-- e2e/paths/02-client/12_lock_of_verified_data.spec.js | 2 +- e2e/paths/02-client/19_summary.spec.js | 2 +- loopback/locale/en.json | 6 ++++-- modules/worker/back/methods/worker/specs/new.spec.js | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 2e3122c89..b1e7888a8 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -365,8 +365,8 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), - (1106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), (1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), (1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), (1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), diff --git a/e2e/paths/02-client/01_create_client.spec.js b/e2e/paths/02-client/01_create_client.spec.js index ff2aac6b9..3274ae8f1 100644 --- a/e2e/paths/02-client/01_create_client.spec.js +++ b/e2e/paths/02-client/01_create_client.spec.js @@ -73,8 +73,8 @@ describe('Client create path', () => { it(`should attempt to create a new user with all it's data but wrong email`, async() => { await page.write(selectors.createClientView.name, 'Carol Danvers'); - await page.write(selectors.createClientView.socialName, 'AVG tax'); - await page.write(selectors.createClientView.street, 'Many places'); + await page.write(selectors.createClientView.socialName, 'AVG TAX'); + await page.write(selectors.createClientView.street, 'MANY PLACES'); await page.clearInput(selectors.createClientView.email); await page.write(selectors.createClientView.email, 'incorrect email format'); await page.waitToClick(selectors.createClientView.createButton); diff --git a/e2e/paths/02-client/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js index 7abe15460..2d7ab7541 100644 --- a/e2e/paths/02-client/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client/12_lock_of_verified_data.spec.js @@ -28,7 +28,7 @@ describe('Client lock verified data path', () => { it('should edit the social name', async() => { await page.waitForSelector(selectors.clientFiscalData.socialName); await page.clearInput(selectors.clientFiscalData.socialName); - await page.write(selectors.clientFiscalData.socialName, 'Captain America Civil War'); + await page.write(selectors.clientFiscalData.socialName, 'CAPTAIN AMERICA CIVIL WAR'); await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); diff --git a/e2e/paths/02-client/19_summary.spec.js b/e2e/paths/02-client/19_summary.spec.js index ab39154cf..b3bf43c5c 100644 --- a/e2e/paths/02-client/19_summary.spec.js +++ b/e2e/paths/02-client/19_summary.spec.js @@ -36,7 +36,7 @@ describe('Client summary path', () => { it('should display fiscal address details', async() => { const result = await page.waitToGetProperty(selectors.clientSummary.street, 'innerText'); - expect(result).toContain('20 Ingram Street'); + expect(result).toContain('20 INGRAM STREET'); }); it('should display some fiscal data', async() => { diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 030afbe9e..6f1f72ffb 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -178,5 +178,7 @@ "The renew period has not been exceeded": "The renew period has not been exceeded", "You can not use the same password": "You can not use the same password", "Valid priorities": "Valid priorities: %d", - "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}" -} + "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}", + "Social name should be uppercase": "Social name should be uppercase", + "Street should be uppercase": "Street should be uppercase" +} \ No newline at end of file diff --git a/modules/worker/back/methods/worker/specs/new.spec.js b/modules/worker/back/methods/worker/specs/new.spec.js index 1c41d666b..4dc6c5540 100644 --- a/modules/worker/back/methods/worker/specs/new.spec.js +++ b/modules/worker/back/methods/worker/specs/new.spec.js @@ -20,7 +20,7 @@ describe('Worker new', () => { const employeeId = 1; const defaultWorker = { fi: '78457139E', - name: 'defaultWorker', + name: 'DEFAULTERWORKER', firstName: 'default', lastNames: 'worker', email: 'defaultWorker@mydomain.com', From f24aa2c80130ce509ffc9e7b4e03a5c9b42a211d Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 17 Jul 2023 13:27:27 +0200 Subject: [PATCH 149/311] pop vehicle error --- back/models/invoice-in.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 back/models/invoice-in.js diff --git a/back/models/invoice-in.js b/back/models/invoice-in.js new file mode 100644 index 000000000..6fa1fa0e1 --- /dev/null +++ b/back/models/invoice-in.js @@ -0,0 +1,9 @@ +let UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.rewriteDbError(function(err) { + if (err.code === 'ER_ROW_IS_REFERENCED') + return new UserError(`This invoice has a linked vehicle.`); + return err; + }); +}; From 10e726c48656803a2c076adc066e43bff49a0595 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 17 Jul 2023 13:51:16 +0200 Subject: [PATCH 150/311] move vehicleInvoice --- .../invoiceIn/back/models/invoiceInVehicle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename back/models/invoice-in.js => modules/invoiceIn/back/models/invoiceInVehicle.js (81%) diff --git a/back/models/invoice-in.js b/modules/invoiceIn/back/models/invoiceInVehicle.js similarity index 81% rename from back/models/invoice-in.js rename to modules/invoiceIn/back/models/invoiceInVehicle.js index 6fa1fa0e1..cf45bf741 100644 --- a/back/models/invoice-in.js +++ b/modules/invoiceIn/back/models/invoiceInVehicle.js @@ -2,7 +2,7 @@ let UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.rewriteDbError(function(err) { - if (err.code === 'ER_ROW_IS_REFERENCED') + if (err.code === 'ER_ROW_IS_REFERENCED_2') return new UserError(`This invoice has a linked vehicle.`); return err; }); From a5d1c68511060e930ec2a802542ec591913c728c Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 17 Jul 2023 14:07:45 +0200 Subject: [PATCH 151/311] change err and traduction --- loopback/locale/es.json | 3 ++- modules/invoiceIn/back/models/invoice-in.js | 8 ++++++++ modules/invoiceIn/back/models/invoiceInVehicle.js | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 4086cfa4a..08f5bf765 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -305,5 +305,6 @@ "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", "Valid priorities": "Prioridades válidas: %d", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", - "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado" + "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", + "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado" } diff --git a/modules/invoiceIn/back/models/invoice-in.js b/modules/invoiceIn/back/models/invoice-in.js index 51905ccb8..0efa6c309 100644 --- a/modules/invoiceIn/back/models/invoice-in.js +++ b/modules/invoiceIn/back/models/invoice-in.js @@ -1,3 +1,5 @@ +const UserError = require('vn-loopback/util/user-error'); + module.exports = Self => { require('../methods/invoice-in/filter')(Self); require('../methods/invoice-in/summary')(Self); @@ -7,4 +9,10 @@ module.exports = Self => { require('../methods/invoice-in/invoiceInPdf')(Self); require('../methods/invoice-in/invoiceInEmail')(Self); require('../methods/invoice-in/getSerial')(Self); + Self.rewriteDbError(function(err) { + console.log(err); + if (err.code === 'ER_ROW_IS_REFERENCED_2') + return new UserError(`This invoice has a linked vehicle.`); + return err; + }); }; diff --git a/modules/invoiceIn/back/models/invoiceInVehicle.js b/modules/invoiceIn/back/models/invoiceInVehicle.js index cf45bf741..7fa780142 100644 --- a/modules/invoiceIn/back/models/invoiceInVehicle.js +++ b/modules/invoiceIn/back/models/invoiceInVehicle.js @@ -2,6 +2,7 @@ let UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.rewriteDbError(function(err) { + console.log(err); if (err.code === 'ER_ROW_IS_REFERENCED_2') return new UserError(`This invoice has a linked vehicle.`); return err; From 52f58a92c85f78d978bec7304816bef5b55c2d2f Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 17 Jul 2023 14:11:05 +0200 Subject: [PATCH 152/311] refs err.sqlMessage --- modules/invoiceIn/back/models/invoice-in.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/invoiceIn/back/models/invoice-in.js b/modules/invoiceIn/back/models/invoice-in.js index 0efa6c309..82e0bf078 100644 --- a/modules/invoiceIn/back/models/invoice-in.js +++ b/modules/invoiceIn/back/models/invoice-in.js @@ -10,8 +10,7 @@ module.exports = Self => { require('../methods/invoice-in/invoiceInEmail')(Self); require('../methods/invoice-in/getSerial')(Self); Self.rewriteDbError(function(err) { - console.log(err); - if (err.code === 'ER_ROW_IS_REFERENCED_2') + if (err.code === 'ER_ROW_IS_REFERENCED_2' && err.sqlMessage.includes('vehicleInvoiceIn')) return new UserError(`This invoice has a linked vehicle.`); return err; }); From d2120cdc3d772e49346a4855827b8ff102efbeee Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 17 Jul 2023 14:24:50 +0200 Subject: [PATCH 153/311] refs #5762 feat: multiplatform recover-password and change-password --- back/methods/vn-user/recover-password.js | 9 +++++++-- back/methods/vn-user/sign-in.js | 10 ++-------- back/models/vn-user.js | 11 +++++++---- front/salix/components/change-password/index.js | 14 +++----------- front/salix/components/login/index.js | 2 +- front/salix/routes.js | 2 +- .../back/methods/account/change-password.js | 13 +++++++------ .../methods/account/specs/change-password.spec.js | 14 +++++++------- 8 files changed, 35 insertions(+), 40 deletions(-) diff --git a/back/methods/vn-user/recover-password.js b/back/methods/vn-user/recover-password.js index b87bb14d4..b5d183ba3 100644 --- a/back/methods/vn-user/recover-password.js +++ b/back/methods/vn-user/recover-password.js @@ -7,6 +7,11 @@ module.exports = Self => { type: 'string', description: 'The user name or email', required: true + }, + { + arg: 'directory', + type: 'string', + description: 'The directory for mail' } ], http: { @@ -15,7 +20,7 @@ module.exports = Self => { } }); - Self.recoverPassword = async function(user) { + Self.recoverPassword = async function(user, directory) { const models = Self.app.models; const usesEmail = user.indexOf('@') !== -1; @@ -29,7 +34,7 @@ module.exports = Self => { } try { - await Self.resetPassword({email: user, emailTemplate: 'recover-password'}); + await Self.resetPassword({email: user, emailTemplate: 'recover-password', directory}); } catch (err) { if (err.code === 'EMAIL_NOT_FOUND') return; diff --git a/back/methods/vn-user/sign-in.js b/back/methods/vn-user/sign-in.js index 73cc705de..b9e0d2f70 100644 --- a/back/methods/vn-user/sign-in.js +++ b/back/methods/vn-user/sign-in.js @@ -53,19 +53,13 @@ module.exports = Self => { return Self.validateLogin(user, password); }; - Self.passExpired = async(vnUser, myOptions) => { + Self.passExpired = async vnUser => { const today = Date.vnNew(); today.setHours(0, 0, 0, 0); if (vnUser.passExpired && vnUser.passExpired.getTime() <= today.getTime()) { - const $ = Self.app.models; - const changePasswordToken = await $.AccessToken.create({ - scopes: ['changePassword'], - userId: vnUser.id - }, myOptions); const err = new UserError('Pass expired', 'passExpired'); - changePasswordToken.twoFactor = vnUser.twoFactor ? true : false; - err.details = {token: changePasswordToken}; + err.details = {userId: vnUser.id, twoFactor: vnUser.twoFactor ? true : false}; throw err; } }; diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 11d4bf250..f47dc47e2 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -99,10 +99,13 @@ module.exports = function(Self) { const origin = headers.origin; const user = await Self.app.models.VnUser.findById(info.user.id); + let directory = info.options?.directory ?? '/#!/reset-password?access_token=$token$'; + directory = directory.replace('$token$', info.accessToken.id); + const params = { recipient: info.email, lang: user.lang, - url: `${origin}/#!/reset-password?access_token=${info.accessToken.id}` + url: origin + directory }; const options = Object.assign({}, info.options); @@ -158,9 +161,9 @@ module.exports = function(Self) { } }; - Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls = - Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls - .filter(acl => acl.property != 'changePassword'); + // Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls = + // Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls + // .filter(acl => acl.property != 'changePassword'); // FIXME: https://redmine.verdnatura.es/issues/5761 // Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => { diff --git a/front/salix/components/change-password/index.js b/front/salix/components/change-password/index.js index 797d4dc96..7e30bf54e 100644 --- a/front/salix/components/change-password/index.js +++ b/front/salix/components/change-password/index.js @@ -15,9 +15,6 @@ export default class Controller { } $onInit() { - if (!this.$state.params.id) - this.$state.go('login'); - this.$http.get('UserPasswords/findOne') .then(res => { this.passRequirements = res.data; @@ -25,7 +22,7 @@ export default class Controller { } submit() { - const userId = this.$state.params.userId; + const userId = parseInt(this.$state.params.userId); const oldPassword = this.oldPassword; const newPassword = this.newPassword; const repeatPassword = this.repeatPassword; @@ -36,18 +33,13 @@ export default class Controller { if (newPassword != this.repeatPassword) throw new UserError(`Passwords don't match`); - const headers = { - Authorization: this.$state.params.id - }; - this.$http.patch('Accounts/change-password', { - id: userId, + userId, oldPassword, newPassword, code - }, - {headers} + } ).then(() => { this.vnApp.showSuccess(this.$translate.instant('Password updated!')); this.$state.go('login'); diff --git a/front/salix/components/login/index.js b/front/salix/components/login/index.js index be4fb3926..7d8cd2049 100644 --- a/front/salix/components/login/index.js +++ b/front/salix/components/login/index.js @@ -36,7 +36,7 @@ export default class Controller { const err = req.data?.error; if (err?.code == 'passExpired') - this.$state.go('change-password', err.details.token); + this.$state.go('change-password', err.details); this.loading = false; this.password = ''; diff --git a/front/salix/routes.js b/front/salix/routes.js index 5a2c030bc..8621f83c7 100644 --- a/front/salix/routes.js +++ b/front/salix/routes.js @@ -45,7 +45,7 @@ function config($stateProvider, $urlRouterProvider) { }) .state('change-password', { parent: 'outLayout', - url: '/change-password?id&userId&twoFactor', + url: '/change-password?userId&twoFactor', description: 'Change password', template: '' }) diff --git a/modules/account/back/methods/account/change-password.js b/modules/account/back/methods/account/change-password.js index a739f37d0..49af93110 100644 --- a/modules/account/back/methods/account/change-password.js +++ b/modules/account/back/methods/account/change-password.js @@ -1,12 +1,15 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('changePassword', { + Self.remoteMethod('changePassword', { description: 'Changes the user password', - accessType: 'WRITE', - accessScopes: ['changePassword'], accepts: [ { + arg: 'userId', + type: 'integer', + description: 'The user id', + required: true + }, { arg: 'oldPassword', type: 'string', description: 'The old password', @@ -28,9 +31,7 @@ module.exports = Self => { } }); - Self.changePassword = async function(ctx, oldPassword, newPassword, code, options) { - const userId = ctx.req.accessToken.userId; - + Self.changePassword = async function(userId, oldPassword, newPassword, code, options) { const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); diff --git a/modules/account/back/methods/account/specs/change-password.spec.js b/modules/account/back/methods/account/specs/change-password.spec.js index 045f98493..2fa3010af 100644 --- a/modules/account/back/methods/account/specs/change-password.spec.js +++ b/modules/account/back/methods/account/specs/change-password.spec.js @@ -1,7 +1,7 @@ const {models} = require('vn-loopback/server/server'); describe('account changePassword()', () => { - const ctx = {req: {accessToken: {userId: 70}}}; + const userId = 70; const unauthCtx = { req: { headers: {}, @@ -20,7 +20,7 @@ describe('account changePassword()', () => { try { const options = {transaction: tx}; - await models.Account.changePassword(ctx, 'wrongPassword', 'nightmare.9999', null, options); + await models.Account.changePassword(userId, 'wrongPassword', 'nightmare.9999', null, options); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -37,8 +37,8 @@ describe('account changePassword()', () => { try { const options = {transaction: tx}; - await models.Account.changePassword(ctx, 'nightmare', 'nightmare.9999', null, options); - await models.Account.changePassword(ctx, 'nightmare.9999', 'nightmare.9999', null, options); + await models.Account.changePassword(userId, 'nightmare', 'nightmare.9999', null, options); + await models.Account.changePassword(userId, 'nightmare.9999', 'nightmare.9999', null, options); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -54,7 +54,7 @@ describe('account changePassword()', () => { try { const options = {transaction: tx}; - await models.Account.changePassword(ctx, 'nightmare', 'nightmare.9999', null, options); + await models.Account.changePassword(userId, 'nightmare', 'nightmare.9999', null, options); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -86,8 +86,8 @@ describe('account changePassword()', () => { } try { - const authCode = await models.AuthCode.findOne({where: {userFk: 70}}, options); - await models.Account.changePassword(ctx, 'nightmare', 'nightmare.9999', authCode.code, options); + const authCode = await models.AuthCode.findOne({where: {userFk: userId}}, options); + await models.Account.changePassword(userId, 'nightmare', 'nightmare.9999', authCode.code, options); await tx.rollback(); } catch (e) { await tx.rollback(); From 125d908c5d5395a5ed48900cae4ba062ce17b739 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 17 Jul 2023 14:41:15 +0200 Subject: [PATCH 154/311] refs #5762 uncomment --- back/models/vn-user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/back/models/vn-user.js b/back/models/vn-user.js index f47dc47e2..163649718 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -161,9 +161,9 @@ module.exports = function(Self) { } }; - // Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls = - // Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls - // .filter(acl => acl.property != 'changePassword'); + Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls = + Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls + .filter(acl => acl.property != 'changePassword'); // FIXME: https://redmine.verdnatura.es/issues/5761 // Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => { From 15dee8bef442e17c56375e382c6c5d6ba5f19316 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 17 Jul 2023 15:19:36 +0200 Subject: [PATCH 155/311] refs #5976 refactor: transaferSale call setDeleted --- db/changes/233001/00-setDeleted_acl.sql | 6 ++++++ .../ticket/back/methods/ticket/specs/transferSales.spec.js | 2 ++ modules/ticket/back/methods/ticket/transferSales.js | 7 ++----- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 db/changes/233001/00-setDeleted_acl.sql diff --git a/db/changes/233001/00-setDeleted_acl.sql b/db/changes/233001/00-setDeleted_acl.sql new file mode 100644 index 000000000..1030965dd --- /dev/null +++ b/db/changes/233001/00-setDeleted_acl.sql @@ -0,0 +1,6 @@ +UPDATE `salix`.`ACL` + SET principalId='salesperson' + WHERE + model='Ticket' + AND property='setDeleted' + AND accessType='WRITE'; diff --git a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js index 562688917..61c788b64 100644 --- a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js +++ b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js @@ -5,6 +5,8 @@ describe('sale transferSales()', () => { const userId = 1101; const activeCtx = { accessToken: {userId: userId}, + headers: {origin: ''}, + __: value => value }; const ctx = {req: activeCtx}; diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 0eee50d5f..00fc02f38 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -96,11 +96,8 @@ module.exports = Self => { } const isTicketEmpty = await models.Ticket.isEmpty(id, myOptions); - if (isTicketEmpty) { - await originalTicket.updateAttributes({ - isDeleted: true - }, myOptions); - } + if (isTicketEmpty) + await models.Ticket.setDeleted(ctx, id, myOptions); if (tx) await tx.commit(); From 47e8fab8d9401ce78c6baa04a6c1667f59e786c6 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 17 Jul 2023 19:51:46 +0200 Subject: [PATCH 156/311] refs remove --- modules/invoiceIn/back/models/invoiceInVehicle.js | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 modules/invoiceIn/back/models/invoiceInVehicle.js diff --git a/modules/invoiceIn/back/models/invoiceInVehicle.js b/modules/invoiceIn/back/models/invoiceInVehicle.js deleted file mode 100644 index 7fa780142..000000000 --- a/modules/invoiceIn/back/models/invoiceInVehicle.js +++ /dev/null @@ -1,10 +0,0 @@ -let UserError = require('vn-loopback/util/user-error'); - -module.exports = Self => { - Self.rewriteDbError(function(err) { - console.log(err); - if (err.code === 'ER_ROW_IS_REFERENCED_2') - return new UserError(`This invoice has a linked vehicle.`); - return err; - }); -}; From 3c013110d35a96aadb7f78b226f3de590bf4957a Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 18 Jul 2023 07:32:45 +0200 Subject: [PATCH 157/311] refs #5819 Changed structure sql --- db/dump/structure.sql | 121 ++++++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 47 deletions(-) diff --git a/db/dump/structure.sql b/db/dump/structure.sql index ee5fb40a1..4e7127310 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -77831,7 +77831,7 @@ BEGIN LEAVE cur1Loop; END IF; - CALL zone_getLeaves2(vZoneFk, NULL, NULL); + CALL zone_getLeaves(vZoneFk, NULL, NULL, TRUE); myLoop: LOOP SET vGeoFk = NULL; @@ -77844,7 +77844,7 @@ BEGIN LEAVE myLoop; END IF; - CALL zone_getLeaves2(vZoneFk, vGeoFk, NULL); + CALL zone_getLeaves(vZoneFk, vGeoFk, NULL, TRUE); UPDATE tmp.zoneNodes SET isChecked = TRUE WHERE geoFk = vGeoFk; @@ -78130,55 +78130,58 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves`(vSelf INT, vParentFk INT, vSearch VARCHAR(255)) -BEGIN +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getLeaves`( + vSelf INT, + vParentFk INT, + vSearch VARCHAR(255), + vHasInsert BOOL +) +BEGIN /** * Devuelve las ubicaciones incluidas en la ruta y que sean hijos de parentFk. * @param vSelf Id de la zona * @param vParentFk Id del geo a calcular - * @param vSearch cadena a buscar + * @param vSearch Cadena a buscar + * @param vHasInsert Indica si inserta en tmp.zoneNodes + * Optional @table tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) */ DECLARE vIsNumber BOOL; - DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; + DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch <> ''; - DROP TEMPORARY TABLE IF EXISTS tNodes; - CREATE TEMPORARY TABLE tNodes + CREATE OR REPLACE TEMPORARY TABLE tNodes (UNIQUE (id)) ENGINE = MEMORY - SELECT id - FROM zoneGeo + SELECT id + FROM zoneGeo LIMIT 0; IF vIsSearch THEN SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - + INSERT INTO tNodes - SELECT id + SELECT id FROM zoneGeo WHERE (vIsNumber AND `name` = vSearch) OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) LIMIT 1000; - + ELSEIF vParentFk IS NULL THEN INSERT INTO tNodes - SELECT geoFk + SELECT geoFk FROM zoneIncluded WHERE zoneFk = vSelf; END IF; IF vParentFk IS NULL THEN - DROP TEMPORARY TABLE IF EXISTS tChilds; - CREATE TEMPORARY TABLE tChilds + CREATE OR REPLACE TEMPORARY TABLE tChilds + (INDEX(id)) ENGINE = MEMORY - SELECT id - FROM tNodes; + SELECT id FROM tNodes; - DROP TEMPORARY TABLE IF EXISTS tParents; - CREATE TEMPORARY TABLE tParents + CREATE OR REPLACE TEMPORARY TABLE tParents + (INDEX(id)) ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; + SELECT id FROM zoneGeo LIMIT 0; myLoop: LOOP DELETE FROM tParents; @@ -78186,43 +78189,67 @@ BEGIN SELECT parentFk id FROM zoneGeo g JOIN tChilds c ON c.id = g.id - WHERE g.parentFk IS NOT NULL; - + WHERE g.parentFk IS NOT NULL; + INSERT IGNORE INTO tNodes - SELECT id - FROM tParents; - - IF ROW_COUNT() = 0 THEN + SELECT id FROM tParents; + + IF NOT ROW_COUNT() THEN LEAVE myLoop; END IF; - + DELETE FROM tChilds; INSERT INTO tChilds - SELECT id - FROM tParents; + SELECT id FROM tParents; END LOOP; - + DROP TEMPORARY TABLE tChilds, tParents; END IF; - IF !vIsSearch THEN + IF NOT vIsSearch THEN INSERT IGNORE INTO tNodes - SELECT id + SELECT id FROM zoneGeo WHERE parentFk <=> vParentFk; END IF; - SELECT g.id, - g.name, - g.parentFk, - g.sons, - isIncluded selected - FROM zoneGeo g - JOIN tNodes n ON n.id = g.id - LEFT JOIN zoneIncluded i ON i.geoFk = g.id AND i.zoneFk = vSelf - ORDER BY `depth`, selected DESC, name; + CREATE OR REPLACE TEMPORARY TABLE tZones + SELECT g.id, + g.name, + g.parentFk, + g.sons, + NOT g.sons OR `type` = 'country' isChecked, + i.isIncluded selected, + g.`depth`, + vSelf + FROM zoneGeo g + JOIN tNodes n ON n.id = g.id + LEFT JOIN zoneIncluded i ON i.geoFk = g.id + AND i.zoneFk = vSelf + ORDER BY g.`depth`, selected DESC, g.name; - DROP TEMPORARY TABLE tNodes; + IF vHasInsert THEN + INSERT IGNORE INTO tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) + SELECT id, + name, + parentFk, + sons, + isChecked, + vSelf + FROM tZones + WHERE selected + OR (selected IS NULL AND vParentFk IS NOT NULL); + ELSE + SELECT id, + name, + parentFk, + sons, + selected + FROM tZones + ORDER BY `depth`, selected DESC, name; + END IF; + + DROP TEMPORARY TABLE tNodes, tZones; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -78540,7 +78567,7 @@ BEGIN INDEX(geoFk)) ENGINE = MEMORY; - CALL zone_getLeaves2(vSelf, NULL , NULL); + CALL zone_getLeaves(vSelf, NULL , NULL, TRUE); UPDATE tmp.zoneNodes zn SET isChecked = 0 @@ -78553,7 +78580,7 @@ BEGIN WHERE NOT isChecked LIMIT 1; - CALL zone_getLeaves2(vSelf, vGeoFk, NULL); + CALL zone_getLeaves(vSelf, vGeoFk, NULL, TRUE); UPDATE tmp.zoneNodes SET isChecked = TRUE WHERE geoFk = vGeoFk; From 834e4b3723d3d3c9ed569f1397a4d75d475a59e0 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Jul 2023 07:56:44 +0200 Subject: [PATCH 158/311] refs #4734 refactor: variables definindas --- back/methods/viaexpress-config/renderer.js | 40 +++++--------------- back/methods/viaexpress-config/template.ejs | 42 ++++++++++----------- back/models/viaexpress-config.json | 6 +-- db/changes/232601/00-viaexpress.sql | 6 +-- 4 files changed, 37 insertions(+), 57 deletions(-) diff --git a/back/methods/viaexpress-config/renderer.js b/back/methods/viaexpress-config/renderer.js index 4014dd42d..e9abce5ca 100644 --- a/back/methods/viaexpress-config/renderer.js +++ b/back/methods/viaexpress-config/renderer.js @@ -24,7 +24,7 @@ module.exports = Self => { const models = Self.app.models; const viaexpressConfig = await models.ViaexpressConfig.findOne({ - fields: ['clientViaexpress', 'userViaexpress', 'passwordViaexpress', 'defaultWeight', 'deliveryType'] + fields: ['client', 'user', 'password', 'defaultWeight', 'deliveryType'] }); const expedition = await models.Expedition.findOne({ @@ -107,36 +107,16 @@ module.exports = Self => { ] }); - const shipped = expedition.ticket().shipped; - + const ticket = expedition.ticket(); + const sender = ticket.company().client(); + const shipped = ticket.shipped.toISOString(); const data = { - defaultWeight: viaexpressConfig.defaultWeight, - date: shipped.toISOString(), // const date = new Date().toISOString(); - deliveryType: viaexpressConfig.deliveryType, - senderName: expedition.ticket().company().client().socialName, - senderStreet: expedition.ticket().company().client().defaultAddress().street, - senderPostalCode: expedition.ticket().company().client().defaultAddress().postalCode, - senderCity: expedition.ticket().company().client().defaultAddress().city, - senderProvince: expedition.ticket().company().client().defaultAddress().province().name, - senderPhone: expedition.ticket().company().client().defaultAddress().mobile - || expedition.ticket().company().client().defaultAddress().phone - || expedition.ticket().company().client().mobile - || expedition.ticket().company().client().phone, - senderEmail: expedition.ticket().company().client().email, - receiverName: expedition.ticket().address().nickname, - receiverStreet: expedition.ticket().address().street, - receiverPostalCode: expedition.ticket().address().postalCode, - receiverCity: expedition.ticket().address().city, - receiverProvince: expedition.ticket().address().province().name, - receiverPhone: expedition.ticket().address().mobile - || expedition.ticket().address().phone - || expedition.ticket().client().mobile - || expedition.ticket().client().phone, - receiverEmail: expedition.ticket().client().email, - receiverCountry: expedition.ticket().address().province().country().code, - clientViaexpress: viaexpressConfig.clientViaexpress, - userViaexpress: viaexpressConfig.userViaexpress, - passwordViaexpress: viaexpressConfig.passwordViaexpress + viaexpressConfig, + sender, + senderAddress: sender.defaultAddress(), + client: ticket.client(), + address: ticket.address(), + shipped }; const template = fs.readFileSync(__dirname + '/template.ejs', 'utf-8'); diff --git a/back/methods/viaexpress-config/template.ejs b/back/methods/viaexpress-config/template.ejs index e8b1f1977..0b6eb468c 100644 --- a/back/methods/viaexpress-config/template.ejs +++ b/back/methods/viaexpress-config/template.ejs @@ -3,12 +3,12 @@ - <%= defaultWeight %> + <%= viaexpressConfig.defaultWeight %> 1 0 - <%= date %> + <%= shipped %> 0 - <%= deliveryType %> + <%= viaexpressConfig.deliveryType %> 0 0 0 @@ -20,31 +20,31 @@ - <%= senderName %> - <%= senderStreet %> - <%= senderPostalCode %> - <%= senderCity %> - <%= senderProvince %> + <%= sender.socialName %> + <%= senderAddress.street %> + <%= senderAddress.postalCode %> + <%= senderAddress.city %> + <%= senderAddress.province().name %> - <%= senderPhone %> - <%= senderEmail %> + <%= senderAddress.mobile || senderAddress.phone || sender.mobile || sender.phone %> + <%= sender.email %> - <%= receiverName %> - <%= receiverStreet %> - <%= receiverPostalCode %> - <%= receiverCity %> + <%= address.nickname %> + <%= address.street %> + <%= address.postalCode %> + <%= address.city %> - <%= receiverProvince %> + <%= address.province().name %> - <%= receiverPhone %> - <%= receiverEmail %> - <%= receiverCountry %> + <%= address.mobile || address.phone || client.mobile || client.phone %> + <%= client.email %> + <%= address.province().country().code %> - <%= clientViaexpress %> - <%= userViaexpress %> - <%= passwordViaexpress %> + <%= viaexpressConfig.client %> + <%= viaexpressConfig.user %> + <%= viaexpressConfig.password %> diff --git a/back/models/viaexpress-config.json b/back/models/viaexpress-config.json index 26d6c8e37..8df24201b 100644 --- a/back/models/viaexpress-config.json +++ b/back/models/viaexpress-config.json @@ -15,13 +15,13 @@ "type": "string", "required": true }, - "clientViaexpress": { + "client": { "type": "string" }, - "userViaexpress": { + "user": { "type": "string" }, - "passwordViaexpress": { + "password": { "type": "string" }, "defaultWeight": { diff --git a/db/changes/232601/00-viaexpress.sql b/db/changes/232601/00-viaexpress.sql index 9e3baa9fd..42cf3b647 100644 --- a/db/changes/232601/00-viaexpress.sql +++ b/db/changes/232601/00-viaexpress.sql @@ -1,9 +1,9 @@ CREATE TABLE `vn`.`viaexpressConfig` ( id int auto_increment NOT NULL, url varchar(100) NOT NULL, - clientViaexpress varchar(100) NOT NULL, - userViaexpress varchar(100) NOT NULL, - passwordViaexpress varchar(100) NOT NULL, + client varchar(100) NOT NULL, + user varchar(100) NOT NULL, + password varchar(100) NOT NULL, defaultWeight decimal(10,2) NOT NULL, deliveryType varchar(5) NOT NULL, CONSTRAINT viaexpressConfig_PK PRIMARY KEY (id) From 93da12923959e0b829871d30e08b1e157f3b6e7c Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 18 Jul 2023 08:54:45 +0200 Subject: [PATCH 159/311] refs #5983 feat(itemShelving): add getInventory --- .../233001/00-itemShelving_inventory.sql | 52 +++++++++++++++++++ .../methods/item-shelving/getInventory.js | 37 +++++++++++++ .../item-shelving/specs/getInventory.spec.js | 19 +++++++ modules/item/back/models/item-shelving.js | 1 + 4 files changed, 109 insertions(+) create mode 100644 db/changes/233001/00-itemShelving_inventory.sql create mode 100644 modules/item/back/methods/item-shelving/getInventory.js create mode 100644 modules/item/back/methods/item-shelving/specs/getInventory.spec.js diff --git a/db/changes/233001/00-itemShelving_inventory.sql b/db/changes/233001/00-itemShelving_inventory.sql new file mode 100644 index 000000000..b2a2ff321 --- /dev/null +++ b/db/changes/233001/00-itemShelving_inventory.sql @@ -0,0 +1,52 @@ + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_inventory`(vParkingFromFk INT, vParkingToFk INT) +/** + * Devuelve un listado de ubicaciones a revisar + * + * @param vParkingFromFk Parking de partida, identificador de vn.parking + * @param vParkingToFk Parking de llegada, identificador de vn.parking +*/ + + DECLARE vSectorFk INT; + DECLARE vPickingOrderFrom INT; + DECLARE vPickingOrderTo INT; + + SELECT ish.id, + p.pickingOrder, + p.code parking, + ish.shelvingFk, + ish.itemFk, + i.longName, + ish.visible, + p.sectorFk, + it.workerFk buyer, + CONCAT('http:',ic.url, '/catalog/1600x900/',i.image) urlImage, + ish.isChecked, + CASE + WHEN s.notPrepared > sm.parked THEN 0 + WHEN sm.visible > sm.parked THEN 1 + ELSE 2 + END + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN (SELECT s.itemFk, sum(s.quantity) notPrepared + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE t.shipped BETWEEN CURDATE() + AND CURDATE() + INTERVAL 23 HOUR + AND s.isPicked = FALSE + AND w.name = 'Algemesi' + GROUP BY s.itemFk) s ON s.itemFk = i.id + JOIN hedera.imageConfig ic + WHERE p.pickingOrder BETWEEN vParkingFrom AND vPickingOrderTo + AND p.sectorFk = vSectorFk + ORDER BY p.pickingOrder; + +END ;; +DELIMITER ; diff --git a/modules/item/back/methods/item-shelving/getInventory.js b/modules/item/back/methods/item-shelving/getInventory.js new file mode 100644 index 000000000..144bd83e7 --- /dev/null +++ b/modules/item/back/methods/item-shelving/getInventory.js @@ -0,0 +1,37 @@ +module.exports = Self => { + Self.remoteMethod('getInventory', { + description: 'Get list of itemShelving to review between two parking code', + accessType: 'WRITE', + accepts: [{ + arg: 'parkingFrom', + type: 'string', + required: true, + description: 'Parking code from' + }, + { + arg: 'parkingTo', + type: 'string', + required: true, + description: 'Parking code to' + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getInventory`, + verb: 'POST' + } + }); + + Self.getInventory = async(parkingFrom, parkingTo, options) => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const [result] = await Self.rawSql(`CALL vn.itemShelving_inventory(?, ?)`, [parkingFrom, parkingTo], myOptions); + + return result; + }; +}; diff --git a/modules/item/back/methods/item-shelving/specs/getInventory.spec.js b/modules/item/back/methods/item-shelving/specs/getInventory.spec.js new file mode 100644 index 000000000..76cc39073 --- /dev/null +++ b/modules/item/back/methods/item-shelving/specs/getInventory.spec.js @@ -0,0 +1,19 @@ +const models = require('vn-loopback/server/server').models; + +describe('itemShelving getInventory()', () => { + it('should return a list of itemShelvings', async() => { + const tx = await models.ItemShelving.beginTransaction({}); + + let response; + try { + const options = {transaction: tx}; + response = await models.ItemShelving.getInventory(1, 2, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + + expect(response.length).toEqual(2); + }); +}); diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index 5f372a3be..98ff18931 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -1,3 +1,4 @@ module.exports = Self => { require('../methods/item-shelving/deleteItemShelvings')(Self); + require('../methods/item-shelving/getInventory')(Self); }; From b3a7a170f0522ff693be1684d3201b8914a8ca7e Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Jul 2023 11:54:43 +0200 Subject: [PATCH 160/311] =?UTF-8?q?refs=20#5934=20feat:=20a=C3=B1adido=20c?= =?UTF-8?q?lientSms=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/233001/00-clientSms.sql | 15 +++++++ modules/client/back/methods/client/sendSms.js | 8 +++- modules/client/back/model-config.json | 3 ++ modules/client/back/models/client-sms.json | 29 +++++++++++++ modules/client/back/models/sms.json | 2 +- modules/client/front/index.js | 1 + modules/client/front/routes.json | 7 ++++ modules/client/front/sms/index.html | 42 +++++++++++++++++++ modules/client/front/sms/index.js | 39 +++++++++++++++++ modules/client/front/sms/locale/es.yml | 2 + 10 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 db/changes/233001/00-clientSms.sql create mode 100644 modules/client/back/models/client-sms.json create mode 100644 modules/client/front/sms/index.html create mode 100644 modules/client/front/sms/index.js create mode 100644 modules/client/front/sms/locale/es.yml diff --git a/db/changes/233001/00-clientSms.sql b/db/changes/233001/00-clientSms.sql new file mode 100644 index 000000000..353041ad9 --- /dev/null +++ b/db/changes/233001/00-clientSms.sql @@ -0,0 +1,15 @@ +CREATE TABLE `vn`.`clientSms` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `clientFk` int(11) NOT NULL, + `smsFk` mediumint(8) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `clientSms_FK` (`clientFk`), + KEY `clientSms_FK_1` (`smsFk`), + CONSTRAINT `clientSms_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, + CONSTRAINT `clientSms_FK_1` FOREIGN KEY (`smsFk`) REFERENCES `sms` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('ClientSms', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('ClientSms', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/modules/client/back/methods/client/sendSms.js b/modules/client/back/methods/client/sendSms.js index 83b7c8d6e..270d7e5b5 100644 --- a/modules/client/back/methods/client/sendSms.js +++ b/modules/client/back/methods/client/sendSms.js @@ -7,7 +7,7 @@ module.exports = Self => { arg: 'id', type: 'number', required: true, - description: 'The ticket id', + description: 'The client id', http: {source: 'path'} }, { @@ -33,6 +33,12 @@ module.exports = Self => { Self.sendSms = async(ctx, id, destination, message) => { const models = Self.app.models; const sms = await models.Sms.send(ctx, destination, message); + + await models.ClientSms.create({ + clientFk: id, + smsFk: sms.id + }); + return sms; }; }; diff --git a/modules/client/back/model-config.json b/modules/client/back/model-config.json index 1e06ea1c0..bc48ec360 100644 --- a/modules/client/back/model-config.json +++ b/modules/client/back/model-config.json @@ -95,6 +95,9 @@ "ClientSample": { "dataSource": "vn" }, + "ClientSms": { + "dataSource": "vn" + }, "Sms": { "dataSource": "vn" }, diff --git a/modules/client/back/models/client-sms.json b/modules/client/back/models/client-sms.json new file mode 100644 index 000000000..18d7ad051 --- /dev/null +++ b/modules/client/back/models/client-sms.json @@ -0,0 +1,29 @@ +{ + "name": "ClientSms", + "base": "VnModel", + "options": { + "mysql": { + "table": "clientSms" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "clientFk": { + "type": "number" + }, + "smsFk": { + "type": "number" + } + }, + "relations": { + "sms": { + "type": "belongsTo", + "model": "Sms", + "foreignKey": "smsFk" + } + } +} diff --git a/modules/client/back/models/sms.json b/modules/client/back/models/sms.json index 4639131ef..8f349b073 100644 --- a/modules/client/back/models/sms.json +++ b/modules/client/back/models/sms.json @@ -36,7 +36,7 @@ } }, "relations": { - "sender": { + "user": { "type": "belongsTo", "model": "VnUser", "foreignKey": "senderFk" diff --git a/modules/client/front/index.js b/modules/client/front/index.js index c7e39ea5d..62076459b 100644 --- a/modules/client/front/index.js +++ b/modules/client/front/index.js @@ -48,4 +48,5 @@ import './notification'; import './unpaid'; import './extended-list'; import './credit-management'; +import './sms'; diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index 01d1b53bf..773b7b22a 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -23,6 +23,7 @@ {"state": "client.card.recovery.index", "icon": "icon-recovery"}, {"state": "client.card.webAccess", "icon": "cloud"}, {"state": "client.card.log", "icon": "history"}, + {"state": "client.card.sms", "icon": "contact_support"}, { "description": "Credit management", "icon": "monetization_on", @@ -373,6 +374,12 @@ "component": "vn-client-log", "description": "Log" }, + { + "url" : "/sms", + "state": "client.card.sms", + "component": "vn-client-sms", + "description": "Sms" + }, { "url": "/dms", "state": "client.card.dms", diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html new file mode 100644 index 000000000..db944e3b0 --- /dev/null +++ b/modules/client/front/sms/index.html @@ -0,0 +1,42 @@ + + + + + + + + Sender + Number sender + Destination + Message + Status + Created + + + + + + + {{::clientSms.sms.user.name}} + + + {{::clientSms.sms.sender}} + {{::clientSms.sms.destination}} + {{::clientSms.sms.message}} + {{::clientSms.sms.status}} + {{::clientSms.sms.created | date:'dd/MM/yyyy HH:mm'}} + + + + + + + diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js new file mode 100644 index 000000000..1478b78e9 --- /dev/null +++ b/modules/client/front/sms/index.js @@ -0,0 +1,39 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + + this.filter = { + fields: ['id', 'smsFk'], + include: { + relation: 'sms', + scope: { + fields: [ + 'senderFk', + 'sender', + 'destination', + 'message', + 'statusCode', + 'status', + 'created'], + include: { + relation: 'user', + scope: { + fields: ['name'] + } + } + } + } + }; + } +} + +ngModule.vnComponent('vnClientSms', { + template: require('./index.html'), + controller: Controller, + bindings: { + client: '<' + } +}); diff --git a/modules/client/front/sms/locale/es.yml b/modules/client/front/sms/locale/es.yml new file mode 100644 index 000000000..6d1e9e147 --- /dev/null +++ b/modules/client/front/sms/locale/es.yml @@ -0,0 +1,2 @@ +Sender: Remitente +Number sender: Número remitente From 3e8775149a4dc286ebedeeb4cd9b95a4157d2596 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Jul 2023 13:02:42 +0200 Subject: [PATCH 161/311] refs #5934 feat: change icon --- modules/client/back/models/sms.json | 2 +- modules/client/front/routes.json | 2 +- modules/client/front/sms/index.html | 4 +--- modules/client/front/sms/index.js | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/client/back/models/sms.json b/modules/client/back/models/sms.json index 8f349b073..4639131ef 100644 --- a/modules/client/back/models/sms.json +++ b/modules/client/back/models/sms.json @@ -36,7 +36,7 @@ } }, "relations": { - "user": { + "sender": { "type": "belongsTo", "model": "VnUser", "foreignKey": "senderFk" diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index 773b7b22a..63d6709e5 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -23,7 +23,7 @@ {"state": "client.card.recovery.index", "icon": "icon-recovery"}, {"state": "client.card.webAccess", "icon": "cloud"}, {"state": "client.card.log", "icon": "history"}, - {"state": "client.card.sms", "icon": "contact_support"}, + {"state": "client.card.sms", "icon": "sms"}, { "description": "Credit management", "icon": "monetization_on", diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index db944e3b0..3331f217b 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -13,7 +13,6 @@ Sender - Number sender Destination Message Status @@ -24,10 +23,9 @@ - {{::clientSms.sms.user.name}} + {{::clientSms.sms.sender.name}} - {{::clientSms.sms.sender}} {{::clientSms.sms.destination}} {{::clientSms.sms.message}} {{::clientSms.sms.status}} diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js index 1478b78e9..6ad64282e 100644 --- a/modules/client/front/sms/index.js +++ b/modules/client/front/sms/index.js @@ -19,7 +19,7 @@ export default class Controller extends Section { 'status', 'created'], include: { - relation: 'user', + relation: 'sender', scope: { fields: ['name'] } From 9076553070b5ff5e7399eeb5df7d28904a86ba79 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 18 Jul 2023 14:11:50 +0200 Subject: [PATCH 162/311] refs #5983 test(itemShelving): add getInventory --- .../233001/00-itemShelving_inventory.sql | 94 +++++++++++-------- db/dump/fixtures.sql | 12 ++- .../item-shelving/specs/getInventory.spec.js | 7 +- 3 files changed, 70 insertions(+), 43 deletions(-) diff --git a/db/changes/233001/00-itemShelving_inventory.sql b/db/changes/233001/00-itemShelving_inventory.sql index b2a2ff321..c66ad69e9 100644 --- a/db/changes/233001/00-itemShelving_inventory.sql +++ b/db/changes/233001/00-itemShelving_inventory.sql @@ -1,52 +1,64 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_inventory`(vParkingFromFk INT, vParkingToFk INT) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_inventory`(vParkingFromFk VARCHAR(8), vParkingToFk VARCHAR(8)) +BEGIN /** * Devuelve un listado de ubicaciones a revisar * - * @param vParkingFromFk Parking de partida, identificador de vn.parking - * @param vParkingToFk Parking de llegada, identificador de vn.parking + * @param vParkingFromFk Parking de partida, identificador de parking + * @param vParkingToFk Parking de llegada, identificador de parking */ DECLARE vSectorFk INT; DECLARE vPickingOrderFrom INT; - DECLARE vPickingOrderTo INT; - - SELECT ish.id, - p.pickingOrder, - p.code parking, - ish.shelvingFk, - ish.itemFk, - i.longName, - ish.visible, - p.sectorFk, - it.workerFk buyer, - CONCAT('http:',ic.url, '/catalog/1600x900/',i.image) urlImage, - ish.isChecked, - CASE - WHEN s.notPrepared > sm.parked THEN 0 - WHEN sm.visible > sm.parked THEN 1 - ELSE 2 - END - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN (SELECT s.itemFk, sum(s.quantity) notPrepared - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - WHERE t.shipped BETWEEN CURDATE() - AND CURDATE() + INTERVAL 23 HOUR - AND s.isPicked = FALSE - AND w.name = 'Algemesi' - GROUP BY s.itemFk) s ON s.itemFk = i.id - JOIN hedera.imageConfig ic - WHERE p.pickingOrder BETWEEN vParkingFrom AND vPickingOrderTo - AND p.sectorFk = vSectorFk - ORDER BY p.pickingOrder; + DECLARE vPickingOrderTo INT; -END ;; + SELECT p.sectorFk, p.pickingOrder INTO vSectorFk, vPickingOrderFrom + FROM vn.parking p + WHERE p.code = vParkingFromFk COLLATE 'utf8mb3_general_ci'; + + SELECT p.pickingOrder INTO vPickingOrderTo + FROM vn.parking p + WHERE p.code = vParkingToFk COLLATE 'utf8mb3_general_ci'; + + CALL vn.visible_getMisfit(vSectorFk); + + SELECT ish.id, + p.pickingOrder, + p.code parking, + ish.shelvingFk, + ish.itemFk, + i.longName, + ish.visible, + p.sectorFk, + it.workerFk buyer, + CONCAT('http:',ic.url, '/catalog/1600x900/',i.image) urlImage, + ish.isChecked, + CASE + WHEN s.notPrepared > sm.parked THEN 0 + WHEN sm.visible > sm.parked THEN 1 + ELSE 2 + END priority + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN (SELECT s.itemFk, sum(s.quantity) notPrepared + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.config c ON c.mainWarehouseFk = w.id + WHERE t.shipped BETWEEN util.VN_CURDATE() + AND util.VN_CURDATE() + INTERVAL 23 HOUR + AND s.isPicked = FALSE + GROUP BY s.itemFk) s ON s.itemFk = i.id + JOIN hedera.imageConfig ic + WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo + AND p.sectorFk = vSectorFk + ORDER BY p.pickingOrder; + +END$$ DELIMITER ; + diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index fe11d5b64..670a45778 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -37,7 +37,7 @@ ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1; INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`) VALUES - ('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66); + ('DEFAULT_TOKEN', '1209600', CURDATE(), 66); INSERT INTO `salix`.`printConfig` (`id`, `itRecipient`, `incidencesEmail`) VALUES @@ -2953,3 +2953,13 @@ INSERT INTO `vn`.`invoiceInSerial` (`code`, `description`, `cplusTerIdNifFk`, `t ('E', 'Midgard', 1, 'CEE'), ('R', 'Jotunheim', 1, 'NATIONAL'), ('W', 'Vanaheim', 1, 'WORLD'); + + +INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`) + VALUES + (1, 0, 0, 'marvel.com'); + +/* DELETE ME */ +UPDATE vn.config + SET mainWarehouseFk=1 + WHERE id=1; \ No newline at end of file diff --git a/modules/item/back/methods/item-shelving/specs/getInventory.spec.js b/modules/item/back/methods/item-shelving/specs/getInventory.spec.js index 76cc39073..6a8c9804c 100644 --- a/modules/item/back/methods/item-shelving/specs/getInventory.spec.js +++ b/modules/item/back/methods/item-shelving/specs/getInventory.spec.js @@ -7,7 +7,12 @@ describe('itemShelving getInventory()', () => { let response; try { const options = {transaction: tx}; - response = await models.ItemShelving.getInventory(1, 2, options); + await models.ItemShelving.rawSql(` + UPDATE vn.config + SET mainWarehouseFk=1 + WHERE id=1 + `, null, options); + response = await models.ItemShelving.getInventory('100-01', 'LR-02-3', options); await tx.rollback(); } catch (e) { await tx.rollback(); From 7bd378e9dde911c7176e92fc1d4a5883f44e071d Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Jul 2023 14:15:56 +0200 Subject: [PATCH 163/311] refs # --- back/models/company.json | 3 + db/changes/233001/00-company.sql | 1 + loopback/locale/en.json | 1 + loopback/locale/es.json | 4 +- .../back/methods/client/canBeInvoiced.js | 25 ++++++- .../ticket/back/methods/ticket/makeInvoice.js | 4 +- print/templates/reports/invoice/sql/sales.sql | 66 ++++++------------- 7 files changed, 53 insertions(+), 51 deletions(-) create mode 100644 db/changes/233001/00-company.sql diff --git a/back/models/company.json b/back/models/company.json index f16c5762f..f8b5641ac 100644 --- a/back/models/company.json +++ b/back/models/company.json @@ -18,6 +18,9 @@ }, "expired": { "type": "date" + }, + "supplierAccountFk": { + "type": "number" } }, "scope": { diff --git a/db/changes/233001/00-company.sql b/db/changes/233001/00-company.sql new file mode 100644 index 000000000..a3b61b9cc --- /dev/null +++ b/db/changes/233001/00-company.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`company` MODIFY COLUMN sage200Company int(2) DEFAULT 10 NOT NULL; diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 030afbe9e..5c7c10967 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -177,6 +177,7 @@ "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", "The renew period has not been exceeded": "The renew period has not been exceeded", "You can not use the same password": "You can not use the same password", + "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", "Valid priorities": "Valid priorities: %d", "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 784ff5e6e..69f157a47 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -305,5 +305,7 @@ "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", "Valid priorities": "Prioridades válidas: %d", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", - "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado" + "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", + "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias" + " } diff --git a/modules/client/back/methods/client/canBeInvoiced.js b/modules/client/back/methods/client/canBeInvoiced.js index 567d491f1..843e9549f 100644 --- a/modules/client/back/methods/client/canBeInvoiced.js +++ b/modules/client/back/methods/client/canBeInvoiced.js @@ -1,3 +1,5 @@ +const UserError = require('vn-loopback/util/user-error'); + module.exports = function(Self) { Self.remoteMethodCtx('canBeInvoiced', { description: 'Change property isEqualizated in all client addresses', @@ -9,6 +11,12 @@ module.exports = function(Self) { required: true, description: 'Client id', http: {source: 'path'} + }, + { + arg: 'companyFk', + description: 'The company id', + type: 'number', + required: true } ], returns: { @@ -22,18 +30,29 @@ module.exports = function(Self) { } }); - Self.canBeInvoiced = async(id, options) => { + Self.canBeInvoiced = async(id, companyFk, options) => { const models = Self.app.models; - const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); const client = await models.Client.findById(id, { - fields: ['id', 'isTaxDataChecked', 'hasToInvoice'] + fields: ['id', 'isTaxDataChecked', 'hasToInvoice', 'payMethodFk'], + include: + { + relation: 'payMethod', + scope: { + fields: ['code'] + } + } }, myOptions); + const company = await models.Company.findById(companyFk, {fields: ['supplierAccountFk']}, myOptions); + + if (client.payMethod().code === 'wireTransfer' && !company.supplierAccountFk) + throw new UserError('The company has not informed the supplier account for bank transfers'); + if (client.isTaxDataChecked && client.hasToInvoice) return true; diff --git a/modules/ticket/back/methods/ticket/makeInvoice.js b/modules/ticket/back/methods/ticket/makeInvoice.js index 22fe7b3f5..e18e58e0b 100644 --- a/modules/ticket/back/methods/ticket/makeInvoice.js +++ b/modules/ticket/back/methods/ticket/makeInvoice.js @@ -14,7 +14,7 @@ module.exports = function(Self) { { arg: 'companyFk', description: 'The company id', - type: 'string', + type: 'number', required: true }, { @@ -67,7 +67,7 @@ module.exports = function(Self) { const [firstTicket] = tickets; const clientId = firstTicket.clientFk; - const clientCanBeInvoiced = await models.Client.canBeInvoiced(clientId, myOptions); + const clientCanBeInvoiced = await models.Client.canBeInvoiced(clientId, companyFk, myOptions); if (!clientCanBeInvoiced) throw new UserError(`This client can't be invoiced`); diff --git a/print/templates/reports/invoice/sql/sales.sql b/print/templates/reports/invoice/sql/sales.sql index f5721a594..3833a3700 100644 --- a/print/templates/reports/invoice/sql/sales.sql +++ b/print/templates/reports/invoice/sql/sales.sql @@ -1,31 +1,19 @@ -SELECT +SELECT io.ref, - c.socialName, - sa.iban, - pm.name AS payMethod, - t.clientFk, - t.shipped, - t.nickname, s.ticketFk, - s.itemFk, - s.concept, - s.quantity, - s.price, + ib.ediBotanic botanical, + s.quantity, + s.price, s.discount, - i.tag5, - i.value5, - i.tag6, - i.value6, - i.tag7, - i.value7, - tc.code AS vatType, - ib.ediBotanic botanical + s.itemFk, + s.concept, + tc.code vatType FROM vn.invoiceOut io JOIN vn.ticket t ON t.refFk = io.ref JOIN vn.supplier su ON su.id = io.companyFk - JOIN vn.client c ON c.id = t.clientFk + JOIN vn.client c ON c.id = t.clientFk JOIN vn.payMethod pm ON pm.id = c.payMethodFk - JOIN vn.company co ON co.id = io.companyFk + JOIN vn.company co ON co.id = io.companyFk JOIN vn.supplierAccount sa ON sa.id = co.supplierAccountFk JOIN vn.sale s ON s.ticketFk = t.id JOIN item i ON i.id = s.itemFk @@ -38,35 +26,23 @@ SELECT AND itc.itemFk = s.itemFk JOIN vn.taxClass tc ON tc.id = itc.taxClassFk WHERE t.refFk = ? - UNION ALL -SELECT + UNION ALL +SELECT io.ref, - c.socialName, - sa.iban, - pm.name AS payMethod, - t.clientFk, - t.shipped, - t.nickname, - t.id AS ticketFk, + t.id ticketFk, + NULL botanical, + ts.quantity, + ts.price, + 0 discount, '', - ts.description concept, - ts.quantity, - ts.price, - 0 discount, - NULL AS tag5, - NULL AS value5, - NULL AS tag6, - NULL AS value6, - NULL AS tag7, - NULL AS value7, - tc.code AS vatType, - NULL AS botanical + ts.description concept, + tc.code vatType FROM vn.invoiceOut io JOIN vn.ticket t ON t.refFk = io.ref JOIN vn.ticketService ts ON ts.ticketFk = t.id - JOIN vn.client c ON c.id = t.clientFk + JOIN vn.client c ON c.id = t.clientFk JOIN vn.payMethod pm ON pm.id = c.payMethodFk - JOIN vn.company co ON co.id = io.companyFk + JOIN vn.company co ON co.id = io.companyFk JOIN vn.supplierAccount sa ON sa.id = co.supplierAccountFk JOIN vn.taxClass tc ON tc.id = ts.taxClassFk - WHERE t.refFk = ? \ No newline at end of file + WHERE t.refFk = ? From 4c7f42acb5a05bd868dbc095feff9504d80f2d91 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Jul 2023 14:17:07 +0200 Subject: [PATCH 164/311] a --- loopback/locale/es.json | 1 - 1 file changed, 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 69f157a47..9412a9571 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -307,5 +307,4 @@ "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias" - " } From d3165fcdc75c74bb05a15060dcfec1c55bc80394 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Jul 2023 14:25:53 +0200 Subject: [PATCH 165/311] refs #5849 fix: tback --- .../client/back/methods/client/specs/canBeInvoiced.spec.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/client/back/methods/client/specs/canBeInvoiced.spec.js b/modules/client/back/methods/client/specs/canBeInvoiced.spec.js index 2f11d8013..397be3c92 100644 --- a/modules/client/back/methods/client/specs/canBeInvoiced.spec.js +++ b/modules/client/back/methods/client/specs/canBeInvoiced.spec.js @@ -4,6 +4,7 @@ const LoopBackContext = require('loopback-context'); describe('client canBeInvoiced()', () => { const userId = 19; const clientId = 1101; + const companyId = 442; const activeCtx = { accessToken: {userId: userId} }; @@ -23,7 +24,7 @@ describe('client canBeInvoiced()', () => { const client = await models.Client.findById(clientId, null, options); await client.updateAttribute('isTaxDataChecked', false, options); - const canBeInvoiced = await models.Client.canBeInvoiced(clientId, options); + const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options); expect(canBeInvoiced).toEqual(false); @@ -43,7 +44,7 @@ describe('client canBeInvoiced()', () => { const client = await models.Client.findById(clientId, null, options); await client.updateAttribute('hasToInvoice', false, options); - const canBeInvoiced = await models.Client.canBeInvoiced(clientId, options); + const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options); expect(canBeInvoiced).toEqual(false); @@ -60,7 +61,7 @@ describe('client canBeInvoiced()', () => { try { const options = {transaction: tx}; - const canBeInvoiced = await models.Client.canBeInvoiced(clientId, options); + const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options); expect(canBeInvoiced).toEqual(true); From f07ac89cb6ea7b68033b702a36e13b2b2ec5d32a Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 18 Jul 2023 15:01:04 +0200 Subject: [PATCH 166/311] refs #5976 add custom error --- loopback/locale/es.json | 3 ++- .../ticket/back/methods/ticket/setDeleted.js | 4 +-- .../back/methods/ticket/transferSales.js | 27 +++++++++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 784ff5e6e..16b0af7f5 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -305,5 +305,6 @@ "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", "Valid priorities": "Prioridades válidas: %d", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", - "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado" + "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", + "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %d" } diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js index 878cce056..46c0add6b 100644 --- a/modules/ticket/back/methods/ticket/setDeleted.js +++ b/modules/ticket/back/methods/ticket/setDeleted.js @@ -41,8 +41,8 @@ module.exports = Self => { const isEditable = await Self.isEditable(ctx, id, myOptions); - if (!isEditable) - throw new UserError(`The sales of this ticket can't be modified`); + throw new UserError(`The sales of this ticket can't be modified`); + // if (!isEditable) // Check if ticket has refunds const ticketRefunds = await models.TicketRefund.find({ diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 00fc02f38..2e4bf023d 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -37,6 +37,7 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; const myOptions = {userId}; + const $t = ctx.req.__; // $translate let tx; if (typeof options == 'object') @@ -78,9 +79,9 @@ module.exports = Self => { const saleIds = sales.map(sale => sale.id); - const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); - if (ticketId != id && hasClaimedSales) - throw new UserError(`Can't transfer claimed sales`); + // const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); + // if (ticketId != id && hasClaimedSales) + // throw new UserError(`Can't transfer claimed sales`); for (const sale of sales) { const originalSale = map.get(sale.id); @@ -96,14 +97,30 @@ module.exports = Self => { } const isTicketEmpty = await models.Ticket.isEmpty(id, myOptions); - if (isTicketEmpty) - await models.Ticket.setDeleted(ctx, id, myOptions); + if (isTicketEmpty) { + try { + await models.Ticket.setDeleted(ctx, id, myOptions); + } catch (e) { + console.log('e:', e); + console.log('e.message:', e.message); + console.log('e translation:', $t(e.message, {})); + if (e.statusCode === 400) { + throw new UserError( + `This ticket cannot be left empty.`, + 'TRANSFER_SET_DELETED', + $t(e.message) + ); + } + throw e; + } + } if (tx) await tx.commit(); return {id: ticketId}; } catch (e) { if (tx) await tx.rollback(); + console.log('e.UserError:', e); throw e; } }; From bd723bb7ba540771f786ecd3bc9972781d92e0ca Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 18 Jul 2023 15:01:58 +0200 Subject: [PATCH 167/311] refs #5824 mod ng --- modules/item/front/fixed-price/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/front/fixed-price/index.html b/modules/item/front/fixed-price/index.html index d9a955fe1..f1f6e1419 100644 --- a/modules/item/front/fixed-price/index.html +++ b/modules/item/front/fixed-price/index.html @@ -85,7 +85,7 @@ show-field="id" value-field="id" search-function="$ctrl.itemSearchFunc($search)" - on-change="$ctrl.upsertPrice(price, true)" + ng-change="$ctrl.upsertPrice(price, true)" order="id DESC" tabindex="1"> From 49c656928ed8049f00f333c4e7cb482d836cefd1 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 18 Jul 2023 15:43:11 +0200 Subject: [PATCH 168/311] refs #5983 feat(itemShelving): add visible --- modules/item/back/models/item-shelving.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index 49bebcb6b..be379adca 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -23,6 +23,9 @@ }, "isChecked": { "type": "boolean" + }, + "visible": { + "type": "number" } }, "relations": { From 85c017431ce9c199bfa0f7f5a1e394cd43b8931f Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 19 Jul 2023 07:01:43 +0200 Subject: [PATCH 169/311] refs #5983 fix(itemShelving): fixtures --- db/dump/fixtures.sql | 5 ----- 1 file changed, 5 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 670a45778..eaa00a3de 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2958,8 +2958,3 @@ INSERT INTO `vn`.`invoiceInSerial` (`code`, `description`, `cplusTerIdNifFk`, `t INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`) VALUES (1, 0, 0, 'marvel.com'); - -/* DELETE ME */ -UPDATE vn.config - SET mainWarehouseFk=1 - WHERE id=1; \ No newline at end of file From b17de86fb1f7f94e6f892f0662ec09d8d5d467f8 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 19 Jul 2023 12:15:52 +0200 Subject: [PATCH 170/311] refs #6043 add ACL --- db/changes/233001/00-fixACLVehicle.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 db/changes/233001/00-fixACLVehicle.sql diff --git a/db/changes/233001/00-fixACLVehicle.sql b/db/changes/233001/00-fixACLVehicle.sql new file mode 100644 index 000000000..6625f0d5c --- /dev/null +++ b/db/changes/233001/00-fixACLVehicle.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) + VALUES + ('Vehicle','sorted','WRITE','ALLOW','employee'); \ No newline at end of file From 36c31af455bff82604fd29fee0a397051172de47 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 19 Jul 2023 12:38:13 +0200 Subject: [PATCH 171/311] refs #5690 rounding translate --- modules/ticket/front/future/index.html | 1 + modules/ticket/front/index/index.html | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/ticket/front/future/index.html b/modules/ticket/front/future/index.html index 742143b27..5119d103b 100644 --- a/modules/ticket/front/future/index.html +++ b/modules/ticket/front/future/index.html @@ -125,6 +125,7 @@ diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index 3b490a3a9..26e5553ed 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -77,6 +77,7 @@ From 7cff0149887a1eb09d586a51212798caa97d570a Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 19 Jul 2023 13:27:31 +0200 Subject: [PATCH 172/311] refs #5983 fix(itemShelving): vn --- .../233001/00-itemShelving_inventory.sql | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/db/changes/233001/00-itemShelving_inventory.sql b/db/changes/233001/00-itemShelving_inventory.sql index c66ad69e9..b0b080ef3 100644 --- a/db/changes/233001/00-itemShelving_inventory.sql +++ b/db/changes/233001/00-itemShelving_inventory.sql @@ -14,14 +14,14 @@ BEGIN DECLARE vPickingOrderTo INT; SELECT p.sectorFk, p.pickingOrder INTO vSectorFk, vPickingOrderFrom - FROM vn.parking p + FROM parking p WHERE p.code = vParkingFromFk COLLATE 'utf8mb3_general_ci'; SELECT p.pickingOrder INTO vPickingOrderTo - FROM vn.parking p + FROM parking p WHERE p.code = vParkingToFk COLLATE 'utf8mb3_general_ci'; - CALL vn.visible_getMisfit(vSectorFk); + CALL visible_getMisfit(vSectorFk); SELECT ish.id, p.pickingOrder, @@ -39,19 +39,19 @@ BEGIN WHEN sm.visible > sm.parked THEN 1 ELSE 2 END priority - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - JOIN vn.itemType it ON it.id = i.typeFk + FROM itemShelving ish + JOIN item i ON i.id = ish.itemFk + JOIN itemType it ON it.id = i.typeFk JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk JOIN (SELECT s.itemFk, sum(s.quantity) notPrepared - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.config c ON c.mainWarehouseFk = w.id + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN warehouse w ON w.id = t.warehouseFk + JOIN config c ON c.mainWarehouseFk = w.id WHERE t.shipped BETWEEN util.VN_CURDATE() - AND util.VN_CURDATE() + INTERVAL 23 HOUR + AND util.dayEnd(util.VN_CURDATE()) AND s.isPicked = FALSE GROUP BY s.itemFk) s ON s.itemFk = i.id JOIN hedera.imageConfig ic From 2c79056f3464b4f526a72143567f948e7e4a831f Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 19 Jul 2023 13:44:04 +0200 Subject: [PATCH 173/311] refs #5976 error extended --- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 2 +- modules/route/front/roadmap/index/index.js | 2 -- modules/ticket/back/methods/ticket/setDeleted.js | 4 ++-- modules/ticket/back/methods/ticket/transferSales.js | 12 ++++-------- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 030afbe9e..dde24ddc6 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -178,5 +178,6 @@ "The renew period has not been exceeded": "The renew period has not been exceeded", "You can not use the same password": "You can not use the same password", "Valid priorities": "Valid priorities: %d", - "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}" + "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}", + "This ticket cannot be left empty.": "This ticket cannot be left empty. %s" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 16b0af7f5..c12b980fa 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -306,5 +306,5 @@ "Valid priorities": "Prioridades válidas: %d", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", - "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %d" + "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s" } diff --git a/modules/route/front/roadmap/index/index.js b/modules/route/front/roadmap/index/index.js index 3ffc5b4b1..c5f5ef9d1 100644 --- a/modules/route/front/roadmap/index/index.js +++ b/modules/route/front/roadmap/index/index.js @@ -46,8 +46,6 @@ class Controller extends Section { } deleteRoadmaps() { - console.log(this.checked); - for (const roadmap of this.checked) { this.$http.delete(`Roadmaps/${roadmap.id}`) .then(() => this.$.model.refresh()) diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js index 46c0add6b..878cce056 100644 --- a/modules/ticket/back/methods/ticket/setDeleted.js +++ b/modules/ticket/back/methods/ticket/setDeleted.js @@ -41,8 +41,8 @@ module.exports = Self => { const isEditable = await Self.isEditable(ctx, id, myOptions); - throw new UserError(`The sales of this ticket can't be modified`); - // if (!isEditable) + if (!isEditable) + throw new UserError(`The sales of this ticket can't be modified`); // Check if ticket has refunds const ticketRefunds = await models.TicketRefund.find({ diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 2e4bf023d..de52e2f18 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -79,9 +79,9 @@ module.exports = Self => { const saleIds = sales.map(sale => sale.id); - // const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); - // if (ticketId != id && hasClaimedSales) - // throw new UserError(`Can't transfer claimed sales`); + const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); + if (ticketId != id && hasClaimedSales) + throw new UserError(`Can't transfer claimed sales`); for (const sale of sales) { const originalSale = map.get(sale.id); @@ -101,14 +101,11 @@ module.exports = Self => { try { await models.Ticket.setDeleted(ctx, id, myOptions); } catch (e) { - console.log('e:', e); - console.log('e.message:', e.message); - console.log('e translation:', $t(e.message, {})); if (e.statusCode === 400) { throw new UserError( `This ticket cannot be left empty.`, 'TRANSFER_SET_DELETED', - $t(e.message) + $t(e.message, ...e.translateArgs) ); } throw e; @@ -120,7 +117,6 @@ module.exports = Self => { return {id: ticketId}; } catch (e) { if (tx) await tx.rollback(); - console.log('e.UserError:', e); throw e; } }; From b188ae6f570d406cf01664dc9e98706f2ae3c1f1 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 19 Jul 2023 14:14:35 +0200 Subject: [PATCH 174/311] refs #5976 fix: e2e --- db/changes/233001/00-setDeleted_acl.sql | 2 +- e2e/paths/05-ticket/14_create_ticket.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/changes/233001/00-setDeleted_acl.sql b/db/changes/233001/00-setDeleted_acl.sql index 1030965dd..cdeff9522 100644 --- a/db/changes/233001/00-setDeleted_acl.sql +++ b/db/changes/233001/00-setDeleted_acl.sql @@ -1,5 +1,5 @@ UPDATE `salix`.`ACL` - SET principalId='salesperson' + SET principalId='salesPerson' WHERE model='Ticket' AND property='setDeleted' diff --git a/e2e/paths/05-ticket/14_create_ticket.spec.js b/e2e/paths/05-ticket/14_create_ticket.spec.js index 80c288a01..1f9c0c40a 100644 --- a/e2e/paths/05-ticket/14_create_ticket.spec.js +++ b/e2e/paths/05-ticket/14_create_ticket.spec.js @@ -10,7 +10,7 @@ describe('Ticket create path', () => { beforeAll(async() => { browser = await getBrowser(); page = browser.page; - await page.loginAndModule('employee', 'ticket'); + await page.loginAndModule('salesPerson', 'ticket'); }); afterAll(async() => { From ab95ef74a945c4c232f2cb6a9a73c9c51f767147 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Jul 2023 07:17:35 +0200 Subject: [PATCH 175/311] refs #5934 refactor: nombres variables --- db/changes/233001/00-clientSms.sql | 6 +++--- modules/client/back/models/client-sms.json | 3 --- modules/client/front/sms/index.html | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/db/changes/233001/00-clientSms.sql b/db/changes/233001/00-clientSms.sql index 353041ad9..e1e34f6b2 100644 --- a/db/changes/233001/00-clientSms.sql +++ b/db/changes/233001/00-clientSms.sql @@ -7,9 +7,9 @@ CREATE TABLE `vn`.`clientSms` ( KEY `clientSms_FK_1` (`smsFk`), CONSTRAINT `clientSms_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `clientSms_FK_1` FOREIGN KEY (`smsFk`) REFERENCES `sms` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES - ('ClientSms', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('ClientSms', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + ('ClientSms', 'find', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('ClientSms', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/modules/client/back/models/client-sms.json b/modules/client/back/models/client-sms.json index 18d7ad051..b2244ebbb 100644 --- a/modules/client/back/models/client-sms.json +++ b/modules/client/back/models/client-sms.json @@ -14,9 +14,6 @@ }, "clientFk": { "type": "number" - }, - "smsFk": { - "type": "number" } }, "relations": { diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index 3331f217b..9abadd312 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -3,7 +3,7 @@ url="ClientSms" link="{clientFk: $ctrl.$params.id}" filter="::$ctrl.filter" - data="clientSmss" + data="clientSmsList" limit="20" auto-load="true"> @@ -20,7 +20,7 @@ - + {{::clientSms.sms.sender.name}} From b13618529aebd455f42d1285dbe59e2c6313549a Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Jul 2023 07:21:38 +0200 Subject: [PATCH 176/311] =?UTF-8?q?refs=20#5849=20delete:=20traducci=C3=B3?= =?UTF-8?q?n=20erronea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- loopback/locale/en.json | 1 - 1 file changed, 1 deletion(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 5c7c10967..030afbe9e 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -177,7 +177,6 @@ "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", "The renew period has not been exceeded": "The renew period has not been exceeded", "You can not use the same password": "You can not use the same password", - "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", "Valid priorities": "Valid priorities: %d", "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}" } From 60e75d7825cfdc9c5222700ac0f36cf3d92101e0 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 20 Jul 2023 08:23:43 +0200 Subject: [PATCH 177/311] refs #5837 fix client condition --- modules/client/back/models/client.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 163d51fc5..8369fa906 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -41,6 +41,9 @@ module.exports = Self => { }); async function socialNameIsUnique(err, done) { + if (!this.countryFk) + return done(); + const filter = { include: { relation: 'country', @@ -59,13 +62,11 @@ module.exports = Self => { } }; - const existingClient = await Self.app.models.Client.findOne(filter); + const client = await Self.app.models.Country.findById(this.countryFk, {fields: ['isSocialNameUnique']}); + const existingClient = await Self.findOne(filter); - if (existingClient) { - // eslint-disable-next-line max-len - if (existingClient.country().isSocialNameUnique && this.socialName === existingClient.socialName) - err(); - } + if (existingClient && (existingClient.country().isSocialNameUnique || client.isSocialNameUnique)) + err(); done(); } From 0585080303f72750987698c299e4d716ca13890f Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 20 Jul 2023 09:26:40 +0200 Subject: [PATCH 178/311] refs #6011 deploy 2330 version --- CHANGELOG.md | 5 +++++ db/changes/232401/00-ACLgetVehiclesSorted.sql | 3 --- db/changes/{232801 => 233001}/00-roadmap.sql | 2 -- db/changes/{232801 => 233001}/00-roadmapACL.sql | 0 4 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 db/changes/232401/00-ACLgetVehiclesSorted.sql rename db/changes/{232801 => 233001}/00-roadmap.sql (69%) rename db/changes/{232801 => 233001}/00-roadmapACL.sql (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76527ac83..847275825 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2330.01] - 2023-07-27 ### Added +- (Artículos -> Vista Previa) Añadido campo "Plástico reciclado" +- (Rutas -> Troncales) Nueva sección +- (Tickets -> Opciones) Opción establecer peso ### Changed +- (General -> Iconos) Añadidos nuevos iconos + ### Fixed diff --git a/db/changes/232401/00-ACLgetVehiclesSorted.sql b/db/changes/232401/00-ACLgetVehiclesSorted.sql deleted file mode 100644 index 6625f0d5c..000000000 --- a/db/changes/232401/00-ACLgetVehiclesSorted.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) - VALUES - ('Vehicle','sorted','WRITE','ALLOW','employee'); \ No newline at end of file diff --git a/db/changes/232801/00-roadmap.sql b/db/changes/233001/00-roadmap.sql similarity index 69% rename from db/changes/232801/00-roadmap.sql rename to db/changes/233001/00-roadmap.sql index a2835160f..9b5db54eb 100644 --- a/db/changes/232801/00-roadmap.sql +++ b/db/changes/233001/00-roadmap.sql @@ -6,5 +6,3 @@ ALTER TABLE `vn`.`roadmap` CHANGE name name varchar(45) CHARACTER SET utf8mb3 CO ALTER TABLE `vn`.`roadmap` MODIFY COLUMN etd datetime NOT NULL; ALTER TABLE `vn`.`expeditionTruck` COMMENT='Distintas paradas que hacen los trocales'; -ALTER TABLE `vn`.`expeditionTruck` DROP FOREIGN KEY expeditionTruck_FK_2; -ALTER TABLE `vn`.`expeditionTruck` ADD CONSTRAINT expeditionTruck_FK_2 FOREIGN KEY (roadmapFk) REFERENCES vn.roadmap(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/changes/232801/00-roadmapACL.sql b/db/changes/233001/00-roadmapACL.sql similarity index 100% rename from db/changes/232801/00-roadmapACL.sql rename to db/changes/233001/00-roadmapACL.sql From 071a891d30079e13792765a7578b5aae03da6ee2 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 20 Jul 2023 09:30:18 +0200 Subject: [PATCH 179/311] refs #6011 add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 847275825..d5928e9c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Artículos -> Vista Previa) Añadido campo "Plástico reciclado" - (Rutas -> Troncales) Nueva sección - (Tickets -> Opciones) Opción establecer peso +- (Clientes -> SMS) Nueva sección ### Changed - (General -> Iconos) Añadidos nuevos iconos +- (Clientes -> Razón social) Nuevas restricciones por pais ### Fixed From 75ea5942729af3e528157f6b946ef0d3679596e7 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 20 Jul 2023 09:32:52 +0200 Subject: [PATCH 180/311] refs #6011 deploy(2332): init version --- CHANGELOG.md | 9 +++++++++ db/changes/233201/.gitkeep | 0 package-lock.json | 2 +- package.json | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 db/changes/233201/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index d5928e9c4..d4a1e147f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2330.01] - 2023-07-27 + +### Added + +### Changed + +### Fixed + + ## [2330.01] - 2023-07-27 ### Added diff --git a/db/changes/233201/.gitkeep b/db/changes/233201/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/package-lock.json b/package-lock.json index ee6d4e0fa..5506075b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.30.01", + "version": "23.32.01", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 66e341ad5..37e39d5a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.30.01", + "version": "23.32.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From a6b8f4ddf88a5960e9dda46a89b06129942bcba0 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Jul 2023 09:46:25 +0200 Subject: [PATCH 181/311] refs #5244 fix: tfront --- front/core/lib/component.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/front/core/lib/component.js b/front/core/lib/component.js index 6bb83e55a..5695d9449 100644 --- a/front/core/lib/component.js +++ b/front/core/lib/component.js @@ -12,9 +12,10 @@ export default class Component extends EventEmitter { * @param {HTMLElement} $element The main component element * @param {$rootScope.Scope} $scope The element scope * @param {Function} $transclude The transclusion function + * @param {Function} $location The location function */ - constructor($element, $scope, $transclude) { - super(); + constructor($element, $scope, $transclude, $location) { + super($element, $scope, $transclude, $location); this.$ = $scope; if (!$element) return; @@ -164,7 +165,7 @@ export default class Component extends EventEmitter { $transclude.$$boundTransclude.$$slots[slot]; } } -Component.$inject = ['$element', '$scope', '$transclude']; +Component.$inject = ['$element', '$scope', '$location', '$state']; /* * Automatically adds the most used services to the prototype, so they are From d6a27741b53c30de3999faa81212867c674ba427 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Jul 2023 09:50:56 +0200 Subject: [PATCH 182/311] a --- .../back/methods/worker/getItemTypeWorker.js | 65 ------------------- 1 file changed, 65 deletions(-) delete mode 100644 modules/worker/back/methods/worker/getItemTypeWorker.js diff --git a/modules/worker/back/methods/worker/getItemTypeWorker.js b/modules/worker/back/methods/worker/getItemTypeWorker.js deleted file mode 100644 index b1f49ae99..000000000 --- a/modules/worker/back/methods/worker/getItemTypeWorker.js +++ /dev/null @@ -1,65 +0,0 @@ -const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; -const buildFilter = require('vn-loopback/util/filter').buildFilter; -const mergeFilters = require('vn-loopback/util/filter').mergeFilters; - -module.exports = Self => { - Self.remoteMethod('getItemTypeWorker', { - description: 'Returns the workers that appear in itemType', - accessType: 'READ', - accepts: [{ - arg: 'filter', - type: 'Object', - description: 'Filter defining where and paginated data', - required: true - }], - returns: { - type: ['object'], - root: true - }, - http: { - path: `/getItemTypeWorker`, - verb: 'GET' - } - }); - - Self.getItemTypeWorker = async(filter, options) => { - const myOptions = {}; - const conn = Self.dataSource.connector; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - const query = - `SELECT DISTINCT u.id, w.firstName, w.lastName, u.nickname, u.name - FROM itemType it - JOIN worker w ON w.id = it.workerFk - JOIN account.user u ON u.id = w.id`; - - let stmt = new ParameterizedSQL(query); - - let clientFilter = Object.assign({}, filter); - clientFilter.where = buildFilter(filter.where, (param, value) => { - switch (param) { - case 'role': - return {'r.name': value}; - case 'firstName': - return {or: [ - {'w.firstName': {like: `%${value}%`}}, - {'w.lastName': {like: `%${value}%`}}, - {'u.name': {like: `%${value}%`}}, - {'u.nickname': {like: `%${value}%`}} - ]}; - case 'id': - return {'w.id': value}; - } - }); - - let myFilter = { - where: {'u.active': true} - }; - - myFilter = mergeFilters(myFilter, clientFilter); - stmt.merge(conn.makeSuffix(myFilter)); - return conn.executeStmt(stmt); - }; -}; From 7312ed9cc4dbea12b624be248b786e29e2aa2052 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Jul 2023 09:56:07 +0200 Subject: [PATCH 183/311] refs #5244 fix back test --- .../methods/ticket-request/specs/getItemTypeWorkers.spec.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js b/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js index ae5c508b6..c57451c26 100644 --- a/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js +++ b/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js @@ -1,12 +1,10 @@ const models = require('vn-loopback/server/server').models; describe('ticket-request getItemTypeWorker()', () => { - const ctx = {req: {accessToken: {userId: 18}}}; - it('should return the buyer as result', async() => { const filter = {where: {firstName: 'buyer'}}; - const result = await models.TicketRequest.getItemTypeWorker(ctx, filter); + const result = await models.TicketRequest.getItemTypeWorker(filter); expect(result.length).toEqual(1); }); @@ -14,7 +12,7 @@ describe('ticket-request getItemTypeWorker()', () => { it('should return the workers at itemType as result', async() => { const filter = {}; - const result = await models.TicketRequest.getItemTypeWorker(ctx, filter); + const result = await models.TicketRequest.getItemTypeWorker(filter); expect(result.length).toBeGreaterThan(1); }); From 9db8ae237fcbb9fce120af1f237d7b6496338fd7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 20 Jul 2023 10:19:03 +0200 Subject: [PATCH 184/311] refs #5866 addBackTransferClient --- db/changes/233001/00-transferClient.sql | 2 + .../back/methods/ticket/transferClient.js | 69 +++++++++++++++++++ modules/ticket/back/models/ticket-methods.js | 1 + modules/ticket/front/descriptor-menu/index.js | 8 +++ 4 files changed, 80 insertions(+) create mode 100644 db/changes/233001/00-transferClient.sql create mode 100644 modules/ticket/back/methods/ticket/transferClient.js diff --git a/db/changes/233001/00-transferClient.sql b/db/changes/233001/00-transferClient.sql new file mode 100644 index 000000000..8a7ce0543 --- /dev/null +++ b/db/changes/233001/00-transferClient.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) + VALUES ('Ticket','transferClient','WRITE','ALLOW','ROLE','administrative'); \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/transferClient.js b/modules/ticket/back/methods/ticket/transferClient.js new file mode 100644 index 000000000..226f5dedf --- /dev/null +++ b/modules/ticket/back/methods/ticket/transferClient.js @@ -0,0 +1,69 @@ +const UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.remoteMethodCtx('transferClient', { + description: 'Transfering ticket to another client', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'the ticket id', + http: {source: 'path'} + }, + { + arg: 'data', + type: 'object', + required: true, + description: 'the client id', + http: {source: 'body'} + }, + ], + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/:id/transferClient`, + verb: 'PATCH' + } + }); + + Self.transferClient = async(ctx, ticketId, params) => { + const models = Self.app.models; + const args = ctx.args; + const myOptions = {}; + try { + const clientId = params.clientId; + const isEditable = await Self.isEditable(ctx, args.id, myOptions); + console.log('es editable?',isEditable) // Revisar + /* if (!isEditable){ + console.log('no es editable!') + throw new UserError(`The sales of this ticket can't be modified`); + } */ + + const ticket = await models.Ticket.findById(ticketId, myOptions); + console.log('ticket',ticket); + if(!ticket) return false; + const nparams = { + clientFk: clientId, + addressFk: ticket.addressFk, + } + + const promise = await ticket.updateAttributes(nparams); + console.log('promise', promise); + if(promise) return true; + } catch (error) { + console.log(error); + } + + /* if (typeof options == 'object') + Object.assign(myOptions, options); + + const ticket = await Self.findById(id, { + fields: ['isDeleted', 'refFk'] + }, myOptions); */ + + return false; + }; +}; \ No newline at end of file diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index f0c85ecc4..b432c9f6b 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -19,6 +19,7 @@ module.exports = function(Self) { require('../methods/ticket/uploadFile')(Self); require('../methods/ticket/addSale')(Self); require('../methods/ticket/transferSales')(Self); + require('../methods/ticket/transferClient')(Self); require('../methods/ticket/recalculateComponents')(Self); require('../methods/ticket/sendSms')(Self); require('../methods/ticket/isLocked')(Self); diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 0fc8488ca..019ae4fa6 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -96,6 +96,14 @@ class Controller extends Section { } transferClient() { + const ticket = this.ticket; + const clientId = ticket.client.id; + console.log('ticketId',ticket.id) + console.log('clientId',clientId); + this.$http.patch(`Tickets/${ticket.id}/transferClient`, {clientId}).then(() =>{ + this.vnApp.showSuccess(this.$t('Data saved!')); + this.reload(); + }) this.$http.get(`Clients/${this.ticket.client.id}`).then(client => { const ticket = this.ticket; From 2f27f32c45c64034f538b0feb1dad99f301cb388 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Jul 2023 11:26:48 +0200 Subject: [PATCH 185/311] refs #5244 fix: e2e --- e2e/helpers/extensions.js | 2 ++ e2e/helpers/selectors.js | 14 +++++++------- e2e/paths/05-ticket/05_tracking_state.spec.js | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index fe3ef08bd..b6ea32a6c 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -632,6 +632,7 @@ let actions = { await this.write(selector, value.toString()); break; case 'vn-autocomplete': + case 'vn-worker-autocomplete': if (value) await this.autocompleteSearch(selector, value.toString()); else @@ -667,6 +668,7 @@ let actions = { switch (tagName) { case 'vn-textfield': case 'vn-autocomplete': + case 'vn-worker-autocomplete': case 'vn-input-time': case 'vn-datalist': el = await input.$('input'); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 977c8a837..3302280e3 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -187,7 +187,7 @@ export default { country: 'vn-client-create vn-autocomplete[ng-model="$ctrl.client.countryFk"]', userName: 'vn-client-create vn-textfield[ng-model="$ctrl.client.userName"]', email: 'vn-client-create vn-textfield[ng-model="$ctrl.client.email"]', - salesPerson: 'vn-client-create vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', + salesPerson: 'vn-client-create vn-worker-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', saveNewProvicenButton: '#saveProvince', saveNewCityButton: '#saveCity', saveNewPoscode: '#savePostcode', @@ -199,7 +199,7 @@ export default { email: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.email"]', phone: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.phone"]', mobile: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.mobile"]', - salesPerson: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', + salesPerson: 'vn-client-basic-data vn-worker-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', channel: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]', transferor: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.transferorFk"]', businessType: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.businessTypeFk"]', @@ -735,7 +735,7 @@ export default { }, createStateView: { state: 'vn-autocomplete[ng-model="$ctrl.stateFk"]', - worker: 'vn-autocomplete[ng-model="$ctrl.workerFk"]', + worker: 'vn-worker-autocomplete[ng-model="$ctrl.workerFk"]', saveStateButton: `button[type=submit]` }, claimsIndex: { @@ -781,12 +781,12 @@ export default { firstClaimReason: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimReasonFk"]', firstClaimResult: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimResultFk"]', firstClaimResponsible: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]', - firstClaimWorker: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.workerFk"]', + firstClaimWorker: 'vn-claim-development vn-horizontal:nth-child(1) vn-worker-autocomplete[ng-model="claimDevelopment.workerFk"]', firstClaimRedelivery: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]', secondClaimReason: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimReasonFk"]', secondClaimResult: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResultFk"]', secondClaimResponsible: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]', - secondClaimWorker: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.workerFk"]', + secondClaimWorker: 'vn-claim-development vn-horizontal:nth-child(2) vn-worker-autocomplete[ng-model="claimDevelopment.workerFk"]', secondClaimRedelivery: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]', saveDevelopmentButton: 'button[type=submit]' }, @@ -854,7 +854,7 @@ export default { }, createRouteView: { - worker: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.workerFk"]', + worker: 'vn-route-create vn-worker-autocomplete[ng-model="$ctrl.route.workerFk"]', createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]', vehicleAuto: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', agency: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]', @@ -976,7 +976,7 @@ export default { street: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.street"]', user: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.name"]', email: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.email"]', - boss: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.bossFk"]', + boss: 'vn-worker-create vn-worker-autocomplete[ng-model="$ctrl.worker.bossFk"]', role: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.roleFk"]', iban: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.iban"]', createButton: 'vn-worker-create vn-submit[label="Create"]', diff --git a/e2e/paths/05-ticket/05_tracking_state.spec.js b/e2e/paths/05-ticket/05_tracking_state.spec.js index 949c9a8e6..9ac373287 100644 --- a/e2e/paths/05-ticket/05_tracking_state.spec.js +++ b/e2e/paths/05-ticket/05_tracking_state.spec.js @@ -59,7 +59,7 @@ describe('Ticket Create new tracking state path', () => { const result = await page .waitToGetProperty(selectors.createStateView.worker, 'value'); - expect(result).toEqual('salesPersonNick'); + expect(result).toEqual('salesPerson'); }); it(`should succesfully create a valid state`, async() => { From 7d2e98267f4d66afc3e3a9d823c9da60558f935d Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Jul 2023 15:09:31 +0200 Subject: [PATCH 186/311] =?UTF-8?q?refs=20#5561=20eliminados=20valores=20a?= =?UTF-8?q?=20pi=C3=B1on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/232401/00-saleTracking_new.sql | 38 ------------------- .../{232401 => 233001}/00-aclSaleTracking.sql | 3 +- .../back/methods/sale-tracking/filter.js | 10 +++-- 3 files changed, 9 insertions(+), 42 deletions(-) delete mode 100644 db/changes/232401/00-saleTracking_new.sql rename db/changes/{232401 => 233001}/00-aclSaleTracking.sql (63%) diff --git a/db/changes/232401/00-saleTracking_new.sql b/db/changes/232401/00-saleTracking_new.sql deleted file mode 100644 index d5fa569fd..000000000 --- a/db/changes/232401/00-saleTracking_new.sql +++ /dev/null @@ -1,38 +0,0 @@ -DELIMITER $$ -$$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_new`( - vSaleFK INT, - vIsChecked BOOLEAN, - vOriginalQuantity INT, - vWorkerFk INT, - vState VARCHAR(50), - vIsScanned BOOLEAN) -BEGIN -/** - * Modifica registro de saleTracking - * - * @param vSaleFK Identificador del registro a modificar - * @param vIsChecked Indica si la línea ha sido pulsada - * @param vOriginalQuantity Cantidad original - * @param vWorkerFk Identificador del trabajador - * @param vAction Identificador de la acción realizada - * @param vState Identificador del estado a modificar - * @param vIsScanned Identificador si se ha escaneado automáticamente o manual - */ - - REPLACE vn.saleTracking(saleFk, - isChecked, - originalQuantity, - workerFk, - stateFk, - isScanned) - SELECT vSaleFK, - vIsChecked, - vOriginalQuantity, - IFNULL(vWorkerFk, vn.getUser()), - s.id, - vIsScanned - FROM vn.state s - WHERE s.code = vState COLLATE utf8_unicode_ci; -END$$ -DELIMITER ; diff --git a/db/changes/232401/00-aclSaleTracking.sql b/db/changes/233001/00-aclSaleTracking.sql similarity index 63% rename from db/changes/232401/00-aclSaleTracking.sql rename to db/changes/233001/00-aclSaleTracking.sql index 441945fe2..6a699091a 100644 --- a/db/changes/232401/00-aclSaleTracking.sql +++ b/db/changes/233001/00-aclSaleTracking.sql @@ -1,3 +1,4 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES - ('SaleTracking', 'deleteSaleGroupDetail', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + ('SaleTracking', 'deleteSaleGroupDetail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('SaleTracking', 'replaceOrCreate', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/modules/ticket/back/methods/sale-tracking/filter.js b/modules/ticket/back/methods/sale-tracking/filter.js index ee074a852..09101a47a 100644 --- a/modules/ticket/back/methods/sale-tracking/filter.js +++ b/modules/ticket/back/methods/sale-tracking/filter.js @@ -67,9 +67,13 @@ module.exports = Self => { JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk - LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id AND stPrevious.stateFk = 26 - LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id AND stPrepared.stateFk = 14 - LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id AND stControled.stateFk = 8 + LEFT JOIN vn.state st ON TRUE + LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id + AND stPrevious.stateFk = (SELECT id FROM vn.state WHERE code = 'PREVIOUS_PREPARATION') + LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id + AND stPrepared.stateFk = (SELECT id FROM vn.state WHERE code = 'PREPARED') + LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id + AND stControled.stateFk = (SELECT id FROM vn.state s2 WHERE code = 'CHECKED') LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id LEFT JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk LEFT JOIN vn.parking p ON p.id = sg.parkingFk From 618989052a481df85338fa54ec297c0ae57d876c Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 20 Jul 2023 15:15:33 +0200 Subject: [PATCH 187/311] refs #5866 fix transferClient and test added --- .../{233001 => 233201}/00-transferClient.sql | 0 .../ticket/specs/transferClient.spec.js | 49 +++++++++++++++ .../back/methods/ticket/transferClient.js | 60 +++++++------------ modules/ticket/front/descriptor-menu/index.js | 18 +----- .../front/descriptor-menu/index.spec.js | 13 ---- 5 files changed, 71 insertions(+), 69 deletions(-) rename db/changes/{233001 => 233201}/00-transferClient.sql (100%) create mode 100644 modules/ticket/back/methods/ticket/specs/transferClient.spec.js diff --git a/db/changes/233001/00-transferClient.sql b/db/changes/233201/00-transferClient.sql similarity index 100% rename from db/changes/233001/00-transferClient.sql rename to db/changes/233201/00-transferClient.sql diff --git a/modules/ticket/back/methods/ticket/specs/transferClient.spec.js b/modules/ticket/back/methods/ticket/specs/transferClient.spec.js new file mode 100644 index 000000000..ed10e5159 --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/transferClient.spec.js @@ -0,0 +1,49 @@ +const models = require('vn-loopback/server/server').models; + +describe('Ticket transferClient()', () => { + const userId = 9; + const activeCtx = { + accessToken: {userId: userId}, + }; + const ctx = {req: activeCtx}; + + it('should throw an error as the ticket is not editable', async() => { + const tx = await models.Ticket.beginTransaction({}); + let error; + + try { + const options = {transaction: tx}; + const ticketId = 4; + const clientId = 1; + await models.Ticket.transferClient(ctx, ticketId, clientId, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error.message).toEqual(`The current ticket can't be modified`); + }); + + it('should be assigned a different clientFk', async() => { + const tx = await models.Ticket.beginTransaction({}); + let updatedTicket; + const ticketId = 10; + const clientId = 1; + + try { + const options = {transaction: tx}; + + await models.Ticket.transferClient(ctx, ticketId, clientId, options); + updatedTicket = await models.Ticket.findById(ticketId, {fields: ['clientFk']}, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + + expect(updatedTicket.clientFk).toEqual(clientId); + }); +}); diff --git a/modules/ticket/back/methods/ticket/transferClient.js b/modules/ticket/back/methods/ticket/transferClient.js index 226f5dedf..05ea27fa0 100644 --- a/modules/ticket/back/methods/ticket/transferClient.js +++ b/modules/ticket/back/methods/ticket/transferClient.js @@ -12,58 +12,38 @@ module.exports = Self => { http: {source: 'path'} }, { - arg: 'data', - type: 'object', + arg: 'clientId', + type: 'number', required: true, - description: 'the client id', - http: {source: 'body'} }, ], - returns: { - type: 'boolean', - root: true - }, http: { path: `/:id/transferClient`, verb: 'PATCH' } }); - Self.transferClient = async(ctx, ticketId, params) => { + Self.transferClient = async(ctx, ticketId, clientId, options) => { const models = Self.app.models; - const args = ctx.args; const myOptions = {}; - try { - const clientId = params.clientId; - const isEditable = await Self.isEditable(ctx, args.id, myOptions); - console.log('es editable?',isEditable) // Revisar - /* if (!isEditable){ - console.log('no es editable!') - throw new UserError(`The sales of this ticket can't be modified`); - } */ - - const ticket = await models.Ticket.findById(ticketId, myOptions); - console.log('ticket',ticket); - if(!ticket) return false; - const nparams = { - clientFk: clientId, - addressFk: ticket.addressFk, - } - - const promise = await ticket.updateAttributes(nparams); - console.log('promise', promise); - if(promise) return true; - } catch (error) { - console.log(error); - } - - /* if (typeof options == 'object') + if (typeof options == 'object') Object.assign(myOptions, options); - const ticket = await Self.findById(id, { - fields: ['isDeleted', 'refFk'] - }, myOptions); */ + const isEditable = await Self.isEditable(ctx, ticketId, myOptions); - return false; + if (!isEditable) + throw new UserError(`The current ticket can't be modified`); + + const ticket = await models.Ticket.findById( + ticketId, + {fields: ['id', 'shipped', 'clientFk', 'addressFk']}, + myOptions + ); + const client = await models.Client.findById(clientId, {fields: ['id', 'defaultAddressFk']}, myOptions); + + await ticket.updateAttributes({ + clientFk: clientId, + addressFk: client.defaultAddressFk, + }); }; -}; \ No newline at end of file +}; diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 019ae4fa6..62a233891 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -98,26 +98,12 @@ class Controller extends Section { transferClient() { const ticket = this.ticket; const clientId = ticket.client.id; - console.log('ticketId',ticket.id) - console.log('clientId',clientId); - this.$http.patch(`Tickets/${ticket.id}/transferClient`, {clientId}).then(() =>{ - this.vnApp.showSuccess(this.$t('Data saved!')); - this.reload(); - }) - this.$http.get(`Clients/${this.ticket.client.id}`).then(client => { - const ticket = this.ticket; - const params = - { - clientFk: client.data.id, - addressFk: client.data.defaultAddressFk, - }; - - this.$http.patch(`Tickets/${ticket.id}`, params).then(() => { + this.$http.patch(`Tickets/${ticket.id}/transferClient`, {clientId}) + .then(() => { this.vnApp.showSuccess(this.$t('Data saved!')); this.reload(); }); - }); } isTicketEditable() { diff --git a/modules/ticket/front/descriptor-menu/index.spec.js b/modules/ticket/front/descriptor-menu/index.spec.js index 914fe486c..1bb270165 100644 --- a/modules/ticket/front/descriptor-menu/index.spec.js +++ b/modules/ticket/front/descriptor-menu/index.spec.js @@ -326,17 +326,4 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); - - describe('transferClient()', () => { - it(`should perform two queries, a get to obtain the clientData and a patch to update the ticket`, () => { - const client = - { - clientFk: 1101, - addressFk: 1, - }; - $httpBackend.expect('GET', `Clients/${ticket.client.id}`).respond(client); - $httpBackend.expect('PATCH', `Tickets/${ticket.id}`).respond(); - controller.transferClient(); - }); - }); }); From eb963ff993f8f142298a6edefc631f2451fbf90b Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Jul 2023 08:28:19 +0200 Subject: [PATCH 188/311] refs #5866 fix(transferClient): correct variable name --- modules/ticket/back/methods/ticket/transferClient.js | 12 ++++++------ modules/ticket/front/descriptor-menu/index.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/ticket/back/methods/ticket/transferClient.js b/modules/ticket/back/methods/ticket/transferClient.js index 05ea27fa0..04c153bd2 100644 --- a/modules/ticket/back/methods/ticket/transferClient.js +++ b/modules/ticket/back/methods/ticket/transferClient.js @@ -12,7 +12,7 @@ module.exports = Self => { http: {source: 'path'} }, { - arg: 'clientId', + arg: 'clientFk', type: 'number', required: true, }, @@ -23,26 +23,26 @@ module.exports = Self => { } }); - Self.transferClient = async(ctx, ticketId, clientId, options) => { + Self.transferClient = async(ctx, id, clientFk, options) => { const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - const isEditable = await Self.isEditable(ctx, ticketId, myOptions); + const isEditable = await Self.isEditable(ctx, id, myOptions); if (!isEditable) throw new UserError(`The current ticket can't be modified`); const ticket = await models.Ticket.findById( - ticketId, + id, {fields: ['id', 'shipped', 'clientFk', 'addressFk']}, myOptions ); - const client = await models.Client.findById(clientId, {fields: ['id', 'defaultAddressFk']}, myOptions); + const client = await models.Client.findById(clientFk, {fields: ['id', 'defaultAddressFk']}, myOptions); await ticket.updateAttributes({ - clientFk: clientId, + clientFk, addressFk: client.defaultAddressFk, }); }; diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 62a233891..7bdefcd97 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -97,9 +97,9 @@ class Controller extends Section { transferClient() { const ticket = this.ticket; - const clientId = ticket.client.id; + const clientFk = ticket.client.id; - this.$http.patch(`Tickets/${ticket.id}/transferClient`, {clientId}) + this.$http.patch(`Tickets/${ticket.id}/transferClient`, {clientFk}) .then(() => { this.vnApp.showSuccess(this.$t('Data saved!')); this.reload(); From f52b398596a2c1b65728f5eea9d4530f6e48ac91 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Jul 2023 09:50:27 +0200 Subject: [PATCH 189/311] refs #5561 refactor: sustituidos sql por loopback --- .../back/methods/sale-tracking/delete.js | 25 ++++++++--- .../ticket/back/methods/sale-tracking/new.js | 44 ++++++++++++++----- 2 files changed, 53 insertions(+), 16 deletions(-) diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index 000c52621..30956228b 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -25,6 +25,7 @@ module.exports = Self => { }); Self.delete = async(saleFk, stateCode, options) => { + const models = Self.app.models; const myOptions = {}; let tx; @@ -37,15 +38,27 @@ module.exports = Self => { } try { - const result = await Self.rawSql(`CALL vn.saleTracking_del(?, ?)`, - [ - saleFk, - stateCode, - ], myOptions); + const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions); + for (let itemShelvingSale of itemShelvingSales) + await itemShelvingSale.destroy(myOptions); + + const state = await models.State.findOne({ + where: {code: stateCode} + }, myOptions); + + const filter = { + where: { + saleFk: saleFk, + stateFk: state.id + } + }; + const saleTrackings = await models.SaleTracking.find(filter, myOptions); + for (let saleTracking of saleTrackings) + await saleTracking.destroy(myOptions); if (tx) await tx.commit(); - return result; + return true; } catch (e) { if (tx) await tx.rollback(); throw e; diff --git a/modules/ticket/back/methods/sale-tracking/new.js b/modules/ticket/back/methods/sale-tracking/new.js index ec5951d7d..2be5bd86e 100644 --- a/modules/ticket/back/methods/sale-tracking/new.js +++ b/modules/ticket/back/methods/sale-tracking/new.js @@ -33,6 +33,7 @@ module.exports = Self => { }); Self.new = async(ctx, saleFk, isChecked, quantity, stateCode, options) => { + const models = Self.app.models; const userId = ctx.req.accessToken.userId; const myOptions = {}; let tx; @@ -45,19 +46,42 @@ module.exports = Self => { myOptions.transaction = tx; } try { - const result = await Self.rawSql(`CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?)`, - [ - saleFk, - isChecked, - quantity, - userId, - stateCode, - null - ], myOptions); + const state = await models.State.findOne({ + where: {code: stateCode} + }, myOptions); + + const saleTracking = await models.SaleTracking.findOne({ + where: { + saleFk: saleFk, + stateFk: state.id, + workerFk: userId + } + }, myOptions); + + let newSaleTracking; + if (saleTracking) { + newSaleTracking = await saleTracking.updateAttributes({ + saleFk: saleFk, + stateFk: state.id, + workerFk: userId, + isChecked: isChecked, + originalQuantity: quantity, + isScanned: null + }, myOptions); + } else { + newSaleTracking = await models.SaleTracking.create({ + saleFk: saleFk, + stateFk: state.id, + workerFk: userId, + isChecked: isChecked, + originalQuantity: quantity, + isScanned: null + }); + } if (tx) await tx.commit(); - return result; + return newSaleTracking; } catch (e) { if (tx) await tx.rollback(); throw e; From cf0b6f8c6e3ee2bfd99c53aead6d2ef1fc951dab Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Jul 2023 12:01:01 +0200 Subject: [PATCH 190/311] refs #5561 fix: saleGroupDetail.saleFk UNIQUE --- db/changes/233201/00-saleGroupDetail.sql | 7 +++++++ modules/ticket/back/methods/sale-tracking/delete.js | 8 +++++--- modules/ticket/back/methods/sale-tracking/filter.js | 1 + modules/ticket/front/sale-tracking/index.js | 5 +---- 4 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 db/changes/233201/00-saleGroupDetail.sql diff --git a/db/changes/233201/00-saleGroupDetail.sql b/db/changes/233201/00-saleGroupDetail.sql new file mode 100644 index 000000000..e25c4f35c --- /dev/null +++ b/db/changes/233201/00-saleGroupDetail.sql @@ -0,0 +1,7 @@ +DELETE FROM `vn`.`saleGroupDetail` WHERE id IN (468106,468104,468107,468105,495210,495208,495207,495209,462879,462880,447186,450623,450622,455606,455605,455827,455829,455828,459067,460689,460691,460690,460692,462408,463403,463405,463404,463129,463127,463126,463128,468098,468096,468099,468097,468310,468314,468313,475654,468325,473248,474803,474739,475042,475052,475047,475041,475051,475046,475040,475050,475045,475039,475049,475044,475038,475048,475043,474888,474892,474890,474887,474891,474889,481109,481107,481105,481108,481106,481110,479008,490787,490792,490791,485295,485294,485293,485528,490796,487853,487959,491303,490789,490914,490913,492305,492310,492307,492304,492309,492306,492303,492308,494111,494110,494480,494482,494481,494483,495202,495200,495199,495201,497209,499765,499763,499767,499764,499768,499766,502014,502013,508820,508819,508818,463133,463131,463130,463132,468102,468100,468103,468101,468311,468316,468315,468327,474894,474898,474896,474893,474897,474895,495206,495204,495203,495205,499771,499769,499773,499770,499774,499772) +ALTER TABLE `vn`.`saleGroupDetail` ADD CONSTRAINT saleGroupDetail_UN UNIQUE KEY (saleFk); + +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) + VALUES + ('SaleGroupDetail','deleteById','WRITE','ALLOW','employee'); + diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index 30956228b..b8754d48c 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -38,9 +38,11 @@ module.exports = Self => { } try { - const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions); - for (let itemShelvingSale of itemShelvingSales) - await itemShelvingSale.destroy(myOptions); + if (stateCode === 'PREPARED') { + const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions); + for (let itemShelvingSale of itemShelvingSales) + await itemShelvingSale.destroy(myOptions); + } const state = await models.State.findOne({ where: {code: stateCode} diff --git a/modules/ticket/back/methods/sale-tracking/filter.js b/modules/ticket/back/methods/sale-tracking/filter.js index 09101a47a..2fa21cb1a 100644 --- a/modules/ticket/back/methods/sale-tracking/filter.js +++ b/modules/ticket/back/methods/sale-tracking/filter.js @@ -55,6 +55,7 @@ module.exports = Self => { stPrevious.isChecked as isPrevious, stPrepared.isChecked as isPrepared, stControled.isChecked as isControled, + sgd.id saleGroupDetailFk, (MAX(sgd.id) IS NOT NULL) AS hasSaleGroupDetail, p.code AS parkingCode, i.value5, diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index 0237428c8..6ea7778b1 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -30,10 +30,7 @@ class Controller extends Section { clickSaleGroupDetail(index) { const sale = this.sales[index]; - const params = { - saleFk: sale.saleFk - }; - return this.$http.post('SaleTrackings/deleteSaleGroupDetail', params) + return this.$http.delete(`SaleGroupDetails/${sale.saleGroupDetailFk}`) .then(() => { sale.hasSaleGroupDetail = false; this.vnApp.showSuccess(this.$t('Data saved!')); From 51f9055d232c9faf7c3d4bf7cc495ee2cfe0628d Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Jul 2023 12:01:57 +0200 Subject: [PATCH 191/311] remove file --- .../sale-tracking/deleteSaleGroupDetail.js | 49 ------------------- 1 file changed, 49 deletions(-) delete mode 100644 modules/ticket/back/methods/sale-tracking/deleteSaleGroupDetail.js diff --git a/modules/ticket/back/methods/sale-tracking/deleteSaleGroupDetail.js b/modules/ticket/back/methods/sale-tracking/deleteSaleGroupDetail.js deleted file mode 100644 index 13806edf0..000000000 --- a/modules/ticket/back/methods/sale-tracking/deleteSaleGroupDetail.js +++ /dev/null @@ -1,49 +0,0 @@ - -module.exports = Self => { - Self.remoteMethod('deleteSaleGroupDetail', { - description: 'Elimina los registros de saleGroupDetail', - accessType: 'WRITE', - accepts: [ - { - arg: 'saleFk', - type: 'number', - description: 'The sale id' - } - ], - returns: { - type: ['object'], - root: true - }, - http: { - path: `/deleteSaleGroupDetail`, - verb: 'POST' - } - }); - - Self.deleteSaleGroupDetail = async(saleFk, options) => { - const models = Self.app.models; - const myOptions = {}; - let tx; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - try { - const deletes = await models.SaleGroupDetail.destroyAll({ - saleFk: saleFk - }, myOptions); - - if (tx) await tx.commit(); - - return deletes; - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } - }; -}; From f926c600174b947ae6eeb8ae8dc9895e742bf256 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Jul 2023 12:02:02 +0200 Subject: [PATCH 192/311] remove file --- modules/ticket/back/models/sale-tracking.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/ticket/back/models/sale-tracking.js b/modules/ticket/back/models/sale-tracking.js index 38de256be..54a2b5a1a 100644 --- a/modules/ticket/back/models/sale-tracking.js +++ b/modules/ticket/back/models/sale-tracking.js @@ -3,5 +3,4 @@ module.exports = Self => { require('../methods/sale-tracking/listSaleTracking')(Self); require('../methods/sale-tracking/new')(Self); require('../methods/sale-tracking/delete')(Self); - require('../methods/sale-tracking/deleteSaleGroupDetail')(Self); }; From 9bf891fcec582b11ed216e061f99a75b049ad20f Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Jul 2023 12:20:06 +0200 Subject: [PATCH 193/311] refs #5561 fixed --- db/changes/233201/00-saleGroupDetail.sql | 2 +- modules/ticket/front/sale-tracking/index.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/db/changes/233201/00-saleGroupDetail.sql b/db/changes/233201/00-saleGroupDetail.sql index e25c4f35c..d16478716 100644 --- a/db/changes/233201/00-saleGroupDetail.sql +++ b/db/changes/233201/00-saleGroupDetail.sql @@ -1,4 +1,4 @@ -DELETE FROM `vn`.`saleGroupDetail` WHERE id IN (468106,468104,468107,468105,495210,495208,495207,495209,462879,462880,447186,450623,450622,455606,455605,455827,455829,455828,459067,460689,460691,460690,460692,462408,463403,463405,463404,463129,463127,463126,463128,468098,468096,468099,468097,468310,468314,468313,475654,468325,473248,474803,474739,475042,475052,475047,475041,475051,475046,475040,475050,475045,475039,475049,475044,475038,475048,475043,474888,474892,474890,474887,474891,474889,481109,481107,481105,481108,481106,481110,479008,490787,490792,490791,485295,485294,485293,485528,490796,487853,487959,491303,490789,490914,490913,492305,492310,492307,492304,492309,492306,492303,492308,494111,494110,494480,494482,494481,494483,495202,495200,495199,495201,497209,499765,499763,499767,499764,499768,499766,502014,502013,508820,508819,508818,463133,463131,463130,463132,468102,468100,468103,468101,468311,468316,468315,468327,474894,474898,474896,474893,474897,474895,495206,495204,495203,495205,499771,499769,499773,499770,499774,499772) +DELETE FROM `vn`.`saleGroupDetail` WHERE id IN (468106,468104,468107,468105,495210,495208,495207,495209,462879,462880,447186,450623,450622,455606,455605,455827,455829,455828,459067,460689,460691,460690,460692,462408,463403,463405,463404,463129,463127,463126,463128,468098,468096,468099,468097,468310,468314,468313,475654,468325,473248,474803,474739,475042,475052,475047,475041,475051,475046,475040,475050,475045,475039,475049,475044,475038,475048,475043,474888,474892,474890,474887,474891,474889,481109,481107,481105,481108,481106,481110,479008,490787,490792,490791,485295,485294,485293,485528,490796,487853,487959,491303,490789,490914,490913,492305,492310,492307,492304,492309,492306,492303,492308,494111,494110,494480,494482,494481,494483,495202,495200,495199,495201,497209,499765,499763,499767,499764,499768,499766,502014,502013,508820,508819,508818,463133,463131,463130,463132,468102,468100,468103,468101,468311,468316,468315,468327,474894,474898,474896,474893,474897,474895,495206,495204,495203,495205,499771,499769,499773,499770,499774,499772); ALTER TABLE `vn`.`saleGroupDetail` ADD CONSTRAINT saleGroupDetail_UN UNIQUE KEY (saleFk); INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index 6ea7778b1..6c0e7232e 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -30,6 +30,8 @@ class Controller extends Section { clickSaleGroupDetail(index) { const sale = this.sales[index]; + if (!sale.saleGroupDetailFk) return; + return this.$http.delete(`SaleGroupDetails/${sale.saleGroupDetailFk}`) .then(() => { sale.hasSaleGroupDetail = false; From 985e258529a0debad2e27172049fc0e91bc9ee13 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Jul 2023 12:33:14 +0200 Subject: [PATCH 194/311] refs #5769 fix(web-access): email rule --- back/methods/vn-user/privileges.js | 2 +- back/models/vn-user.js | 2 +- modules/client/front/web-access/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/back/methods/vn-user/privileges.js b/back/methods/vn-user/privileges.js index 690ce74a3..08cfaaae8 100644 --- a/back/methods/vn-user/privileges.js +++ b/back/methods/vn-user/privileges.js @@ -47,7 +47,7 @@ module.exports = Self => { const user = await Self.findById(userId, {fields: ['hasGrant']}, myOptions); const userToUpdate = await Self.findById(id, { - fields: ['id', 'name', 'hasGrant', 'roleFk', 'password'], + fields: ['id', 'name', 'hasGrant', 'roleFk', 'password', 'email'], include: { relation: 'role', scope: { diff --git a/back/models/vn-user.js b/back/models/vn-user.js index a7ce12073..985f017a5 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -20,7 +20,7 @@ module.exports = function(Self) { Self.validatesFormatOf('email', { message: 'Invalid email', allowNull: true, - allowBlank: true, + allowBlank: false, with: /^[\w|.|-]+@[\w|-]+(\.[\w|-]+)*(,[\w|.|-]+@[\w|-]+(\.[\w|-]+)*)*$/ }); diff --git a/modules/client/front/web-access/index.html b/modules/client/front/web-access/index.html index 74407ba5c..bf3d34c79 100644 --- a/modules/client/front/web-access/index.html +++ b/modules/client/front/web-access/index.html @@ -39,7 +39,7 @@ label="Recovery email" ng-model="$ctrl.account.email" info="This email is used for user to regain access their account." - rule="VnUser.name"> + rule="VnUser.email"> From 203f6a5659f6fdead03c013a43f2b59ec881e5f8 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Jul 2023 12:41:16 +0200 Subject: [PATCH 195/311] refs #5712 correct sql folder --- db/changes/{232801 => 233201}/00-workerDocuware.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{232801 => 233201}/00-workerDocuware.sql (100%) diff --git a/db/changes/232801/00-workerDocuware.sql b/db/changes/233201/00-workerDocuware.sql similarity index 100% rename from db/changes/232801/00-workerDocuware.sql rename to db/changes/233201/00-workerDocuware.sql From ade7303a6fd6878bac8d3de5bd88af0c61991254 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 21 Jul 2023 13:05:55 +0200 Subject: [PATCH 196/311] refs #6047 added editable-td component --- e2e/helpers/selectors.js | 2 +- e2e/paths/08-route/04_tickets.spec.js | 3 +-- modules/route/front/tickets/index.html | 21 +++++++++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 977c8a837..93288efa7 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -875,7 +875,7 @@ export default { }, routeTickets: { - firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-input-number[ng-model="ticket.priority"]', + firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-td-editable', firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check', buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]', firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]', diff --git a/e2e/paths/08-route/04_tickets.spec.js b/e2e/paths/08-route/04_tickets.spec.js index ccd5562c2..c890162a1 100644 --- a/e2e/paths/08-route/04_tickets.spec.js +++ b/e2e/paths/08-route/04_tickets.spec.js @@ -18,8 +18,7 @@ describe('Route tickets path', () => { }); it('should modify the first ticket priority', async() => { - await page.clearInput(selectors.routeTickets.firstTicketPriority); - await page.type(selectors.routeTickets.firstTicketPriority, '9'); + await page.writeOnEditableTD(selectors.routeTickets.firstTicketPriority, '9'); await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index 32a4a2d7c..453eb0517 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -84,14 +84,27 @@ tabindex="-1"> - - + + {{ticket.priority}} + + + + + + + {{::ticket.street}} Date: Fri, 21 Jul 2023 13:13:44 +0200 Subject: [PATCH 197/311] removed unnecesary comments --- modules/route/front/tickets/index.html | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index 453eb0517..ea6755cca 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -98,12 +98,6 @@ vn-focus> - {{::ticket.street}} Date: Mon, 24 Jul 2023 10:34:44 +0200 Subject: [PATCH 198/311] refs #5929 added ACL and accurate errors --- db/changes/233201/00-updatePrice.sql | 2 ++ loopback/locale/es.json | 6 +++-- .../ticket/back/methods/ticket/isEditable.js | 23 +++++++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 db/changes/233201/00-updatePrice.sql diff --git a/db/changes/233201/00-updatePrice.sql b/db/changes/233201/00-updatePrice.sql new file mode 100644 index 000000000..93888df6e --- /dev/null +++ b/db/changes/233201/00-updatePrice.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) + VALUES ('Ticket','*','*','ALLOW','ROLE','buyer'); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d95e8d8a4..1a200709f 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -307,5 +307,7 @@ "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", - "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado" -} + "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado", + "You don't have enough privileges.": "You don't have enough privileges.", + "This ticket is locked.": "This ticket is locked." +} \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/isEditable.js b/modules/ticket/back/methods/ticket/isEditable.js index 13bd4d57f..9f7e14dcc 100644 --- a/modules/ticket/back/methods/ticket/isEditable.js +++ b/modules/ticket/back/methods/ticket/isEditable.js @@ -1,3 +1,5 @@ +const UserError = require('vn-loopback/util/user-error'); + module.exports = Self => { Self.remoteMethodCtx('isEditable', { description: 'Check if a ticket is editable', @@ -31,7 +33,7 @@ module.exports = Self => { }, myOptions); const isRoleAdvanced = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*'); - + const canEditWeeklyTicket = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'buyer', 'WRITE'); const alertLevel = state ? state.alertLevel : null; const ticket = await models.Ticket.findById(id, { fields: ['clientFk'], @@ -48,13 +50,26 @@ module.exports = Self => { const isLocked = await models.Ticket.isLocked(id, myOptions); const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions); + console.log('isRoleAdvanced', isRoleAdvanced); + console.log('canEditWeeklyTicket', canEditWeeklyTicket); + console.log('ticket', ticket); + console.log('isLocked', isLocked); + console.log('isWeekly', isWeekly); const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0); const isNormalClient = ticket && ticket.client().type().code == 'normal'; const isEditable = !(alertLevelGreaterThanZero && isNormalClient); + if (!ticket) + throw new UserError(`The ticket doesn't exist.`); - if (ticket && (isEditable || isRoleAdvanced) && !isLocked && !isWeekly) - return true; + if (!isEditable && !isRoleAdvanced) + throw new UserError(`This ticket is not editable.`); - return false; + if (isLocked) + throw new UserError(`This ticket is locked.`); + + if (isWeekly && !canEditWeeklyTicket) + throw new UserError(`You don't have enough privileges.`); + + return true; }; }; From ea4190f15cd9227aece6361a981be22f8f7f665d Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 24 Jul 2023 13:32:28 +0200 Subject: [PATCH 199/311] refs #5216 update expedition state added --- .../expedition-state/updateExpeditionState.js | 71 +++++++++++++++++++ .../ticket/back/models/expedition-state.js | 1 + 2 files changed, 72 insertions(+) create mode 100644 modules/ticket/back/methods/expedition-state/updateExpeditionState.js diff --git a/modules/ticket/back/methods/expedition-state/updateExpeditionState.js b/modules/ticket/back/methods/expedition-state/updateExpeditionState.js new file mode 100644 index 000000000..ce5144d30 --- /dev/null +++ b/modules/ticket/back/methods/expedition-state/updateExpeditionState.js @@ -0,0 +1,71 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethod('updateExpedtionState', { + description: 'Update an expedition state', + accepts: [ + { + arg: 'expeditions', + type: [ + { + expeditionFk: 'number', + stateCode: 'string' + } + ], + required: true, + description: 'Array of objects containing expeditionFk and stateCode' + } + ], + http: { + path: `/updateExpeditionState`, + verb: 'post' + } + }); + + Self.updateExpedtionState = async(expeditions, options) => { + const models = Self.app.models; + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + if (expeditions.length === 0) + return false; + + const promises = []; + try { + const conn = Self.dataSource.connector; + for (const expedition of expeditions) { + const stmt = new ParameterizedSQL( + `SELECT id FROM vn.expeditionStateType WHERE code = ?`, + [expedition.stateCode] + ); + const result = await conn.query(stmt); + if (result.length === 0) + throw new Error(`The state code '${exp.stateCode}' does not exist.`); + + const typeFk = result[0].id; + + const newExpeditionState = await models.Self.create({ + expeditionFk: expedition.expeditionFk, + typeFk, + }); + } + + await Promise.all(promises); + + if (tx) await tx.commit(); + + return true; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/ticket/back/models/expedition-state.js b/modules/ticket/back/models/expedition-state.js index af76af718..041c57be6 100644 --- a/modules/ticket/back/models/expedition-state.js +++ b/modules/ticket/back/models/expedition-state.js @@ -1,3 +1,4 @@ module.exports = function(Self) { require('../methods/expedition-state/filter')(Self); + require('../methods/expedition-state/updateExpeditionState')(Self); }; From 44ceeac9c4195ed2808fa9a8be20bd53bd9ed5f1 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 25 Jul 2023 10:21:54 +0200 Subject: [PATCH 200/311] refs #5983 feat(itemShelving): add userFk field --- modules/item/back/models/item-shelving.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index be379adca..8628bfeee 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -25,6 +25,9 @@ "type": "boolean" }, "visible": { + "type": "number" + }, + "userFk": { "type": "number" } }, From 9978db9d523f4b82670a5ea6b431c8b37630c121 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 25 Jul 2023 11:33:01 +0200 Subject: [PATCH 201/311] refs #5929 WIP test created --- db/changes/233201/00-updatePrice.sql | 2 +- loopback/locale/es.json | 3 +- .../ticket/back/methods/ticket/isEditable.js | 8 +- .../methods/ticket/specs/isEditable.spec.js | 130 +++++------------- 4 files changed, 42 insertions(+), 101 deletions(-) diff --git a/db/changes/233201/00-updatePrice.sql b/db/changes/233201/00-updatePrice.sql index 93888df6e..959943d6f 100644 --- a/db/changes/233201/00-updatePrice.sql +++ b/db/changes/233201/00-updatePrice.sql @@ -1,2 +1,2 @@ INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) - VALUES ('Ticket','*','*','ALLOW','ROLE','buyer'); + VALUES ('Ticket','canEditWeekly','WRITE','ALLOW','ROLE','buyer'); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 1a200709f..942cc74c7 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -309,5 +309,6 @@ "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado", "You don't have enough privileges.": "You don't have enough privileges.", - "This ticket is locked.": "This ticket is locked." + "This ticket is locked.": "This ticket is locked.", + "This ticket is not editable.": "This ticket is not editable." } \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/isEditable.js b/modules/ticket/back/methods/ticket/isEditable.js index 9f7e14dcc..967988214 100644 --- a/modules/ticket/back/methods/ticket/isEditable.js +++ b/modules/ticket/back/methods/ticket/isEditable.js @@ -33,7 +33,7 @@ module.exports = Self => { }, myOptions); const isRoleAdvanced = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*'); - const canEditWeeklyTicket = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'buyer', 'WRITE'); + const canEditWeeklyTicket = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'canEditWeekly', 'WRITE'); const alertLevel = state ? state.alertLevel : null; const ticket = await models.Ticket.findById(id, { fields: ['clientFk'], @@ -50,14 +50,10 @@ module.exports = Self => { const isLocked = await models.Ticket.isLocked(id, myOptions); const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions); - console.log('isRoleAdvanced', isRoleAdvanced); - console.log('canEditWeeklyTicket', canEditWeeklyTicket); - console.log('ticket', ticket); - console.log('isLocked', isLocked); - console.log('isWeekly', isWeekly); const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0); const isNormalClient = ticket && ticket.client().type().code == 'normal'; const isEditable = !(alertLevelGreaterThanZero && isNormalClient); + if (!ticket) throw new UserError(`The ticket doesn't exist.`); diff --git a/modules/ticket/back/methods/ticket/specs/isEditable.spec.js b/modules/ticket/back/methods/ticket/specs/isEditable.spec.js index 7337017d6..043445c28 100644 --- a/modules/ticket/back/methods/ticket/specs/isEditable.spec.js +++ b/modules/ticket/back/methods/ticket/specs/isEditable.spec.js @@ -1,143 +1,68 @@ const models = require('vn-loopback/server/server').models; describe('ticket isEditable()', () => { - it('should return false if the given ticket does not exist', async() => { + it('should throw an error as the ticket does not exist', async() => { const tx = await models.Ticket.beginTransaction({}); - let result; - + let error; try { const options = {transaction: tx}; const ctx = { req: {accessToken: {userId: 9}} }; - result = await models.Ticket.isEditable(ctx, 9999, options); - + await models.Ticket.isEditable(ctx, 9999, options); await tx.rollback(); } catch (e) { await tx.rollback(); - throw e; + error = e; } - expect(result).toEqual(false); + expect(error.message).toEqual(`The ticket doesn't exist.`); }); - it(`should return false if the given ticket isn't invoiced but isDeleted`, async() => { + it('should throw an error as this ticket is not editable', async() => { const tx = await models.Ticket.beginTransaction({}); - let result; - - try { - const options = {transaction: tx}; - const deletedTicket = await models.Ticket.findOne({ - where: { - invoiceOut: null, - isDeleted: true - }, - fields: ['id'] - }); - - const ctx = { - req: {accessToken: {userId: 9}} - }; - - result = await models.Ticket.isEditable(ctx, deletedTicket.id, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - - expect(result).toEqual(false); - }); - - it('should return true if the given ticket is editable', async() => { - const tx = await models.Ticket.beginTransaction({}); - let result; + let error; try { const options = {transaction: tx}; const ctx = { - req: {accessToken: {userId: 9}} + req: {accessToken: {userId: 1}} }; - result = await models.Ticket.isEditable(ctx, 16, options); - + await models.Ticket.isEditable(ctx, 8, options); await tx.rollback(); } catch (e) { + error = e; await tx.rollback(); - throw e; } - expect(result).toEqual(true); + expect(error.message).toEqual(`This ticket is not editable.`); }); - it('should not be able to edit a deleted or invoiced ticket even for salesAssistant', async() => { + it('should throw an error as this ticket is locked.', async() => { const tx = await models.Ticket.beginTransaction({}); - let result; - - try { - const options = {transaction: tx}; - const ctx = { - req: {accessToken: {userId: 21}} - }; - - result = await models.Ticket.isEditable(ctx, 19, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - - expect(result).toEqual(false); - }); - - it('should not be able to edit a deleted or invoiced ticket even for productionBoss', async() => { - const tx = await models.Ticket.beginTransaction({}); - let result; - - try { - const options = {transaction: tx}; - const ctx = { - req: {accessToken: {userId: 50}} - }; - - result = await models.Ticket.isEditable(ctx, 19, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - - expect(result).toEqual(false); - }); - - it('should not be able to edit a deleted or invoiced ticket even for salesPerson', async() => { - const tx = await models.Ticket.beginTransaction({}); - let result; - + let error; try { const options = {transaction: tx}; const ctx = { req: {accessToken: {userId: 18}} }; - result = await models.Ticket.isEditable(ctx, 19, options); + await models.Ticket.isEditable(ctx, 19, options); await tx.rollback(); } catch (e) { + error = e; await tx.rollback(); - throw e; } - expect(result).toEqual(false); + expect(error.message).toEqual(`This ticket is locked.`); }); - it('should not be able to edit if is a ticket weekly', async() => { + it('should throw an error as you do not have enough privileges.', async() => { const tx = await models.Ticket.beginTransaction({}); - + let error; try { const options = {transaction: tx}; @@ -147,10 +72,29 @@ describe('ticket isEditable()', () => { expect(result).toEqual(false); + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual(`You don't have enough privileges.`); + }); + + it('should be able to edit a ticket weekly', async() => { + const tx = await models.Ticket.beginTransaction({}); + let result; + try { + const options = {transaction: tx}; + const ctx = {req: {accessToken: {userId: 35}}}; + + result = await models.Ticket.isEditable(ctx, 15, options); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } + + expect(result).toEqual(true); }); }); From bf92c5d482ce4bf7a4055da56e279136f3651926 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 25 Jul 2023 15:00:08 +0200 Subject: [PATCH 202/311] refs #6059 validateLogin sync user --- back/models/vn-user.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 985f017a5..68a556d77 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -115,6 +115,14 @@ module.exports = function(Self) { Self.validateLogin = async function(user, password) { let loginInfo = Object.assign({password}, Self.userUses(user)); token = await Self.login(loginInfo, 'user'); + + const userToken = await token.user.get(); + try { + await Self.app.models.Account.sync(userToken.name, password); + } catch (err) { + console.warn(err); + } + return {token: token.id, ttl: token.ttl}; }; From 543fbf3c0a322e9b586ed3caf8194c1491753235 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 25 Jul 2023 15:35:08 +0200 Subject: [PATCH 203/311] refs #5929 isEditableOrThrow created, tests passed --- loopback/locale/en.json | 6 +- loopback/locale/es.json | 7 +- modules/ticket/back/methods/ticket/addSale.js | 5 +- .../back/methods/ticket/componentUpdate.js | 6 +- .../ticket/back/methods/ticket/isEditable.js | 52 +-------- .../back/methods/ticket/isEditableOrThrow.js | 49 ++++++++ .../back/methods/ticket/priceDifference.js | 7 +- .../methods/ticket/recalculateComponents.js | 6 +- .../ticket/back/methods/ticket/setDeleted.js | 5 +- .../back/methods/ticket/specs/addSale.spec.js | 2 +- .../methods/ticket/specs/isEditable.spec.js | 109 ++++-------------- .../ticket/specs/isEditableOrThrow.spec.js | 100 ++++++++++++++++ .../ticket/specs/priceDifference.spec.js | 3 +- .../specs/recalculateComponents.spec.js | 3 +- .../ticket/specs/transferClient.spec.js | 2 +- .../ticket/specs/transferSales.spec.js | 2 +- .../back/methods/ticket/transferClient.js | 6 +- .../back/methods/ticket/transferSales.js | 6 +- modules/ticket/back/models/ticket-methods.js | 1 + 19 files changed, 203 insertions(+), 174 deletions(-) create mode 100644 modules/ticket/back/methods/ticket/isEditableOrThrow.js create mode 100644 modules/ticket/back/methods/ticket/specs/isEditableOrThrow.spec.js diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 030afbe9e..135bb2be9 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -178,5 +178,9 @@ "The renew period has not been exceeded": "The renew period has not been exceeded", "You can not use the same password": "You can not use the same password", "Valid priorities": "Valid priorities: %d", - "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}" + "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}", + "You don't have enough privileges.": "You don't have enough privileges.", + "This ticket is locked.": "This ticket is locked.", + "This ticket is not editable.": "This ticket is not editable.", + "The ticket doesn't exist.": "The ticket doesn't exist." } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 942cc74c7..ac62d62e1 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -308,7 +308,8 @@ "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado", - "You don't have enough privileges.": "You don't have enough privileges.", - "This ticket is locked.": "This ticket is locked.", - "This ticket is not editable.": "This ticket is not editable." + "You don't have enough privileges.": "No tienes suficientes permisos.", + "This ticket is locked.": "Este ticket está bloqueado.", + "This ticket is not editable.": "Este ticket no es editable.", + "The ticket doesn't exist.": "No existe el ticket." } \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/addSale.js b/modules/ticket/back/methods/ticket/addSale.js index 2cd02a8a4..9a3e32a7e 100644 --- a/modules/ticket/back/methods/ticket/addSale.js +++ b/modules/ticket/back/methods/ticket/addSale.js @@ -1,4 +1,3 @@ - const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { @@ -47,9 +46,7 @@ module.exports = Self => { } try { - const isEditable = await models.Ticket.isEditable(ctx, id, myOptions); - if (!isEditable) - throw new UserError(`The sales of this ticket can't be modified`); + const isEditable = await models.Ticket.isEditableOrThrow(ctx, id, myOptions); const item = await models.Item.findById(itemId, null, myOptions); const ticket = await models.Ticket.findById(id, { diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index 48aee36d4..eadbf65c2 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -1,4 +1,3 @@ -const UserError = require('vn-loopback/util/user-error'); const loggable = require('vn-loopback/util/log'); module.exports = Self => { @@ -116,10 +115,7 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; const $t = ctx.req.__; // $translate - const isEditable = await models.Ticket.isEditable(ctx, args.id, myOptions); - - if (!isEditable) - throw new UserError(`The sales of this ticket can't be modified`); + const isEditable = await models.Ticket.isEditableOrThrow(ctx, args.id, myOptions); const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE'); if (!editZone) { diff --git a/modules/ticket/back/methods/ticket/isEditable.js b/modules/ticket/back/methods/ticket/isEditable.js index 967988214..f657cd5e3 100644 --- a/modules/ticket/back/methods/ticket/isEditable.js +++ b/modules/ticket/back/methods/ticket/isEditable.js @@ -1,5 +1,3 @@ -const UserError = require('vn-loopback/util/user-error'); - module.exports = Self => { Self.remoteMethodCtx('isEditable', { description: 'Check if a ticket is editable', @@ -22,50 +20,12 @@ module.exports = Self => { }); Self.isEditable = async(ctx, id, options) => { - const models = Self.app.models; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - const state = await models.TicketState.findOne({ - where: {ticketFk: id} - }, myOptions); - - const isRoleAdvanced = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*'); - const canEditWeeklyTicket = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'canEditWeekly', 'WRITE'); - const alertLevel = state ? state.alertLevel : null; - const ticket = await models.Ticket.findById(id, { - fields: ['clientFk'], - include: [{ - relation: 'client', - scope: { - include: { - relation: 'type' - } - } - }] - }, myOptions); - - const isLocked = await models.Ticket.isLocked(id, myOptions); - const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions); - - const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0); - const isNormalClient = ticket && ticket.client().type().code == 'normal'; - const isEditable = !(alertLevelGreaterThanZero && isNormalClient); - - if (!ticket) - throw new UserError(`The ticket doesn't exist.`); - - if (!isEditable && !isRoleAdvanced) - throw new UserError(`This ticket is not editable.`); - - if (isLocked) - throw new UserError(`This ticket is locked.`); - - if (isWeekly && !canEditWeeklyTicket) - throw new UserError(`You don't have enough privileges.`); - + try { + await Self.isEditableOrThrow(ctx, id, options); + } catch (e) { + if (e.name === 'ForbiddenError') return false; + throw e; + } return true; }; }; diff --git a/modules/ticket/back/methods/ticket/isEditableOrThrow.js b/modules/ticket/back/methods/ticket/isEditableOrThrow.js new file mode 100644 index 000000000..6a8bafa2c --- /dev/null +++ b/modules/ticket/back/methods/ticket/isEditableOrThrow.js @@ -0,0 +1,49 @@ +const ForbiddenError = require('vn-loopback/util/forbiddenError'); + +module.exports = Self => { + Self.isEditableOrThrow = async(ctx, id, options) => { + const models = Self.app.models; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const state = await models.TicketState.findOne({ + where: {ticketFk: id} + }, myOptions); + + const isRoleAdvanced = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*'); + const canEditWeeklyTicket = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'canEditWeekly', 'WRITE'); + const alertLevel = state ? state.alertLevel : null; + const ticket = await models.Ticket.findById(id, { + fields: ['clientFk'], + include: [{ + relation: 'client', + scope: { + include: { + relation: 'type' + } + } + }] + }, myOptions); + + const isLocked = await models.Ticket.isLocked(id, myOptions); + const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions); + + const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0); + const isNormalClient = ticket && ticket.client().type().code == 'normal'; + const isEditable = !(alertLevelGreaterThanZero && isNormalClient); + + if (!ticket) + throw new ForbiddenError(`The ticket doesn't exist.`); + + if (!isEditable && !isRoleAdvanced) + throw new ForbiddenError(`This ticket is not editable.`); + + if (isLocked) + throw new ForbiddenError(`This ticket is locked.`); + + if (isWeekly && !canEditWeeklyTicket) + throw new ForbiddenError(`You don't have enough privileges.`); + }; +}; diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js index 42a71f1c8..754646b03 100644 --- a/modules/ticket/back/methods/ticket/priceDifference.js +++ b/modules/ticket/back/methods/ticket/priceDifference.js @@ -1,5 +1,3 @@ -const UserError = require('vn-loopback/util/user-error'); - module.exports = Self => { Self.remoteMethodCtx('priceDifference', { description: 'Returns sales with price difference if the ticket is editable', @@ -72,10 +70,7 @@ module.exports = Self => { } try { - const isEditable = await Self.isEditable(ctx, args.id, myOptions); - - if (!isEditable) - throw new UserError(`The sales of this ticket can't be modified`); + const isEditable = await Self.isEditableOrThrow(ctx, args.id, myOptions); const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE'); if (!editZone) { diff --git a/modules/ticket/back/methods/ticket/recalculateComponents.js b/modules/ticket/back/methods/ticket/recalculateComponents.js index eb9c8a72e..78c44bab3 100644 --- a/modules/ticket/back/methods/ticket/recalculateComponents.js +++ b/modules/ticket/back/methods/ticket/recalculateComponents.js @@ -1,4 +1,3 @@ -const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('recalculateComponents', { description: 'Calculates the price of a sale and its components', @@ -33,10 +32,7 @@ module.exports = Self => { } try { - const isEditable = await Self.isEditable(ctx, id, myOptions); - - if (!isEditable) - throw new UserError(`The current ticket can't be modified`); + const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions); const recalculation = await Self.rawSql('CALL vn.ticket_recalcComponents(?, NULL)', [id], myOptions); diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js index 878cce056..6485f198e 100644 --- a/modules/ticket/back/methods/ticket/setDeleted.js +++ b/modules/ticket/back/methods/ticket/setDeleted.js @@ -39,10 +39,7 @@ module.exports = Self => { const ticketToDelete = await models.Ticket.findById(id, {fields: ['isDeleted']}, myOptions); if (ticketToDelete.isDeleted) return false; - const isEditable = await Self.isEditable(ctx, id, myOptions); - - if (!isEditable) - throw new UserError(`The sales of this ticket can't be modified`); + const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions); // Check if ticket has refunds const ticketRefunds = await models.TicketRefund.find({ diff --git a/modules/ticket/back/methods/ticket/specs/addSale.spec.js b/modules/ticket/back/methods/ticket/specs/addSale.spec.js index 2e568716a..b1ecb133b 100644 --- a/modules/ticket/back/methods/ticket/specs/addSale.spec.js +++ b/modules/ticket/back/methods/ticket/specs/addSale.spec.js @@ -97,6 +97,6 @@ describe('ticket addSale()', () => { error = e; } - expect(error.message).toEqual(`The sales of this ticket can't be modified`); + expect(error.message).toEqual(`This ticket is locked.`); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/isEditable.spec.js b/modules/ticket/back/methods/ticket/specs/isEditable.spec.js index 043445c28..301745ed3 100644 --- a/modules/ticket/back/methods/ticket/specs/isEditable.spec.js +++ b/modules/ticket/back/methods/ticket/specs/isEditable.spec.js @@ -1,100 +1,37 @@ const models = require('vn-loopback/server/server').models; -describe('ticket isEditable()', () => { - it('should throw an error as the ticket does not exist', async() => { - const tx = await models.Ticket.beginTransaction({}); - let error; - try { - const options = {transaction: tx}; - const ctx = { - req: {accessToken: {userId: 9}} - }; - - await models.Ticket.isEditable(ctx, 9999, options); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - error = e; - } - - expect(error.message).toEqual(`The ticket doesn't exist.`); - }); - - it('should throw an error as this ticket is not editable', async() => { - const tx = await models.Ticket.beginTransaction({}); - let error; - - try { - const options = {transaction: tx}; - const ctx = { - req: {accessToken: {userId: 1}} - }; - - await models.Ticket.isEditable(ctx, 8, options); - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toEqual(`This ticket is not editable.`); - }); - - it('should throw an error as this ticket is locked.', async() => { - const tx = await models.Ticket.beginTransaction({}); - let error; - try { - const options = {transaction: tx}; - const ctx = { - req: {accessToken: {userId: 18}} - }; - - await models.Ticket.isEditable(ctx, 19, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toEqual(`This ticket is locked.`); - }); - - it('should throw an error as you do not have enough privileges.', async() => { - const tx = await models.Ticket.beginTransaction({}); - let error; - try { - const options = {transaction: tx}; - - const ctx = {req: {accessToken: {userId: 1}}}; - - const result = await models.Ticket.isEditable(ctx, 15, options); - - expect(result).toEqual(false); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toEqual(`You don't have enough privileges.`); - }); - - it('should be able to edit a ticket weekly', async() => { +describe('isEditable()', () => { + it('should return false if It is able to edit', async() => { const tx = await models.Ticket.beginTransaction({}); let result; + try { const options = {transaction: tx}; const ctx = {req: {accessToken: {userId: 35}}}; - - result = await models.Ticket.isEditable(ctx, 15, options); + result = await models.Ticket.isEditable(ctx, 5, options); await tx.rollback(); - } catch (e) { + } catch (error) { await tx.rollback(); throw e; } - expect(result).toEqual(true); + expect(result).toBeFalse(); + }); + + it('should return true if It is able to edit', async() => { + const tx = await models.Ticket.beginTransaction({}); + let result; + + try { + const options = {transaction: tx}; + const ctx = {req: {accessToken: {userId: 35}}}; + result = await models.Ticket.isEditable(ctx, 15, options); + await tx.rollback(); + } catch (error) { + await tx.rollback(); + throw e; + } + + expect(result).toBeTrue(); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/isEditableOrThrow.spec.js b/modules/ticket/back/methods/ticket/specs/isEditableOrThrow.spec.js new file mode 100644 index 000000000..b65ed64a1 --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/isEditableOrThrow.spec.js @@ -0,0 +1,100 @@ +const models = require('vn-loopback/server/server').models; + +describe('ticket isEditableOrThrow()', () => { + it('should throw an error as the ticket does not exist', async() => { + const tx = await models.Ticket.beginTransaction({}); + let error; + try { + const options = {transaction: tx}; + const ctx = { + req: {accessToken: {userId: 9}} + }; + + await models.Ticket.isEditableOrThrow(ctx, 9999, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error.message).toEqual(`The ticket doesn't exist.`); + }); + + it('should throw an error as this ticket is not editable', async() => { + const tx = await models.Ticket.beginTransaction({}); + let error; + + try { + const options = {transaction: tx}; + const ctx = { + req: {accessToken: {userId: 1}} + }; + + await models.Ticket.isEditableOrThrow(ctx, 8, options); + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual(`This ticket is not editable.`); + }); + + it('should throw an error as this ticket is locked.', async() => { + const tx = await models.Ticket.beginTransaction({}); + let error; + try { + const options = {transaction: tx}; + const ctx = { + req: {accessToken: {userId: 18}} + }; + + await models.Ticket.isEditableOrThrow(ctx, 19, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual(`This ticket is locked.`); + }); + + it('should throw an error as you do not have enough privileges.', async() => { + const tx = await models.Ticket.beginTransaction({}); + let error; + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}}; + + const result = await models.Ticket.isEditableOrThrow(ctx, 15, options); + + expect(result).toEqual(false); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual(`You don't have enough privileges.`); + }); + + it('should return undefined if It can be edited', async() => { + const tx = await models.Ticket.beginTransaction({}); + let result; + try { + const options = {transaction: tx}; + const ctx = {req: {accessToken: {userId: 35}}}; + + result = await models.Ticket.isEditableOrThrow(ctx, 15, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + + expect(result).toBeUndefined(); + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js index cc54353ef..d01f0c1bb 100644 --- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js @@ -1,5 +1,6 @@ const models = require('vn-loopback/server/server').models; const UserError = require('vn-loopback/util/user-error'); +const ForbiddenError = require('vn-loopback/util/forbiddenError'); describe('sale priceDifference()', () => { it('should return ticket price differences', async() => { @@ -59,7 +60,7 @@ describe('sale priceDifference()', () => { await tx.rollback(); } - expect(error).toEqual(new UserError(`The sales of this ticket can't be modified`)); + expect(error).toEqual(new ForbiddenError(`This ticket is not editable.`)); }); it('should return ticket movable', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/recalculateComponents.spec.js b/modules/ticket/back/methods/ticket/specs/recalculateComponents.spec.js index ed10d114f..383c2c6d5 100644 --- a/modules/ticket/back/methods/ticket/specs/recalculateComponents.spec.js +++ b/modules/ticket/back/methods/ticket/specs/recalculateComponents.spec.js @@ -1,4 +1,5 @@ const models = require('vn-loopback/server/server').models; +const ForbiddenError = require('vn-loopback/util/forbiddenError'); describe('ticket recalculateComponents()', () => { const ticketId = 11; @@ -38,6 +39,6 @@ describe('ticket recalculateComponents()', () => { error = e; } - expect(error).toEqual(new Error(`The current ticket can't be modified`)); + expect(error).toEqual(new ForbiddenError(`This ticket is locked.`)); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/transferClient.spec.js b/modules/ticket/back/methods/ticket/specs/transferClient.spec.js index ed10e5159..c09c20083 100644 --- a/modules/ticket/back/methods/ticket/specs/transferClient.spec.js +++ b/modules/ticket/back/methods/ticket/specs/transferClient.spec.js @@ -23,7 +23,7 @@ describe('Ticket transferClient()', () => { error = e; } - expect(error.message).toEqual(`The current ticket can't be modified`); + expect(error.message).toEqual(`This ticket is locked.`); }); it('should be assigned a different clientFk', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js index 562688917..ef92e88c0 100644 --- a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js +++ b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js @@ -33,7 +33,7 @@ describe('sale transferSales()', () => { error = e; } - expect(error.message).toEqual(`The sales of this ticket can't be modified`); + expect(error.message).toEqual(`This ticket is not editable.`); }); it('should throw an error if the receiving ticket is not editable', async() => { diff --git a/modules/ticket/back/methods/ticket/transferClient.js b/modules/ticket/back/methods/ticket/transferClient.js index 04c153bd2..c87ad4881 100644 --- a/modules/ticket/back/methods/ticket/transferClient.js +++ b/modules/ticket/back/methods/ticket/transferClient.js @@ -1,4 +1,3 @@ -const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('transferClient', { description: 'Transfering ticket to another client', @@ -29,10 +28,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const isEditable = await Self.isEditable(ctx, id, myOptions); - - if (!isEditable) - throw new UserError(`The current ticket can't be modified`); + const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions); const ticket = await models.Ticket.findById( id, diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 0eee50d5f..bd99920db 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -1,4 +1,4 @@ -let UserError = require('vn-loopback/util/user-error'); +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('transferSales', { @@ -48,9 +48,7 @@ module.exports = Self => { } try { - const isEditable = await models.Ticket.isEditable(ctx, id, myOptions); - if (!isEditable) - throw new UserError(`The sales of this ticket can't be modified`); + const isEditable = await models.Ticket.isEditableOrThrow(ctx, id, myOptions); if (ticketId) { const isReceiverEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions); diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index b432c9f6b..c37337253 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -6,6 +6,7 @@ module.exports = function(Self) { require('../methods/ticket/componentUpdate')(Self); require('../methods/ticket/new')(Self); require('../methods/ticket/isEditable')(Self); + require('../methods/ticket/isEditableOrThrow')(Self); require('../methods/ticket/setDeleted')(Self); require('../methods/ticket/restore')(Self); require('../methods/ticket/getSales')(Self); From fa9dfdf411ef9028f04853567a07abefe790635e Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 25 Jul 2023 16:32:38 +0200 Subject: [PATCH 204/311] refs #5216 try ACL updateExpeditionState --- db/changes/233201/00-addExpeditionState.sql | 2 ++ .../{updateExpeditionState.js => addExpeditionState.js} | 5 +++-- modules/ticket/back/models/expedition-state.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 db/changes/233201/00-addExpeditionState.sql rename modules/ticket/back/methods/expedition-state/{updateExpeditionState.js => addExpeditionState.js} (92%) diff --git a/db/changes/233201/00-addExpeditionState.sql b/db/changes/233201/00-addExpeditionState.sql new file mode 100644 index 000000000..fb236b0c3 --- /dev/null +++ b/db/changes/233201/00-addExpeditionState.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) + VALUES ('ExpeditionState','addExpeditionState','WRITE','ALLOW','ROLE','delivery'); \ No newline at end of file diff --git a/modules/ticket/back/methods/expedition-state/updateExpeditionState.js b/modules/ticket/back/methods/expedition-state/addExpeditionState.js similarity index 92% rename from modules/ticket/back/methods/expedition-state/updateExpeditionState.js rename to modules/ticket/back/methods/expedition-state/addExpeditionState.js index ce5144d30..d22d7c676 100644 --- a/modules/ticket/back/methods/expedition-state/updateExpeditionState.js +++ b/modules/ticket/back/methods/expedition-state/addExpeditionState.js @@ -17,7 +17,7 @@ module.exports = Self => { } ], http: { - path: `/updateExpeditionState`, + path: `/addExpeditionState`, verb: 'post' } }); @@ -52,10 +52,11 @@ module.exports = Self => { const typeFk = result[0].id; - const newExpeditionState = await models.Self.create({ + const newExpeditionState = models.Self.create({ expeditionFk: expedition.expeditionFk, typeFk, }); + promises.push(newExpeditionState); } await Promise.all(promises); diff --git a/modules/ticket/back/models/expedition-state.js b/modules/ticket/back/models/expedition-state.js index 041c57be6..496dd88d3 100644 --- a/modules/ticket/back/models/expedition-state.js +++ b/modules/ticket/back/models/expedition-state.js @@ -1,4 +1,4 @@ module.exports = function(Self) { require('../methods/expedition-state/filter')(Self); - require('../methods/expedition-state/updateExpeditionState')(Self); + require('../methods/expedition-state/addExpeditionState')(Self); }; From a0fee6ad50add6065c60c701ab9abcbf1adfc611 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 26 Jul 2023 09:20:54 +0200 Subject: [PATCH 205/311] refs #5929 removed useless vars --- modules/ticket/back/methods/ticket/addSale.js | 2 +- modules/ticket/back/methods/ticket/componentUpdate.js | 2 +- modules/ticket/back/methods/ticket/priceDifference.js | 2 +- modules/ticket/back/methods/ticket/recalculateComponents.js | 2 +- modules/ticket/back/methods/ticket/setDeleted.js | 2 +- .../back/methods/ticket/specs/isEditableOrThrow.spec.js | 6 +----- modules/ticket/back/methods/ticket/transferClient.js | 2 +- modules/ticket/back/methods/ticket/transferSales.js | 2 +- 8 files changed, 8 insertions(+), 12 deletions(-) diff --git a/modules/ticket/back/methods/ticket/addSale.js b/modules/ticket/back/methods/ticket/addSale.js index 9a3e32a7e..cbf884273 100644 --- a/modules/ticket/back/methods/ticket/addSale.js +++ b/modules/ticket/back/methods/ticket/addSale.js @@ -46,7 +46,7 @@ module.exports = Self => { } try { - const isEditable = await models.Ticket.isEditableOrThrow(ctx, id, myOptions); + await models.Ticket.isEditableOrThrow(ctx, id, myOptions); const item = await models.Item.findById(itemId, null, myOptions); const ticket = await models.Ticket.findById(id, { diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index eadbf65c2..b5ff50d59 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -115,7 +115,7 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; const $t = ctx.req.__; // $translate - const isEditable = await models.Ticket.isEditableOrThrow(ctx, args.id, myOptions); + await models.Ticket.isEditableOrThrow(ctx, args.id, myOptions); const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE'); if (!editZone) { diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js index 754646b03..495e9e1aa 100644 --- a/modules/ticket/back/methods/ticket/priceDifference.js +++ b/modules/ticket/back/methods/ticket/priceDifference.js @@ -70,7 +70,7 @@ module.exports = Self => { } try { - const isEditable = await Self.isEditableOrThrow(ctx, args.id, myOptions); + await Self.isEditableOrThrow(ctx, args.id, myOptions); const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE'); if (!editZone) { diff --git a/modules/ticket/back/methods/ticket/recalculateComponents.js b/modules/ticket/back/methods/ticket/recalculateComponents.js index 78c44bab3..bdf74f8b6 100644 --- a/modules/ticket/back/methods/ticket/recalculateComponents.js +++ b/modules/ticket/back/methods/ticket/recalculateComponents.js @@ -32,7 +32,7 @@ module.exports = Self => { } try { - const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions); + await Self.isEditableOrThrow(ctx, id, myOptions); const recalculation = await Self.rawSql('CALL vn.ticket_recalcComponents(?, NULL)', [id], myOptions); diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js index 6485f198e..2f8c402da 100644 --- a/modules/ticket/back/methods/ticket/setDeleted.js +++ b/modules/ticket/back/methods/ticket/setDeleted.js @@ -39,7 +39,7 @@ module.exports = Self => { const ticketToDelete = await models.Ticket.findById(id, {fields: ['isDeleted']}, myOptions); if (ticketToDelete.isDeleted) return false; - const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions); + await Self.isEditableOrThrow(ctx, id, myOptions); // Check if ticket has refunds const ticketRefunds = await models.TicketRefund.find({ diff --git a/modules/ticket/back/methods/ticket/specs/isEditableOrThrow.spec.js b/modules/ticket/back/methods/ticket/specs/isEditableOrThrow.spec.js index b65ed64a1..6c89bac26 100644 --- a/modules/ticket/back/methods/ticket/specs/isEditableOrThrow.spec.js +++ b/modules/ticket/back/methods/ticket/specs/isEditableOrThrow.spec.js @@ -65,13 +65,9 @@ describe('ticket isEditableOrThrow()', () => { let error; try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}}; - const result = await models.Ticket.isEditableOrThrow(ctx, 15, options); - - expect(result).toEqual(false); - + await models.Ticket.isEditableOrThrow(ctx, 15, options); await tx.rollback(); } catch (e) { error = e; diff --git a/modules/ticket/back/methods/ticket/transferClient.js b/modules/ticket/back/methods/ticket/transferClient.js index c87ad4881..60e70d710 100644 --- a/modules/ticket/back/methods/ticket/transferClient.js +++ b/modules/ticket/back/methods/ticket/transferClient.js @@ -28,7 +28,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions); + await Self.isEditableOrThrow(ctx, id, myOptions); const ticket = await models.Ticket.findById( id, diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index bd99920db..a48c5683c 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -48,7 +48,7 @@ module.exports = Self => { } try { - const isEditable = await models.Ticket.isEditableOrThrow(ctx, id, myOptions); + await models.Ticket.isEditableOrThrow(ctx, id, myOptions); if (ticketId) { const isReceiverEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions); From bbc26d8ba4f9bd5b02d8c3981366ad6041a6b4c6 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 26 Jul 2023 12:36:30 +0200 Subject: [PATCH 206/311] WIP refs #5216 addExpeditionState --- .../expedition-state/addExpeditionState.js | 33 ++++++++----------- modules/ticket/back/model-config.json | 3 ++ .../back/models/expedition-state-type.js | 3 ++ .../back/models/expedition-state-type.json | 22 +++++++++++++ 4 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 modules/ticket/back/models/expedition-state-type.js create mode 100644 modules/ticket/back/models/expedition-state-type.json diff --git a/modules/ticket/back/methods/expedition-state/addExpeditionState.js b/modules/ticket/back/methods/expedition-state/addExpeditionState.js index d22d7c676..33a5ae552 100644 --- a/modules/ticket/back/methods/expedition-state/addExpeditionState.js +++ b/modules/ticket/back/methods/expedition-state/addExpeditionState.js @@ -1,17 +1,11 @@ -const UserError = require('vn-loopback/util/user-error'); - module.exports = Self => { - Self.remoteMethod('updateExpedtionState', { + Self.remoteMethod('addExpeditionState', { description: 'Update an expedition state', + accessType: 'WRITE', accepts: [ { arg: 'expeditions', - type: [ - { - expeditionFk: 'number', - stateCode: 'string' - } - ], + type: ['object'], required: true, description: 'Array of objects containing expeditionFk and stateCode' } @@ -23,6 +17,7 @@ module.exports = Self => { }); Self.updateExpedtionState = async(expeditions, options) => { + console.log('Expeditions!!!!!!!!', expeditions); const models = Self.app.models; let tx; const myOptions = {}; @@ -35,22 +30,22 @@ module.exports = Self => { myOptions.transaction = tx; } - if (expeditions.length === 0) - return false; - const promises = []; try { const conn = Self.dataSource.connector; for (const expedition of expeditions) { - const stmt = new ParameterizedSQL( - `SELECT id FROM vn.expeditionStateType WHERE code = ?`, - [expedition.stateCode] + const expeditionStateType = await models.expeditionStateType.findOne( + { + fields: ['id'], + where: {code: expedition.stateCode} + } ); - const result = await conn.query(stmt); - if (result.length === 0) - throw new Error(`The state code '${exp.stateCode}' does not exist.`); - const typeFk = result[0].id; + const result = await conn.query(stmt); + if (!expeditionStateType.id) + throw new Error(`The state code '${expedition.stateCode}' does not exist.`); + + const typeFk = result.id; const newExpeditionState = models.Self.create({ expeditionFk: expedition.expeditionFk, diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index 3c7e12eea..83d7303b7 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -20,6 +20,9 @@ "ExpeditionState": { "dataSource": "vn" }, + "ExpeditionStateType": { + "dataSource": "vn" + }, "Packaging": { "dataSource": "vn" }, diff --git a/modules/ticket/back/models/expedition-state-type.js b/modules/ticket/back/models/expedition-state-type.js new file mode 100644 index 000000000..f21b44940 --- /dev/null +++ b/modules/ticket/back/models/expedition-state-type.js @@ -0,0 +1,3 @@ +module.exports = function(Self) { + +}; diff --git a/modules/ticket/back/models/expedition-state-type.json b/modules/ticket/back/models/expedition-state-type.json new file mode 100644 index 000000000..70207568b --- /dev/null +++ b/modules/ticket/back/models/expedition-state-type.json @@ -0,0 +1,22 @@ +{ + "name": "ExpeditionStateType", + "base": "VnModel", + "options": { + "mysql": { + "table": "expeditionStateType" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "description": { + "type": "string" + }, + "code": { + "type": "string" + } + } +} \ No newline at end of file From 2a0c363dc5443091d71df034da772032b56191e3 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 26 Jul 2023 13:28:40 +0200 Subject: [PATCH 207/311] hotfix change model --- .../assets/files/{model.ezp => model.ezpx} | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename print/templates/email/printer-setup/assets/files/{model.ezp => model.ezpx} (95%) diff --git a/print/templates/email/printer-setup/assets/files/model.ezp b/print/templates/email/printer-setup/assets/files/model.ezpx similarity index 95% rename from print/templates/email/printer-setup/assets/files/model.ezp rename to print/templates/email/printer-setup/assets/files/model.ezpx index dba98e0ee..739593447 100644 --- a/print/templates/email/printer-setup/assets/files/model.ezp +++ b/print/templates/email/printer-setup/assets/files/model.ezpx @@ -539,9 +539,9 @@ 2 4 - + false - false + true 4294967295 5 W5 @@ -571,15 +571,15 @@ 2896 - 187 - 24 + 138 + 32 426 2896 - 187 - 24 + 138 + 32 426 2896 @@ -621,14 +621,14 @@ New label -Lang:(es-ES) OS:Microsoft Windows NT 10.0.22000.0(Win32NT) +Lang:(es-ES) OS:Microsoft Windows NT 10.0.19045.0(Win32NT) Mm 203 EZPL - GODEX G300#132207AB - None + 00000000 + COM1 USB 2886794855 9100 From 10361ba78e584735dd2b239f97cdbde036a93a93 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 26 Jul 2023 13:33:56 +0200 Subject: [PATCH 208/311] refs #5216 addExpeditionState refactored --- .../expedition-state/addExpeditionState.js | 27 ++++++++++--------- .../back/models/expedition-state-type.js | 3 --- 2 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 modules/ticket/back/models/expedition-state-type.js diff --git a/modules/ticket/back/methods/expedition-state/addExpeditionState.js b/modules/ticket/back/methods/expedition-state/addExpeditionState.js index 33a5ae552..16b7a4c75 100644 --- a/modules/ticket/back/methods/expedition-state/addExpeditionState.js +++ b/modules/ticket/back/methods/expedition-state/addExpeditionState.js @@ -5,23 +5,28 @@ module.exports = Self => { accepts: [ { arg: 'expeditions', - type: ['object'], + type: [{ + expeditionFk: 'number', + stateCode: 'string', + }], required: true, description: 'Array of objects containing expeditionFk and stateCode' } ], + returns: { + type: 'boolean', + root: true + }, http: { - path: `/addExpeditionState`, + path: `/addState`, verb: 'post' } }); - Self.updateExpedtionState = async(expeditions, options) => { - console.log('Expeditions!!!!!!!!', expeditions); + Self.addExpeditionState = async(expeditions, options) => { const models = Self.app.models; let tx; const myOptions = {}; - if (typeof options == 'object') Object.assign(myOptions, options); @@ -32,22 +37,19 @@ module.exports = Self => { const promises = []; try { - const conn = Self.dataSource.connector; for (const expedition of expeditions) { - const expeditionStateType = await models.expeditionStateType.findOne( + const expeditionStateType = await models.ExpeditionStateType.findOne( { fields: ['id'], where: {code: expedition.stateCode} } ); - const result = await conn.query(stmt); if (!expeditionStateType.id) throw new Error(`The state code '${expedition.stateCode}' does not exist.`); - const typeFk = result.id; - - const newExpeditionState = models.Self.create({ + const typeFk = expeditionStateType.id; + const newExpeditionState = models.ExpeditionState.create({ expeditionFk: expedition.expeditionFk, typeFk, }); @@ -57,11 +59,10 @@ module.exports = Self => { await Promise.all(promises); if (tx) await tx.commit(); - return true; } catch (e) { if (tx) await tx.rollback(); - throw e; + return false; } }; }; diff --git a/modules/ticket/back/models/expedition-state-type.js b/modules/ticket/back/models/expedition-state-type.js deleted file mode 100644 index f21b44940..000000000 --- a/modules/ticket/back/models/expedition-state-type.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function(Self) { - -}; From 1277af1399ff877069a7f33840e1174f374ba11c Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 26 Jul 2023 13:53:15 +0200 Subject: [PATCH 209/311] hotfix mod path --- print/templates/email/printer-setup/attachments.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/print/templates/email/printer-setup/attachments.json b/print/templates/email/printer-setup/attachments.json index 1e1f710c3..969fdd23a 100644 --- a/print/templates/email/printer-setup/attachments.json +++ b/print/templates/email/printer-setup/attachments.json @@ -1,9 +1,9 @@ [ { - "filename": "model.ezp", + "filename": "model.ezpx", "component": "printer-setup", - "path": "/assets/files/model.ezp", - "cid": "model.ezp" + "path": "/assets/files/model.ezpx", + "cid": "model.ezpx" }, { "filename": "port.png", @@ -11,4 +11,4 @@ "path": "/assets/files/port.png", "cid": "port.png" } -] \ No newline at end of file +] From 777426aa055fbd6d88f4c571a16896cb8f7b018b Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 27 Jul 2023 07:58:55 +0200 Subject: [PATCH 210/311] refs #5561 add backTest --- .../back/methods/sale-tracking/delete.js | 2 +- .../ticket/back/methods/sale-tracking/new.js | 4 +- .../sale-tracking/specs/delete.spec.js | 30 ++++++++++++ .../sale-tracking/specs/filter.spec.js | 23 +++++++++ .../specs/listSaleTracking.spec.js | 2 +- .../methods/sale-tracking/specs/new.spec.js | 49 +++++++++++++++++++ 6 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 modules/ticket/back/methods/sale-tracking/specs/delete.spec.js create mode 100644 modules/ticket/back/methods/sale-tracking/specs/filter.spec.js create mode 100644 modules/ticket/back/methods/sale-tracking/specs/new.spec.js diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index b8754d48c..0b977e5d4 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -1,7 +1,7 @@ module.exports = Self => { Self.remoteMethod('delete', { - description: 'Elimina el registro (si se cumple la condición) y inserta uno nuevo', + description: 'Delete sale trackings and item shelving sales', accessType: 'READ', accepts: [ { diff --git a/modules/ticket/back/methods/sale-tracking/new.js b/modules/ticket/back/methods/sale-tracking/new.js index 2be5bd86e..6a99c299c 100644 --- a/modules/ticket/back/methods/sale-tracking/new.js +++ b/modules/ticket/back/methods/sale-tracking/new.js @@ -1,7 +1,7 @@ module.exports = Self => { Self.remoteMethodCtx('new', { - description: 'Remplaza el registro o lo crea si no existe', + description: `Replaces the record or creates it if it doesn't exist`, accessType: 'READ', accepts: [ { @@ -76,7 +76,7 @@ module.exports = Self => { isChecked: isChecked, originalQuantity: quantity, isScanned: null - }); + }, myOptions); } if (tx) await tx.commit(); diff --git a/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js b/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js new file mode 100644 index 000000000..a8bcf5692 --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js @@ -0,0 +1,30 @@ +const models = require('vn-loopback/server/server').models; + +describe('sale-tracking delete()', () => { + it('should delete a row of saleTracking and itemShelvingSale', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const itemShelvingsBefore = await models.ItemShelvingSale.find(null, options); + const saleTrackingsBefore = await models.SaleTracking.find(null, options); + + const saleFk = 1; + const stateCode = 'PREPARED'; + const result = await models.SaleTracking.delete(saleFk, stateCode, options); + + const itemShelvingsAfter = await models.ItemShelvingSale.find(null, options); + const saleTrackingsAfter = await models.SaleTracking.find(null, options); + + expect(result).toEqual(true); + expect(saleTrackingsAfter.length).toBeLessThan(saleTrackingsBefore.length); + expect(itemShelvingsAfter.length).toBeLessThan(itemShelvingsBefore.length); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/sale-tracking/specs/filter.spec.js b/modules/ticket/back/methods/sale-tracking/specs/filter.spec.js new file mode 100644 index 000000000..8a679f3a5 --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/specs/filter.spec.js @@ -0,0 +1,23 @@ +const app = require('vn-loopback/server/server'); + +describe('sale-tracking filter()', () => { + it('should return 1 result filtering by ticket id', async() => { + const tx = await app.models.Claim.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const id = 1; + const filter = {order: ['concept ASC', 'quantity DESC']}; + const result = await app.models.SaleTracking.filter(id, filter, options); + + expect(result.length).toEqual(4); + expect(result[0].ticketFk).toEqual(1); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/sale-tracking/specs/listSaleTracking.spec.js b/modules/ticket/back/methods/sale-tracking/specs/listSaleTracking.spec.js index d51c56874..89f274c57 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/listSaleTracking.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/listSaleTracking.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -describe('ticket listSaleTracking()', () => { +describe('sale-tracking listSaleTracking()', () => { it('should call the listSaleTracking method and return the response', async() => { const tx = await models.SaleTracking.beginTransaction({}); diff --git a/modules/ticket/back/methods/sale-tracking/specs/new.spec.js b/modules/ticket/back/methods/sale-tracking/specs/new.spec.js new file mode 100644 index 000000000..fcd383582 --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/specs/new.spec.js @@ -0,0 +1,49 @@ +const models = require('vn-loopback/server/server').models; + +describe('sale-tracking new()', () => { + it('should update a saleTracking', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + + try { + const options = {transaction: tx}; + const ctx = {req: {accessToken: {userId: 55}}}; + + const saleFk = 1; + const isChecked = true; + const quantity = 20; + const stateCode = 'PREPARED'; + const result = await models.SaleTracking.new(ctx, saleFk, isChecked, quantity, stateCode, options); + + expect(result.isChecked).toBe(true); + expect(result.originalQuantity).toBe(20); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should create a saleTracking', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + + try { + const options = {transaction: tx}; + const ctx = {req: {accessToken: {userId: 1}}}; + + const saleFk = 1; + const isChecked = true; + const quantity = 20; + const stateCode = 'PREPARED'; + const result = await models.SaleTracking.new(ctx, saleFk, isChecked, quantity, stateCode, options); + + expect(result.isChecked).toBe(true); + expect(result.originalQuantity).toBe(20); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); From 29baa2f0c7d7998864863761adca7eb30b6608bc Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 27 Jul 2023 08:27:09 +0200 Subject: [PATCH 211/311] refs #6015 modify changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5928e9c4..8440e0f2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - (General -> Iconos) Añadidos nuevos iconos -- (Clientes -> Razón social) Nuevas restricciones por pais +- (Clientes -> Razón social) Permite crear clientes con la misma razón social según el país ### Fixed From 65b9cadd9e6ed72d263c8a23e1efb0878069b4ca Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 27 Jul 2023 12:51:14 +0200 Subject: [PATCH 212/311] refs #5804 refactor: sustituido activeBuyers por getItemTypeWorker --- .../item/back/methods/item/activeBuyers.js | 44 ------------------- .../methods/item/specs/activeBuyers.spec.js | 24 ---------- modules/item/back/models/item.js | 1 - .../front/request-search-panel/index.html | 14 +++--- modules/item/front/search-panel/index.html | 12 ++--- .../ticket-request/getItemTypeWorker.js | 33 ++++++++------ .../specs/getItemTypeWorkers.spec.js | 6 +-- 7 files changed, 34 insertions(+), 100 deletions(-) delete mode 100644 modules/item/back/methods/item/activeBuyers.js delete mode 100644 modules/item/back/methods/item/specs/activeBuyers.spec.js diff --git a/modules/item/back/methods/item/activeBuyers.js b/modules/item/back/methods/item/activeBuyers.js deleted file mode 100644 index e16ff877b..000000000 --- a/modules/item/back/methods/item/activeBuyers.js +++ /dev/null @@ -1,44 +0,0 @@ -const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; -const mergeFilters = require('vn-loopback/util/filter').mergeFilters; - -module.exports = Self => { - Self.remoteMethod('activeBuyers', { - description: 'Returns a list of buyers for the given item type', - accepts: [{ - arg: 'filter', - type: 'object', - description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string` - }], - returns: { - type: ['object'], - root: true - }, - http: { - path: `/activeBuyers`, - verb: 'GET' - } - }); - - Self.activeBuyers = async(filter, options) => { - const conn = Self.dataSource.connector; - const where = {isActive: true}; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - filter = mergeFilters(filter, {where}); - - let stmt = new ParameterizedSQL( - `SELECT DISTINCT w.id workerFk, w.firstName, w.lastName, u.name, u.nickname - FROM worker w - JOIN itemType it ON it.workerFk = w.id - JOIN account.user u ON u.id = w.id - JOIN item i ON i.typeFk = it.id`, - null, myOptions); - - stmt.merge(conn.makeSuffix(filter)); - - return conn.executeStmt(stmt); - }; -}; diff --git a/modules/item/back/methods/item/specs/activeBuyers.spec.js b/modules/item/back/methods/item/specs/activeBuyers.spec.js deleted file mode 100644 index 5bf36756f..000000000 --- a/modules/item/back/methods/item/specs/activeBuyers.spec.js +++ /dev/null @@ -1,24 +0,0 @@ -const models = require('vn-loopback/server/server').models; - -describe('Worker activeBuyers', () => { - it('should return the buyers in itemType as result', async() => { - const tx = await models.Item.beginTransaction({}); - - try { - const options = {transaction: tx}; - const filter = {}; - const result = await models.Item.activeBuyers(filter, options); - const firstWorker = result[0]; - const secondWorker = result[1]; - - expect(result.length).toEqual(2); - expect(firstWorker.nickname).toEqual('logisticBossNick'); - expect(secondWorker.nickname).toEqual('buyerNick'); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index b8baa97ea..61c5c2588 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -14,7 +14,6 @@ module.exports = Self => { require('../methods/item/getWasteByWorker')(Self); require('../methods/item/getWasteByItem')(Self); require('../methods/item/createIntrastat')(Self); - require('../methods/item/activeBuyers')(Self); require('../methods/item/buyerWasteEmail')(Self); require('../methods/item/labelPdf')(Self); diff --git a/modules/item/front/request-search-panel/index.html b/modules/item/front/request-search-panel/index.html index a76684776..9d35fbca4 100644 --- a/modules/item/front/request-search-panel/index.html +++ b/modules/item/front/request-search-panel/index.html @@ -1,7 +1,7 @@
@@ -26,7 +26,7 @@ search-function="{firstName: $search}" value-field="id" where="{role: {inq: ['logistic', 'buyer']}}" - label="Atender"> + label="Buyer"> {{nickname}} @@ -57,7 +57,7 @@ {{firstName}} {{lastName}} - +
- - - - { - Self.remoteMethodCtx('getItemTypeWorker', { + Self.remoteMethod('getItemTypeWorker', { description: 'Returns the workers that appear in itemType', accessType: 'READ', accepts: [{ @@ -20,10 +22,9 @@ module.exports = Self => { } }); - Self.getItemTypeWorker = async(ctx, filter, options) => { + Self.getItemTypeWorker = async(filter, options) => { const myOptions = {}; const conn = Self.dataSource.connector; - let tx; if (typeof options == 'object') Object.assign(myOptions, options); @@ -33,25 +34,29 @@ module.exports = Self => { FROM itemType it JOIN worker w ON w.id = it.workerFk JOIN account.user u ON u.id = w.id`; + const stmt = new ParameterizedSQL(query); - let stmt = new ParameterizedSQL(query); - - if (filter.where) { - const value = filter.where.firstName; - const myFilter = { - where: {or: [ + filter.where = buildFilter(filter.where, (param, value) => { + switch (param) { + case 'firstName': + return {or: [ {'w.firstName': {like: `%${value}%`}}, {'w.lastName': {like: `%${value}%`}}, {'u.name': {like: `%${value}%`}}, {'u.nickname': {like: `%${value}%`}} - ]} - }; + ]}; + case 'id': + return {'w.id': value}; + } + }); - stmt.merge(conn.makeSuffix(myFilter)); - } + let myFilter = { + where: {'u.active': true} + }; - if (tx) await tx.commit(); + myFilter = mergeFilters(myFilter, filter); + stmt.merge(conn.makeSuffix(myFilter)); return conn.executeStmt(stmt); }; }; diff --git a/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js b/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js index ae5c508b6..c57451c26 100644 --- a/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js +++ b/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js @@ -1,12 +1,10 @@ const models = require('vn-loopback/server/server').models; describe('ticket-request getItemTypeWorker()', () => { - const ctx = {req: {accessToken: {userId: 18}}}; - it('should return the buyer as result', async() => { const filter = {where: {firstName: 'buyer'}}; - const result = await models.TicketRequest.getItemTypeWorker(ctx, filter); + const result = await models.TicketRequest.getItemTypeWorker(filter); expect(result.length).toEqual(1); }); @@ -14,7 +12,7 @@ describe('ticket-request getItemTypeWorker()', () => { it('should return the workers at itemType as result', async() => { const filter = {}; - const result = await models.TicketRequest.getItemTypeWorker(ctx, filter); + const result = await models.TicketRequest.getItemTypeWorker(filter); expect(result.length).toBeGreaterThan(1); }); From 3bc3ffe1153644fc568d24176e6ca3590d36f491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 27 Jul 2023 13:40:39 +0200 Subject: [PATCH 213/311] refs #6077 Log-InvoiceInDueday-incorrecto --- .../invoiceIn/back/locale/invoiceIn/en.yml | 20 +++++++++++++++++++ .../invoiceIn/back/locale/invoiceIn/es.yml | 20 +++++++++++++++++++ .../back/locale/invoiceInDueDay/en.yml | 9 +++++++++ .../back/locale/invoiceInDueDay/es.yml | 9 +++++++++ .../invoiceIn/back/locale/invoiceInTax/en.yml | 12 +++++++++++ .../invoiceIn/back/locale/invoiceInTax/es.yml | 12 +++++++++++ 6 files changed, 82 insertions(+) create mode 100644 modules/invoiceIn/back/locale/invoiceIn/en.yml create mode 100644 modules/invoiceIn/back/locale/invoiceIn/es.yml create mode 100644 modules/invoiceIn/back/locale/invoiceInDueDay/en.yml create mode 100644 modules/invoiceIn/back/locale/invoiceInDueDay/es.yml create mode 100644 modules/invoiceIn/back/locale/invoiceInTax/en.yml create mode 100644 modules/invoiceIn/back/locale/invoiceInTax/es.yml diff --git a/modules/invoiceIn/back/locale/invoiceIn/en.yml b/modules/invoiceIn/back/locale/invoiceIn/en.yml new file mode 100644 index 000000000..4110dcdbc --- /dev/null +++ b/modules/invoiceIn/back/locale/invoiceIn/en.yml @@ -0,0 +1,20 @@ +name: invoice in +columns: + id: id + serialNumber: serial number + serial: serial + supplierFk: supplier + issued: issued + supplierRef: supplierRef + isBooked: is booked + currencyFk: currency + created: created + companyFk: company + docFk: document + booked: booked + operated: operated + bookEntried: book entried + isVatDeductible: is VAT deductible + withholdingSageFk: withholding + expenceFkDeductible: expence deductible + editorFk: editor \ No newline at end of file diff --git a/modules/invoiceIn/back/locale/invoiceIn/es.yml b/modules/invoiceIn/back/locale/invoiceIn/es.yml new file mode 100644 index 000000000..432b27cb3 --- /dev/null +++ b/modules/invoiceIn/back/locale/invoiceIn/es.yml @@ -0,0 +1,20 @@ +name: factura recibida +columns: + id: id + serialNumber: número de serie + serial: serie + supplierFk: proveedor + issued: fecha emisión + supplierRef: referéncia proveedor + isBooked: facturado + currencyFk: moneda + created: creado + companyFk: empresa + docFk: documento + booked: fecha contabilización + operated: fecha entrega + bookEntried: fecha asiento + isVatDeductible: impuesto deducible + withholdingSageFk: código de retención + expenceFkDeductible: gasto deducible + editorFk: editor \ No newline at end of file diff --git a/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml b/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml new file mode 100644 index 000000000..5e42dfc66 --- /dev/null +++ b/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml @@ -0,0 +1,9 @@ +name: invoice in due day +columns: + id: id + invoiceInFk: invoice in + dueDated: due date + bankFk: bank + amount: amount + foreignValue : foreign amount + created: created diff --git a/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml b/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml new file mode 100644 index 000000000..168db9803 --- /dev/null +++ b/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml @@ -0,0 +1,9 @@ +name: vencimientos factura recibida +columns: + id: id + invoiceInFk: factura + dueDated: fecha vto. + bankFk: banco + amount: importe + foreignValue : importe divisa + created: creado diff --git a/modules/invoiceIn/back/locale/invoiceInTax/en.yml b/modules/invoiceIn/back/locale/invoiceInTax/en.yml new file mode 100644 index 000000000..86a9e42c3 --- /dev/null +++ b/modules/invoiceIn/back/locale/invoiceInTax/en.yml @@ -0,0 +1,12 @@ +name: invoice in tax +colmns: + id: id + invoiceInFk: invoice in + taxCodeFk: tax + taxableBase: taxable base + expenceFk: expence + foreignValue: foreign amount + taxTypeSageFk: tax type + transactionTypeSageFk: transaction type + created: created + editorFk: editor diff --git a/modules/invoiceIn/back/locale/invoiceInTax/es.yml b/modules/invoiceIn/back/locale/invoiceInTax/es.yml new file mode 100644 index 000000000..233c591e9 --- /dev/null +++ b/modules/invoiceIn/back/locale/invoiceInTax/es.yml @@ -0,0 +1,12 @@ +name: factura recibida impuesto +colmns: + id: id + invoiceInFk: factura recibida + taxCodeFk: código IVA + taxableBase: base imponible + expenceFk: código gasto + foreignValue: importe divisa + taxTypeSageFk: código impuesto + transactionTypeSageFk: código transacción + created: creado + editorFk: editor \ No newline at end of file From 7367d1cdfeb5f5b4ba9114229ced38bd920e70c9 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 27 Jul 2023 14:41:53 +0200 Subject: [PATCH 214/311] refs #6013 fix: add await --- .../back/methods/worker-time-control/weeklyHourRecordEmail.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js b/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js index f44080559..3203dea82 100644 --- a/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js +++ b/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js @@ -51,7 +51,7 @@ module.exports = Self => { const salix = await models.Url.findOne({ where: { appName: 'salix', - environment: process.env.NODE_ENV || 'dev' + environment: process.env.NODE_ENV || 'development' } }, myOptions); @@ -61,7 +61,7 @@ module.exports = Self => { const url = `${salix.url}worker/${args.workerId}/time-control?timestamp=${timestamp}`; ctx.args.url = url; - Self.sendTemplate(ctx, 'weekly-hour-record'); + await Self.sendTemplate(ctx, 'weekly-hour-record'); return models.WorkerTimeControl.updateWorkerTimeControlMail(ctx, myOptions); }; From 0054f2d82f04b3a26bbf341be66f499918ee8676 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 27 Jul 2023 15:07:10 +0200 Subject: [PATCH 215/311] refs #6013 fix: codigo no bloqueante --- .../methods/worker-time-control/sendMail.js | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/modules/worker/back/methods/worker-time-control/sendMail.js b/modules/worker/back/methods/worker-time-control/sendMail.js index ab5e56a77..13317fc65 100644 --- a/modules/worker/back/methods/worker-time-control/sendMail.js +++ b/modules/worker/back/methods/worker-time-control/sendMail.js @@ -121,15 +121,18 @@ module.exports = Self => { `, [started, ended]); stmts.push(stmt); - stmt = new ParameterizedSQL(`INSERT INTO mail (receiver, subject, body) - SELECT CONCAT(u.name, '@verdnatura.es'), - CONCAT('Error registro de horas semana ', ?, ' año ', ?) , - CONCAT('No se ha podido enviar el registro de horas al empleado/s: ', GROUP_CONCAT(DISTINCT CONCAT('
', w.id, ' ', w.firstName, ' ', w.lastName))) - FROM tmp.timeControlError tce - JOIN vn.workerTimeControl wtc ON wtc.id = tce.id - JOIN worker w ON w.id = wtc.userFK - JOIN account.user u ON u.id = w.bossFk - GROUP BY w.bossFk`, [args.week, args.year]); + stmt = new ParameterizedSQL(` + INSERT INTO mail (receiver, subject, body) + SELECT CONCAT(u.name, '@verdnatura.es'), + CONCAT('Error registro de horas semana ', ?, ' año ', ?) , + CONCAT('No se ha podido enviar el registro de horas al empleado/s: ', + GROUP_CONCAT(DISTINCT CONCAT('
', w.id, ' ', w.firstName, ' ', w.lastName))) + FROM tmp.timeControlError tce + JOIN vn.workerTimeControl wtc ON wtc.id = tce.id + JOIN worker w ON w.id = wtc.userFK + JOIN account.user u ON u.id = w.bossFk + GROUP BY w.bossFk + `, [args.week, args.year]); stmts.push(stmt); stmt = new ParameterizedSQL(` @@ -176,6 +179,7 @@ module.exports = Self => { const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions); + console.log(days[index]); for (let day of days[index]) { if (!myOptions.transaction) { tx = await Self.beginTransaction({}); @@ -371,7 +375,30 @@ module.exports = Self => { } } catch (e) { if (tx) await tx.rollback(); - throw e; + delete myOptions.transaction; + + const stmts = []; + let stmt; + stmt = new ParameterizedSQL(` + INSERT INTO mail (receiver, subject, body) + SELECT CONCAT(u.name, '@verdnatura.es'), + CONCAT('Error registro de horas semana ', ?, ' año ', ?) , + CONCAT('No se ha podido enviar el registro de horas al empleado/s: ', + GROUP_CONCAT(DISTINCT CONCAT('
', w.id, ' ', w.firstName, ' ', w.lastName))) + FROM worker w + JOIN account.user u ON u.id = w.bossFk + WHERE w.id = ? + GROUP BY w.bossFk + `, [args.week, args.year, day.workerFk]); + stmts.push(stmt); + + const sql = ParameterizedSQL.join(stmts, ';'); + await conn.executeStmt(sql); + + previousWorkerFk = day.workerFk; + previousReceiver = day.receiver; + + continue; } } From 251ed36eca664a9c015bcc15003d49dc39a774cc Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 28 Jul 2023 10:51:48 +0200 Subject: [PATCH 216/311] refs #6013 feat: mostrar error en el mail --- .../back/methods/worker-time-control/sendMail.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/worker/back/methods/worker-time-control/sendMail.js b/modules/worker/back/methods/worker-time-control/sendMail.js index 13317fc65..4988d1f46 100644 --- a/modules/worker/back/methods/worker-time-control/sendMail.js +++ b/modules/worker/back/methods/worker-time-control/sendMail.js @@ -179,7 +179,6 @@ module.exports = Self => { const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions); - console.log(days[index]); for (let day of days[index]) { if (!myOptions.transaction) { tx = await Self.beginTransaction({}); @@ -374,22 +373,18 @@ module.exports = Self => { delete myOptions.transaction; } } catch (e) { - if (tx) await tx.rollback(); - delete myOptions.transaction; - const stmts = []; let stmt; stmt = new ParameterizedSQL(` INSERT INTO mail (receiver, subject, body) SELECT CONCAT(u.name, '@verdnatura.es'), CONCAT('Error registro de horas semana ', ?, ' año ', ?) , - CONCAT('No se ha podido enviar el registro de horas al empleado/s: ', - GROUP_CONCAT(DISTINCT CONCAT('
', w.id, ' ', w.firstName, ' ', w.lastName))) + CONCAT('No se ha podido enviar el registro de horas al empleado: ', + w.id, ' ', w.firstName, ' ', w.lastName, ' por el motivo: ', ?) FROM worker w JOIN account.user u ON u.id = w.bossFk WHERE w.id = ? - GROUP BY w.bossFk - `, [args.week, args.year, day.workerFk]); + `, [args.week, args.year, e.message, day.workerFk]); stmts.push(stmt); const sql = ParameterizedSQL.join(stmts, ';'); @@ -398,6 +393,9 @@ module.exports = Self => { previousWorkerFk = day.workerFk; previousReceiver = day.receiver; + if (tx) await tx.rollback(); + delete myOptions.transaction; + continue; } } From 1d4ce2c70342e01371143b317f80d5c17214c474 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 28 Jul 2023 12:24:24 +0200 Subject: [PATCH 217/311] refs #5804 fix: delete transaction --- .../ticket/back/methods/ticket-request/getItemTypeWorker.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js b/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js index f160cfaac..9ea859f7c 100644 --- a/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js +++ b/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js @@ -22,13 +22,9 @@ module.exports = Self => { } }); - Self.getItemTypeWorker = async(filter, options) => { - const myOptions = {}; + Self.getItemTypeWorker = async filter => { const conn = Self.dataSource.connector; - if (typeof options == 'object') - Object.assign(myOptions, options); - const query = `SELECT DISTINCT u.id, u.nickname FROM itemType it From 4061f3e5ce87668745a74e04986aaee49c35e926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 28 Jul 2023 12:28:41 +0200 Subject: [PATCH 218/311] #refs 6077 espacios por tabulaciones --- .../invoiceIn/back/locale/invoiceIn/en.yml | 36 +++++++++---------- .../invoiceIn/back/locale/invoiceIn/es.yml | 36 +++++++++---------- .../back/locale/invoiceInDueDay/en.yml | 14 ++++---- .../back/locale/invoiceInDueDay/es.yml | 14 ++++---- .../invoiceIn/back/locale/invoiceInTax/en.yml | 20 +++++------ .../invoiceIn/back/locale/invoiceInTax/es.yml | 20 +++++------ 6 files changed, 70 insertions(+), 70 deletions(-) diff --git a/modules/invoiceIn/back/locale/invoiceIn/en.yml b/modules/invoiceIn/back/locale/invoiceIn/en.yml index 4110dcdbc..5aa81b9ff 100644 --- a/modules/invoiceIn/back/locale/invoiceIn/en.yml +++ b/modules/invoiceIn/back/locale/invoiceIn/en.yml @@ -1,20 +1,20 @@ name: invoice in columns: - id: id - serialNumber: serial number - serial: serial - supplierFk: supplier - issued: issued - supplierRef: supplierRef - isBooked: is booked - currencyFk: currency - created: created - companyFk: company - docFk: document - booked: booked - operated: operated - bookEntried: book entried - isVatDeductible: is VAT deductible - withholdingSageFk: withholding - expenceFkDeductible: expence deductible - editorFk: editor \ No newline at end of file + id: id + serialNumber: serial number + serial: serial + supplierFk: supplier + issued: issued + supplierRef: supplierRef + isBooked: is booked + currencyFk: currency + created: created + companyFk: company + docFk: document + booked: booked + operated: operated + bookEntried: book entried + isVatDeductible: is VAT deductible + withholdingSageFk: withholding + expenceFkDeductible: expence deductible + editorFk: editor \ No newline at end of file diff --git a/modules/invoiceIn/back/locale/invoiceIn/es.yml b/modules/invoiceIn/back/locale/invoiceIn/es.yml index 432b27cb3..61f62f022 100644 --- a/modules/invoiceIn/back/locale/invoiceIn/es.yml +++ b/modules/invoiceIn/back/locale/invoiceIn/es.yml @@ -1,20 +1,20 @@ name: factura recibida columns: - id: id - serialNumber: número de serie - serial: serie - supplierFk: proveedor - issued: fecha emisión - supplierRef: referéncia proveedor - isBooked: facturado - currencyFk: moneda - created: creado - companyFk: empresa - docFk: documento - booked: fecha contabilización - operated: fecha entrega - bookEntried: fecha asiento - isVatDeductible: impuesto deducible - withholdingSageFk: código de retención - expenceFkDeductible: gasto deducible - editorFk: editor \ No newline at end of file + id: id + serialNumber: número de serie + serial: serie + supplierFk: proveedor + issued: fecha emisión + supplierRef: referéncia proveedor + isBooked: facturado + currencyFk: moneda + created: creado + companyFk: empresa + docFk: documento + booked: fecha contabilización + operated: fecha entrega + bookEntried: fecha asiento + isVatDeductible: impuesto deducible + withholdingSageFk: código de retención + expenceFkDeductible: gasto deducible + editorFk: editor \ No newline at end of file diff --git a/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml b/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml index 5e42dfc66..f01a0de46 100644 --- a/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml +++ b/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml @@ -1,9 +1,9 @@ name: invoice in due day columns: - id: id - invoiceInFk: invoice in - dueDated: due date - bankFk: bank - amount: amount - foreignValue : foreign amount - created: created + id: id + invoiceInFk: invoice in + dueDated: due date + bankFk: bank + amount: amount + foreignValue : foreign amount + created: created diff --git a/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml b/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml index 168db9803..34b20b37d 100644 --- a/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml +++ b/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml @@ -1,9 +1,9 @@ name: vencimientos factura recibida columns: - id: id - invoiceInFk: factura - dueDated: fecha vto. - bankFk: banco - amount: importe - foreignValue : importe divisa - created: creado + id: id + invoiceInFk: factura + dueDated: fecha vto. + bankFk: banco + amount: importe + foreignValue : importe divisa + created: creado diff --git a/modules/invoiceIn/back/locale/invoiceInTax/en.yml b/modules/invoiceIn/back/locale/invoiceInTax/en.yml index 86a9e42c3..374f62e7d 100644 --- a/modules/invoiceIn/back/locale/invoiceInTax/en.yml +++ b/modules/invoiceIn/back/locale/invoiceInTax/en.yml @@ -1,12 +1,12 @@ name: invoice in tax colmns: - id: id - invoiceInFk: invoice in - taxCodeFk: tax - taxableBase: taxable base - expenceFk: expence - foreignValue: foreign amount - taxTypeSageFk: tax type - transactionTypeSageFk: transaction type - created: created - editorFk: editor + id: id + invoiceInFk: invoice in + taxCodeFk: tax + taxableBase: taxable base + expenceFk: expence + foreignValue: foreign amount + taxTypeSageFk: tax type + transactionTypeSageFk: transaction type + created: created + editorFk: editor diff --git a/modules/invoiceIn/back/locale/invoiceInTax/es.yml b/modules/invoiceIn/back/locale/invoiceInTax/es.yml index 233c591e9..b20663dd4 100644 --- a/modules/invoiceIn/back/locale/invoiceInTax/es.yml +++ b/modules/invoiceIn/back/locale/invoiceInTax/es.yml @@ -1,12 +1,12 @@ name: factura recibida impuesto colmns: - id: id - invoiceInFk: factura recibida - taxCodeFk: código IVA - taxableBase: base imponible - expenceFk: código gasto - foreignValue: importe divisa - taxTypeSageFk: código impuesto - transactionTypeSageFk: código transacción - created: creado - editorFk: editor \ No newline at end of file + id: id + invoiceInFk: factura recibida + taxCodeFk: código IVA + taxableBase: base imponible + expenceFk: código gasto + foreignValue: importe divisa + taxTypeSageFk: código impuesto + transactionTypeSageFk: código transacción + created: creado + editorFk: editor \ No newline at end of file From 136b401ede36eed3d0e3cc9025a429bf74d48ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 28 Jul 2023 14:17:50 +0200 Subject: [PATCH 219/311] refs #6077 espacios correctos --- .../invoiceIn/back/locale/invoiceIn/en.yml | 36 +++++++++---------- .../invoiceIn/back/locale/invoiceIn/es.yml | 36 +++++++++---------- .../back/locale/invoiceInDueDay/en.yml | 14 ++++---- .../back/locale/invoiceInDueDay/es.yml | 14 ++++---- .../invoiceIn/back/locale/invoiceInTax/en.yml | 22 ++++++------ .../invoiceIn/back/locale/invoiceInTax/es.yml | 22 ++++++------ 6 files changed, 72 insertions(+), 72 deletions(-) diff --git a/modules/invoiceIn/back/locale/invoiceIn/en.yml b/modules/invoiceIn/back/locale/invoiceIn/en.yml index 5aa81b9ff..ec9a824b6 100644 --- a/modules/invoiceIn/back/locale/invoiceIn/en.yml +++ b/modules/invoiceIn/back/locale/invoiceIn/en.yml @@ -1,20 +1,20 @@ name: invoice in columns: - id: id - serialNumber: serial number - serial: serial - supplierFk: supplier - issued: issued - supplierRef: supplierRef - isBooked: is booked - currencyFk: currency - created: created - companyFk: company - docFk: document - booked: booked - operated: operated - bookEntried: book entried - isVatDeductible: is VAT deductible - withholdingSageFk: withholding - expenceFkDeductible: expence deductible - editorFk: editor \ No newline at end of file + id: id + serialNumber: serial number + serial: serial + supplierFk: supplier + issued: issued + supplierRef: supplierRef + isBooked: is booked + currencyFk: currency + created: created + companyFk: company + docFk: document + booked: booked + operated: operated + bookEntried: book entried + isVatDeductible: is VAT deductible + withholdingSageFk: withholding + expenceFkDeductible: expence deductible + editorFk: editor \ No newline at end of file diff --git a/modules/invoiceIn/back/locale/invoiceIn/es.yml b/modules/invoiceIn/back/locale/invoiceIn/es.yml index 61f62f022..64e96b379 100644 --- a/modules/invoiceIn/back/locale/invoiceIn/es.yml +++ b/modules/invoiceIn/back/locale/invoiceIn/es.yml @@ -1,20 +1,20 @@ name: factura recibida columns: - id: id - serialNumber: número de serie - serial: serie - supplierFk: proveedor - issued: fecha emisión - supplierRef: referéncia proveedor - isBooked: facturado - currencyFk: moneda - created: creado - companyFk: empresa - docFk: documento - booked: fecha contabilización - operated: fecha entrega - bookEntried: fecha asiento - isVatDeductible: impuesto deducible - withholdingSageFk: código de retención - expenceFkDeductible: gasto deducible - editorFk: editor \ No newline at end of file + id: id + serialNumber: número de serie + serial: serie + supplierFk: proveedor + issued: fecha emisión + supplierRef: referéncia proveedor + isBooked: facturado + currencyFk: moneda + created: creado + companyFk: empresa + docFk: documento + booked: fecha contabilización + operated: fecha entrega + bookEntried: fecha asiento + isVatDeductible: impuesto deducible + withholdingSageFk: código de retención + expenceFkDeductible: gasto deducible + editorFk: editor \ No newline at end of file diff --git a/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml b/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml index f01a0de46..7a6c0dfaf 100644 --- a/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml +++ b/modules/invoiceIn/back/locale/invoiceInDueDay/en.yml @@ -1,9 +1,9 @@ name: invoice in due day columns: - id: id - invoiceInFk: invoice in - dueDated: due date - bankFk: bank - amount: amount - foreignValue : foreign amount - created: created + id: id + invoiceInFk: invoice in + dueDated: due date + bankFk: bank + amount: amount + foreignValue : foreign amount + created: created diff --git a/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml b/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml index 34b20b37d..993437b05 100644 --- a/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml +++ b/modules/invoiceIn/back/locale/invoiceInDueDay/es.yml @@ -1,9 +1,9 @@ name: vencimientos factura recibida columns: - id: id - invoiceInFk: factura - dueDated: fecha vto. - bankFk: banco - amount: importe - foreignValue : importe divisa - created: creado + id: id + invoiceInFk: factura + dueDated: fecha vto. + bankFk: banco + amount: importe + foreignValue : importe divisa + created: creado diff --git a/modules/invoiceIn/back/locale/invoiceInTax/en.yml b/modules/invoiceIn/back/locale/invoiceInTax/en.yml index 374f62e7d..c0d12c37d 100644 --- a/modules/invoiceIn/back/locale/invoiceInTax/en.yml +++ b/modules/invoiceIn/back/locale/invoiceInTax/en.yml @@ -1,12 +1,12 @@ name: invoice in tax -colmns: - id: id - invoiceInFk: invoice in - taxCodeFk: tax - taxableBase: taxable base - expenceFk: expence - foreignValue: foreign amount - taxTypeSageFk: tax type - transactionTypeSageFk: transaction type - created: created - editorFk: editor +columns: + id: id + invoiceInFk: invoice in + taxCodeFk: tax + taxableBase: taxable base + expenceFk: expence + foreignValue: foreign amount + taxTypeSageFk: tax type + transactionTypeSageFk: transaction type + created: created + editorFk: editor diff --git a/modules/invoiceIn/back/locale/invoiceInTax/es.yml b/modules/invoiceIn/back/locale/invoiceInTax/es.yml index b20663dd4..7cb847ed8 100644 --- a/modules/invoiceIn/back/locale/invoiceInTax/es.yml +++ b/modules/invoiceIn/back/locale/invoiceInTax/es.yml @@ -1,12 +1,12 @@ name: factura recibida impuesto -colmns: - id: id - invoiceInFk: factura recibida - taxCodeFk: código IVA - taxableBase: base imponible - expenceFk: código gasto - foreignValue: importe divisa - taxTypeSageFk: código impuesto - transactionTypeSageFk: código transacción - created: creado - editorFk: editor \ No newline at end of file +columns: + id: id + invoiceInFk: factura recibida + taxCodeFk: código IVA + taxableBase: base imponible + expenceFk: código gasto + foreignValue: importe divisa + taxTypeSageFk: código impuesto + transactionTypeSageFk: código transacción + created: creado + editorFk: editor \ No newline at end of file From e253dd79822b068849a43dc78f5167bfb15388a8 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 28 Jul 2023 14:39:01 +0200 Subject: [PATCH 220/311] refs #5351 fix(worker_model): remove required userFk --- modules/worker/back/models/worker.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 6d23c1b66..6e1371055 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -25,8 +25,7 @@ "type" : "string" }, "userFk": { - "type" : "number", - "required": true + "type" : "number" }, "bossFk": { "type" : "number" From 81dc163819fb45e288d004378f7f916cb7e7b5d1 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 28 Jul 2023 14:40:03 +0200 Subject: [PATCH 221/311] ya no muestra error en el front --- modules/worker/front/card/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js index 0bf9ae5c4..b8b533c5d 100644 --- a/modules/worker/front/card/index.js +++ b/modules/worker/front/card/index.js @@ -36,7 +36,7 @@ class Controller extends ModuleCard { this.$http.get(`Workers/${this.$params.id}`, {filter}) .then(res => this.worker = res.data), this.$http.get(`Workers/${this.$params.id}/activeContract`) - .then(res => this.hasWorkCenter = res.data.workCenterFk) + .then(res => this.hasWorkCenter = res.data?.workCenterFk) ]); } } From 40607a42cfc37606bf4496dc1d759d1e6d4757a3 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 1 Aug 2023 10:25:44 +0200 Subject: [PATCH 222/311] hotfix-loadData --- .../front/department/descriptor/index.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/worker/front/department/descriptor/index.js b/modules/worker/front/department/descriptor/index.js index 5ab1059d9..388a7f776 100644 --- a/modules/worker/front/department/descriptor/index.js +++ b/modules/worker/front/department/descriptor/index.js @@ -32,6 +32,28 @@ class Controller extends Descriptor { this.vnApp.showSuccess(this.$t('Department deleted.')); }); } + + loadData() { + const filter = { + fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName', + 'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'], + include: [ + {relation: 'client', + scope: { + fields: ['id', 'name'] + }}, + { + relation: 'worker', + scope: { + fields: ['id', 'firstName', 'lastName'] + } + } + ] + }; + + return this.getData(`Departments/${this.id}`, {filter}) + .then(res => this.entity = res.data); + } } Controller.$inject = ['$element', '$scope', '$rootScope']; From 30c5e8d8ccd638e57e85f35f55de8f16fe7c1103 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 1 Aug 2023 11:11:29 +0200 Subject: [PATCH 223/311] hotFix(canBeInvoiced): no de vuelve error si hay mas de un ticket y uno esta a 0 --- modules/ticket/back/methods/ticket/canBeInvoiced.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/canBeInvoiced.js b/modules/ticket/back/methods/ticket/canBeInvoiced.js index 0f6cb476b..348f02348 100644 --- a/modules/ticket/back/methods/ticket/canBeInvoiced.js +++ b/modules/ticket/back/methods/ticket/canBeInvoiced.js @@ -67,7 +67,7 @@ module.exports = function(Self) { throw new UserError(`This ticket is already invoiced`); const priceZero = ticket.totalWithVat == 0; - if (priceZero) + if (ticketsIds.length == 1 && priceZero) throw new UserError(`A ticket with an amount of zero can't be invoiced`); }); From 16353dfddc1fab62c3b3e16a7b1aa040af632486 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 2 Aug 2023 07:35:40 +0200 Subject: [PATCH 224/311] refs #5995 First commit --- modules/route/back/methods/route/cmr.js | 36 ++ modules/route/back/models/route.js | 1 + modules/ticket/back/methods/ticket/closure.js | 319 ++++++++++-------- .../reports/cmr/assets/css/import.js | 12 + .../reports/cmr/assets/css/style.css | 101 ++++++ .../reports/cmr/assets/images/signature.png | Bin 0 -> 27129 bytes print/templates/reports/cmr/cmr.html | 212 ++++++++++++ print/templates/reports/cmr/cmr.js | 38 +++ print/templates/reports/cmr/locale/es.yml | 1 + print/templates/reports/cmr/options.json | 3 + print/templates/reports/cmr/sql/data.sql | 49 +++ .../templates/reports/cmr/sql/merchandise.sql | 11 + .../templates/reports/cmr/sql/signatures.sql | 7 + 13 files changed, 646 insertions(+), 144 deletions(-) create mode 100644 modules/route/back/methods/route/cmr.js create mode 100644 print/templates/reports/cmr/assets/css/import.js create mode 100644 print/templates/reports/cmr/assets/css/style.css create mode 100644 print/templates/reports/cmr/assets/images/signature.png create mode 100644 print/templates/reports/cmr/cmr.html create mode 100644 print/templates/reports/cmr/cmr.js create mode 100644 print/templates/reports/cmr/locale/es.yml create mode 100644 print/templates/reports/cmr/options.json create mode 100644 print/templates/reports/cmr/sql/data.sql create mode 100644 print/templates/reports/cmr/sql/merchandise.sql create mode 100644 print/templates/reports/cmr/sql/signatures.sql diff --git a/modules/route/back/methods/route/cmr.js b/modules/route/back/methods/route/cmr.js new file mode 100644 index 000000000..cd7ef57ce --- /dev/null +++ b/modules/route/back/methods/route/cmr.js @@ -0,0 +1,36 @@ +module.exports = Self => { + Self.remoteMethodCtx('cmr', { + description: 'Returns the cmr', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The cmr id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: '/:id/cmr', + verb: 'GET' + } + }); + + Self.cmr = (ctx, id) => Self.printReport(ctx, id, 'cmr'); +}; diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index 883f4597e..96e7ed04f 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -14,6 +14,7 @@ module.exports = Self => { require('../methods/route/driverRouteEmail')(Self); require('../methods/route/sendSms')(Self); require('../methods/route/downloadZip')(Self); + require('../methods/route/cmr')(Self); Self.validate('kmStart', validateDistance, { message: 'Distance must be lesser than 1000' diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index eee5e28e2..493a2c3a0 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -5,177 +5,208 @@ const config = require('vn-print/core/config'); const storage = require('vn-print/core/storage'); module.exports = async function(ctx, Self, tickets, reqArgs = {}) { - const userId = ctx.req.accessToken.userId; - if (tickets.length == 0) return; + const userId = ctx.req.accessToken.userId; + if (tickets.length == 0) return; - const failedtickets = []; - for (const ticket of tickets) { - try { - await Self.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id], {userId}); + const failedtickets = []; + for (const ticket of tickets) { + try { + await Self.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id], {userId}); - const [invoiceOut] = await Self.rawSql(` - SELECT io.id, io.ref, io.serial, cny.code companyCode, io.issued - FROM ticket t - JOIN invoiceOut io ON io.ref = t.refFk - JOIN company cny ON cny.id = io.companyFk - WHERE t.id = ? - `, [ticket.id]); + const [invoiceOut] = await Self.rawSql(` + SELECT io.id, io.ref, io.serial, cny.code companyCode, io.issued + FROM ticket t + JOIN invoiceOut io ON io.ref = t.refFk + JOIN company cny ON cny.id = io.companyFk + WHERE t.id = ? + `, [ticket.id]); - const mailOptions = { - overrideAttachments: true, - attachments: [] - }; + const mailOptions = { + overrideAttachments: true, + attachments: [] + }; - const isToBeMailed = ticket.recipient && ticket.salesPersonFk && ticket.isToBeMailed; + const isToBeMailed = ticket.recipient && ticket.salesPersonFk && ticket.isToBeMailed; - if (invoiceOut) { - const args = { - reference: invoiceOut.ref, - recipientId: ticket.clientFk, - recipient: ticket.recipient, - replyTo: ticket.salesPersonEmail - }; + if (invoiceOut) { + const args = { + reference: invoiceOut.ref, + recipientId: ticket.clientFk, + recipient: ticket.recipient, + replyTo: ticket.salesPersonEmail + }; - const invoiceReport = new Report('invoice', args); - const stream = await invoiceReport.toPdfStream(); + const invoiceReport = new Report('invoice', args); + const stream = await invoiceReport.toPdfStream(); - const issued = invoiceOut.issued; - const year = issued.getFullYear().toString(); - const month = (issued.getMonth() + 1).toString(); - const day = issued.getDate().toString(); + const issued = invoiceOut.issued; + const year = issued.getFullYear().toString(); + const month = (issued.getMonth() + 1).toString(); + const day = issued.getDate().toString(); - const fileName = `${year}${invoiceOut.ref}.pdf`; + const fileName = `${year}${invoiceOut.ref}.pdf`; - // Store invoice - await storage.write(stream, { - type: 'invoice', - path: `${year}/${month}/${day}`, - fileName: fileName - }); + // Store invoice + await storage.write(stream, { + type: 'invoice', + path: `${year}/${month}/${day}`, + fileName: fileName + }); - await Self.rawSql('UPDATE invoiceOut SET hasPdf = true WHERE id = ?', [invoiceOut.id], {userId}); + await Self.rawSql('UPDATE invoiceOut SET hasPdf = true WHERE id = ?', [invoiceOut.id], {userId}); - if (isToBeMailed) { - const invoiceAttachment = { - filename: fileName, - content: stream - }; + if (isToBeMailed) { + const invoiceAttachment = { + filename: fileName, + content: stream + }; - if (invoiceOut.serial == 'E' && invoiceOut.companyCode == 'VNL') { - const exportation = new Report('exportation', args); - const stream = await exportation.toPdfStream(); - const fileName = `CITES-${invoiceOut.ref}.pdf`; + if (invoiceOut.serial == 'E' && invoiceOut.companyCode == 'VNL') { + const exportation = new Report('exportation', args); + const stream = await exportation.toPdfStream(); + const fileName = `CITES-${invoiceOut.ref}.pdf`; - mailOptions.attachments.push({ - filename: fileName, - content: stream - }); - } + mailOptions.attachments.push({ + filename: fileName, + content: stream + }); + } - mailOptions.attachments.push(invoiceAttachment); + mailOptions.attachments.push(invoiceAttachment); - const email = new Email('invoice', args); - await email.send(mailOptions); - } - } else if (isToBeMailed) { - const args = { - id: ticket.id, - recipientId: ticket.clientFk, - recipient: ticket.recipient, - replyTo: ticket.salesPersonEmail - }; + const email = new Email('invoice', args); + await email.send(mailOptions); + } + } else if (isToBeMailed) { + const args = { + id: ticket.id, + recipientId: ticket.clientFk, + recipient: ticket.recipient, + replyTo: ticket.salesPersonEmail + }; - const email = new Email('delivery-note-link', args); - await email.send(); - } + const email = new Email('delivery-note-link', args); + await email.send(); + } - // Incoterms authorization - const [{firstOrder}] = await Self.rawSql(` - SELECT COUNT(*) as firstOrder - FROM ticket t - JOIN client c ON c.id = t.clientFk - WHERE t.clientFk = ? - AND NOT t.isDeleted - AND c.isVies - `, [ticket.clientFk]); + // Incoterms authorization + const [{firstOrder}] = await Self.rawSql(` + SELECT COUNT(*) as firstOrder + FROM ticket t + JOIN client c ON c.id = t.clientFk + WHERE t.clientFk = ? + AND NOT t.isDeleted + AND c.isVies + `, [ticket.clientFk]); - if (firstOrder == 1) { - const args = { - id: ticket.clientFk, - companyId: ticket.companyFk, - recipientId: ticket.clientFk, - recipient: ticket.recipient, - replyTo: ticket.salesPersonEmail - }; + if (firstOrder == 1) { + const args = { + id: ticket.clientFk, + companyId: ticket.companyFk, + recipientId: ticket.clientFk, + recipient: ticket.recipient, + replyTo: ticket.salesPersonEmail + }; - const email = new Email('incoterms-authorization', args); - await email.send(); + const email = new Email('incoterms-authorization', args); + await email.send(); - const [sample] = await Self.rawSql( - `SELECT id - FROM sample - WHERE code = 'incoterms-authorization' - `); + const [sample] = await Self.rawSql( + `SELECT id + FROM sample + WHERE code = 'incoterms-authorization' + `); - await Self.rawSql(` - INSERT INTO clientSample (clientFk, typeFk, companyFk) VALUES(?, ?, ?) - `, [ticket.clientFk, sample.id, ticket.companyFk], {userId}); - } - } catch (error) { - // Domain not found - if (error.responseCode == 450) - return invalidEmail(ticket); + await Self.rawSql(` + INSERT INTO clientSample (clientFk, typeFk, companyFk) VALUES(?, ?, ?) + `, [ticket.clientFk, sample.id, ticket.companyFk], {userId}); + } - // Save tickets on a list of failed ids - failedtickets.push({ - id: ticket.id, - stacktrace: error - }); - } - } + await Self.rawSql(` + INSERT INTO cmr (ticketFk, companyFk, addressToFk, addressFromFk, supplierFk, ead) + SELECT t.id, + com.id, + a.id, + c2.defaultAddressFk, + su.id, + t.landed + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state s ON s.id = ts.stateFk + JOIN alertLevel al ON al.id = s.alertLevel + JOIN client c ON c.id = t.clientFk + JOIN address a ON a.id = t.addressFk + JOIN province p ON p.id = a.provinceFk + JOIN country co ON co.id = p.countryFk + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + JOIN warehouse w ON w.id = t.warehouseFk + JOIN company com ON com.id = t.companyFk + JOIN client c2 ON c2.id = com.clientFk + JOIN supplierAccount sa ON sa.id = com.supplierAccountFk + JOIN supplier su ON su.id = sa.supplierFk + WHERE shipped BETWEEN util.yesterday() AND util.dayEnd(util.yesterday()) + AND al.code IN ('PACKED', 'DELIVERED') + AND co.code <> 'ES' + AND am.name <> 'ABONO' + AND w.code = 'ALG' + AND dm.code = 'DELIVERY' + `); + } catch (error) { + // Domain not found + if (error.responseCode == 450) + return invalidEmail(ticket); - // Send email with failed tickets - if (failedtickets.length > 0) { - let body = 'This following tickets have failed:

'; + // Save tickets on a list of failed ids + failedtickets.push({ + id: ticket.id, + stacktrace: error + }); + } + } - for (const ticket of failedtickets) { - body += `Ticket: ${ticket.id} -
${ticket.stacktrace}

`; - } + // Send email with failed tickets + if (failedtickets.length > 0) { + let body = 'This following tickets have failed:

'; - smtp.send({ - to: config.app.reportEmail, - subject: '[API] Nightly ticket closure report', - html: body - }); - } + for (const ticket of failedtickets) { + body += `Ticket: ${ticket.id} +
${ticket.stacktrace}

`; + } - async function invalidEmail(ticket) { - await Self.rawSql(`UPDATE client SET email = NULL WHERE id = ?`, [ - ticket.clientFk - ], {userId}); + smtp.send({ + to: config.app.reportEmail, + subject: '[API] Nightly ticket closure report', + html: body + }); + } - const oldInstance = `{"email": "${ticket.recipient}"}`; - const newInstance = `{"email": ""}`; - await Self.rawSql(` - INSERT INTO clientLog (originFk, userFk, action, changedModel, oldInstance, newInstance) - VALUES (?, NULL, 'UPDATE', 'Client', ?, ?)`, [ - ticket.clientFk, - oldInstance, - newInstance - ], {userId}); + async function invalidEmail(ticket) { + await Self.rawSql(`UPDATE client SET email = NULL WHERE id = ?`, [ + ticket.clientFk + ], {userId}); - const body = `No se ha podido enviar el albarán ${ticket.id} - al cliente ${ticket.clientFk} - ${ticket.clientName} - porque la dirección de email "${ticket.recipient}" no es correcta - o no está disponible.

- Para evitar que se repita este error, se ha eliminado la dirección de email de la ficha del cliente. - Actualiza la dirección de email con una correcta.`; + const oldInstance = `{"email": "${ticket.recipient}"}`; + const newInstance = `{"email": ""}`; + await Self.rawSql(` + INSERT INTO clientLog (originFk, userFk, action, changedModel, oldInstance, newInstance) + VALUES (?, NULL, 'UPDATE', 'Client', ?, ?)`, [ + ticket.clientFk, + oldInstance, + newInstance + ], {userId}); - smtp.send({ - to: ticket.salesPersonEmail, - subject: 'No se ha podido enviar el albarán', - html: body - }); - } + const body = `No se ha podido enviar el albarán ${ticket.id} + al cliente ${ticket.clientFk} - ${ticket.clientName} + porque la dirección de email "${ticket.recipient}" no es correcta + o no está disponible.

+ Para evitar que se repita este error, se ha eliminado la dirección de email de la ficha del cliente. + Actualiza la dirección de email con una correcta.`; + + smtp.send({ + to: ticket.salesPersonEmail, + subject: 'No se ha podido enviar el albarán', + html: body + }); + } }; diff --git a/print/templates/reports/cmr/assets/css/import.js b/print/templates/reports/cmr/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/cmr/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/reports/cmr/assets/css/style.css b/print/templates/reports/cmr/assets/css/style.css new file mode 100644 index 000000000..201afc3b6 --- /dev/null +++ b/print/templates/reports/cmr/assets/css/style.css @@ -0,0 +1,101 @@ +html { + font-family: "Roboto", "Helvetica", "Arial", sans-serif; + margin: 10px; + font-size: 22px; +} +.mainTable, .specialTable, .categoryTable { + width: 100%; + border-collapse: collapse; + font-size: inherit; +} +.mainTable td { + width: 50%; + border: 1px solid black; + vertical-align: top; + padding: 15px; + font-size: inherit; +} +.signTable { + height: 12%; +} +.signTable td { + width: calc(100% / 3); + border: 1px solid black; + vertical-align: top; + font-size: inherit; + padding: 15px; + border-top: none; +} +#title { + font-weight: bold; + font-size: 85px; +} +hr { + border: 1px solid #cccccc; + height: 0px; + border-radius: 25px; +} +#cellHeader { + border: 0px; + text-align: center; + vertical-align: middle; +} +#label, #merchandiseLabels { + font-size: 13px; +} +#merchandiseLabels { + border: none; +} +.imgSection { + text-align: center; + height: 200px; + overflow: hidden; +} +img { + object-fit: contain; + width: 100%; + height: 100%; +} +#lineBreak { + white-space: pre-line; +} +.specialTable td { + border: 1px solid black; + vertical-align: top; + padding: 15px; + font-size: inherit; + border-top: none; + border-bottom: none; +} +.specialTable #itemCategoryList { + width: 70%; + padding-top: 10px; +} +.categoryTable { + padding-bottom: none; +} +.categoryTable td { + vertical-align: top; + font-size: inherit; + border: none; + padding: 5px; + overflow: hidden; +} +.categoryTable #merchandiseLabels { + border-bottom: 4px solid #cccccc; + padding: none; +} +#merchandiseDetail { + font-weight: bold; + padding-top: 10px; +} +#merchandiseData { + font-weight: bold; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +#merchandiseLabels td { + padding-bottom: 11px; + max-width: 300px; +} \ No newline at end of file diff --git a/print/templates/reports/cmr/assets/images/signature.png b/print/templates/reports/cmr/assets/images/signature.png new file mode 100644 index 0000000000000000000000000000000000000000..0961df764f5e038b0c61620b60ba0c601d41ae93 GIT binary patch literal 27129 zcmcG#2T+sS+b-m2=^X(nf~WxjrMJ*SkrIT29*S7DAfTalM5^=}2vty# z-V-`1HB_aOP|k|`zxVy-&N<(FckUc#oP_sX>se3vJ#DR(*N?RBGo55T34uVEpbzfq zKp@o15D3-B<881*IaD3qF4%hY7 z(zEe(vXQmrQc~o+?JWlgxWJKCoZc?Zt{!sU3S58a%7O2c$0A&ue}*8P6u9nC7UVS2 ze8j1WaEEhB2}=vvh)GIu%E$_fNlQq|$_jFdi;CS65xpfMCLtsyEhi}|CoazUpMP9n zHFsM(Ii0)r{<9YNOM%M)iFA__5%Kc!684f1M!4IHh{?*ziinDfh>Ht>5kek5u1G6y zAy<#<|4_IK_potybVE8KTsbKet*j9!qyiV<^luSd-2Nr&>hT{n0fmWpTe*pd35!xh z`e&e~=6^rb#pU189!ND$u*!e<{ofMy(DQMFi|D{T5GZ#WxSA*26?y%i#cXZu=5{$0w=0f9t#I3WHHa{T-HUuoRrRNdiLNQAo{0^$6Rp&tE1 zg;Q0PVi;LYK0`-WTZEU#O$t;0nFGITg@h|`iHnMh35iMyiAm^*Ny+Xy@}k8LFu%2X*y8TDjW5p?4Ly08_$_j<#~rqT)89x1?o- zq@-_&3yE4w$_QD>irWauTEk^UttF&IW#E#3_yY6qB5Y6;4N~U+ja*xV4WRL_lH|m# zt!zbYMP-GorR=1H#AGC`g{-XLQbJNzRx&mc5|Y+dqBj3f({^_R&ST~LU#U{KvIP_+ z!QztEvQk1eGNQIZ;&zg@Le@4Cc0%G3HnuWSvR1dm#elYKZRG3_?k-jUDvmBz_HYq5 zS9>nb|A!k@gfqfj6JZNq89>B~#|M4YV_|yMw0{uN3dzc5p4(Vm(4!>g$O!7YgqR9V=e-A6q|DOB*8A$%`a{nLY+BjIb+QUJp72%@D zBSHyEf15_+|82ED@BT{w`)4?aij=SahGX!@zX2WY3P`(yaP6;IU<-lRWI^xV(eqAT znLxi4d~8D4n@W+Hdy(+|6^n6b@|Omi1+Jx&Xa+Bq#~+r%mS5I7I9Pl=)&jd&>(wH2 zcjU?V@d+l2?2fqMUbPliBr4`@_!$3RY@wdUO(g1j69&JphKx0HAEW&)Nh8ro9zVF= zLzGK_#T4^y*xI3$&RpG@Y|u~OozhbDSx=t7?Yp%YLrFf!0Vfp}%9kcjT9C;g%CF9p z(16dY_nJ0vSjg(S4@E?E@wumZnqJ07=GXXR&~g%$|XR zfEm|EhjWlGB-`c{Ih(3Wjaty} zDcx1pA?w&z0x+Jm<1h&1;67N-VF(cYkZF-i7Mj^!TN^A{)l_1`K_Dc=gBUJIdI*qW z{sBoG+Nj}4 zgX9af;30+whYcL#IPuSlxh{YmjeZWy=EI4O!L$9ZfK`=`D2(za34KlDC+=vFP?8-_0<2`@zUn_y)WsYxALV9Foxuqz{0jbebTegnD9H)az~}au z^mF<>10?|NGixC2QdEkR6w(X2OU;@fA`nlD%1N436j6jL&CnM%5L!I{%52zMiKxm zliTR%O)va%DA9KBeJ}h!8eU4`KIrd#ap^5Hg)1vgz?DPQrNFGr;uEll;P>*35D{}0 zV8~uL;Hwfd`Q&h~lxQnkedl@k7jJIjZKN!ngWLScAW@)}k|5Tz@Y+6B09Uf@DSO?R5=I|g42%@3FLai+C|8>w2 zz{M8OsO4W+xKs>F_0?vX}CwXBM<&nm8i{zZBSrI1K zamb2;xMhw8V~}|~SRF5Sdde$cl83m#U4PB!$Eu$ou?I>b0l{jsqh@a-gT?m)&J@TH za{zXlM0=Z0rAq*i*e_WL)Etx-2hYlAkS1VD(~72Vlq~vp!d@obKogK<$teAw|Z93J&0DQNh_e)VV_5q0v%q|}_ zBRY#6?qLp-qzN_C2EZ#UF9BTas(8h_b3v!9Z=j!a92HDl*<@?i{KEi+K%F#_%6B0z zb86sgXy<2Li?Odbw|V+M>ZOP?Tlk)#S2xhD>e5m3Mf`><)K92@{xwGeu;~e4ycXrA zQ|VPB)(?-i78TX{WhzTjr^cJ*O73}Gf=p882Q!LoUFp6!{q=@8MUU5shSHV(&YL2X z1>7hDe(0*OSVATxOy4B2(*JT58?JCUx&>T^ksdf1$K-h&gyvTo--&{x-a+@$2^59z zQ-E*9I$0zY-A`oIB|n!FX+mGuq9wO$9?p=0G6T=yPD5UX05dQnj>Ce2cd4O`qZ{IB zzUJ)f2T=gDZM`obqE{%2wd~DPYV6urZy4WLf4f!-LReGDAEqlJ4);d^=n@n!+R~Mh zTubjaG*aT}%NKvhGQ)zXd{Q!tH!BKwt;;g24l2H#rfHI(u=OZzcZ*FyXkJ4>i2jQZ zz$`Ctk){&2sAJ!0gq8!)6bmsjcli9Yy399^cmbUL2gnNFY0$$5zTue`vsSXS%PXYn zOauc(yQ;v<^ktuSck&ngeSmkV_S-0_-MJHJFK65!g1iP{WTq%dkq4+^!4SWH7#ydQ z{-*IPh11u6I6VnCC4I?`srzU#Q^?KtQx(&2oigtnW!~}O13zwJ*c1OFSi{L@D#E}c z=_%Zbf-wFoSXiuUcb|1?V#na*`QJGd-MIaEekZ3ZccAbERnE#@>pqEa!+rUZ&V6oWf!;6R;7fAash1 zEY4Dn-Fe8{5&06hs}+dQ-&;VWvP?Hem~?b}j5>Ap%NNX{^MVTGk|IUby|3zJ^-V^0 z>f)%A_Rp9Qs49Xf1ZS)e-S&FBr-YWf$X3uJLoj}riDK>Dk=|pMN@NUnyOZkUs2v+$ z;ZYD5p!}d8Kf>>q&jDGAUx0-t?tp~a($ZPpwHHrGNv9#63_v_aW{Do@`J;HP*du8m z^72Ir3;SjZ)Zf|5wk4~e?g!a!|;1Lj-?N2AC zeCl^}mQ%IWNsGV@v{hJWA%NRK=@h}hd;LJ^t;*&2E0|e3f@{$-oA+TV#>WW{4S^-he+0nwS7+2d-G4+S_KME z-!a^uOsbEy_S!dphJwI8Zw`Toc3<5tggYx;DXn0)UdCJK%P;i9egb95^EggO$qAul zNFC6$5-(A0!JVJ$5-e}$w72x4($>I_Xdcp9Vidfm975r(ravvnh+1V?@v5F zMinGTS)8;D7LVtb9p)jfm}`jLPK(}T2XQ_{aJu&eRnToPqz(kJDG}n-3*puv|IB3; z5PCn{I4RC~qz+9#Bxgs#hh#26dijB!8~Rv=)0p*lPZcgD)m!whJ?=j?M^<5>gS4lo zU588^W@H}0Y{P#4nCJI@br3K`&x4N2R8jQ?viat54l#3D#nBLz{&*Y$RL;6M2^c`^H&`*Gp#J2?gTE_4TEyI@1ZhRO$ z8x3+@+Hqr1$O0urg;U4}fc$X>8h8sZ{861_yNW&~;4X8>?^*~NNK-w#4*8qfC`ZiZ z1x&*&Bb6VudvO&8WTAI2z- z>)+5K#b!$TaqqVMLn zu`&qbfU}rllq3@@B6W8QxH*Vc)R4D5_779O<~u?PfrsW`?A~|uSt(s3azIHJc_e(O zA)Z$Nx}Sk!$08@wud_(%N;S=G4#stW1P(?+Nrv|#5}M<7KxKxQ!?H|mX4u7^ zWk?V5QNZ<^6y@8A9{bZM1$_c3^*WRVbGXzCzxm@FW>UZ&uQk6Wk`o1wxvWkFQ2@P& zC(D>oOyi`ehATJRM48Gy(S za2mX111S>X|3us}P}4?(4)Xk0+Re-7M~5t77>ZjeQcBuCxL0(>WvCuY+lO^e?R4JX;XXjV(67r1xM{jEZy)xX z1@N232%`LgIMCKFXV4pbl(x67Up=W^9} zU0rNP4n2ApzSe*@y*c{(LBC$V;R_1Y3&8PGq(E7%yHvzaZ1O)};*gg6djjhtpyrnf z)Qq5nYgQ1vd({92=qTOcz5YOcVi@;<^#pUbl9Xj%*`TAoEiqF&D$YLL{SjavQk&o1WHMGoz*Ce_Dez}A4fL!3daYbgrA2U;ZqXrrOd`RZFJ z|C07NpjQj`62!V1rS=82OXMpGqfCI&Nr?&bfc#7)LE-=nOY5shy?ygE8c!%`7IXLn zlmp5H(Se&m=Acgng}Wcmficr{qqt0F{e5#o@(jxs4=9`=lnOf?3syzMZK5d=$@n(8 zCUk0vY&u|Zh0>6zp^L|?hpU^7H;HjC zgf&7GAN}@2CrRF1@u2L1;QkU8gZP5BKCmb=FxQHH3A6bdtT3GkEh2!5xgqO2ZO~Vs zpoL=tWrqM=cNWSjz8}12IQ?jfLk`j;4*)^g!cfxeSLv^%X2}xzvmc=B1;X-zq=XaE z18Q*^Cn!Wp2%XB8Q00fDe*oDYIRQefB=VYxK_xRe@Rtc_nRzJ_3VKZ8SnjKJOXM7!BRY!E8=6oIImEw0sL9>OfhQ zvMHk5k6?yHoZ21vXaRz#QtsilO>tr%JA@9@m&$SbieMK4_SdQE!o7pWpIPTuY+f2d zhJ(N>-gx{LrOl4;w&+?rf^SLeq60yD@duO(p;JO81Ri44$B|}AB7e}2^|`58yU=n9 z!UoiJ+!d^=)_-&wcjfBuNun+B18SdH-4|5vE*~X^FGA=*O{UBOkO4URE5e&-a}5NJ zGz}7iV(d@`sIuy^t*4svy)dA=D~W$N8#t-o;j9h9B-v7k>}mh`7b z4POc?zw%e&;W5`05ds0C|9-X2$h+er%!2Yj6Uzz9!dkbv-c)%z?>4mIj07I zIPq#x3~5@iflmRji!%|in_28E2T*9~D*aE9l_`*#CK61kEOP*?juSgnS<-C|wFU$z z(Sws{NZHqk+mz=)Cu9;X?k>_-o@yQ_oK?D=A_#3e4q*am=yZSFbBaVp{YM0RJ7CaD zozx8&yo@fu8G90-nLb-qSUB$eFHFCf1*{22v$qaZwpkf2cN?44csOX&g#A3?65 zy*b@%zCexqtnuzD9po)&Se1{jfrd3=R~3K-Y<5vW7Nmg#TI%n+F#~S3ra5?bV$*AGst`CaIoLE1VXJgCDWt_ zf_U=$*Ie&0hmoUOpmc(Q*a{(m##8xtZS<=HELaCz zF-S?&BxqKd$eEeN6v&7p@BF=?$@!e{N?18Wk)N0kR)d370eK0UJLTh`Ee?7){=gUX zEXAsze-XX1X$5#Yy_DL>MPxXErvkNl^C`~f+6*vAWWb~TH2|!s%OEWUSy9}f*-4e9 zDa5Eh?d_&LAbg)v!;6~zBeC8l6gnkD6oHcPKplN0U#K9<)D%^2@@RDOMk9Up>@f`* z{azp^b1;~2L7KWLicyJMF9}qJdd9IqMN*V3)JZ?U98e z(&Z_yO7d1gQ_6wI9qraP`Ge9qz5XW^r1vV2zyu^`P!a1en|1`+f;U{YBM`_!2H4=+ z^9$Qw=(~;p&JN7e464)Z#ILc8l-i4eFG>jpXah{1qHKynAaWoigO3H#|L-rCQIxy~ z37Wgxx1ikrKJ#EOa_PpFMC9}kDrxq!XQX+(@2rc}n*aQ~`AyktWyzm^FE)><%lwtm zmzo)e*>+bX-HI@j(Ts%??)EwG6P?G7T7NG-4*NposdGMDT)?wP)p9q(p+bac)c=m1 zZeDFd9T$zf+?rogTy|jyi|Yik&DCl=e5btsZ9@)QcwNM(k=qE!q9z}mAX-&IfrMC`ctDkLmwo{g)4HwAeMF|s|fBC z=@Qr1c+@gv!}3Ysc4s8|k;1Y`qaq|XL{22>L^_)j#GsbONeGe(HF@!|q?}IeCmiaE+J~fD=3UeU ze)Ezsuj(IguA+ZAf@%8BCB(ut6gX9(eYAP!tF)0~)FyX?VdOXmR6AxffNvn)7vEfc zH~0PR<)?Lt_xl!1M$m1MK&@-Cx*G3ZLBLK5M0qU%zr{th;b^W=eR)hqrenge6w8WL zr~7c$RH~pYLCaM0w}Vzu-IZStDX4nMC9?VsgWuGdF!<>Wuf^Stt+?rm)9+_JswUQ; z-hv(8Mm=}s^4(<*eePXEM$c^!W{>+A|JGWP)Jrr!tzGH*97VHr8TMvuz^KXfl=Y-8 z0Vp8!_SK8;pOvKXR-zWygg zvp3e@UW9xL;np2qhx?r2bU;Ad>x@3L5p+Ss2M46dhGUnX*CqR=7hPoEbn;~f*Up~G zy#&Jvy7HoWuHr(V1N(N=LUc#s*t(u(0#R^Ec+9mCi`xD9#`MA3D<_^-yH%e@9=->! z?CQ72-FiGsUpnz5yk-?>eTyQFiY|SRmr3s;RcVvl8(tKJB@OO)NQB<=gYh$e^xIqn zS(d?X(`}M^fOK$sKA%^=Ha|X$2=8tcp7!1<_`V(ygDh_I>#Asbkr`HY@TF6-aqOP; zRQR$qTwXU|QT=9~vT*1rNgz!yW<^+{=(|B%QW%5jwHfEIDoxijY9Cy9f8LHT)YeT? z&{?0${w9W#p55rb+D`kT)$TwoA_SE;V>B5*d*y*|=}L>IQUcqy{wy_Ohto!R$j0#Q z*WVLHvCrU7mPQ@6;>mBz8|#bmBdQk1_*m=pwoQj~Q1*@8wE-3Hg~!U0)8|bWaMfLM zA~{zITdDPdtG_7gFnUs3n=OJ$n3c%Za&qs@<8G_4n^iC-T=rk&iLp5!eo8Ydpy&xp zZnSf27;wZSb;2te-3AZcstf=v49Aw5ficiNi`oYXo(p~>(etZs?AL;TI~cV!Ol;%0VRQHTLh< zsZ=J#-9xe?(hwjUHs4}wrpG(0R%CK!&Cx7x8!C9yXNF(0v<&hABvF}ntj zC4GzBg>uK1^K54wP3{-Xc-2NIh#(B5P%dtrY-c|<2*ppM2=*v1Dnk!4$JBMn8m^b@D)PP!bbaPSy%*t_{{q(D({C+t`}|MF&Nj38 zs=mH%%LFc0Te{6#N@}Dz4XE0cMXA9mvphBW6HG&Q-YKHzB;=>~o<`x^T=8(a7}A3Rx7-=l5?IKj{Z~>lis16nz!dysyDQR0p*72o2*RR+3yu0PjwaiRE{GBp{ zT?@OHhHH!oc^{RKcBPJLIX7Nz#G;sHD=wC>v9t#q^SlI-*Rws74Xt*cuV3_SGqUW} z)}@kAw=tMBEV0+*YASnh7J`Q3rCP+J}Thzm(dp%9~>$ z9-pJVT-##^N>c{TW83g|Y+d*R+jb9|*gz{+%dFaK3Gmyu5E%~K@bNlQ^4EMW4#GX& zh&>1@yCHmf2!1}?RlMEfwAzQ3vp3lzqtX5%;;Z&(r770DFw>$9IS-)!#R~h!0ls~5 z&e>@;JjCi(qrV2AE}pO7VU$JI+QhL#_}gvxga{cC2ZfvRHK8ZYmkBrHwCl0z?#JvE zM-q<$6CeA`#!TPqpXQP&0I3jE2e0?*LIr;6v{k_sd%yf%#77Gt*w#%(%f|T|`53yKqa(31axq?f>drMq3I{ZDCR20ppcMf$Z7W`ij&dcNgz+ew)}oz?$_N-^+$TT&c`9Tk6jW9^pyr1spc{-Yia z3j$qh-Q|>gM2aigIF$Bn45^3>tvEFbBEVpc$AHYa>Yh&12roV#8XNj{(#fAai2;y1 z87qp*pzzQ#2T`_EX~%BQmdDPV_Yk4<(_B9`Lso5dOMGAEXb%7N>JN9e6NbCnPOi z)Xj1Bfsg7r%HYyE_ly_yWvUjxRF<~1)SdQ0wE) zNscelK)uKnVVLu@&i7-c)L}v>p}5lSmLhl!mS{@Qc zyZy9l+WO08PtaGIi%twR3+uD_Cno*KR1U;zS@2N}6+P@Y^>*>5g-l8|J+YZ1!UvU7 zi0G>4%I_YP=9}|^}};p@gDKK^>Esx@~c>(esX4O|~f zj^_6>ODW^3_;1a1Eg;cst@)-=6HmryCaF+FmHEZZa&4cLkl9Yn`cIZ7q`>KW~C}TDDG(u2?%ioXen$V@?{JAtcU-kMPQE%VdiHf?H z@3dY;R30*UNpdq^UKB%^a4e1$1i{qXl{^j`G|l;2{nEO2mAbK>n?J?{Kc5(Mfyu|r z*F5%|Ve-v+vE1T%;j(`s!3%9}jd@+y!z63yK3O%dIZzi{Eu#dIjOJc56GKRaFg(wMZY9t=xvLC%4LEM>cM(2uKV^Z*-NHq0A$@yTUUZHqDr6 zP=uP|^oc>T4|6c>G7|%P3Ck7#MA_kr&rS~n@~tOy-7^e*56-E50QJAz2+nF!Wv2e8 zpLx|!kkJz8qC+ab2jD)Iq@ChcC^jo0Cq8-KVdDBuog7i~vRfebgT8|79C~Pvgr`Lq z&mX=kn-YytpZ&IH06m8?pYQ2nRHL5R05#hXvD>=)lfbM@-ApVmsB7m6l{r|SioY0+ z?G4c?tW$h$++Oz**%-Ao5r$O}7ZiQO3ur@AKB7Y|+XK*d9-osrdS*pv?oM_c3jXPb>X%x^dv_$-ZyRpMV}MMq>)kH8ulL3$ zrI82megl@ArH<~4HotGR2EUKm^z{On}IiW z<>w9qoEy@-v?lncf7t65Sbh~rjb7-ka~W~L!^2%QQvbaK!yic4Z28!KfBR`n@HNn8 z8I}@W%BTy!@gw3o@03dvvpagc_0XA7k>VZ4hssA74tXuNpjM#1dDbx`v$m?Kq=-?y z2iuiSc}Xo*F0V5l<6nCx7CrCCEn7ZGChD{W;N)2}dwp~F@ip|JSAa_E^#b7Nd{jp( zDCuinPY+ECb&MO9P58{In_O7a@8=Qlaa#JlvRm0l5)`r)T;vLGY0 zW&lkomFiv5ff?AEPLd}%90eWL)ER1{&5pxqwwtxX*pm4hwKJmiPT6Dhu4VPr`21XZ zs8I{;lGH6#oR=0YE?cR`M;$~HRCsyjy-2vx$c(;E+3Mn;Yk!QH6JDe9^i7rLEZQb=vqO zo=2KK+p)qv)PRkAuU&6Ln7m1ApOWky^Jd%q5$1DtwNv%3VZy=SV8IK;{ui)Z(q2;B zO2&fwN|%_35=vzAd;E@017$~gU9{&tpxQWZ75T!GiX!Xh^x0^~jk^QZx9&ANIYr0@=8rcyf5f?T)W1!0 zas7GQNskceleU%FAmmYmSG<2~s@<`qd#R zU7(}@KAsEju)p?;x>nuX3I>&{T-(=vI$kMe-?{0n z>EbnV@C0$1#m-oD>8uBDgkju`0p$_HVGo}9FEAcL)1JHx-0w!zhe5R&7;va>=_J`;)a`0~g?G2keSUwiWWt;11gSo$i*G zsU=dcFy}vxpU8E?bqXJ^7fOLH4XfRNZRZ63U7)kAV#s|_*?Q$w;PE4#c zh$(ptb@UJT-S`q!8##VpJ7DJ%Sk3swj9D6;TwA|wQf+|obS+_asrBp}tH|GS0l0Eq zAlEqJs7KbvT<=KFW`R8}kCl8ynfbD$@Eq)KReaSh*c1PIQ!No3Z`Ka;P=2owM7de= z|LczH@RCXq$ea4}ZYlDC-P7KvmG^>vm{U9}NlH81SDlULHLny4YY2mLw*psLY&@u# zE0iy9b6>qVQiPsw#fd2q=6X6nWsMgaf4Rk;t!Pa!b(r$BvWP9ss{}mnX zjp{gzG~u_;QKWS;ZZO=+8U4gY%1?y#A&gbhviL{u0oV*7sPm`oZ5KP+o!Zyyf7*tc zRL8wV_60}%;9ODy{aLy#dA+JHb>GvpC&K}mXFC;pYFu*`SuoSgUuRy9us`YX9=_U9 z2HtUNGqczQYHf-3YWSUIyw~SYG-FnHUU_HJ$W!Hf_;O{Om+Q!@;_EzwNwYQ@TcR%$ zD4LxU~2MY zes12NZ6Kkt7{xi0dKzn2pD-%}pX?z$gwmVDp_dLNcz0_y@-=vbyb0hi-a3-Q5*@Mw2R0r~co);tGA@w{*?!$#S_3S`xoG29pGP>IGKFm_1b>VZOpLry zvzq2bFyZLfe2NU2Q&sTS-7Hw3F&b!f|JJG6ov^xgGpNE=T?Ks&n9<`|g&3Y<8%rkCH(5ow(EK$;+ zN3fa974s-`jdd%scN7ixUUGYHJH`MDWSiVy8K+^!`;QCs-KO?Dk{*BMTwqWktl8>> zRbLGZr(MycTdwCovbN@f?M($;chzVNfx`!Ocbx5q8T75R0BbI#6VywLjG=ADAf2ga zz9zU{l-?a3hJ6|Tk~t7L>O*>u|uR=?D4a6#G%sVlLMD5Lr|uT$Y0ayJUq(jpE`YaK82|# z!jd4lI&bZ?p4*$yuh~+DFwpoYdqcbO z)Mg^9t%BOquy#QM{E8P z;QDbt=hH$|3oV2((a|5ZrWzAu5P{>e8U0Tam|vs^Hlms#{%vt zA(CK-Kk0FC3Wlh$#vzQZS z7L&HD?eje%^nE)VB;B$LzrQe0%GmwJqK3`sbeSMT^fVz)$qAsU@*FSwx4;l18#<6~ z2M5o^D7e%}A99Yg$ z=H6%@LkX?))OvIw1#T1OUWRVs?9}PFVtpU*i5h3fb3B{KZoX*@F5zy~eV9l3dhSeK zGU4#V29m16yi-X9B8t50HLZ>=Z}+p=1*cs_VL>RrX+I0sZ^x(0^J5eYnfl*pH#R39mP zM-Z1#28m>GRb~BV#rrVxHs>MTqP)-?%VsoO;9-YSE)=wzJBB{i8p=pnj0nN=HX& zymB+)2up+_s*>3%kQ2UVKabutYq{PZI``TEhIjgo5=d9|h*a9 zdqz!uQn!ryZPvDJk%XEYqt~JrRfti^v)}f!|x(S|M zTImOlYi%#^EUoz<=ggV(1o>pY`83(*i+8;#dxKZ49ZtuG8$+_IT}ND=t2%*HVBSuS zUG0j0vU8KlPmO%RT&4zHvzmH*gPK=2FPXo_8ysLE&83FLd4uZT)_YJ3-5ddC`_;K! zeLy?GOYTRPr{s)e6fZ0fkR?O!$=IcsSB=a!yjit>UK5-4MwBgKW9v13exwv*jB;`6 zsMIOmPBvKEd>XAjUSI~3i@iD{_2P+f-@%<80{^>Ww5qbsHi~35f+Cq|E#ia~YK%Z# z4(gYTt%Dh(FVC(3T;8PGnKvKVO7Pgx%g%prKD>-o-1$RdecS~_yKdD z{GHT+{)w>*G7@GY*ir#1a_J&ZX`_LADa*;@odY#Yd=Z)ugI#j}#0g8@$q-SB_5#`2l-nq%=g4%V9bG_apaeXasM6*Js z$~xE6)RvZ|rH?lNbA|1nyp7fw!W7^nT!_3?>-8*niFDp4aCNj zbloGg^$P-iB`|$_!yj&%H16scbfQWrzn}-nRxy9{_0wKo%jFLm91`W4IpSy%kbc;b z=5Fqi?4ayQN{#&p-Nf}m8dR;e-yR+-K;;LcSEpWUCNhHVWssO-PtJikDV+4x&4U|W3Q2}_{#t{l1+^f_s=R7tiR&1JQ0A8sR_3D zWGSde>c)ke;?435e)f{fzb*<_vUAqtjc|% zWrg3(>3mJ>rkp2~`sC0bCW>`=CRp3ATsQsUyv$&j{)T0)`ZmEg=vT#)u*lmh9SZ^X z;_*0dXQFS+mYbs~%W_NBm;&6uUCDFBD0`$KRX^q9Z0WVsn#;^jhR)>$W%5}Z80QPN z3gtw)cUHPKwbfSnjYP`a|8`)UBV5UJrbfbzVDt)=heD4&e@pPl>2aJ7?r%8OZsV~% zCK+ANG*}4Ep0cv&z*R~f&*z)wW}-hDPT*4Sj%`F_*YGM|FU;>dFg|CB=0ZN}4by9! zl^D>`sX$d2Slk*=v7|R+kKc;xK3H_JxW_EfTp@1BBenZLoqxy}Uo&sURuwbWmE|9I zC;fB7!spUuQ9oTqF{jiX%ey8BjcW~yO`#n%9o^G;5rVf(QB8)6S!`JK<26c4W-@B_ z-?yK-j80GLvCdl(JmP9!$CK0115P7G%LaMaR@JK_Lt{Y`aM%5wWMSa}KGqoDgIQWx zjC8{j#O#nyh1LhYV-Kbm#ACMeeAK~(I#k61=ftRNcZ%{_*4|Jl=3<|U|B8lvQz%SJ z;GhJ%87BgJm$YQL`o`jxWQP#x*M)r}J3%jD$7xz6p)zuIY0V|^YMK`G!m_3x4clM4 zIN32$eeqt_66^ROa>}1v9oX7kvCXt)Gc~*9^MNVcAZPLSXH66%mnHTg3k%j%BjxZ3 z7S&+UQi|ub<24^jGIZiqe^zHRAeUH)C_?MoX4m#r>Vya~e5@Dg+C#=QJZ5@h_|1|W zputYp{<+O^$uyzD;#h4qa@NRmq!JH{9GyFr{jtkzN%7)Pb~#@Hl0KkBspW@nz&DqQ z#g(AP951B@@+ww8_+OexdselPL9Vf8)1EeZ={Qn3+ooYdtR1h?uW?hJu>nTgsFF@S zbEDFAEbw+Y!^6vSLLv3{LNoVI1_=5!tzNgdeEZpJlDyxwpy&pRp1BpzTyEwRiQJ2x z(>hC6Mm#;c8%n6Mv62y~BUCc?+v77;QcdWete1+c97nco9xJ%~b^gDBo3g1DoK-+Q$CwQxU;%`fl2!|FB1STfjuEts8m3#j5D-$}$!9 zOv!t?N?1dxOwCgEP!?V1BRZCnq=vHXw0cJ?nc#GnnxYtAQ4{Utav_4Nz7P5=qU%U% zOV5JOd$U?(Vr}H%-G)pH*&M{%)$mVF`On6fb;sz{J%1W)|J5ZA%j}5PCVY%lLMJIs ze0MR-4Bx{(9(}Zv!}N?u`VQenRlC|ly~A1Z&`@2`q`9-{INM7qc*F7k+*TI`-#o4nz zSdq)or#WlyUexe($7_~eV~Y8Uf^_wP}(9$2<*H|rZ09mAj`W6`rXvJ;atvqy;XhNG{vA^m1kmXnbwjyJ4=R! zwm2r4oJFvYSc<_Adg^_@Nx|MZr;zK~QPxGT!6l&~91G*8pq=?V%*$u}JN~?;!@%jjmo5uVoLlJ^oCZPP_)2^aJ28MR zQA7V*-%5qtq`L2Nt-FVLSPhK7N^9O}*yZ6)U{d~PIUYNKwof6dS3C+W z&ECmk?(@xl>_Wsg5anBOM^83PpuMKKT+;JFF8W@P^U&Au3SYrj&Ev~GsK%n|$L>NC z3qQ8(mnvEYz2^8&^JSV)XUz;(ZzaI(pL#Bp8eb{aO1XGYIPdVT=ll;RSvzB*OB{yW zp6!Aq%1rdkr6wtMn8tb(JI}H%4jc-WCo`cE3R|UNVXM*;{3F?Qt_cb7o5uLB#rBb{ z-ycFlMhY`|Q3LjJ9rf~SLrqNsH*nIF3$8c}{;cqbS-XHnm^pGewvNkCcTTB?7Q-iGtpDVYm6 zR+cg6&S&#NAtJ&rp_b`1n`aOxo~l#aPhoV)k0Svjtd_z^!H9Dny_Q<1G1oSzdyd zDf(AYJ}AD7WlXR^76L>=Sl%-?l3&k5%cUx}tlGE3v88PA&7-a;*3<3-$gtPMQ8!0i z_;5PfVhmfl9U!%Y+9@QLl+5qnEElfTszroV&0ujNs-mr&S9hUFH0v(>3f{7Chkc_{ zF(dOV*&1&qytaeeXR`vt2u+>IBJ{qOqRpJpXy%WRPQfl%gmjU<4aZvOwN-81ul92R z-kD@V=FIrfV6e+#+tzKv4cSF6^ImW%zJ2W1_t{D3Ofpq@;kUfIRFKI8zkUs#C@Jvc zMIV*X7huRq@lReH^z_t_mpM8nPSFy7fm^%~$noX~@^wqZY08g3AdeCUuFlDUD^V(O zycIWUKZ6^v;Hi|<<&uFv+p+(H3y##FaWOw1o(h5)-_d}w5;%9^3%xfF+_&RMGL-TY z4hYqstBxK}GRBohA!2&SWmt!5E1vTpD^meVz-aySMqRDaTlq7T#`@WoKw-$1J?+vZ zY7h1_KG|YsZdk&`RjJLUGh>|{6 zic@`!=H6pKLncN0e2#X>Pkr$nFVVLH`Oe4naIe!a1@~TX9uv`}G}UJS`&xP1pRIc% zM-|~{pFO~?p^x)wH+YooE^l!5cI;CD$87Fg!K>fs%-8goIT%CZHE_8eArhbF^x8sH z&ahzY6ge)EghTHc;sW(p^p5FN1Te z`N$NDDRtZ+PG7dGijIT7=0P{NCWyFT$1se&V5er4-j`rk4|ZhNz>e&i)5Oofg@Pk+ zD&-O5-&F@ckg+?ck_w!1o_fDgV*|YpuR?w6>>6H80@wRyjoO@a(w(}a%?8No-2~&1 zB{>4_8fWpB-_6l0fC8CG^7s|U1ANK5i~beaT^`jXx6EMx90{2817)ae4YQtd)8uL1 zU$uT0GBJf;?7-f89H!~10Vij&{FG8ZNkvg6=Fm|aFCT|YM5#*1h>l(0oe&Sq&0I5k z&r8zN2!b66f*nX9i-ZL6u~??sLN13!zv~i)XOAaq$VFtFL0s!q!7l!E)mfrZDI_PbeHB-A%JO>UiV;pJUWc2aOoBA-yxkOxj$o;>1 z`>v>_ws31e1(kMG6cqs*T{_a6B5FcW2uKN42}lc;(n4q=MM?+|2#^4R z9;GE9EeV7GN;8B6ktz}Vx92|pZ+G0Mj67tIwf4yVzPaW%=iDc2@^tj5`cDc03N-{} zs+R81vbdhn9CWPs)NScgejP)Fn??VwRfom3=(5E(gq^^eYT&OWo{ zpKMg}6R2EPm3x3gw$YFTy}O=(^&3VtlB~A2zloI z&(PPKN>D|=m5VLu3R99@F%-%JH(3X;Yo%A)btO_;z|dYH(S%~&#mQv;@PuY!{nJ}p zl;2M)j@nVO0+k0}Q&?Nj?Y=q#C4pLu?o>SS_~=N`f$=%X0GJ6SYU&dsL}zKFeEp1v zPhNB)MzC7zFm3f*R5fI(yTUan^W%5gdf>Y*bg(Y47ZB|4Hk%QnQW2;^v}6gur`%ff zfhuj4P--@3(Y5G;)g0Mv{#O6dG-7b>2tb64UjLl#djG&Hv<8MH(qg?9!luDU$wlH4 zjQeN5w|A;fp7cst^Dw)4+PhY1Nb<|{-)W+Ji`NFoMkp+j4any*T)9?*Ox^P~FdK&D)cJa$WK-&68%idHLF2 ze=}X5o8O{IOk7LY$VkdtnBPo$NBj~UB-1c3nQ|%|61jw*Y~IudNUrF`$tE2adh-4a zP{dVkX!Ry}&atmHlotO6i>>W z)C@v~d9PTY*EUR?XZ(mIDT2MN zOKH9zQ%DSS!qw5grO!oo02Sa7LAd}Z#&~O1&5`qgEzhQc_}*ej2d`*eHOWL8SOni= zQC<2DIwmg~aDE+#RG!_E&21CW$;JDo;MRp{ppG9;bq#X6ikt=$@0sD!QNH#~^jInL zH~zR7g9{VQNR?>Otv2DqR%h5t&vP2Gft|l{?eV==$nq-7)5Dav@Dh|Jqegn@WrC=d zD>lujJA%U6@K0WCuBIy4%j=vlYy)Fzkfa`Uuh9kC{G@PVvn}|wb@QGTy}S&vw7xZ+ zZD3P85xn&p0v=3j(_Wo1TUweb7-%Li!smB5U!mWe57U%>6dbD{MFswbw3ut|o$+Nz zZ;te^Dsm|Pm8#PYwta5$RRw}GS*7sQPedMDsbHxmy({Y)h%oj_n)b&x)CmcQ=tz?6 zv6NS+ogzQUw*anr*vYPNgh_fE>3AD0fwv|ARf>_qqje*@$5t?krnjD)wZ$?((5jHN z8S=i_B$r&KDx33Mb3v#yI3&)_?>wMdDUW<|WSB}@ir*zr(+y}^{w^7XYZK{xlRNca zns(iFua&SBZHT-|U2s_d{FK6bNMRR3vAGzkuix+Kyv=#GJN>Q4cJP9_sic0V&SXP~ z8+=%%;weCioi^~a9%W5wVwrBs`KBytfet9JMwsrrrb? zA*0*Ar_A3V*13RS$Sv>jnO*whuvaIx?O5xN~Iy?$t%6UU4^Pki%?1kip<4O9YsO!Q)8>i}f zu8zDp#l)Xt+$nj4DWluJ);X{i^+T5%?^wgVQNpqW<2%N7Nq9O7=CAKw>7UPdcL%&O z(}v{E;i`jQ5W`{?B1kmr^B$@SQF+HIzFXCQ(r2G&K&wt|RatDCA!?KNSOL%BRm^y^ zS{_+0tgRt7}oW>aZU{weB+} zZ=Ig@Iv4|yS?I7&`XnNE8_$qjJ{(dA0(~&cCd^&`ITyM@&%7Q?)UKV=uG6uuv*@8- zgjik+OHmjiA6_Tjig|WMWG4mi(hwnATpOG(3*SF0Q z*5KdV2;!U5KRIt@ru;(NGzZ*XdKFu%nmt8JUr^P2iTR~e34i`-O>AqbBe%KtoIs07 zAdC}L`s;zE&s5}d^Rev+!vzuEM=yjEvcbw)8|853PU%@^n#Df=|35LgO45|jrBQug z?t*Uek!juoQKwHzFeSY@Dg*~ZWzMJvxCI+Te}m|u)W5>L1zTV?aNP{J#pJ;l%S!f;4>$(pF8-EQIxK6M3{O`-NJ1KNfps{VWTGjCWMb@hoZH z3_2rm7v?eHGBRc8QK(Q=R#cOe&~2qbw~zjDY$(Pum{U{!1-9sMej6&3n23bQ@? z+y6U50B4a;>U=dJ-NJ+B)IIJB3XyPP(>m@_lBv|Wcb zCvyzUhM(_!@v224TdrfW$ER)u)KA$d5ic_avLN^Ct6&-B*k@Jx1I&++_Q;Oyp9S)D zFH|IFh?Gs>%!vK`zUafo^Nsg?F1B86`10>v4mB^Tc2<%a10yd`Sm72E8_q3*1jfDi zKhjzbm#&_^0nT+El6_K#oJg>I`Cum2NIo(0 z!2_sPWfZNn4YJ#0LYj@>4k4Pkiu<;Gk%+QX*UrZ|Y>}x>!C7*#&LP$sabZldtoUq} zn{)AC&2g2im6_5Lx<4tXIVHIdj%l!!bIvs402#;ffBG_Xz0x2sQk=r#Z|)RGYQvn7 zNc1^Tl1sLEm)ZBw%~_>c7G*~ok{fVmUe{$0 zm-_HUO2ivsA9v=5uKOK65#8KuQov$W->>&%J*DGkV#){EvV+1_ni@=i5viCv-kQKlfBPu$bVmUloyQtRoPQ*t z*k9y+hujEe`#{_~@7l%@6yU7WWAMcn<*nnp#*l9=YTRuwh!s2KZ zO92jG)l2j@w_MTxG(f>yo)PbSe4OE`iUwzTF`Vs>O}=jeDuf)W#GC@L)Y>7$csSUB!PT9X2+Sy-ht0oNJz-5oomnQdOGUKrhB&&t~U%2o4we>|tGNMt@ z;PgGv^6%AtoB6Y;oXU*>h$6$isi?Bsh#Ii1xIIbJWSM{w+Uo>)A_kh{skBpRFV)ze z^_scoNol}dK8%~eDffozJ-A6)TA`t$gP)Bo+4&hPg|zzx-1Az0)QX*dy`8cIqjR4l z-e#7`*-y&`=;nl*1ncJrXgr7~t$G8b7TF*owFs(Q=+KO9))-J%rY~9Ru@Q@I4{kSc zlsH8nLS^9N9nqGk(AKm$BCJrA^f>72lTF=K1H?RFq6BD6oAG!?40Q|Cq)E>Xc|Cto ziLunm-n_|*{g=t(9~9efC_g1%MFTVHOE*{WFz4=|>;Tqzs4z+5?@P^hhbx@Tq=`#+ z#wBWwOoLx7?=IbG?HwN<(*9&iM-SU%!N&Q<^z`}iu-@DDy ziE|5mfhO!C2C;r7Vp)bcI$){ArA49}-&QIt6I|dBD6lfPG{Bjez<)w2EFrt}-0Tik^pMB* zX`Rz2v+gwH`n)q)h{Dd&-b&Uh5?|bDgD0X*W+=C)u4nEXmx~-#%`WiwvC;ZL=>QnD z7C;wv;v-0^Zk(@YM5-rpl>6i#fK0I3!o)|%br{5rf7Y9#tX-x1ByK)`&CjxWlO$Q_ z{nVUW;^7`ri8G=lAA~kM!M?TfcquZ8O+H(;T51>Z94dn`HM1B<>9Tb_pgW}YaB-R` z@=e+$*G3$mpG#x{!+&=Nfe)!4WS=f`H5@_<(fW=b;Mp#eZ)>v~6cF`lU~rnG&PSb$ z92^q)d)}*g0_D;1Cq{Et4eQUydKn*K{W%D-@-zRf$l?Bi9_9EDim7~!V@D#sR(z_OAfxbm_pV%z(Z38wt5%IJpMp#Ret#5uurn3}@)ys;^6erY=@Bsb1K2Z5Q-_Z(3x`H-i3*rZy)Z2$rJvEhst1XA*Lf3KX->=f)vdmTwr(hZK*C$skvTud7 zPdeHJ?!Gt@KA7$0*r%zX8G4umV$$I~JtBqC9e%<(O@F0lDNwAHYi-EqX=PkvO9Nu*ia7 zH=_8YaChpp!cu3M<~s4!Q&$UMh9QW_AcvsbLNgBFX_4R#Uc%z^Ve_y3bCyFLO;s)a>bBtxxMQM0AR z2szg$Z}>gZPKB3TDnPFQs&^>|mroWl-E)ceMub_JNAX9|vtQbf=v_=1siZqFJ8MG( zq}mk3#C7+T|Ewj8#=iBU`wTvw^4OaUaNt;$R|pQEeomJ=`FuGQ4ytq(u&eB6B3~Xo zjLlvtZbw9wlxUi_JD(0ZAUQP5bE(3m@007 z^lX)bT98)oZH`6`mooW^H<$UCbED9k9d;?_bvF?@w0BwyDrf6w@>fqz->TYl z^*Ur!H8ia_p=vI5V~S_P8Pv6H=ua$I-BR|zhE3}Z_#vdl9mD6S?!XKSJ>*rC2&FU( zISQ2!{wvZvlAb|X+9mRn4s;llUlo6lg{MEuYHH73uJL=CctWQ8eQb)xWC_c+&!Y?f za^|g9y$Yz}(2pvl2U~t=&No`IErYacO*Y9O@5gpA7d@qKNQonKL-9;okf|Pd|0dSn zC|JKO1KPeHuw68gc>4$?fdizl5I#=-n}I(RgVx=1EobZa(P0lBY$sf_{Os`#s`at~ zgN8Zx1iHsoeKoaas_axZVp{CCGLO6u_>5y;@T|T(+vqCMZ~PCfi|xFPn-{WTu74W- zh?t^mI(Wrv#TNmQEc*X$3^nt*qwa-Aug9v@TSlGcaZvrzQ4%&3=GlvD_-K+W93E`w zg=xL}Ga(C3@s-Y#T0skAYVD*ZmN&v_Z=~o|2`*v;ca7wL3rbZZ^Rs0u}?Ianc8@290nwGls)IRjp>Vj%Aw4BjbwTFZ?%B<1(Uj4T>Qg3nNviZNg zp859mb9?9N98f<${YOvSv6A{J2iBM^SdMky(FCbl#fz2zA^8FX)^(5)4Y*}eUPQGC zwH5MJESwSB@|~2NFaZiZT8SqOXKy5HCvSbm*H{o*GYmraP%ZGSG=?Ps9Y(Hr9|I7# zKH)c=co?RF2A^#X*&0rIARZ|8h(#xIELcuou3-+rW$MZO=ON|}_?oxc&NW2fB8WXy zLiL>{6*u;%ihw^n$c^7PN-}r)O&FD0+(Z2 z-l}ls2HoQpg{L*whxY1nPSAiTP1BYMu?%j|jP3eS1J&#~$@Q~Sc;{_TeXa!t0;MPi z=i;gKa8y?t`BXUfFMEY=L2KPrq1;wgs=MDgAzp*e7l2D7m&@*jKqprD(K(I&h35iI?k;v+>zy?uN+R^q5T+`z{ zQ~?W)pSTDW`tO?C6B2u#Vrg4sGHv>$pukFn%yegdoSV!;HQw*`fd9j}w@CdJ>ZvOz z(&EsCidya29~vLqMZG_NX-2XE7pW^3S(nume@g1~H+<1Oq0_6f8_11zk~mr7HD%X4 zd9p_j=J#t?Ggz#mx}N+j@Ng?eJ>+COKhW7FTP}Qj(^2Ji@AkqDAWuPEhvcFKl7Kol zS%mbRkqAr(-5r}&JW^1X8W!?TX(s!q=Rj07$4YI(j+LA#Zljfd%21>S2~cz%p*~Gl z{6^{d*GX%->c0(v8Rzr%*uh1|0tHecY%Q22s>J+S`fKpsP-AZf-XolEAg!+zzRh>Ac(j zsRC;PsaT3?B?Gr*zj<9RnoK)mQ|@J*jOmf?3J2UgT0kR_1F*0y3%&fO?@?Wf5D2#> z|A8bVIx@%~Zk9krrM3tSWgpbm)@8bMabh}2A+4EV_oc_GvnCEsMIvz0J{=wE-Fv81 zVbcz!P`5}#vCiOQiHV-7drVtc&>yT25n3Z2QZs)ci2^Sv1$u?7HQ(;sbt!iz14yp4 zzY)BRj*NH%AMnlQ=uFc%rvWz89?+pQ61x8hguh#X{HF8ubW0_+W%LCA`UfDJrVY9G z&HGy0y++Z{jOK}VcdXR>bHDJf;z?BV#?x0Z-H4SUpYrMOtHATO7yG4Muc4=BKN55K zc1ur63Nl^ + + + + + + + + + + + + + + + + + + + + + + + +
+ 1. Remitente / Expediteur / Sender +
+ {{data.senderName}}
+ {{data.senderStreet}}
+ {{data.senderPostCode}} {{data.senderCity}} {{(data.senderCountry) ? `(${data.senderCountry})` : null}} +
+ CMR
+ {{data.cmrFk}} +
+ 2. Consignatario / Destinataire / Consignee +
+ {{data.deliveryAddressFk}}
+ {{data.deliveryName}}
+ {{data.deliveryPhone || data.clientPhone}} + {{((data.deliveryPhone || data.clientPhone) && data.deliveryMobile) ? '/' : null}} + {{data.deliveryMobile}}
+
+ 16. Transportista / Transporteur / Carrier +
+ {{data.carrierName}}
+ {{data.carrierStreet}}
+ {{data.carrierPostalCode}} {{data.carrierCity}} {{(data.carrierCountry) ? `(${data.carrierCountry})` : null}} +
+ + 3. Lugar y fecha de entrega / + Lieu et date de livraison / + Place and date of delivery + +
+ {{data.deliveryStreet}}
+ {{data.deliveryPostalCode}} {{data.deliveryCity}} {{(data.deliveryCountry) ? `(${data.deliveryCountry})` : null}}
+ {{(data.ead) ? formatDate(data.ead, '%d/%m/%Y') : null}}
+ +
+ 17. Porteadores sucesivos / Transporteurs succesifs / Succesive Carriers +
+
+ + 4. Lugar y fecha de carga / + Lieu et date del prise en charge de la merchandise / + Place and date of taking over the goods + +
+ {{data.loadStreet}}
+ {{data.loadPostalCode}} {{data.loadCity}} {{(data.loadCountry) ? `(${data.loadCountry})` : null}}
+ {{formatDate(data.created, '%d/%m/%Y')}}
+
+ + 18. Obervaciones del transportista / + Reserves et observations du transporteur / + Carrier's reservations and observations + +
+ {{data.truckPlate}}
+ {{data.observations}} +
+ 5. Documentos anexos / Documents annexes / Documents attached +
+
+ + + + + +
+ + 7 & 8. Número de bultos y clase de embalage / + Number of packages and packaging class / + Nombre de colis et classe d'emballage + +
+
+ {{data.packagesList}} +
+
+ + + + + + + + + + + + + + + +
6. Marcas y números / Brands and numbers / Marques et numéros9. Naturaleza de la merc. / Nature of goods / Nature des marchandises10. nº Estadístico / Statistical no. / n° statistique11. Peso bruto / Gross weight / Poids brut (kg)12. Volumen / Volume (m3)
{{merchandise.ticketFk}}{{merchandise.name}}N/A{{merchandise.weight}}{{merchandise.volume}}
+
+ {{data.merchandiseDetail}} +
+
+ + + + + + + + + + + + + +
+ + 13. Instrucciones del remitente / + Instrunstions de l'expèditeur / Sender + instruccions + +
+ {{data.senderInstruccions}} +
+ + 19. Estipulaciones particulares / + Conventions particulieres / + Special agreements + +
+ {{data.specialAgreements}} +
+ + 14. Forma de pago / + Prescriptions d'affranchissement / + Instruction as to payment for carriage + +
+ {{data.paymentInstruccions}} +
+ 20. A pagar por / Être payé pour / To be paid by +
+
+ 21. Formalizado en / Etabile a / Estabilshed in +
+ {{data.loadStreet}}
+ {{data.loadPostalCode}} {{data.loadCity}} {{(data.loadCountry) ? `(${data.loadCountry})` : null}}
+
+ 15. Reembolso / Remboursement / Cash on delivery +
+
+ + + + + + + + + +
+ + 22. Firma y sello del remitente / + Signature et timbre de l'expèditeur / + Signature and stamp of the sender + +
+
+ +
+
+ + 23. Firma y sello del transportista / + Signature et timbre du transporteur / + Signature and stamp of the carrier + +
+
+ +
+
+ + 24. Firma y sello del consignatario / + Signature et timbre du destinataire / + Signature and stamp of the consignee + +
+
+ +
+
+ + + \ No newline at end of file diff --git a/print/templates/reports/cmr/cmr.js b/print/templates/reports/cmr/cmr.js new file mode 100644 index 000000000..cfb3dd360 --- /dev/null +++ b/print/templates/reports/cmr/cmr.js @@ -0,0 +1,38 @@ +const config = require(`vn-print/core/config`); +const vnReport = require('../../../core/mixins/vn-report.js'); +const md5 = require('md5'); +const fs = require('fs-extra'); + +module.exports = { + name: 'cmr', + mixins: [vnReport], + async serverPrefetch() { + this.data = await this.findOneFromDef('data', [this.id]); + if (this.data.ticketFk) { + this.merchandises = await this.rawSqlFromDef('merchandise', [this.data.ticketFk]); + this.signatures = await this.findOneFromDef('signatures', [this.data.ticketFk]); + } + }, + props: { + id: { + type: Number, + required: true, + description: 'The cmr id' + }, + }, + methods: { + dmsPath(isClient) { + if (!this.signatures) return; + + const signatureName = (isClient) + ? this.signatures.clientSignature + : this.signatures.deliverySignature; + const hash = md5(signatureName.toString()).substring(0, 3); + const file = `${config.storage.root}/${hash}/${signatureName}.png`; + + if (!fs.existsSync(file)) return null; + + return `data:image/png;base64, ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`; + } + } +}; \ No newline at end of file diff --git a/print/templates/reports/cmr/locale/es.yml b/print/templates/reports/cmr/locale/es.yml new file mode 100644 index 000000000..79f481b35 --- /dev/null +++ b/print/templates/reports/cmr/locale/es.yml @@ -0,0 +1 @@ +reportName: cmr \ No newline at end of file diff --git a/print/templates/reports/cmr/options.json b/print/templates/reports/cmr/options.json new file mode 100644 index 000000000..9151ca63b --- /dev/null +++ b/print/templates/reports/cmr/options.json @@ -0,0 +1,3 @@ +{ + "format": "A4" +} \ No newline at end of file diff --git a/print/templates/reports/cmr/sql/data.sql b/print/templates/reports/cmr/sql/data.sql new file mode 100644 index 000000000..e66ab7154 --- /dev/null +++ b/print/templates/reports/cmr/sql/data.sql @@ -0,0 +1,49 @@ +SELECT c.id cmrFk, + c.ticketFk, + c.truckPlate, + c.observations, + c.senderInstruccions, + c.paymentInstruccions, + c.specialAgreements, + c.created, + c.packagesList, + c.merchandiseDetail, + c.ead, + s.name carrierName, + s.street carrierStreet, + s.postCode carrierPostCode, + s.city carrierCity, + cou.country carrierCountry, + s2.name senderName, + s2.street senderStreet, + s2.postCode senderPostCode, + s2.city senderCity, + cou2.country senderCountry, + a.street deliveryStreet, + a.id deliveryAddressFk, + a.postalCode deliveryPostalCode, + a.city deliveryCity, + a.nickname deliveryName, + a.phone deliveryPhone, + a.mobile deliveryMobile, + cou3.country deliveryCountry, + cl.phone clientPhone, + a2.street loadStreet, + a2.postalCode loadPostalCode, + a2.city loadCity, + cou4.country loadCountry + FROM cmr c + LEFT JOIN supplier s ON s.id = c.supplierFk + LEFT JOIN country cou ON cou.id = s.countryFk + LEFT JOIN company co ON co.id = c.companyFk + LEFT JOIN supplierAccount sa ON sa.id = co.supplierAccountFk + LEFT JOIN supplier s2 ON s2.id = sa.supplierFk + LEFT JOIN country cou2 ON cou2.id = s2.countryFk + LEFT JOIN `address` a ON a.id = c.addressToFk + LEFT JOIN province p ON p.id = a.provinceFk + LEFT JOIN country cou3 ON cou3.id = p.countryFk + LEFT JOIN client cl ON cl.id = a.clientFk + LEFT JOIN `address` a2 ON a2.id = c.addressFromFk + LEFT JOIN province p2 ON p2.id = a2.provinceFk + LEFT JOIN country cou4 ON cou4.id = p2.countryFk + WHERE c.id = ? \ No newline at end of file diff --git a/print/templates/reports/cmr/sql/merchandise.sql b/print/templates/reports/cmr/sql/merchandise.sql new file mode 100644 index 000000000..cab597caa --- /dev/null +++ b/print/templates/reports/cmr/sql/merchandise.sql @@ -0,0 +1,11 @@ +SELECT s.ticketFk, + ic.name, + CAST(SUM(sv.weight) AS DECIMAL(10,2)) `weight`, + CAST(SUM(sv.volume) AS DECIMAL(10,3)) volume + FROM sale s + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN itemCategory ic ON ic.id = it.categoryFk + WHERE sv.ticketFk = ? + GROUP BY ic.id \ No newline at end of file diff --git a/print/templates/reports/cmr/sql/signatures.sql b/print/templates/reports/cmr/sql/signatures.sql new file mode 100644 index 000000000..c90d4c91c --- /dev/null +++ b/print/templates/reports/cmr/sql/signatures.sql @@ -0,0 +1,7 @@ +SELECT dc.id clientSignature, dd.id deliverySignature + FROM ticket t + JOIN ticketDms dt ON dt.ticketFk = t.id + LEFT JOIN dms dc ON dc.id = dt.dmsFk + JOIN `route` r ON r.id = t.routeFk + LEFT JOIN dms dd ON dd.id = r.deliverySignFk + WHERE t.id = ? \ No newline at end of file From 84624935d6d2c08155ba6baa324b74d8787e2a9f Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 2 Aug 2023 09:09:50 +0200 Subject: [PATCH 225/311] refs #5995 Load blob --- .../reports/cmr/assets/images/signature.png | Bin 27129 -> 0 bytes print/templates/reports/cmr/cmr.html | 6 ++--- print/templates/reports/cmr/cmr.js | 22 ++++++++++-------- print/templates/reports/cmr/sql/data.sql | 3 ++- print/templates/reports/cmr/sql/signature.sql | 5 ++++ .../templates/reports/cmr/sql/signatures.sql | 7 ------ 6 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 print/templates/reports/cmr/assets/images/signature.png create mode 100644 print/templates/reports/cmr/sql/signature.sql delete mode 100644 print/templates/reports/cmr/sql/signatures.sql diff --git a/print/templates/reports/cmr/assets/images/signature.png b/print/templates/reports/cmr/assets/images/signature.png deleted file mode 100644 index 0961df764f5e038b0c61620b60ba0c601d41ae93..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27129 zcmcG#2T+sS+b-m2=^X(nf~WxjrMJ*SkrIT29*S7DAfTalM5^=}2vty# z-V-`1HB_aOP|k|`zxVy-&N<(FckUc#oP_sX>se3vJ#DR(*N?RBGo55T34uVEpbzfq zKp@o15D3-B<881*IaD3qF4%hY7 z(zEe(vXQmrQc~o+?JWlgxWJKCoZc?Zt{!sU3S58a%7O2c$0A&ue}*8P6u9nC7UVS2 ze8j1WaEEhB2}=vvh)GIu%E$_fNlQq|$_jFdi;CS65xpfMCLtsyEhi}|CoazUpMP9n zHFsM(Ii0)r{<9YNOM%M)iFA__5%Kc!684f1M!4IHh{?*ziinDfh>Ht>5kek5u1G6y zAy<#<|4_IK_potybVE8KTsbKet*j9!qyiV<^luSd-2Nr&>hT{n0fmWpTe*pd35!xh z`e&e~=6^rb#pU189!ND$u*!e<{ofMy(DQMFi|D{T5GZ#WxSA*26?y%i#cXZu=5{$0w=0f9t#I3WHHa{T-HUuoRrRNdiLNQAo{0^$6Rp&tE1 zg;Q0PVi;LYK0`-WTZEU#O$t;0nFGITg@h|`iHnMh35iMyiAm^*Ny+Xy@}k8LFu%2X*y8TDjW5p?4Ly08_$_j<#~rqT)89x1?o- zq@-_&3yE4w$_QD>irWauTEk^UttF&IW#E#3_yY6qB5Y6;4N~U+ja*xV4WRL_lH|m# zt!zbYMP-GorR=1H#AGC`g{-XLQbJNzRx&mc5|Y+dqBj3f({^_R&ST~LU#U{KvIP_+ z!QztEvQk1eGNQIZ;&zg@Le@4Cc0%G3HnuWSvR1dm#elYKZRG3_?k-jUDvmBz_HYq5 zS9>nb|A!k@gfqfj6JZNq89>B~#|M4YV_|yMw0{uN3dzc5p4(Vm(4!>g$O!7YgqR9V=e-A6q|DOB*8A$%`a{nLY+BjIb+QUJp72%@D zBSHyEf15_+|82ED@BT{w`)4?aij=SahGX!@zX2WY3P`(yaP6;IU<-lRWI^xV(eqAT znLxi4d~8D4n@W+Hdy(+|6^n6b@|Omi1+Jx&Xa+Bq#~+r%mS5I7I9Pl=)&jd&>(wH2 zcjU?V@d+l2?2fqMUbPliBr4`@_!$3RY@wdUO(g1j69&JphKx0HAEW&)Nh8ro9zVF= zLzGK_#T4^y*xI3$&RpG@Y|u~OozhbDSx=t7?Yp%YLrFf!0Vfp}%9kcjT9C;g%CF9p z(16dY_nJ0vSjg(S4@E?E@wumZnqJ07=GXXR&~g%$|XR zfEm|EhjWlGB-`c{Ih(3Wjaty} zDcx1pA?w&z0x+Jm<1h&1;67N-VF(cYkZF-i7Mj^!TN^A{)l_1`K_Dc=gBUJIdI*qW z{sBoG+Nj}4 zgX9af;30+whYcL#IPuSlxh{YmjeZWy=EI4O!L$9ZfK`=`D2(za34KlDC+=vFP?8-_0<2`@zUn_y)WsYxALV9Foxuqz{0jbebTegnD9H)az~}au z^mF<>10?|NGixC2QdEkR6w(X2OU;@fA`nlD%1N436j6jL&CnM%5L!I{%52zMiKxm zliTR%O)va%DA9KBeJ}h!8eU4`KIrd#ap^5Hg)1vgz?DPQrNFGr;uEll;P>*35D{}0 zV8~uL;Hwfd`Q&h~lxQnkedl@k7jJIjZKN!ngWLScAW@)}k|5Tz@Y+6B09Uf@DSO?R5=I|g42%@3FLai+C|8>w2 zz{M8OsO4W+xKs>F_0?vX}CwXBM<&nm8i{zZBSrI1K zamb2;xMhw8V~}|~SRF5Sdde$cl83m#U4PB!$Eu$ou?I>b0l{jsqh@a-gT?m)&J@TH za{zXlM0=Z0rAq*i*e_WL)Etx-2hYlAkS1VD(~72Vlq~vp!d@obKogK<$teAw|Z93J&0DQNh_e)VV_5q0v%q|}_ zBRY#6?qLp-qzN_C2EZ#UF9BTas(8h_b3v!9Z=j!a92HDl*<@?i{KEi+K%F#_%6B0z zb86sgXy<2Li?Odbw|V+M>ZOP?Tlk)#S2xhD>e5m3Mf`><)K92@{xwGeu;~e4ycXrA zQ|VPB)(?-i78TX{WhzTjr^cJ*O73}Gf=p882Q!LoUFp6!{q=@8MUU5shSHV(&YL2X z1>7hDe(0*OSVATxOy4B2(*JT58?JCUx&>T^ksdf1$K-h&gyvTo--&{x-a+@$2^59z zQ-E*9I$0zY-A`oIB|n!FX+mGuq9wO$9?p=0G6T=yPD5UX05dQnj>Ce2cd4O`qZ{IB zzUJ)f2T=gDZM`obqE{%2wd~DPYV6urZy4WLf4f!-LReGDAEqlJ4);d^=n@n!+R~Mh zTubjaG*aT}%NKvhGQ)zXd{Q!tH!BKwt;;g24l2H#rfHI(u=OZzcZ*FyXkJ4>i2jQZ zz$`Ctk){&2sAJ!0gq8!)6bmsjcli9Yy399^cmbUL2gnNFY0$$5zTue`vsSXS%PXYn zOauc(yQ;v<^ktuSck&ngeSmkV_S-0_-MJHJFK65!g1iP{WTq%dkq4+^!4SWH7#ydQ z{-*IPh11u6I6VnCC4I?`srzU#Q^?KtQx(&2oigtnW!~}O13zwJ*c1OFSi{L@D#E}c z=_%Zbf-wFoSXiuUcb|1?V#na*`QJGd-MIaEekZ3ZccAbERnE#@>pqEa!+rUZ&V6oWf!;6R;7fAash1 zEY4Dn-Fe8{5&06hs}+dQ-&;VWvP?Hem~?b}j5>Ap%NNX{^MVTGk|IUby|3zJ^-V^0 z>f)%A_Rp9Qs49Xf1ZS)e-S&FBr-YWf$X3uJLoj}riDK>Dk=|pMN@NUnyOZkUs2v+$ z;ZYD5p!}d8Kf>>q&jDGAUx0-t?tp~a($ZPpwHHrGNv9#63_v_aW{Do@`J;HP*du8m z^72Ir3;SjZ)Zf|5wk4~e?g!a!|;1Lj-?N2AC zeCl^}mQ%IWNsGV@v{hJWA%NRK=@h}hd;LJ^t;*&2E0|e3f@{$-oA+TV#>WW{4S^-he+0nwS7+2d-G4+S_KME z-!a^uOsbEy_S!dphJwI8Zw`Toc3<5tggYx;DXn0)UdCJK%P;i9egb95^EggO$qAul zNFC6$5-(A0!JVJ$5-e}$w72x4($>I_Xdcp9Vidfm975r(ravvnh+1V?@v5F zMinGTS)8;D7LVtb9p)jfm}`jLPK(}T2XQ_{aJu&eRnToPqz(kJDG}n-3*puv|IB3; z5PCn{I4RC~qz+9#Bxgs#hh#26dijB!8~Rv=)0p*lPZcgD)m!whJ?=j?M^<5>gS4lo zU588^W@H}0Y{P#4nCJI@br3K`&x4N2R8jQ?viat54l#3D#nBLz{&*Y$RL;6M2^c`^H&`*Gp#J2?gTE_4TEyI@1ZhRO$ z8x3+@+Hqr1$O0urg;U4}fc$X>8h8sZ{861_yNW&~;4X8>?^*~NNK-w#4*8qfC`ZiZ z1x&*&Bb6VudvO&8WTAI2z- z>)+5K#b!$TaqqVMLn zu`&qbfU}rllq3@@B6W8QxH*Vc)R4D5_779O<~u?PfrsW`?A~|uSt(s3azIHJc_e(O zA)Z$Nx}Sk!$08@wud_(%N;S=G4#stW1P(?+Nrv|#5}M<7KxKxQ!?H|mX4u7^ zWk?V5QNZ<^6y@8A9{bZM1$_c3^*WRVbGXzCzxm@FW>UZ&uQk6Wk`o1wxvWkFQ2@P& zC(D>oOyi`ehATJRM48Gy(S za2mX111S>X|3us}P}4?(4)Xk0+Re-7M~5t77>ZjeQcBuCxL0(>WvCuY+lO^e?R4JX;XXjV(67r1xM{jEZy)xX z1@N232%`LgIMCKFXV4pbl(x67Up=W^9} zU0rNP4n2ApzSe*@y*c{(LBC$V;R_1Y3&8PGq(E7%yHvzaZ1O)};*gg6djjhtpyrnf z)Qq5nYgQ1vd({92=qTOcz5YOcVi@;<^#pUbl9Xj%*`TAoEiqF&D$YLL{SjavQk&o1WHMGoz*Ce_Dez}A4fL!3daYbgrA2U;ZqXrrOd`RZFJ z|C07NpjQj`62!V1rS=82OXMpGqfCI&Nr?&bfc#7)LE-=nOY5shy?ygE8c!%`7IXLn zlmp5H(Se&m=Acgng}Wcmficr{qqt0F{e5#o@(jxs4=9`=lnOf?3syzMZK5d=$@n(8 zCUk0vY&u|Zh0>6zp^L|?hpU^7H;HjC zgf&7GAN}@2CrRF1@u2L1;QkU8gZP5BKCmb=FxQHH3A6bdtT3GkEh2!5xgqO2ZO~Vs zpoL=tWrqM=cNWSjz8}12IQ?jfLk`j;4*)^g!cfxeSLv^%X2}xzvmc=B1;X-zq=XaE z18Q*^Cn!Wp2%XB8Q00fDe*oDYIRQefB=VYxK_xRe@Rtc_nRzJ_3VKZ8SnjKJOXM7!BRY!E8=6oIImEw0sL9>OfhQ zvMHk5k6?yHoZ21vXaRz#QtsilO>tr%JA@9@m&$SbieMK4_SdQE!o7pWpIPTuY+f2d zhJ(N>-gx{LrOl4;w&+?rf^SLeq60yD@duO(p;JO81Ri44$B|}AB7e}2^|`58yU=n9 z!UoiJ+!d^=)_-&wcjfBuNun+B18SdH-4|5vE*~X^FGA=*O{UBOkO4URE5e&-a}5NJ zGz}7iV(d@`sIuy^t*4svy)dA=D~W$N8#t-o;j9h9B-v7k>}mh`7b z4POc?zw%e&;W5`05ds0C|9-X2$h+er%!2Yj6Uzz9!dkbv-c)%z?>4mIj07I zIPq#x3~5@iflmRji!%|in_28E2T*9~D*aE9l_`*#CK61kEOP*?juSgnS<-C|wFU$z z(Sws{NZHqk+mz=)Cu9;X?k>_-o@yQ_oK?D=A_#3e4q*am=yZSFbBaVp{YM0RJ7CaD zozx8&yo@fu8G90-nLb-qSUB$eFHFCf1*{22v$qaZwpkf2cN?44csOX&g#A3?65 zy*b@%zCexqtnuzD9po)&Se1{jfrd3=R~3K-Y<5vW7Nmg#TI%n+F#~S3ra5?bV$*AGst`CaIoLE1VXJgCDWt_ zf_U=$*Ie&0hmoUOpmc(Q*a{(m##8xtZS<=HELaCz zF-S?&BxqKd$eEeN6v&7p@BF=?$@!e{N?18Wk)N0kR)d370eK0UJLTh`Ee?7){=gUX zEXAsze-XX1X$5#Yy_DL>MPxXErvkNl^C`~f+6*vAWWb~TH2|!s%OEWUSy9}f*-4e9 zDa5Eh?d_&LAbg)v!;6~zBeC8l6gnkD6oHcPKplN0U#K9<)D%^2@@RDOMk9Up>@f`* z{azp^b1;~2L7KWLicyJMF9}qJdd9IqMN*V3)JZ?U98e z(&Z_yO7d1gQ_6wI9qraP`Ge9qz5XW^r1vV2zyu^`P!a1en|1`+f;U{YBM`_!2H4=+ z^9$Qw=(~;p&JN7e464)Z#ILc8l-i4eFG>jpXah{1qHKynAaWoigO3H#|L-rCQIxy~ z37Wgxx1ikrKJ#EOa_PpFMC9}kDrxq!XQX+(@2rc}n*aQ~`AyktWyzm^FE)><%lwtm zmzo)e*>+bX-HI@j(Ts%??)EwG6P?G7T7NG-4*NposdGMDT)?wP)p9q(p+bac)c=m1 zZeDFd9T$zf+?rogTy|jyi|Yik&DCl=e5btsZ9@)QcwNM(k=qE!q9z}mAX-&IfrMC`ctDkLmwo{g)4HwAeMF|s|fBC z=@Qr1c+@gv!}3Ysc4s8|k;1Y`qaq|XL{22>L^_)j#GsbONeGe(HF@!|q?}IeCmiaE+J~fD=3UeU ze)Ezsuj(IguA+ZAf@%8BCB(ut6gX9(eYAP!tF)0~)FyX?VdOXmR6AxffNvn)7vEfc zH~0PR<)?Lt_xl!1M$m1MK&@-Cx*G3ZLBLK5M0qU%zr{th;b^W=eR)hqrenge6w8WL zr~7c$RH~pYLCaM0w}Vzu-IZStDX4nMC9?VsgWuGdF!<>Wuf^Stt+?rm)9+_JswUQ; z-hv(8Mm=}s^4(<*eePXEM$c^!W{>+A|JGWP)Jrr!tzGH*97VHr8TMvuz^KXfl=Y-8 z0Vp8!_SK8;pOvKXR-zWygg zvp3e@UW9xL;np2qhx?r2bU;Ad>x@3L5p+Ss2M46dhGUnX*CqR=7hPoEbn;~f*Up~G zy#&Jvy7HoWuHr(V1N(N=LUc#s*t(u(0#R^Ec+9mCi`xD9#`MA3D<_^-yH%e@9=->! z?CQ72-FiGsUpnz5yk-?>eTyQFiY|SRmr3s;RcVvl8(tKJB@OO)NQB<=gYh$e^xIqn zS(d?X(`}M^fOK$sKA%^=Ha|X$2=8tcp7!1<_`V(ygDh_I>#Asbkr`HY@TF6-aqOP; zRQR$qTwXU|QT=9~vT*1rNgz!yW<^+{=(|B%QW%5jwHfEIDoxijY9Cy9f8LHT)YeT? z&{?0${w9W#p55rb+D`kT)$TwoA_SE;V>B5*d*y*|=}L>IQUcqy{wy_Ohto!R$j0#Q z*WVLHvCrU7mPQ@6;>mBz8|#bmBdQk1_*m=pwoQj~Q1*@8wE-3Hg~!U0)8|bWaMfLM zA~{zITdDPdtG_7gFnUs3n=OJ$n3c%Za&qs@<8G_4n^iC-T=rk&iLp5!eo8Ydpy&xp zZnSf27;wZSb;2te-3AZcstf=v49Aw5ficiNi`oYXo(p~>(etZs?AL;TI~cV!Ol;%0VRQHTLh< zsZ=J#-9xe?(hwjUHs4}wrpG(0R%CK!&Cx7x8!C9yXNF(0v<&hABvF}ntj zC4GzBg>uK1^K54wP3{-Xc-2NIh#(B5P%dtrY-c|<2*ppM2=*v1Dnk!4$JBMn8m^b@D)PP!bbaPSy%*t_{{q(D({C+t`}|MF&Nj38 zs=mH%%LFc0Te{6#N@}Dz4XE0cMXA9mvphBW6HG&Q-YKHzB;=>~o<`x^T=8(a7}A3Rx7-=l5?IKj{Z~>lis16nz!dysyDQR0p*72o2*RR+3yu0PjwaiRE{GBp{ zT?@OHhHH!oc^{RKcBPJLIX7Nz#G;sHD=wC>v9t#q^SlI-*Rws74Xt*cuV3_SGqUW} z)}@kAw=tMBEV0+*YASnh7J`Q3rCP+J}Thzm(dp%9~>$ z9-pJVT-##^N>c{TW83g|Y+d*R+jb9|*gz{+%dFaK3Gmyu5E%~K@bNlQ^4EMW4#GX& zh&>1@yCHmf2!1}?RlMEfwAzQ3vp3lzqtX5%;;Z&(r770DFw>$9IS-)!#R~h!0ls~5 z&e>@;JjCi(qrV2AE}pO7VU$JI+QhL#_}gvxga{cC2ZfvRHK8ZYmkBrHwCl0z?#JvE zM-q<$6CeA`#!TPqpXQP&0I3jE2e0?*LIr;6v{k_sd%yf%#77Gt*w#%(%f|T|`53yKqa(31axq?f>drMq3I{ZDCR20ppcMf$Z7W`ij&dcNgz+ew)}oz?$_N-^+$TT&c`9Tk6jW9^pyr1spc{-Yia z3j$qh-Q|>gM2aigIF$Bn45^3>tvEFbBEVpc$AHYa>Yh&12roV#8XNj{(#fAai2;y1 z87qp*pzzQ#2T`_EX~%BQmdDPV_Yk4<(_B9`Lso5dOMGAEXb%7N>JN9e6NbCnPOi z)Xj1Bfsg7r%HYyE_ly_yWvUjxRF<~1)SdQ0wE) zNscelK)uKnVVLu@&i7-c)L}v>p}5lSmLhl!mS{@Qc zyZy9l+WO08PtaGIi%twR3+uD_Cno*KR1U;zS@2N}6+P@Y^>*>5g-l8|J+YZ1!UvU7 zi0G>4%I_YP=9}|^}};p@gDKK^>Esx@~c>(esX4O|~f zj^_6>ODW^3_;1a1Eg;cst@)-=6HmryCaF+FmHEZZa&4cLkl9Yn`cIZ7q`>KW~C}TDDG(u2?%ioXen$V@?{JAtcU-kMPQE%VdiHf?H z@3dY;R30*UNpdq^UKB%^a4e1$1i{qXl{^j`G|l;2{nEO2mAbK>n?J?{Kc5(Mfyu|r z*F5%|Ve-v+vE1T%;j(`s!3%9}jd@+y!z63yK3O%dIZzi{Eu#dIjOJc56GKRaFg(wMZY9t=xvLC%4LEM>cM(2uKV^Z*-NHq0A$@yTUUZHqDr6 zP=uP|^oc>T4|6c>G7|%P3Ck7#MA_kr&rS~n@~tOy-7^e*56-E50QJAz2+nF!Wv2e8 zpLx|!kkJz8qC+ab2jD)Iq@ChcC^jo0Cq8-KVdDBuog7i~vRfebgT8|79C~Pvgr`Lq z&mX=kn-YytpZ&IH06m8?pYQ2nRHL5R05#hXvD>=)lfbM@-ApVmsB7m6l{r|SioY0+ z?G4c?tW$h$++Oz**%-Ao5r$O}7ZiQO3ur@AKB7Y|+XK*d9-osrdS*pv?oM_c3jXPb>X%x^dv_$-ZyRpMV}MMq>)kH8ulL3$ zrI82megl@ArH<~4HotGR2EUKm^z{On}IiW z<>w9qoEy@-v?lncf7t65Sbh~rjb7-ka~W~L!^2%QQvbaK!yic4Z28!KfBR`n@HNn8 z8I}@W%BTy!@gw3o@03dvvpagc_0XA7k>VZ4hssA74tXuNpjM#1dDbx`v$m?Kq=-?y z2iuiSc}Xo*F0V5l<6nCx7CrCCEn7ZGChD{W;N)2}dwp~F@ip|JSAa_E^#b7Nd{jp( zDCuinPY+ECb&MO9P58{In_O7a@8=Qlaa#JlvRm0l5)`r)T;vLGY0 zW&lkomFiv5ff?AEPLd}%90eWL)ER1{&5pxqwwtxX*pm4hwKJmiPT6Dhu4VPr`21XZ zs8I{;lGH6#oR=0YE?cR`M;$~HRCsyjy-2vx$c(;E+3Mn;Yk!QH6JDe9^i7rLEZQb=vqO zo=2KK+p)qv)PRkAuU&6Ln7m1ApOWky^Jd%q5$1DtwNv%3VZy=SV8IK;{ui)Z(q2;B zO2&fwN|%_35=vzAd;E@017$~gU9{&tpxQWZ75T!GiX!Xh^x0^~jk^QZx9&ANIYr0@=8rcyf5f?T)W1!0 zas7GQNskceleU%FAmmYmSG<2~s@<`qd#R zU7(}@KAsEju)p?;x>nuX3I>&{T-(=vI$kMe-?{0n z>EbnV@C0$1#m-oD>8uBDgkju`0p$_HVGo}9FEAcL)1JHx-0w!zhe5R&7;va>=_J`;)a`0~g?G2keSUwiWWt;11gSo$i*G zsU=dcFy}vxpU8E?bqXJ^7fOLH4XfRNZRZ63U7)kAV#s|_*?Q$w;PE4#c zh$(ptb@UJT-S`q!8##VpJ7DJ%Sk3swj9D6;TwA|wQf+|obS+_asrBp}tH|GS0l0Eq zAlEqJs7KbvT<=KFW`R8}kCl8ynfbD$@Eq)KReaSh*c1PIQ!No3Z`Ka;P=2owM7de= z|LczH@RCXq$ea4}ZYlDC-P7KvmG^>vm{U9}NlH81SDlULHLny4YY2mLw*psLY&@u# zE0iy9b6>qVQiPsw#fd2q=6X6nWsMgaf4Rk;t!Pa!b(r$BvWP9ss{}mnX zjp{gzG~u_;QKWS;ZZO=+8U4gY%1?y#A&gbhviL{u0oV*7sPm`oZ5KP+o!Zyyf7*tc zRL8wV_60}%;9ODy{aLy#dA+JHb>GvpC&K}mXFC;pYFu*`SuoSgUuRy9us`YX9=_U9 z2HtUNGqczQYHf-3YWSUIyw~SYG-FnHUU_HJ$W!Hf_;O{Om+Q!@;_EzwNwYQ@TcR%$ zD4LxU~2MY zes12NZ6Kkt7{xi0dKzn2pD-%}pX?z$gwmVDp_dLNcz0_y@-=vbyb0hi-a3-Q5*@Mw2R0r~co);tGA@w{*?!$#S_3S`xoG29pGP>IGKFm_1b>VZOpLry zvzq2bFyZLfe2NU2Q&sTS-7Hw3F&b!f|JJG6ov^xgGpNE=T?Ks&n9<`|g&3Y<8%rkCH(5ow(EK$;+ zN3fa974s-`jdd%scN7ixUUGYHJH`MDWSiVy8K+^!`;QCs-KO?Dk{*BMTwqWktl8>> zRbLGZr(MycTdwCovbN@f?M($;chzVNfx`!Ocbx5q8T75R0BbI#6VywLjG=ADAf2ga zz9zU{l-?a3hJ6|Tk~t7L>O*>u|uR=?D4a6#G%sVlLMD5Lr|uT$Y0ayJUq(jpE`YaK82|# z!jd4lI&bZ?p4*$yuh~+DFwpoYdqcbO z)Mg^9t%BOquy#QM{E8P z;QDbt=hH$|3oV2((a|5ZrWzAu5P{>e8U0Tam|vs^Hlms#{%vt zA(CK-Kk0FC3Wlh$#vzQZS z7L&HD?eje%^nE)VB;B$LzrQe0%GmwJqK3`sbeSMT^fVz)$qAsU@*FSwx4;l18#<6~ z2M5o^D7e%}A99Yg$ z=H6%@LkX?))OvIw1#T1OUWRVs?9}PFVtpU*i5h3fb3B{KZoX*@F5zy~eV9l3dhSeK zGU4#V29m16yi-X9B8t50HLZ>=Z}+p=1*cs_VL>RrX+I0sZ^x(0^J5eYnfl*pH#R39mP zM-Z1#28m>GRb~BV#rrVxHs>MTqP)-?%VsoO;9-YSE)=wzJBB{i8p=pnj0nN=HX& zymB+)2up+_s*>3%kQ2UVKabutYq{PZI``TEhIjgo5=d9|h*a9 zdqz!uQn!ryZPvDJk%XEYqt~JrRfti^v)}f!|x(S|M zTImOlYi%#^EUoz<=ggV(1o>pY`83(*i+8;#dxKZ49ZtuG8$+_IT}ND=t2%*HVBSuS zUG0j0vU8KlPmO%RT&4zHvzmH*gPK=2FPXo_8ysLE&83FLd4uZT)_YJ3-5ddC`_;K! zeLy?GOYTRPr{s)e6fZ0fkR?O!$=IcsSB=a!yjit>UK5-4MwBgKW9v13exwv*jB;`6 zsMIOmPBvKEd>XAjUSI~3i@iD{_2P+f-@%<80{^>Ww5qbsHi~35f+Cq|E#ia~YK%Z# z4(gYTt%Dh(FVC(3T;8PGnKvKVO7Pgx%g%prKD>-o-1$RdecS~_yKdD z{GHT+{)w>*G7@GY*ir#1a_J&ZX`_LADa*;@odY#Yd=Z)ugI#j}#0g8@$q-SB_5#`2l-nq%=g4%V9bG_apaeXasM6*Js z$~xE6)RvZ|rH?lNbA|1nyp7fw!W7^nT!_3?>-8*niFDp4aCNj zbloGg^$P-iB`|$_!yj&%H16scbfQWrzn}-nRxy9{_0wKo%jFLm91`W4IpSy%kbc;b z=5Fqi?4ayQN{#&p-Nf}m8dR;e-yR+-K;;LcSEpWUCNhHVWssO-PtJikDV+4x&4U|W3Q2}_{#t{l1+^f_s=R7tiR&1JQ0A8sR_3D zWGSde>c)ke;?435e)f{fzb*<_vUAqtjc|% zWrg3(>3mJ>rkp2~`sC0bCW>`=CRp3ATsQsUyv$&j{)T0)`ZmEg=vT#)u*lmh9SZ^X z;_*0dXQFS+mYbs~%W_NBm;&6uUCDFBD0`$KRX^q9Z0WVsn#;^jhR)>$W%5}Z80QPN z3gtw)cUHPKwbfSnjYP`a|8`)UBV5UJrbfbzVDt)=heD4&e@pPl>2aJ7?r%8OZsV~% zCK+ANG*}4Ep0cv&z*R~f&*z)wW}-hDPT*4Sj%`F_*YGM|FU;>dFg|CB=0ZN}4by9! zl^D>`sX$d2Slk*=v7|R+kKc;xK3H_JxW_EfTp@1BBenZLoqxy}Uo&sURuwbWmE|9I zC;fB7!spUuQ9oTqF{jiX%ey8BjcW~yO`#n%9o^G;5rVf(QB8)6S!`JK<26c4W-@B_ z-?yK-j80GLvCdl(JmP9!$CK0115P7G%LaMaR@JK_Lt{Y`aM%5wWMSa}KGqoDgIQWx zjC8{j#O#nyh1LhYV-Kbm#ACMeeAK~(I#k61=ftRNcZ%{_*4|Jl=3<|U|B8lvQz%SJ z;GhJ%87BgJm$YQL`o`jxWQP#x*M)r}J3%jD$7xz6p)zuIY0V|^YMK`G!m_3x4clM4 zIN32$eeqt_66^ROa>}1v9oX7kvCXt)Gc~*9^MNVcAZPLSXH66%mnHTg3k%j%BjxZ3 z7S&+UQi|ub<24^jGIZiqe^zHRAeUH)C_?MoX4m#r>Vya~e5@Dg+C#=QJZ5@h_|1|W zputYp{<+O^$uyzD;#h4qa@NRmq!JH{9GyFr{jtkzN%7)Pb~#@Hl0KkBspW@nz&DqQ z#g(AP951B@@+ww8_+OexdselPL9Vf8)1EeZ={Qn3+ooYdtR1h?uW?hJu>nTgsFF@S zbEDFAEbw+Y!^6vSLLv3{LNoVI1_=5!tzNgdeEZpJlDyxwpy&pRp1BpzTyEwRiQJ2x z(>hC6Mm#;c8%n6Mv62y~BUCc?+v77;QcdWete1+c97nco9xJ%~b^gDBo3g1DoK-+Q$CwQxU;%`fl2!|FB1STfjuEts8m3#j5D-$}$!9 zOv!t?N?1dxOwCgEP!?V1BRZCnq=vHXw0cJ?nc#GnnxYtAQ4{Utav_4Nz7P5=qU%U% zOV5JOd$U?(Vr}H%-G)pH*&M{%)$mVF`On6fb;sz{J%1W)|J5ZA%j}5PCVY%lLMJIs ze0MR-4Bx{(9(}Zv!}N?u`VQenRlC|ly~A1Z&`@2`q`9-{INM7qc*F7k+*TI`-#o4nz zSdq)or#WlyUexe($7_~eV~Y8Uf^_wP}(9$2<*H|rZ09mAj`W6`rXvJ;atvqy;XhNG{vA^m1kmXnbwjyJ4=R! zwm2r4oJFvYSc<_Adg^_@Nx|MZr;zK~QPxGT!6l&~91G*8pq=?V%*$u}JN~?;!@%jjmo5uVoLlJ^oCZPP_)2^aJ28MR zQA7V*-%5qtq`L2Nt-FVLSPhK7N^9O}*yZ6)U{d~PIUYNKwof6dS3C+W z&ECmk?(@xl>_Wsg5anBOM^83PpuMKKT+;JFF8W@P^U&Au3SYrj&Ev~GsK%n|$L>NC z3qQ8(mnvEYz2^8&^JSV)XUz;(ZzaI(pL#Bp8eb{aO1XGYIPdVT=ll;RSvzB*OB{yW zp6!Aq%1rdkr6wtMn8tb(JI}H%4jc-WCo`cE3R|UNVXM*;{3F?Qt_cb7o5uLB#rBb{ z-ycFlMhY`|Q3LjJ9rf~SLrqNsH*nIF3$8c}{;cqbS-XHnm^pGewvNkCcTTB?7Q-iGtpDVYm6 zR+cg6&S&#NAtJ&rp_b`1n`aOxo~l#aPhoV)k0Svjtd_z^!H9Dny_Q<1G1oSzdyd zDf(AYJ}AD7WlXR^76L>=Sl%-?l3&k5%cUx}tlGE3v88PA&7-a;*3<3-$gtPMQ8!0i z_;5PfVhmfl9U!%Y+9@QLl+5qnEElfTszroV&0ujNs-mr&S9hUFH0v(>3f{7Chkc_{ zF(dOV*&1&qytaeeXR`vt2u+>IBJ{qOqRpJpXy%WRPQfl%gmjU<4aZvOwN-81ul92R z-kD@V=FIrfV6e+#+tzKv4cSF6^ImW%zJ2W1_t{D3Ofpq@;kUfIRFKI8zkUs#C@Jvc zMIV*X7huRq@lReH^z_t_mpM8nPSFy7fm^%~$noX~@^wqZY08g3AdeCUuFlDUD^V(O zycIWUKZ6^v;Hi|<<&uFv+p+(H3y##FaWOw1o(h5)-_d}w5;%9^3%xfF+_&RMGL-TY z4hYqstBxK}GRBohA!2&SWmt!5E1vTpD^meVz-aySMqRDaTlq7T#`@WoKw-$1J?+vZ zY7h1_KG|YsZdk&`RjJLUGh>|{6 zic@`!=H6pKLncN0e2#X>Pkr$nFVVLH`Oe4naIe!a1@~TX9uv`}G}UJS`&xP1pRIc% zM-|~{pFO~?p^x)wH+YooE^l!5cI;CD$87Fg!K>fs%-8goIT%CZHE_8eArhbF^x8sH z&ahzY6ge)EghTHc;sW(p^p5FN1Te z`N$NDDRtZ+PG7dGijIT7=0P{NCWyFT$1se&V5er4-j`rk4|ZhNz>e&i)5Oofg@Pk+ zD&-O5-&F@ckg+?ck_w!1o_fDgV*|YpuR?w6>>6H80@wRyjoO@a(w(}a%?8No-2~&1 zB{>4_8fWpB-_6l0fC8CG^7s|U1ANK5i~beaT^`jXx6EMx90{2817)ae4YQtd)8uL1 zU$uT0GBJf;?7-f89H!~10Vij&{FG8ZNkvg6=Fm|aFCT|YM5#*1h>l(0oe&Sq&0I5k z&r8zN2!b66f*nX9i-ZL6u~??sLN13!zv~i)XOAaq$VFtFL0s!q!7l!E)mfrZDI_PbeHB-A%JO>UiV;pJUWc2aOoBA-yxkOxj$o;>1 z`>v>_ws31e1(kMG6cqs*T{_a6B5FcW2uKN42}lc;(n4q=MM?+|2#^4R z9;GE9EeV7GN;8B6ktz}Vx92|pZ+G0Mj67tIwf4yVzPaW%=iDc2@^tj5`cDc03N-{} zs+R81vbdhn9CWPs)NScgejP)Fn??VwRfom3=(5E(gq^^eYT&OWo{ zpKMg}6R2EPm3x3gw$YFTy}O=(^&3VtlB~A2zloI z&(PPKN>D|=m5VLu3R99@F%-%JH(3X;Yo%A)btO_;z|dYH(S%~&#mQv;@PuY!{nJ}p zl;2M)j@nVO0+k0}Q&?Nj?Y=q#C4pLu?o>SS_~=N`f$=%X0GJ6SYU&dsL}zKFeEp1v zPhNB)MzC7zFm3f*R5fI(yTUan^W%5gdf>Y*bg(Y47ZB|4Hk%QnQW2;^v}6gur`%ff zfhuj4P--@3(Y5G;)g0Mv{#O6dG-7b>2tb64UjLl#djG&Hv<8MH(qg?9!luDU$wlH4 zjQeN5w|A;fp7cst^Dw)4+PhY1Nb<|{-)W+Ji`NFoMkp+j4any*T)9?*Ox^P~FdK&D)cJa$WK-&68%idHLF2 ze=}X5o8O{IOk7LY$VkdtnBPo$NBj~UB-1c3nQ|%|61jw*Y~IudNUrF`$tE2adh-4a zP{dVkX!Ry}&atmHlotO6i>>W z)C@v~d9PTY*EUR?XZ(mIDT2MN zOKH9zQ%DSS!qw5grO!oo02Sa7LAd}Z#&~O1&5`qgEzhQc_}*ej2d`*eHOWL8SOni= zQC<2DIwmg~aDE+#RG!_E&21CW$;JDo;MRp{ppG9;bq#X6ikt=$@0sD!QNH#~^jInL zH~zR7g9{VQNR?>Otv2DqR%h5t&vP2Gft|l{?eV==$nq-7)5Dav@Dh|Jqegn@WrC=d zD>lujJA%U6@K0WCuBIy4%j=vlYy)Fzkfa`Uuh9kC{G@PVvn}|wb@QGTy}S&vw7xZ+ zZD3P85xn&p0v=3j(_Wo1TUweb7-%Li!smB5U!mWe57U%>6dbD{MFswbw3ut|o$+Nz zZ;te^Dsm|Pm8#PYwta5$RRw}GS*7sQPedMDsbHxmy({Y)h%oj_n)b&x)CmcQ=tz?6 zv6NS+ogzQUw*anr*vYPNgh_fE>3AD0fwv|ARf>_qqje*@$5t?krnjD)wZ$?((5jHN z8S=i_B$r&KDx33Mb3v#yI3&)_?>wMdDUW<|WSB}@ir*zr(+y}^{w^7XYZK{xlRNca zns(iFua&SBZHT-|U2s_d{FK6bNMRR3vAGzkuix+Kyv=#GJN>Q4cJP9_sic0V&SXP~ z8+=%%;weCioi^~a9%W5wVwrBs`KBytfet9JMwsrrrb? zA*0*Ar_A3V*13RS$Sv>jnO*whuvaIx?O5xN~Iy?$t%6UU4^Pki%?1kip<4O9YsO!Q)8>i}f zu8zDp#l)Xt+$nj4DWluJ);X{i^+T5%?^wgVQNpqW<2%N7Nq9O7=CAKw>7UPdcL%&O z(}v{E;i`jQ5W`{?B1kmr^B$@SQF+HIzFXCQ(r2G&K&wt|RatDCA!?KNSOL%BRm^y^ zS{_+0tgRt7}oW>aZU{weB+} zZ=Ig@Iv4|yS?I7&`XnNE8_$qjJ{(dA0(~&cCd^&`ITyM@&%7Q?)UKV=uG6uuv*@8- zgjik+OHmjiA6_Tjig|WMWG4mi(hwnATpOG(3*SF0Q z*5KdV2;!U5KRIt@ru;(NGzZ*XdKFu%nmt8JUr^P2iTR~e34i`-O>AqbBe%KtoIs07 zAdC}L`s;zE&s5}d^Rev+!vzuEM=yjEvcbw)8|853PU%@^n#Df=|35LgO45|jrBQug z?t*Uek!juoQKwHzFeSY@Dg*~ZWzMJvxCI+Te}m|u)W5>L1zTV?aNP{J#pJ;l%S!f;4>$(pF8-EQIxK6M3{O`-NJ1KNfps{VWTGjCWMb@hoZH z3_2rm7v?eHGBRc8QK(Q=R#cOe&~2qbw~zjDY$(Pum{U{!1-9sMej6&3n23bQ@? z+y6U50B4a;>U=dJ-NJ+B)IIJB3XyPP(>m@_lBv|Wcb zCvyzUhM(_!@v224TdrfW$ER)u)KA$d5ic_avLN^Ct6&-B*k@Jx1I&++_Q;Oyp9S)D zFH|IFh?Gs>%!vK`zUafo^Nsg?F1B86`10>v4mB^Tc2<%a10yd`Sm72E8_q3*1jfDi zKhjzbm#&_^0nT+El6_K#oJg>I`Cum2NIo(0 z!2_sPWfZNn4YJ#0LYj@>4k4Pkiu<;Gk%+QX*UrZ|Y>}x>!C7*#&LP$sabZldtoUq} zn{)AC&2g2im6_5Lx<4tXIVHIdj%l!!bIvs402#;ffBG_Xz0x2sQk=r#Z|)RGYQvn7 zNc1^Tl1sLEm)ZBw%~_>c7G*~ok{fVmUe{$0 zm-_HUO2ivsA9v=5uKOK65#8KuQov$W->>&%J*DGkV#){EvV+1_ni@=i5viCv-kQKlfBPu$bVmUloyQtRoPQ*t z*k9y+hujEe`#{_~@7l%@6yU7WWAMcn<*nnp#*l9=YTRuwh!s2KZ zO92jG)l2j@w_MTxG(f>yo)PbSe4OE`iUwzTF`Vs>O}=jeDuf)W#GC@L)Y>7$csSUB!PT9X2+Sy-ht0oNJz-5oomnQdOGUKrhB&&t~U%2o4we>|tGNMt@ z;PgGv^6%AtoB6Y;oXU*>h$6$isi?Bsh#Ii1xIIbJWSM{w+Uo>)A_kh{skBpRFV)ze z^_scoNol}dK8%~eDffozJ-A6)TA`t$gP)Bo+4&hPg|zzx-1Az0)QX*dy`8cIqjR4l z-e#7`*-y&`=;nl*1ncJrXgr7~t$G8b7TF*owFs(Q=+KO9))-J%rY~9Ru@Q@I4{kSc zlsH8nLS^9N9nqGk(AKm$BCJrA^f>72lTF=K1H?RFq6BD6oAG!?40Q|Cq)E>Xc|Cto ziLunm-n_|*{g=t(9~9efC_g1%MFTVHOE*{WFz4=|>;Tqzs4z+5?@P^hhbx@Tq=`#+ z#wBWwOoLx7?=IbG?HwN<(*9&iM-SU%!N&Q<^z`}iu-@DDy ziE|5mfhO!C2C;r7Vp)bcI$){ArA49}-&QIt6I|dBD6lfPG{Bjez<)w2EFrt}-0Tik^pMB* zX`Rz2v+gwH`n)q)h{Dd&-b&Uh5?|bDgD0X*W+=C)u4nEXmx~-#%`WiwvC;ZL=>QnD z7C;wv;v-0^Zk(@YM5-rpl>6i#fK0I3!o)|%br{5rf7Y9#tX-x1ByK)`&CjxWlO$Q_ z{nVUW;^7`ri8G=lAA~kM!M?TfcquZ8O+H(;T51>Z94dn`HM1B<>9Tb_pgW}YaB-R` z@=e+$*G3$mpG#x{!+&=Nfe)!4WS=f`H5@_<(fW=b;Mp#eZ)>v~6cF`lU~rnG&PSb$ z92^q)d)}*g0_D;1Cq{Et4eQUydKn*K{W%D-@-zRf$l?Bi9_9EDim7~!V@D#sR(z_OAfxbm_pV%z(Z38wt5%IJpMp#Ret#5uurn3}@)ys;^6erY=@Bsb1K2Z5Q-_Z(3x`H-i3*rZy)Z2$rJvEhst1XA*Lf3KX->=f)vdmTwr(hZK*C$skvTud7 zPdeHJ?!Gt@KA7$0*r%zX8G4umV$$I~JtBqC9e%<(O@F0lDNwAHYi-EqX=PkvO9Nu*ia7 zH=_8YaChpp!cu3M<~s4!Q&$UMh9QW_AcvsbLNgBFX_4R#Uc%z^Ve_y3bCyFLO;s)a>bBtxxMQM0AR z2szg$Z}>gZPKB3TDnPFQs&^>|mroWl-E)ceMub_JNAX9|vtQbf=v_=1siZqFJ8MG( zq}mk3#C7+T|Ewj8#=iBU`wTvw^4OaUaNt;$R|pQEeomJ=`FuGQ4ytq(u&eB6B3~Xo zjLlvtZbw9wlxUi_JD(0ZAUQP5bE(3m@007 z^lX)bT98)oZH`6`mooW^H<$UCbED9k9d;?_bvF?@w0BwyDrf6w@>fqz->TYl z^*Ur!H8ia_p=vI5V~S_P8Pv6H=ua$I-BR|zhE3}Z_#vdl9mD6S?!XKSJ>*rC2&FU( zISQ2!{wvZvlAb|X+9mRn4s;llUlo6lg{MEuYHH73uJL=CctWQ8eQb)xWC_c+&!Y?f za^|g9y$Yz}(2pvl2U~t=&No`IErYacO*Y9O@5gpA7d@qKNQonKL-9;okf|Pd|0dSn zC|JKO1KPeHuw68gc>4$?fdizl5I#=-n}I(RgVx=1EobZa(P0lBY$sf_{Os`#s`at~ zgN8Zx1iHsoeKoaas_axZVp{CCGLO6u_>5y;@T|T(+vqCMZ~PCfi|xFPn-{WTu74W- zh?t^mI(Wrv#TNmQEc*X$3^nt*qwa-Aug9v@TSlGcaZvrzQ4%&3=GlvD_-K+W93E`w zg=xL}Ga(C3@s-Y#T0skAYVD*ZmN&v_Z=~o|2`*v;ca7wL3rbZZ^Rs0u}?Ianc8@290nwGls)IRjp>Vj%Aw4BjbwTFZ?%B<1(Uj4T>Qg3nNviZNg zp859mb9?9N98f<${YOvSv6A{J2iBM^SdMky(FCbl#fz2zA^8FX)^(5)4Y*}eUPQGC zwH5MJESwSB@|~2NFaZiZT8SqOXKy5HCvSbm*H{o*GYmraP%ZGSG=?Ps9Y(Hr9|I7# zKH)c=co?RF2A^#X*&0rIARZ|8h(#xIELcuou3-+rW$MZO=ON|}_?oxc&NW2fB8WXy zLiL>{6*u;%ihw^n$c^7PN-}r)O&FD0+(Z2 z-l}ls2HoQpg{L*whxY1nPSAiTP1BYMu?%j|jP3eS1J&#~$@Q~Sc;{_TeXa!t0;MPi z=i;gKa8y?t`BXUfFMEY=L2KPrq1;wgs=MDgAzp*e7l2D7m&@*jKqprD(K(I&h35iI?k;v+>zy?uN+R^q5T+`z{ zQ~?W)pSTDW`tO?C6B2u#Vrg4sGHv>$pukFn%yegdoSV!;HQw*`fd9j}w@CdJ>ZvOz z(&EsCidya29~vLqMZG_NX-2XE7pW^3S(nume@g1~H+<1Oq0_6f8_11zk~mr7HD%X4 zd9p_j=J#t?Ggz#mx}N+j@Ng?eJ>+COKhW7FTP}Qj(^2Ji@AkqDAWuPEhvcFKl7Kol zS%mbRkqAr(-5r}&JW^1X8W!?TX(s!q=Rj07$4YI(j+LA#Zljfd%21>S2~cz%p*~Gl z{6^{d*GX%->c0(v8Rzr%*uh1|0tHecY%Q22s>J+S`fKpsP-AZf-XolEAg!+zzRh>Ac(j zsRC;PsaT3?B?Gr*zj<9RnoK)mQ|@J*jOmf?3J2UgT0kR_1F*0y3%&fO?@?Wf5D2#> z|A8bVIx@%~Zk9krrM3tSWgpbm)@8bMabh}2A+4EV_oc_GvnCEsMIvz0J{=wE-Fv81 zVbcz!P`5}#vCiOQiHV-7drVtc&>yT25n3Z2QZs)ci2^Sv1$u?7HQ(;sbt!iz14yp4 zzY)BRj*NH%AMnlQ=uFc%rvWz89?+pQ61x8hguh#X{HF8ubW0_+W%LCA`UfDJrVY9G z&HGy0y++Z{jOK}VcdXR>bHDJf;z?BV#?x0Z-H4SUpYrMOtHATO7yG4Muc4=BKN55K zc1ur63Nl^
- +
@@ -191,7 +191,7 @@
- + Aquí va la el stamp
@@ -202,7 +202,7 @@
- +
diff --git a/print/templates/reports/cmr/cmr.js b/print/templates/reports/cmr/cmr.js index cfb3dd360..ea9dc2a70 100644 --- a/print/templates/reports/cmr/cmr.js +++ b/print/templates/reports/cmr/cmr.js @@ -10,8 +10,9 @@ module.exports = { this.data = await this.findOneFromDef('data', [this.id]); if (this.data.ticketFk) { this.merchandises = await this.rawSqlFromDef('merchandise', [this.data.ticketFk]); - this.signatures = await this.findOneFromDef('signatures', [this.data.ticketFk]); - } + this.signature = await this.findOneFromDef('signature', [this.data.ticketFk]); + } else + this.merchandises = null; }, props: { id: { @@ -20,19 +21,20 @@ module.exports = { description: 'The cmr id' }, }, - methods: { - dmsPath(isClient) { - if (!this.signatures) return; + computed: { + signPath() { + if (!this.signature) return; - const signatureName = (isClient) - ? this.signatures.clientSignature - : this.signatures.deliverySignature; + const signatureName = this.signature.signature const hash = md5(signatureName.toString()).substring(0, 3); const file = `${config.storage.root}/${hash}/${signatureName}.png`; - if (!fs.existsSync(file)) return null; return `data:image/png;base64, ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`; + }, + async getStamp() { + const data = this.data.stamp.toString('base64'); + return `data:image/png;base64, ${data}`; } - } + }, }; \ No newline at end of file diff --git a/print/templates/reports/cmr/sql/data.sql b/print/templates/reports/cmr/sql/data.sql index e66ab7154..41ebee4bb 100644 --- a/print/templates/reports/cmr/sql/data.sql +++ b/print/templates/reports/cmr/sql/data.sql @@ -31,7 +31,8 @@ SELECT c.id cmrFk, a2.street loadStreet, a2.postalCode loadPostalCode, a2.city loadCity, - cou4.country loadCountry + cou4.country loadCountry, + co.stamp FROM cmr c LEFT JOIN supplier s ON s.id = c.supplierFk LEFT JOIN country cou ON cou.id = s.countryFk diff --git a/print/templates/reports/cmr/sql/signature.sql b/print/templates/reports/cmr/sql/signature.sql new file mode 100644 index 000000000..7ec7380a5 --- /dev/null +++ b/print/templates/reports/cmr/sql/signature.sql @@ -0,0 +1,5 @@ +SELECT dc.id `signature` + FROM ticket t + JOIN ticketDms dt ON dt.ticketFk = t.id + LEFT JOIN dms dc ON dc.id = dt.dmsFk + WHERE t.id = ? \ No newline at end of file diff --git a/print/templates/reports/cmr/sql/signatures.sql b/print/templates/reports/cmr/sql/signatures.sql deleted file mode 100644 index c90d4c91c..000000000 --- a/print/templates/reports/cmr/sql/signatures.sql +++ /dev/null @@ -1,7 +0,0 @@ -SELECT dc.id clientSignature, dd.id deliverySignature - FROM ticket t - JOIN ticketDms dt ON dt.ticketFk = t.id - LEFT JOIN dms dc ON dc.id = dt.dmsFk - JOIN `route` r ON r.id = t.routeFk - LEFT JOIN dms dd ON dd.id = r.deliverySignFk - WHERE t.id = ? \ No newline at end of file From 3e8bb221e036e66add3b0b09a107d489ec0ad526 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 2 Aug 2023 09:29:09 +0200 Subject: [PATCH 226/311] refs #5762 Securify fix for recovery url --- back/models/vn-user.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 163649718..3e4a08b6e 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -98,14 +98,22 @@ module.exports = function(Self) { const headers = httpRequest.headers; const origin = headers.origin; + const defaultHash = '/reset-password?access_token=$token$'; + const recoverHashes = { + hedera: 'verificationToken=$token$' + }; + + // FIXME: Change with: info.options?.app + const app = info.options?.directory; + let recoverHash = app ? recoverHashes[app] : defaultHash; + recoverHash = recoverHash.replace('$token$', info.accessToken.id); + const user = await Self.app.models.VnUser.findById(info.user.id); - let directory = info.options?.directory ?? '/#!/reset-password?access_token=$token$'; - directory = directory.replace('$token$', info.accessToken.id); const params = { recipient: info.email, lang: user.lang, - url: origin + directory + url: origin + '/#!' + recoverHash }; const options = Object.assign({}, info.options); From 56cd94feaa8d0261054d4600761f0243d4b46025 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 2 Aug 2023 13:26:42 +0200 Subject: [PATCH 227/311] refs #5843 fix(timeControl_filter): not use userFk --- modules/worker/back/methods/worker-time-control/filter.js | 4 ++-- modules/worker/front/time-control/index.html | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/worker/back/methods/worker-time-control/filter.js b/modules/worker/back/methods/worker-time-control/filter.js index 041c6cbfb..6d0880253 100644 --- a/modules/worker/back/methods/worker-time-control/filter.js +++ b/modules/worker/back/methods/worker-time-control/filter.js @@ -36,9 +36,9 @@ module.exports = Self => { if (isSubordinate === false) throw new UserError(`You don't have enough privileges`); - const subordinate = await Worker.findById(ctx.args.workerFk); + const subordinate = await Worker.findById(ctx.args.workerFk, {fields: ['id']}); filter = mergeFilters(filter, {where: { - userFk: subordinate.userFk + userFk: subordinate.id }}); return Self.find(filter); diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index 760b0dafc..b77acbddc 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -4,7 +4,7 @@ filter="::$ctrl.filter" data="$ctrl.hours"> -
+
@@ -106,12 +106,6 @@
-
- Autonomous worker -
From 4a0b8f37cd02b23637cc9eebb255e949196633ab Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 2 Aug 2023 13:41:44 +0200 Subject: [PATCH 228/311] refs #5995 Load blob --- modules/route/back/models/route.js | 2 +- print/templates/reports/cmr/cmr.html | 4 ++-- print/templates/reports/cmr/cmr.js | 17 +++++++++++------ print/templates/reports/cmr/sql/data.sql | 3 ++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index 96e7ed04f..a8d44cd05 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -29,5 +29,5 @@ module.exports = Self => { const routeMaxKm = 1000; if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd) err(); - } + }; }; diff --git a/print/templates/reports/cmr/cmr.html b/print/templates/reports/cmr/cmr.html index b403cc6d8..ba0f8bfab 100644 --- a/print/templates/reports/cmr/cmr.html +++ b/print/templates/reports/cmr/cmr.html @@ -180,7 +180,7 @@
- +
@@ -191,7 +191,7 @@
- Aquí va la el stamp +
diff --git a/print/templates/reports/cmr/cmr.js b/print/templates/reports/cmr/cmr.js index ea9dc2a70..c939e5152 100644 --- a/print/templates/reports/cmr/cmr.js +++ b/print/templates/reports/cmr/cmr.js @@ -3,6 +3,8 @@ const vnReport = require('../../../core/mixins/vn-report.js'); const md5 = require('md5'); const fs = require('fs-extra'); +const prefixBase64 = 'data:image/png;base64,'; + module.exports = { name: 'cmr', mixins: [vnReport], @@ -13,6 +15,13 @@ module.exports = { this.signature = await this.findOneFromDef('signature', [this.data.ticketFk]); } else this.merchandises = null; + + this.senderStamp = (this.data.senderStamp) + ? `${prefixBase64} ${this.data.senderStamp.toString('base64')}` + : null; + this.deliveryStamp = (this.data.deliveryStamp) + ? `${prefixBase64} ${this.data.deliveryStamp.toString('base64')}` + : null; }, props: { id: { @@ -30,11 +39,7 @@ module.exports = { const file = `${config.storage.root}/${hash}/${signatureName}.png`; if (!fs.existsSync(file)) return null; - return `data:image/png;base64, ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`; + return `${prefixBase64} ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`; }, - async getStamp() { - const data = this.data.stamp.toString('base64'); - return `data:image/png;base64, ${data}`; - } - }, + } }; \ No newline at end of file diff --git a/print/templates/reports/cmr/sql/data.sql b/print/templates/reports/cmr/sql/data.sql index 41ebee4bb..d7c585f22 100644 --- a/print/templates/reports/cmr/sql/data.sql +++ b/print/templates/reports/cmr/sql/data.sql @@ -32,7 +32,8 @@ SELECT c.id cmrFk, a2.postalCode loadPostalCode, a2.city loadCity, cou4.country loadCountry, - co.stamp + co.stamp senderStamp, + s.stamp deliveryStamp FROM cmr c LEFT JOIN supplier s ON s.id = c.supplierFk LEFT JOIN country cou ON cou.id = s.countryFk From 29fe1c0c84f59ce37b81759d4e123a5ee860ff1c Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 2 Aug 2023 13:55:01 +0200 Subject: [PATCH 229/311] refs #5325 displaySearch return if not has search row --- front/core/components/smart-table/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front/core/components/smart-table/index.js b/front/core/components/smart-table/index.js index c3b927c62..63a9f6488 100644 --- a/front/core/components/smart-table/index.js +++ b/front/core/components/smart-table/index.js @@ -339,8 +339,9 @@ export default class SmartTable extends Component { if (!header) return; const tbody = this.element.querySelector('tbody'); - const columns = header.querySelectorAll('th'); + if (!tbody) return; + const columns = header.querySelectorAll('th'); const hasSearchRow = tbody.querySelector('tr#searchRow'); if (hasSearchRow) { if (this.$inputsScope) From 3d200ed64b8bdbf12a6da6f1d977bacfc3e9e5ab Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 2 Aug 2023 13:59:56 +0200 Subject: [PATCH 230/311] changeLog correct version --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de66fe928..2f935f786 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2330.01] - 2023-07-27 +## [2332.01] - 2023-08-09 ### Added From aab0771e6ed5fe2e8393bf1b91ad0c4fcf8e4eb0 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 2 Aug 2023 14:37:38 +0200 Subject: [PATCH 231/311] refs #5995 Removed my code in closure.js --- modules/ticket/back/methods/ticket/closure.js | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index 493a2c3a0..9f9aec9bd 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -120,38 +120,7 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) { await Self.rawSql(` INSERT INTO clientSample (clientFk, typeFk, companyFk) VALUES(?, ?, ?) `, [ticket.clientFk, sample.id, ticket.companyFk], {userId}); - } - - await Self.rawSql(` - INSERT INTO cmr (ticketFk, companyFk, addressToFk, addressFromFk, supplierFk, ead) - SELECT t.id, - com.id, - a.id, - c2.defaultAddressFk, - su.id, - t.landed - FROM ticket t - JOIN ticketState ts ON ts.ticketFk = t.id - JOIN state s ON s.id = ts.stateFk - JOIN alertLevel al ON al.id = s.alertLevel - JOIN client c ON c.id = t.clientFk - JOIN address a ON a.id = t.addressFk - JOIN province p ON p.id = a.provinceFk - JOIN country co ON co.id = p.countryFk - JOIN agencyMode am ON am.id = t.agencyModeFk - JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - JOIN warehouse w ON w.id = t.warehouseFk - JOIN company com ON com.id = t.companyFk - JOIN client c2 ON c2.id = com.clientFk - JOIN supplierAccount sa ON sa.id = com.supplierAccountFk - JOIN supplier su ON su.id = sa.supplierFk - WHERE shipped BETWEEN util.yesterday() AND util.dayEnd(util.yesterday()) - AND al.code IN ('PACKED', 'DELIVERED') - AND co.code <> 'ES' - AND am.name <> 'ABONO' - AND w.code = 'ALG' - AND dm.code = 'DELIVERY' - `); + }; } catch (error) { // Domain not found if (error.responseCode == 450) From 688a72ddb300f0fb2c8be3d9b944da29173674f9 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 3 Aug 2023 08:39:37 +0200 Subject: [PATCH 232/311] refs #5995 Modify sql --- print/templates/reports/cmr/cmr.html | 2 +- print/templates/reports/cmr/sql/data.sql | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/print/templates/reports/cmr/cmr.html b/print/templates/reports/cmr/cmr.html index ba0f8bfab..c6a9e79d6 100644 --- a/print/templates/reports/cmr/cmr.html +++ b/print/templates/reports/cmr/cmr.html @@ -202,7 +202,7 @@
- +
diff --git a/print/templates/reports/cmr/sql/data.sql b/print/templates/reports/cmr/sql/data.sql index d7c585f22..9708c4483 100644 --- a/print/templates/reports/cmr/sql/data.sql +++ b/print/templates/reports/cmr/sql/data.sql @@ -1,5 +1,5 @@ SELECT c.id cmrFk, - c.ticketFk, + t.id ticketFk, c.truckPlate, c.observations, c.senderInstruccions, @@ -48,4 +48,5 @@ SELECT c.id cmrFk, LEFT JOIN `address` a2 ON a2.id = c.addressFromFk LEFT JOIN province p2 ON p2.id = a2.provinceFk LEFT JOIN country cou4 ON cou4.id = p2.countryFk + LEFT JOIN ticket t ON t.cmrFk = c.id WHERE c.id = ? \ No newline at end of file From ca34065e899257be75c14ede0b25b7c260529c92 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 3 Aug 2023 09:17:32 +0200 Subject: [PATCH 233/311] refs #6093 deploy(2332): dev to test --- CHANGELOG.md | 4 ++++ db/changes/{232601 => 233201}/00-acl_viaexpressConfig.sql | 0 db/changes/{232601 => 233201}/00-viaexpress.sql | 0 3 files changed, 4 insertions(+) rename db/changes/{232601 => 233201}/00-acl_viaexpressConfig.sql (100%) rename db/changes/{232601 => 233201}/00-viaexpress.sql (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f935f786..73520a6db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2332.01] - 2023-08-09 ### Added +- (Trabajadores -> Gestión documental) Soporte para Docuware +- (General -> Agencia) Soporte para Viaexpress ### Changed +- (General -> Tickets) Devuelve el motivo por el cual no es editable +- (Desplegables -> Trabajadores) Mejorados ### Fixed diff --git a/db/changes/232601/00-acl_viaexpressConfig.sql b/db/changes/233201/00-acl_viaexpressConfig.sql similarity index 100% rename from db/changes/232601/00-acl_viaexpressConfig.sql rename to db/changes/233201/00-acl_viaexpressConfig.sql diff --git a/db/changes/232601/00-viaexpress.sql b/db/changes/233201/00-viaexpress.sql similarity index 100% rename from db/changes/232601/00-viaexpress.sql rename to db/changes/233201/00-viaexpress.sql From 4628450240c99ddbafa958b232e14c6791ca80ec Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 3 Aug 2023 09:20:03 +0200 Subject: [PATCH 234/311] refs #6093 deploy: 2334 init version --- CHANGELOG.md | 9 +++++++++ db/changes/233401/.gitkeep | 0 package-lock.json | 2 +- package.json | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 db/changes/233401/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index 73520a6db..80d8517de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2334.01] - 2023-08-24 + +### Added + +### Changed + +### Fixed + + ## [2332.01] - 2023-08-09 ### Added diff --git a/db/changes/233401/.gitkeep b/db/changes/233401/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/package-lock.json b/package-lock.json index 5506075b9..f87e3f64b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.32.01", + "version": "23.34.01", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 37e39d5a5..2aa37379e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.32.01", + "version": "23.34.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 9b114796756bc2509e17337105dbb7931a2d1c82 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 3 Aug 2023 10:10:53 +0200 Subject: [PATCH 235/311] refs #5640 traducciones --- loopback/locale/es.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 784ff5e6e..7be7e3c34 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -305,5 +305,14 @@ "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", "Valid priorities": "Prioridades válidas: %d", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", - "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado" + "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", + "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", + "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", + "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado", + "You don't have enough privileges.": "No tienes suficientes permisos.", + "This ticket is locked.": "Este ticket está bloqueado.", + "This ticket is not editable.": "Este ticket no es editable.", + "The ticket doesn't exist.": "No existe el ticket.", + "Social name should be uppercase": "La razón social debe ir en mayuscula", + "Street should be uppercase": "La dirección fiscal debe ir en mayúscula" } From b85023b46d0f5fae9cf09eb41f371c0784092ce8 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 3 Aug 2023 10:11:17 +0200 Subject: [PATCH 236/311] accent --- loopback/locale/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 7be7e3c34..b69eb1574 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -313,6 +313,6 @@ "This ticket is locked.": "Este ticket está bloqueado.", "This ticket is not editable.": "Este ticket no es editable.", "The ticket doesn't exist.": "No existe el ticket.", - "Social name should be uppercase": "La razón social debe ir en mayuscula", + "Social name should be uppercase": "La razón social debe ir en mayúscula", "Street should be uppercase": "La dirección fiscal debe ir en mayúscula" } From 3388fd7c59249a08635bac6268352e17417a9557 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 3 Aug 2023 10:26:29 +0200 Subject: [PATCH 237/311] fix test back --- modules/worker/back/methods/worker/specs/new.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/worker/back/methods/worker/specs/new.spec.js b/modules/worker/back/methods/worker/specs/new.spec.js index 4dc6c5540..d0830b00f 100644 --- a/modules/worker/back/methods/worker/specs/new.spec.js +++ b/modules/worker/back/methods/worker/specs/new.spec.js @@ -21,8 +21,8 @@ describe('Worker new', () => { const defaultWorker = { fi: '78457139E', name: 'DEFAULTERWORKER', - firstName: 'default', - lastNames: 'worker', + firstName: 'DEFAULT', + lastNames: 'WORKER', email: 'defaultWorker@mydomain.com', street: 'S/ DEFAULTWORKERSTREET', city: 'defaultWorkerCity', From 83d0a394e359a976d286b0ab6c72bdbbd1cc7033 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 3 Aug 2023 15:59:09 +0200 Subject: [PATCH 238/311] refs #5973 refactor(item_fetched-tags): restyle empty tags --- modules/item/front/fetched-tags/index.html | 28 +++++++++++----------- modules/item/front/fetched-tags/style.scss | 14 +++++------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/item/front/fetched-tags/index.html b/modules/item/front/fetched-tags/index.html index 472fa676b..df5936871 100644 --- a/modules/item/front/fetched-tags/index.html +++ b/modules/item/front/fetched-tags/index.html @@ -1,40 +1,40 @@ - -
+
{{::$ctrl.item.value5}}
-
{{::$ctrl.item.value6}}
-
{{::$ctrl.item.value7}}
-
{{::$ctrl.item.value8}}
-
{{::$ctrl.item.value9}}
-
{{::$ctrl.item.value10}}
- \ No newline at end of file + diff --git a/modules/item/front/fetched-tags/style.scss b/modules/item/front/fetched-tags/style.scss index 2cd7afbb2..250ca07ab 100644 --- a/modules/item/front/fetched-tags/style.scss +++ b/modules/item/front/fetched-tags/style.scss @@ -28,7 +28,7 @@ vn-fetched-tags { & > vn-horizontal { align-items: center; - + max-width: 210px; & > vn-auto { flex-wrap: wrap; @@ -43,19 +43,19 @@ vn-fetched-tags { & > .inline-tag { color: $color-font-secondary; text-align: center; - font-size: .75rem; - height: 12px; + font-size: .8rem; + height: 13px; padding: 1px; width: 64px; min-width: 64px; max-width: 64px; flex: 1; - border: 1px solid $color-spacer; - + border: 1px solid $color-font-secondary; + &.empty { - border: 1px solid $color-spacer-light; + border: 1px solid darken($color-font-secondary, 30%); } } } } -} \ No newline at end of file +} From 4c199f66b2641d76c8154844551d07c98cf61fe3 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 4 Aug 2023 14:33:38 +0200 Subject: [PATCH 239/311] refs #5762 refactor: recoverPassword use app param --- back/methods/vn-user/recover-password.js | 6 +++--- back/models/vn-user.js | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/back/methods/vn-user/recover-password.js b/back/methods/vn-user/recover-password.js index b5d183ba3..b0f7122b4 100644 --- a/back/methods/vn-user/recover-password.js +++ b/back/methods/vn-user/recover-password.js @@ -9,7 +9,7 @@ module.exports = Self => { required: true }, { - arg: 'directory', + arg: 'app', type: 'string', description: 'The directory for mail' } @@ -20,7 +20,7 @@ module.exports = Self => { } }); - Self.recoverPassword = async function(user, directory) { + Self.recoverPassword = async function(user, app) { const models = Self.app.models; const usesEmail = user.indexOf('@') !== -1; @@ -34,7 +34,7 @@ module.exports = Self => { } try { - await Self.resetPassword({email: user, emailTemplate: 'recover-password', directory}); + await Self.resetPassword({email: user, emailTemplate: 'recover-password', app}); } catch (err) { if (err.code === 'EMAIL_NOT_FOUND') return; diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 7b919ec29..cf210b61b 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -101,8 +101,7 @@ module.exports = function(Self) { hedera: 'verificationToken=$token$' }; - // FIXME: Change with: info.options?.app - const app = info.options?.directory; + const app = info.options?.app; let recoverHash = app ? recoverHashes[app] : defaultHash; recoverHash = recoverHash.replace('$token$', info.accessToken.id); From 4191d2529d10ca3b40771801f06349b6d6cf698c Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 7 Aug 2023 07:57:38 +0200 Subject: [PATCH 240/311] refs #5712 warnFix: getById condition --- modules/worker/back/methods/worker-dms/filter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index 5f55f1bd7..9d8554484 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -71,8 +71,9 @@ module.exports = Self => { 'Stored on': 'created', 'Document ID': 'id' }; + workerDocuware = - await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse) ?? []; + await models.Docuware.getById('hr', worker.lastName + ' ' + worker.firstName, docuwareParse) ?? []; for (document of workerDocuware) { const defaultData = { file: 'dw' + document.id + '.png', From 26d6bbff4cb792592dc18973ca856433715acbf3 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 7 Aug 2023 10:04:46 +0200 Subject: [PATCH 241/311] refs #5929 hotFix: add UserError --- modules/ticket/back/methods/ticket/componentUpdate.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index b5ff50d59..8aad8959b 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -1,4 +1,5 @@ const loggable = require('vn-loopback/util/log'); +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('componentUpdate', { @@ -112,7 +113,6 @@ module.exports = Self => { } try { - const userId = ctx.req.accessToken.userId; const models = Self.app.models; const $t = ctx.req.__; // $translate await models.Ticket.isEditableOrThrow(ctx, args.id, myOptions); @@ -127,11 +127,8 @@ module.exports = Self => { args.warehouseFk, myOptions); - if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk) { - const error = `You don't have privileges to change the zone`; - - throw new UserError(error); - } + if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk) + throw new UserError(`You don't have privileges to change the zone`); } if (args.isWithoutNegatives) { From abd6045bf681127d29506a62642fd863cef3039a Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 7 Aug 2023 13:52:46 +0200 Subject: [PATCH 242/311] warnFix: revert(version): remove changelog and change package.json --- CHANGELOG.md | 8 -------- db/changes/233401/.gitkeep | 0 package.json | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 db/changes/233401/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index 80d8517de..6399235de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,14 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2334.01] - 2023-08-24 - -### Added - -### Changed - -### Fixed - ## [2332.01] - 2023-08-09 diff --git a/db/changes/233401/.gitkeep b/db/changes/233401/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/package.json b/package.json index 2aa37379e..37e39d5a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.34.01", + "version": "23.32.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 00fcd3a800344afb04385b01b95490ac4c864274 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 7 Aug 2023 14:03:07 +0200 Subject: [PATCH 243/311] refs #6083 feat: add lilium ticketSms --- db/changes/233202/00-ticketSmsACL.sql | 3 +++ modules/ticket/front/index.js | 1 + modules/ticket/front/routes.json | 12 +++++++++++- modules/ticket/front/sms/index.html | 2 ++ modules/ticket/front/sms/index.js | 21 +++++++++++++++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 db/changes/233202/00-ticketSmsACL.sql create mode 100644 modules/ticket/front/sms/index.html create mode 100644 modules/ticket/front/sms/index.js diff --git a/db/changes/233202/00-ticketSmsACL.sql b/db/changes/233202/00-ticketSmsACL.sql new file mode 100644 index 000000000..a25a876f8 --- /dev/null +++ b/db/changes/233202/00-ticketSmsACL.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('TicketSms', 'find', 'READ', 'ALLOW', 'ROLE', 'salesPerson'); diff --git a/modules/ticket/front/index.js b/modules/ticket/front/index.js index 029dc16a4..d805cb0f8 100644 --- a/modules/ticket/front/index.js +++ b/modules/ticket/front/index.js @@ -36,3 +36,4 @@ import './future'; import './future-search-panel'; import './advance'; import './advance-search-panel'; +import './sms'; diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index c86b3a1ef..e403ab02d 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -26,7 +26,8 @@ {"state": "ticket.card.components", "icon": "icon-components"}, {"state": "ticket.card.saleTracking", "icon": "assignment"}, {"state": "ticket.card.dms.index", "icon": "cloud_download"}, - {"state": "ticket.card.boxing", "icon": "science"} + {"state": "ticket.card.boxing", "icon": "science"}, + {"state": "ticket.card.sms", "icon": "sms"} ] }, "keybindings": [ @@ -287,6 +288,15 @@ "state": "ticket.advance", "component": "vn-ticket-advance", "description": "Advance tickets" + }, + { + "url": "/sms", + "state": "ticket.card.sms", + "component": "vn-ticket-sms", + "description": "Sms", + "params": { + "ticket": "$ctrl.ticket" + } } ] } diff --git a/modules/ticket/front/sms/index.html b/modules/ticket/front/sms/index.html new file mode 100644 index 000000000..7fb3b870e --- /dev/null +++ b/modules/ticket/front/sms/index.html @@ -0,0 +1,2 @@ + + diff --git a/modules/ticket/front/sms/index.js b/modules/ticket/front/sms/index.js new file mode 100644 index 000000000..69d54aafe --- /dev/null +++ b/modules/ticket/front/sms/index.js @@ -0,0 +1,21 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +class Controller extends Section { + constructor($element, $) { + super($element, $); + } + + async $onInit() { + this.$state.go('ticket.card.summary', {id: this.$params.id}); + window.location.href = await this.vnApp.getUrl(`ticket/${this.$params.id}/sms`); + } +} + +ngModule.vnComponent('vnTicketSms', { + template: require('./index.html'), + controller: Controller, + bindings: { + ticket: '<' + } +}); From bf5b421a4312d5473082fd68c5c847303d4a2d63 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 8 Aug 2023 08:39:13 +0200 Subject: [PATCH 244/311] refs #5976 warnFix(client_create): socialName to upperCase --- db/changes/233202/00-client_create_upper.sql | 87 ++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 db/changes/233202/00-client_create_upper.sql diff --git a/db/changes/233202/00-client_create_upper.sql b/db/changes/233202/00-client_create_upper.sql new file mode 100644 index 000000000..d5d7258a1 --- /dev/null +++ b/db/changes/233202/00-client_create_upper.sql @@ -0,0 +1,87 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_create`( + vFirstname VARCHAR(50), + vSurnames VARCHAR(50), + vFi VARCHAR(9), + vAddress TEXT, + vPostcode CHAR(5), + vCity VARCHAR(25), + vProvinceFk SMALLINT(5), + vCompanyFk SMALLINT(5), + vPhone VARCHAR(11), + vEmail VARCHAR(255), + vUserFk INT +) +BEGIN +/** + * Create new client + * + * @params vFirstname firstName + * @params vSurnames surnames + * @params vFi company code from accounting transactions + * @params vAddress address + * @params vPostcode postCode + * @params vCity city + * @params vProvinceFk province + * @params vCompanyFk company in which he has become a client + * @params vPhone telephone number + * @params vEmail email address + * @params vUserFk user id + */ + DECLARE vPayMethodFk INT; + DECLARE vDueDay INT; + DECLARE vDefaultCredit DECIMAL(10, 2); + DECLARE vIsTaxDataChecked TINYINT(1); + DECLARE vHasCoreVnl BOOLEAN; + DECLARE vMandateTypeFk INT; + + SELECT defaultPayMethodFk, + defaultDueDay, + defaultCredit, + defaultIsTaxDataChecked, + defaultHasCoreVnl, + defaultMandateTypeFk + INTO vPayMethodFk, + vDueDay, + vDefaultCredit, + vIsTaxDataChecked, + vHasCoreVnl, + vMandateTypeFk + FROM clientConfig; + + INSERT INTO `client` + SET id = vUserFk, + name = CONCAT(vFirstname, ' ', vSurnames), + street = vAddress, + fi = TRIM(vFi), + phone = vPhone, + email = vEmail, + provinceFk = vProvinceFk, + city = vCity, + postcode = vPostcode, + socialName = UPPER(CONCAT(vSurnames, ' ', vFirstname)), + payMethodFk = vPayMethodFk, + dueDay = vDueDay, + credit = vDefaultCredit, + isTaxDataChecked = vIsTaxDataChecked, + hasCoreVnl = vHasCoreVnl, + isEqualizated = FALSE + ON duplicate KEY UPDATE + payMethodFk = vPayMethodFk, + dueDay = vDueDay, + credit = vDefaultCredit, + isTaxDataChecked = vIsTaxDataChecked, + hasCoreVnl = vHasCoreVnl, + isActive = TRUE; + + INSERT INTO mandate (clientFk, companyFk, mandateTypeFk) + SELECT vUserFk, vCompanyFk, vMandateTypeFk + WHERE NOT EXISTS ( + SELECT id + FROM mandate + WHERE clientFk = vUserFk + AND companyFk = vCompanyFk + AND mandateTypeFk = vMandateTypeFk + ); +END$$ +DELIMITER ; From 61e3b71bbf7f51b22686f6e49c46b2a5a7069687 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 8 Aug 2023 08:51:03 +0200 Subject: [PATCH 245/311] init version 233401 after revert(version) in test --- CHANGELOG.md | 9 +++++++++ db/changes/233401/.gitkeep | 0 package.json | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 db/changes/233401/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index 6399235de..15fe58d7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2334.01] - 2023-08-24 + +### Added + +### Changed + +### Fixed + + ## [2332.01] - 2023-08-09 ### Added diff --git a/db/changes/233401/.gitkeep b/db/changes/233401/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/package.json b/package.json index 37e39d5a5..2aa37379e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.32.01", + "version": "23.34.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From c5e853b028651db9c94d1467e479cae317c6e91d Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 8 Aug 2023 13:35:36 +0200 Subject: [PATCH 246/311] refs #5976 correct sql folder --- db/changes/{233001 => 233401}/00-setDeleted_acl.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{233001 => 233401}/00-setDeleted_acl.sql (100%) diff --git a/db/changes/233001/00-setDeleted_acl.sql b/db/changes/233401/00-setDeleted_acl.sql similarity index 100% rename from db/changes/233001/00-setDeleted_acl.sql rename to db/changes/233401/00-setDeleted_acl.sql From 2f64a41f645de5deeff913894cd631850f40ef2d Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 8 Aug 2023 14:16:47 +0200 Subject: [PATCH 247/311] refs #5995 Added getExternalCmrs --- .../back/methods/route/getExternalCmrs.js | 139 ++++++++++++++++++ modules/route/back/models/route.js | 1 + 2 files changed, 140 insertions(+) create mode 100644 modules/route/back/methods/route/getExternalCmrs.js diff --git a/modules/route/back/methods/route/getExternalCmrs.js b/modules/route/back/methods/route/getExternalCmrs.js new file mode 100644 index 000000000..4947aeffa --- /dev/null +++ b/modules/route/back/methods/route/getExternalCmrs.js @@ -0,0 +1,139 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; + +module.exports = Self => { + Self.remoteMethodCtx('getExternalCmrs', { + description: 'Returns an array of external cmrs', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + http: {source: 'query'} + }, + { + arg: 'cmrFk', + type: 'integer', + description: 'Searchs the route by id', + http: {source: 'query'} + }, + { + arg: 'ticketFk', + type: 'integer', + description: 'The worker id', + http: {source: 'query'} + }, + { + arg: 'country', + type: 'string', + description: 'The agencyMode id', + http: {source: 'query'} + }, + { + arg: 'clientFk', + type: 'integer', + description: 'The vehicle id', + http: {source: 'query'} + }, + { + arg: 'hasCmrDms', + type: 'boolean', + description: 'The vehicle id', + http: {source: 'query'} + }, + { + arg: 'shipped', + type: 'date', + description: 'The to date filter', + http: {source: 'query'} + }, + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getExternalCmrs`, + verb: 'GET' + } + }); + + Self.getExternalCmrs = async(ctx, filter, options) => { + const conn = Self.dataSource.connector; + + let where = buildFilter(ctx.args, (param, value) => { + switch (param) { + case 'cmrFk': + return {'cmrFk': value}; + case 'ticketFk': + return {'ticketFk': value}; + case 'country': + return {'country': value}; + case 'clientFk': + return {'clientFk': value}; + case 'hasCmrDms': + return {'hasCmrDms': value}; + case 'shipped': + return {'shipped': value}; + } + }); + + filter = mergeFilters(ctx.args.filter, {where}); + + if (!filter.where) { + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + filter.where = {'shipped': yesterday.toISOString().split('T')[0]} + } + + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + let stmts = []; + const stmt = new ParameterizedSQL(` + SELECT * + FROM ( + SELECT t.cmrFk, + t.id ticketFk, + co.country, + t.clientFk, + IF(sub.id, TRUE, FALSE) hasCmrDms, + DATE(t.shipped) shipped + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state s ON s.id = ts.stateFk + JOIN alertLevel al ON al.id = s.alertLevel + JOIN client c ON c.id = t.clientFk + JOIN address a ON a.id = t.addressFk + JOIN province p ON p.id = a.provinceFk + JOIN country co ON co.id = p.countryFk + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + JOIN warehouse w ON w.id = t.warehouseFk + LEFT JOIN ( + SELECT td.ticketFk, d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + JOIN dmsType dt ON dt.id = d.dmsTypeFk + WHERE dt.name = 'cmr' + ) sub ON sub.ticketFk = t.id + WHERE co.code <> 'ES' + AND am.name <> 'ABONO' + AND w.code = 'ALG' + AND dm.code = 'DELIVERY' + AND t.cmrFk + ) sub + `); + + stmt.merge(conn.makeSuffix(filter)); + let itemsIndex = stmts.push(stmt) - 1; + + let sql = ParameterizedSQL.join(stmts, ';'); + let result = await conn.executeStmt(sql); + return itemsIndex === 0 ? result : result[itemsIndex]; + }; +}; diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index a8d44cd05..7e61acf25 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -15,6 +15,7 @@ module.exports = Self => { require('../methods/route/sendSms')(Self); require('../methods/route/downloadZip')(Self); require('../methods/route/cmr')(Self); + require('../methods/route/getExternalCmrs')(Self); Self.validate('kmStart', validateDistance, { message: 'Distance must be lesser than 1000' From 19c09d60a237377f337be9e98483663d0962c049 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 8 Aug 2023 15:04:21 +0200 Subject: [PATCH 248/311] refs #5986 feat(ticket_filter): add classColor column --- modules/ticket/back/methods/ticket/filter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index ea77b7677..eb3da39af 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -248,6 +248,7 @@ module.exports = Self => { am.name AS agencyMode, am.id AS agencyModeFk, st.name AS state, + st.classColor, wk.lastName AS salesPerson, ts.stateFk AS stateFk, ts.alertLevel AS alertLevel, From ce78fc8e5dd383b3c6457fe5f78a45b21b246858 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 8 Aug 2023 15:06:28 +0200 Subject: [PATCH 249/311] refs #5986 feat: state model add classColor properties --- modules/ticket/back/models/state.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/ticket/back/models/state.json b/modules/ticket/back/models/state.json index 9d4dd4f5d..8b7eb69c6 100644 --- a/modules/ticket/back/models/state.json +++ b/modules/ticket/back/models/state.json @@ -27,6 +27,9 @@ "code": { "type": "string", "required": false + }, + "classColor": { + "type": "string" } } } From 765ab054a11def25e8d4c16e28362b17b5bbeb49 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 9 Aug 2023 07:41:38 +0200 Subject: [PATCH 250/311] refs #5934 fix(clientSms): add vn-tooltip --- modules/client/front/sms/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index 9abadd312..e2bc0785e 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -8,7 +8,7 @@ auto-load="true"> - + @@ -27,7 +27,7 @@ {{::clientSms.sms.destination}} - {{::clientSms.sms.message}} + {{::clientSms.sms.message}} {{::clientSms.sms.status}} {{::clientSms.sms.created | date:'dd/MM/yyyy HH:mm'}} From 5653a39e3bf8796a47569b023db6c49c246fe9c0 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 9 Aug 2023 13:10:05 +0200 Subject: [PATCH 251/311] fix fixtures names, socialnames streets --- db/dump/fixtures.sql | 38 +++++++++---------- .../02-client/02_edit_basic_data.spec.js | 4 +- e2e/paths/02-client/19_summary.spec.js | 4 +- e2e/paths/02-client/21_defaulter.spec.js | 2 +- .../15_create_ticket_from_client.spec.js | 2 +- .../components/autocomplete/index.spec.js | 2 +- .../client/specs/extendedListFilter.spec.js | 18 ++++----- .../back/methods/client/specs/filter.spec.js | 18 ++++----- .../back/methods/client/specs/getCard.spec.js | 4 +- .../client/specs/lastActiveTickets.spec.js | 2 +- .../back/methods/client/specs/summary.spec.js | 2 +- .../methods/client/specs/transactions.spec.js | 2 +- .../methods/defaulter/specs/filter.spec.js | 2 +- .../client/front/address/index/index.spec.js | 4 +- modules/client/front/web-access/index.spec.js | 2 +- .../ticket-weekly/specs/filter.spec.js | 4 +- 16 files changed, 55 insertions(+), 55 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 7a572fb04..c278b4e3b 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -103,7 +103,7 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType` INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`) VALUES - (1101, 'BruceWayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), + (1101, 'BruceWayne', 'BRUCE WAYNE', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), (1102, 'PetterParker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'PetterParker@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'), (1103, 'ClarkKent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr', 'e7723f0b24ff05b32ed09d95196f2f29'), (1104, 'TonyStark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), @@ -190,11 +190,11 @@ UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1; INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`) VALUES - (1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106), - (1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107), - (1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108), - (1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109), - (1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110); + (1106, 'LGN', 'DAVID CHARLES', 'HALLER', 1106, 19, 432978106), + (1107, 'ANT', 'HANK' , 'PYM' , 1107, 19, 432978107), + (1108, 'DCX', 'CHARLES' , 'XAVIER', 1108, 19, 432978108), + (1109, 'HLK', 'BRUCE' , 'BANNER', 1109, 19, 432978109), + (1110, 'JJJ', 'JESSICA' , 'JONES' , 1110, 19, 432978110); INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`) VALUES @@ -360,18 +360,18 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`) VALUES - (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), - (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), - (1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), - (1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), - (1111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'), - (1112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'); + (1101, 'BRUCE WAYNE', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1102, 'PETTER PARKER', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1103, 'CLARK KENT', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1104, 'TONY STARK', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1105, 'MAX EISENHARDT', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), + (1106, ' DAVIDCHARLESHALLER', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1107, 'HANK PYM', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1108, 'CHARLES XAVIER', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), + (1109, 'BRUCE BANNER', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), + (1110, 'JESSICA JONES', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), + (1111, 'MISSING', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'), + (1112, 'TRASH', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 @@ -2955,6 +2955,6 @@ INSERT INTO `vn`.`invoiceInSerial` (`code`, `description`, `cplusTerIdNifFk`, `t ('W', 'Vanaheim', 1, 'WORLD'); -INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`) +INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`) VALUES (1, 0, 0, 'marvel.com'); diff --git a/e2e/paths/02-client/02_edit_basic_data.spec.js b/e2e/paths/02-client/02_edit_basic_data.spec.js index 3a476e54f..9a0187ae9 100644 --- a/e2e/paths/02-client/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client/02_edit_basic_data.spec.js @@ -8,7 +8,7 @@ describe('Client Edit basicData path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'client'); - await page.accessToSearchResult('Bruce Wayne'); + await page.accessToSearchResult('BRUCE WAYNE'); await page.accessToSection('client.card.basicData'); }); @@ -81,7 +81,7 @@ describe('Client Edit basicData path', () => { const result = await page .waitToGetProperty(selectors.clientBasicData.transferor, 'value'); - expect(result).toEqual('Max Eisenhardt'); + expect(result).toEqual('MAX EISENHARDT'); }); }); diff --git a/e2e/paths/02-client/19_summary.spec.js b/e2e/paths/02-client/19_summary.spec.js index b3bf43c5c..7ce7ddd9e 100644 --- a/e2e/paths/02-client/19_summary.spec.js +++ b/e2e/paths/02-client/19_summary.spec.js @@ -21,10 +21,10 @@ describe('Client summary path', () => { }); it('should display details from the client on the header', async() => { - await page.waitForTextInElement(selectors.clientSummary.header, 'Petter Parker'); + await page.waitForTextInElement(selectors.clientSummary.header, 'PETTER PARKER'); const result = await page.waitToGetProperty(selectors.clientSummary.header, 'innerText'); - expect(result).toContain('Petter Parker'); + expect(result).toContain('PETTER PARKER'); }); it('should display some basic data', async() => { diff --git a/e2e/paths/02-client/21_defaulter.spec.js b/e2e/paths/02-client/21_defaulter.spec.js index 2bb3d6254..d4a3123a8 100644 --- a/e2e/paths/02-client/21_defaulter.spec.js +++ b/e2e/paths/02-client/21_defaulter.spec.js @@ -28,7 +28,7 @@ describe('Client defaulter path', () => { const salesPersonName = await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText'); - expect(clientName).toEqual('Bruce Banner'); + expect(clientName).toEqual('BRUCE BANNER'); expect(salesPersonName).toEqual('developer'); }); diff --git a/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js b/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js index 51ead6461..94d040091 100644 --- a/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js +++ b/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js @@ -27,7 +27,7 @@ describe('Ticket create from client path', () => { await page.waitForState('ticket.create'); const values = { - client: 'Petter Parker', + client: 'PETTER PARKER', address: 'Petter Parker' }; const formValues = await page.fetchForm($.form, Object.keys(values)); diff --git a/front/core/components/autocomplete/index.spec.js b/front/core/components/autocomplete/index.spec.js index 847761179..449fe3a74 100644 --- a/front/core/components/autocomplete/index.spec.js +++ b/front/core/components/autocomplete/index.spec.js @@ -1,7 +1,7 @@ describe('Component vnAutocomplete', () => { let $element; let controller; - let data = {id: 1, name: 'Bruce Wayne'}; + let data = {id: 1, name: 'BRUCE WAYNE'}; beforeEach(ngModule('vnCore')); diff --git a/modules/client/back/methods/client/specs/extendedListFilter.spec.js b/modules/client/back/methods/client/specs/extendedListFilter.spec.js index 9a0441656..aec57b40e 100644 --- a/modules/client/back/methods/client/specs/extendedListFilter.spec.js +++ b/modules/client/back/methods/client/specs/extendedListFilter.spec.js @@ -20,20 +20,20 @@ describe('client extendedListFilter()', () => { } }); - it('should return the client "Bruce Wayne" matching the search argument with his name', async() => { + it('should return the client "BRUCE WAYNE" matching the search argument with his name', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}, args: {search: 'Bruce Wayne'}}; + const ctx = {req: {accessToken: {userId: 1}}, args: {search: 'BRUCE WAYNE'}}; const filter = {}; const result = await models.Client.extendedListFilter(ctx, filter, options); const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('Bruce Wayne'); + expect(firstResult.name).toEqual('BRUCE WAYNE'); await tx.rollback(); } catch (e) { @@ -42,7 +42,7 @@ describe('client extendedListFilter()', () => { } }); - it('should return the client "Bruce Wayne" matching the search argument with his id', async() => { + it('should return the client "BRUCE WAYNE" matching the search argument with his id', async() => { const tx = await models.Client.beginTransaction({}); try { @@ -55,7 +55,7 @@ describe('client extendedListFilter()', () => { const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('Bruce Wayne'); + expect(firstResult.name).toEqual('BRUCE WAYNE'); await tx.rollback(); } catch (e) { @@ -64,20 +64,20 @@ describe('client extendedListFilter()', () => { } }); - it('should return the client "Bruce Wayne" matching the name argument', async() => { + it('should return the client "BRUCE WAYNE" matching the name argument', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}, args: {name: 'Bruce Wayne'}}; + const ctx = {req: {accessToken: {userId: 1}}, args: {name: 'BRUCE WAYNE'}}; const filter = {}; const result = await models.Client.extendedListFilter(ctx, filter, options); const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('Bruce Wayne'); + expect(firstResult.name).toEqual('BRUCE WAYNE'); await tx.rollback(); } catch (e) { @@ -123,7 +123,7 @@ describe('client extendedListFilter()', () => { const firstClient = result[0]; expect(result.length).toEqual(1); - expect(firstClient.name).toEqual('Max Eisenhardt'); + expect(firstClient.name).toEqual('MAX EISENHARDT'); await tx.rollback(); } catch (e) { diff --git a/modules/client/back/methods/client/specs/filter.spec.js b/modules/client/back/methods/client/specs/filter.spec.js index 679585050..505c1f66f 100644 --- a/modules/client/back/methods/client/specs/filter.spec.js +++ b/modules/client/back/methods/client/specs/filter.spec.js @@ -20,20 +20,20 @@ describe('client filter()', () => { } }); - it('should return the client "Bruce Wayne" matching the search argument with his name', async() => { + it('should return the client "BRUCE WAYNE" matching the search argument with his name', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}, args: {search: 'Bruce Wayne'}}; + const ctx = {req: {accessToken: {userId: 1}}, args: {search: 'BRUCE WAYNE'}}; const filter = {}; const result = await models.Client.filter(ctx, filter, options); const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('Bruce Wayne'); + expect(firstResult.name).toEqual('BRUCE WAYNE'); await tx.rollback(); } catch (e) { @@ -42,7 +42,7 @@ describe('client filter()', () => { } }); - it('should return the client "Bruce Wayne" matching the search argument with his id', async() => { + it('should return the client "BRUCE WAYNE" matching the search argument with his id', async() => { const tx = await models.Client.beginTransaction({}); try { @@ -55,7 +55,7 @@ describe('client filter()', () => { const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('Bruce Wayne'); + expect(firstResult.name).toEqual('BRUCE WAYNE'); await tx.rollback(); } catch (e) { @@ -64,20 +64,20 @@ describe('client filter()', () => { } }); - it('should return the client "Bruce Wayne" matching the name argument', async() => { + it('should return the client "BRUCE WAYNE" matching the name argument', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}, args: {name: 'Bruce Wayne'}}; + const ctx = {req: {accessToken: {userId: 1}}, args: {name: 'BRUCE WAYNE'}}; const filter = {}; const result = await models.Client.filter(ctx, filter, options); const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('Bruce Wayne'); + expect(firstResult.name).toEqual('BRUCE WAYNE'); await tx.rollback(); } catch (e) { @@ -123,7 +123,7 @@ describe('client filter()', () => { const firstClient = result[0]; expect(result.length).toEqual(1); - expect(firstClient.name).toEqual('Max Eisenhardt'); + expect(firstClient.name).toEqual('MAX EISENHARDT'); await tx.rollback(); } catch (e) { diff --git a/modules/client/back/methods/client/specs/getCard.spec.js b/modules/client/back/methods/client/specs/getCard.spec.js index 962e0a2d4..db7296c77 100644 --- a/modules/client/back/methods/client/specs/getCard.spec.js +++ b/modules/client/back/methods/client/specs/getCard.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('Client getCard()', () => { - it('should receive a formated card of Bruce Wayne', async() => { + it('should receive a formated card of BRUCE WAYNE', async() => { const tx = await models.Client.beginTransaction({}); try { @@ -12,7 +12,7 @@ describe('Client getCard()', () => { const result = await models.Client.getCard(ctx, id, options); expect(result.id).toEqual(id); - expect(result.name).toEqual('Bruce Wayne'); + expect(result.name).toEqual('BRUCE WAYNE'); expect(result.debt).toEqual(jasmine.any(Number)); await tx.rollback(); diff --git a/modules/client/back/methods/client/specs/lastActiveTickets.spec.js b/modules/client/back/methods/client/specs/lastActiveTickets.spec.js index 7bddb55ee..41d3dbcf8 100644 --- a/modules/client/back/methods/client/specs/lastActiveTickets.spec.js +++ b/modules/client/back/methods/client/specs/lastActiveTickets.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('Client last active tickets', () => { - it('should receive an array of last active tickets of Bruce Wayne', async() => { + it('should receive an array of last active tickets of BRUCE WAYNE', async() => { const tx = await models.Client.beginTransaction({}); try { diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js index 227f4c398..83d82e609 100644 --- a/modules/client/back/methods/client/specs/summary.spec.js +++ b/modules/client/back/methods/client/specs/summary.spec.js @@ -12,7 +12,7 @@ describe('client summary()', () => { const result = await models.Client.summary(ctx, clientId, options); expect(result.id).toEqual(clientId); - expect(result.name).toEqual('Bruce Wayne'); + expect(result.name).toEqual('BRUCE WAYNE'); await tx.rollback(); } catch (e) { diff --git a/modules/client/back/methods/client/specs/transactions.spec.js b/modules/client/back/methods/client/specs/transactions.spec.js index b4af40195..45fffc1de 100644 --- a/modules/client/back/methods/client/specs/transactions.spec.js +++ b/modules/client/back/methods/client/specs/transactions.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('Client transactions', () => { - it('should call transactions() method to receive a list of Web Payments from Bruce Wayne', async() => { + it('should call transactions() method to receive a list of Web Payments from BRUCE WAYNE', async() => { const tx = await models.Client.beginTransaction({}); try { diff --git a/modules/client/back/methods/defaulter/specs/filter.spec.js b/modules/client/back/methods/defaulter/specs/filter.spec.js index 0a970823e..99b3016af 100644 --- a/modules/client/back/methods/defaulter/specs/filter.spec.js +++ b/modules/client/back/methods/defaulter/specs/filter.spec.js @@ -52,7 +52,7 @@ describe('defaulter filter()', () => { const result = await models.Defaulter.filter(ctx, null, options); const firstRow = result[0]; - expect(firstRow.clientName).toEqual('Petter Parker'); + expect(firstRow.clientName).toEqual('PETTER PARKER'); await tx.rollback(); } catch (e) { diff --git a/modules/client/front/address/index/index.spec.js b/modules/client/front/address/index/index.spec.js index 2a1f0d19e..0ca534231 100644 --- a/modules/client/front/address/index/index.spec.js +++ b/modules/client/front/address/index/index.spec.js @@ -75,9 +75,9 @@ describe('Client', () => { }); it('should return a filter based on a search by name', () => { - const filter = controller.exprBuilder('search', 'Bruce Wayne'); + const filter = controller.exprBuilder('search', 'BRUCE WAYNE'); - expect(filter).toEqual({nickname: {like: '%Bruce Wayne%'}}); + expect(filter).toEqual({nickname: {like: '%BRUCE WAYNE%'}}); }); }); }); diff --git a/modules/client/front/web-access/index.spec.js b/modules/client/front/web-access/index.spec.js index 7325bf932..1407bbdb3 100644 --- a/modules/client/front/web-access/index.spec.js +++ b/modules/client/front/web-access/index.spec.js @@ -22,7 +22,7 @@ describe('Component VnClientWebAccess', () => { describe('$onChanges()', () => { it(`should pass client's account data to account then call isCustomer function`, () => { jest.spyOn(controller, 'isCustomer'); - controller.client = {client: 'Bruce Wayne', account: 'Wayne Industries'}; + controller.client = {client: 'BRUCE WAYNE', account: 'Wayne Industries'}; controller.account = {}; controller.$onChanges(); diff --git a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js index 2587b6657..a6426e54d 100644 --- a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js @@ -57,7 +57,7 @@ describe('ticket-weekly filter()', () => { const result = await models.TicketWeekly.filter(ctx, null, options); const firstRow = result[0]; - expect(firstRow.clientName).toEqual('Bruce Wayne'); + expect(firstRow.clientName).toEqual('BRUCE WAYNE'); await tx.rollback(); } catch (e) { @@ -78,7 +78,7 @@ describe('ticket-weekly filter()', () => { const firstRow = result[0]; expect(firstRow.clientFk).toEqual(1101); - expect(firstRow.clientName).toEqual('Bruce Wayne'); + expect(firstRow.clientName).toEqual('BRUCE WAYNE'); await tx.rollback(); } catch (e) { From aff6668dc9b44def077f20ecf2eaa4324d75a521 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 9 Aug 2023 13:33:06 +0200 Subject: [PATCH 252/311] remove names upper --- db/dump/fixtures.sql | 12 ++++++------ e2e/paths/05-ticket/16_summary.spec.js | 4 ++-- e2e/paths/06-claim/05_summary.spec.js | 4 ++-- e2e/paths/07-order/02_basic_data.spec.js | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index c278b4e3b..c3a5a73ec 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -103,7 +103,7 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType` INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`) VALUES - (1101, 'BruceWayne', 'BRUCE WAYNE', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), + (1101, 'BruceWayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), (1102, 'PetterParker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'PetterParker@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'), (1103, 'ClarkKent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr', 'e7723f0b24ff05b32ed09d95196f2f29'), (1104, 'TonyStark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), @@ -190,11 +190,11 @@ UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1; INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`) VALUES - (1106, 'LGN', 'DAVID CHARLES', 'HALLER', 1106, 19, 432978106), - (1107, 'ANT', 'HANK' , 'PYM' , 1107, 19, 432978107), - (1108, 'DCX', 'CHARLES' , 'XAVIER', 1108, 19, 432978108), - (1109, 'HLK', 'BRUCE' , 'BANNER', 1109, 19, 432978109), - (1110, 'JJJ', 'JESSICA' , 'JONES' , 1110, 19, 432978110); + (1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106), + (1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107), + (1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108), + (1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109), + (1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110); INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`) VALUES diff --git a/e2e/paths/05-ticket/16_summary.spec.js b/e2e/paths/05-ticket/16_summary.spec.js index a6017e454..6904c6b6d 100644 --- a/e2e/paths/05-ticket/16_summary.spec.js +++ b/e2e/paths/05-ticket/16_summary.spec.js @@ -22,11 +22,11 @@ describe('Ticket Summary path', () => { }); it(`should display details from the ticket and it's client on the top of the header`, async() => { - await page.waitForTextInElement(selectors.ticketSummary.header, 'Bruce Banner'); + await page.waitForTextInElement(selectors.ticketSummary.header, 'BRUCE BANNER'); const result = await page.waitToGetProperty(selectors.ticketSummary.header, 'innerText'); expect(result).toContain(`Ticket #${ticketId}`); - expect(result).toContain('Bruce Banner (1109)'); + expect(result).toContain('BRUCE BANNER (1109)'); expect(result).toContain('Somewhere in Thailand'); }); diff --git a/e2e/paths/06-claim/05_summary.spec.js b/e2e/paths/06-claim/05_summary.spec.js index 1333ed01a..15a67ad1e 100644 --- a/e2e/paths/06-claim/05_summary.spec.js +++ b/e2e/paths/06-claim/05_summary.spec.js @@ -23,11 +23,11 @@ describe('Claim summary path', () => { }); it(`should display details from the claim and it's client on the top of the header`, async() => { - await page.waitForTextInElement(selectors.claimSummary.header, 'Tony Stark'); + await page.waitForTextInElement(selectors.claimSummary.header, 'TONY STARK'); const result = await page.waitToGetProperty(selectors.claimSummary.header, 'innerText'); expect(result).toContain('4 -'); - expect(result).toContain('Tony Stark'); + expect(result).toContain('TONY STARK'); }); it('should display the claim state', async() => { diff --git a/e2e/paths/07-order/02_basic_data.spec.js b/e2e/paths/07-order/02_basic_data.spec.js index b2c21b071..abdfa4dd4 100644 --- a/e2e/paths/07-order/02_basic_data.spec.js +++ b/e2e/paths/07-order/02_basic_data.spec.js @@ -53,7 +53,7 @@ describe('Order edit basic data path', () => { await page.accessToSection('order.card.basicData'); const values = { - client: 'Tony Stark', + client: 'TONY STARK', address: 'Tony Stark', agencyMode: 'Other agency' }; From ed88a5b25f807fd83e40cb73bfef9b3bacc4668f Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 10 Aug 2023 07:54:49 +0200 Subject: [PATCH 253/311] refs #5995 Minor change --- modules/route/back/methods/route/getExternalCmrs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/route/back/methods/route/getExternalCmrs.js b/modules/route/back/methods/route/getExternalCmrs.js index 4947aeffa..a232b98cd 100644 --- a/modules/route/back/methods/route/getExternalCmrs.js +++ b/modules/route/back/methods/route/getExternalCmrs.js @@ -101,7 +101,7 @@ module.exports = Self => { t.id ticketFk, co.country, t.clientFk, - IF(sub.id, TRUE, FALSE) hasCmrDms, + sub.id hasCmrDms, DATE(t.shipped) shipped FROM ticket t JOIN ticketState ts ON ts.ticketFk = t.id From d6b30271f287d437314b35d66ed916afa2f46e34 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 10 Aug 2023 08:12:52 +0200 Subject: [PATCH 254/311] refs #5995 Requested changes --- .../back/methods/route/getExternalCmrs.js | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/modules/route/back/methods/route/getExternalCmrs.js b/modules/route/back/methods/route/getExternalCmrs.js index a232b98cd..b7312d02e 100644 --- a/modules/route/back/methods/route/getExternalCmrs.js +++ b/modules/route/back/methods/route/getExternalCmrs.js @@ -3,7 +3,7 @@ const buildFilter = require('vn-loopback/util/filter').buildFilter; const mergeFilters = require('vn-loopback/util/filter').mergeFilters; module.exports = Self => { - Self.remoteMethodCtx('getExternalCmrs', { + Self.remoteMethod('getExternalCmrs', { description: 'Returns an array of external cmrs', accessType: 'READ', accepts: [ @@ -11,43 +11,36 @@ module.exports = Self => { arg: 'filter', type: 'object', description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', - http: {source: 'query'} }, { arg: 'cmrFk', type: 'integer', description: 'Searchs the route by id', - http: {source: 'query'} }, { arg: 'ticketFk', type: 'integer', description: 'The worker id', - http: {source: 'query'} }, { arg: 'country', type: 'string', description: 'The agencyMode id', - http: {source: 'query'} }, { arg: 'clientFk', type: 'integer', description: 'The vehicle id', - http: {source: 'query'} }, { arg: 'hasCmrDms', type: 'boolean', description: 'The vehicle id', - http: {source: 'query'} }, { arg: 'shipped', type: 'date', description: 'The to date filter', - http: {source: 'query'} }, ], returns: { @@ -60,10 +53,27 @@ module.exports = Self => { } }); - Self.getExternalCmrs = async(ctx, filter, options) => { + Self.getExternalCmrs = async( + filter, + cmrFk, + ticketFk, + country, + clientFk, + hasCmrDms, + shipped, + options + ) => { + const params = { + cmrFk, + ticketFk, + country, + clientFk, + hasCmrDms, + shipped, + }; const conn = Self.dataSource.connector; - let where = buildFilter(ctx.args, (param, value) => { + let where = buildFilter(params, (param, value) => { switch (param) { case 'cmrFk': return {'cmrFk': value}; @@ -80,7 +90,7 @@ module.exports = Self => { } }); - filter = mergeFilters(ctx.args.filter, {where}); + filter = mergeFilters(filter, {where}); if (!filter.where) { const yesterday = new Date(); From 8807b9f87f6bf60c080d4c75cd124ea3efae7365 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 10 Aug 2023 09:58:48 +0200 Subject: [PATCH 255/311] fix upper --- db/dump/fixtures.sql | 24 +++++++++---------- .../02-client/02_edit_basic_data.spec.js | 4 ++-- e2e/paths/02-client/19_summary.spec.js | 4 ++-- e2e/paths/02-client/21_defaulter.spec.js | 2 +- .../15_create_ticket_from_client.spec.js | 2 +- e2e/paths/05-ticket/16_summary.spec.js | 4 ++-- e2e/paths/06-claim/05_summary.spec.js | 4 ++-- e2e/paths/07-order/02_basic_data.spec.js | 2 +- .../components/autocomplete/index.spec.js | 2 +- .../client/specs/extendedListFilter.spec.js | 18 +++++++------- .../back/methods/client/specs/filter.spec.js | 18 +++++++------- .../back/methods/client/specs/getCard.spec.js | 4 ++-- .../back/methods/client/specs/summary.spec.js | 2 +- .../methods/defaulter/specs/filter.spec.js | 2 +- .../client/front/address/index/index.spec.js | 4 ++-- modules/client/front/web-access/index.spec.js | 2 +- .../ticket-weekly/specs/filter.spec.js | 4 ++-- 17 files changed, 51 insertions(+), 51 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index c3a5a73ec..b01c07461 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -360,18 +360,18 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`) VALUES - (1101, 'BRUCE WAYNE', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1102, 'PETTER PARKER', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1103, 'CLARK KENT', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1104, 'TONY STARK', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1105, 'MAX EISENHARDT', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), - (1106, ' DAVIDCHARLESHALLER', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1107, 'HANK PYM', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1108, 'CHARLES XAVIER', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), - (1109, 'BRUCE BANNER', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), - (1110, 'JESSICA JONES', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), - (1111, 'MISSING', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'), - (1112, 'TRASH', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'); + (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), + (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), + (1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), + (1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), + (1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'), + (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 diff --git a/e2e/paths/02-client/02_edit_basic_data.spec.js b/e2e/paths/02-client/02_edit_basic_data.spec.js index 9a0187ae9..3a476e54f 100644 --- a/e2e/paths/02-client/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client/02_edit_basic_data.spec.js @@ -8,7 +8,7 @@ describe('Client Edit basicData path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'client'); - await page.accessToSearchResult('BRUCE WAYNE'); + await page.accessToSearchResult('Bruce Wayne'); await page.accessToSection('client.card.basicData'); }); @@ -81,7 +81,7 @@ describe('Client Edit basicData path', () => { const result = await page .waitToGetProperty(selectors.clientBasicData.transferor, 'value'); - expect(result).toEqual('MAX EISENHARDT'); + expect(result).toEqual('Max Eisenhardt'); }); }); diff --git a/e2e/paths/02-client/19_summary.spec.js b/e2e/paths/02-client/19_summary.spec.js index 7ce7ddd9e..b3bf43c5c 100644 --- a/e2e/paths/02-client/19_summary.spec.js +++ b/e2e/paths/02-client/19_summary.spec.js @@ -21,10 +21,10 @@ describe('Client summary path', () => { }); it('should display details from the client on the header', async() => { - await page.waitForTextInElement(selectors.clientSummary.header, 'PETTER PARKER'); + await page.waitForTextInElement(selectors.clientSummary.header, 'Petter Parker'); const result = await page.waitToGetProperty(selectors.clientSummary.header, 'innerText'); - expect(result).toContain('PETTER PARKER'); + expect(result).toContain('Petter Parker'); }); it('should display some basic data', async() => { diff --git a/e2e/paths/02-client/21_defaulter.spec.js b/e2e/paths/02-client/21_defaulter.spec.js index d4a3123a8..2bb3d6254 100644 --- a/e2e/paths/02-client/21_defaulter.spec.js +++ b/e2e/paths/02-client/21_defaulter.spec.js @@ -28,7 +28,7 @@ describe('Client defaulter path', () => { const salesPersonName = await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText'); - expect(clientName).toEqual('BRUCE BANNER'); + expect(clientName).toEqual('Bruce Banner'); expect(salesPersonName).toEqual('developer'); }); diff --git a/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js b/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js index 94d040091..51ead6461 100644 --- a/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js +++ b/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js @@ -27,7 +27,7 @@ describe('Ticket create from client path', () => { await page.waitForState('ticket.create'); const values = { - client: 'PETTER PARKER', + client: 'Petter Parker', address: 'Petter Parker' }; const formValues = await page.fetchForm($.form, Object.keys(values)); diff --git a/e2e/paths/05-ticket/16_summary.spec.js b/e2e/paths/05-ticket/16_summary.spec.js index 6904c6b6d..a6017e454 100644 --- a/e2e/paths/05-ticket/16_summary.spec.js +++ b/e2e/paths/05-ticket/16_summary.spec.js @@ -22,11 +22,11 @@ describe('Ticket Summary path', () => { }); it(`should display details from the ticket and it's client on the top of the header`, async() => { - await page.waitForTextInElement(selectors.ticketSummary.header, 'BRUCE BANNER'); + await page.waitForTextInElement(selectors.ticketSummary.header, 'Bruce Banner'); const result = await page.waitToGetProperty(selectors.ticketSummary.header, 'innerText'); expect(result).toContain(`Ticket #${ticketId}`); - expect(result).toContain('BRUCE BANNER (1109)'); + expect(result).toContain('Bruce Banner (1109)'); expect(result).toContain('Somewhere in Thailand'); }); diff --git a/e2e/paths/06-claim/05_summary.spec.js b/e2e/paths/06-claim/05_summary.spec.js index 15a67ad1e..1333ed01a 100644 --- a/e2e/paths/06-claim/05_summary.spec.js +++ b/e2e/paths/06-claim/05_summary.spec.js @@ -23,11 +23,11 @@ describe('Claim summary path', () => { }); it(`should display details from the claim and it's client on the top of the header`, async() => { - await page.waitForTextInElement(selectors.claimSummary.header, 'TONY STARK'); + await page.waitForTextInElement(selectors.claimSummary.header, 'Tony Stark'); const result = await page.waitToGetProperty(selectors.claimSummary.header, 'innerText'); expect(result).toContain('4 -'); - expect(result).toContain('TONY STARK'); + expect(result).toContain('Tony Stark'); }); it('should display the claim state', async() => { diff --git a/e2e/paths/07-order/02_basic_data.spec.js b/e2e/paths/07-order/02_basic_data.spec.js index abdfa4dd4..b2c21b071 100644 --- a/e2e/paths/07-order/02_basic_data.spec.js +++ b/e2e/paths/07-order/02_basic_data.spec.js @@ -53,7 +53,7 @@ describe('Order edit basic data path', () => { await page.accessToSection('order.card.basicData'); const values = { - client: 'TONY STARK', + client: 'Tony Stark', address: 'Tony Stark', agencyMode: 'Other agency' }; diff --git a/front/core/components/autocomplete/index.spec.js b/front/core/components/autocomplete/index.spec.js index 449fe3a74..847761179 100644 --- a/front/core/components/autocomplete/index.spec.js +++ b/front/core/components/autocomplete/index.spec.js @@ -1,7 +1,7 @@ describe('Component vnAutocomplete', () => { let $element; let controller; - let data = {id: 1, name: 'BRUCE WAYNE'}; + let data = {id: 1, name: 'Bruce Wayne'}; beforeEach(ngModule('vnCore')); diff --git a/modules/client/back/methods/client/specs/extendedListFilter.spec.js b/modules/client/back/methods/client/specs/extendedListFilter.spec.js index aec57b40e..9a0441656 100644 --- a/modules/client/back/methods/client/specs/extendedListFilter.spec.js +++ b/modules/client/back/methods/client/specs/extendedListFilter.spec.js @@ -20,20 +20,20 @@ describe('client extendedListFilter()', () => { } }); - it('should return the client "BRUCE WAYNE" matching the search argument with his name', async() => { + it('should return the client "Bruce Wayne" matching the search argument with his name', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}, args: {search: 'BRUCE WAYNE'}}; + const ctx = {req: {accessToken: {userId: 1}}, args: {search: 'Bruce Wayne'}}; const filter = {}; const result = await models.Client.extendedListFilter(ctx, filter, options); const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('BRUCE WAYNE'); + expect(firstResult.name).toEqual('Bruce Wayne'); await tx.rollback(); } catch (e) { @@ -42,7 +42,7 @@ describe('client extendedListFilter()', () => { } }); - it('should return the client "BRUCE WAYNE" matching the search argument with his id', async() => { + it('should return the client "Bruce Wayne" matching the search argument with his id', async() => { const tx = await models.Client.beginTransaction({}); try { @@ -55,7 +55,7 @@ describe('client extendedListFilter()', () => { const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('BRUCE WAYNE'); + expect(firstResult.name).toEqual('Bruce Wayne'); await tx.rollback(); } catch (e) { @@ -64,20 +64,20 @@ describe('client extendedListFilter()', () => { } }); - it('should return the client "BRUCE WAYNE" matching the name argument', async() => { + it('should return the client "Bruce Wayne" matching the name argument', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}, args: {name: 'BRUCE WAYNE'}}; + const ctx = {req: {accessToken: {userId: 1}}, args: {name: 'Bruce Wayne'}}; const filter = {}; const result = await models.Client.extendedListFilter(ctx, filter, options); const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('BRUCE WAYNE'); + expect(firstResult.name).toEqual('Bruce Wayne'); await tx.rollback(); } catch (e) { @@ -123,7 +123,7 @@ describe('client extendedListFilter()', () => { const firstClient = result[0]; expect(result.length).toEqual(1); - expect(firstClient.name).toEqual('MAX EISENHARDT'); + expect(firstClient.name).toEqual('Max Eisenhardt'); await tx.rollback(); } catch (e) { diff --git a/modules/client/back/methods/client/specs/filter.spec.js b/modules/client/back/methods/client/specs/filter.spec.js index 505c1f66f..679585050 100644 --- a/modules/client/back/methods/client/specs/filter.spec.js +++ b/modules/client/back/methods/client/specs/filter.spec.js @@ -20,20 +20,20 @@ describe('client filter()', () => { } }); - it('should return the client "BRUCE WAYNE" matching the search argument with his name', async() => { + it('should return the client "Bruce Wayne" matching the search argument with his name', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}, args: {search: 'BRUCE WAYNE'}}; + const ctx = {req: {accessToken: {userId: 1}}, args: {search: 'Bruce Wayne'}}; const filter = {}; const result = await models.Client.filter(ctx, filter, options); const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('BRUCE WAYNE'); + expect(firstResult.name).toEqual('Bruce Wayne'); await tx.rollback(); } catch (e) { @@ -42,7 +42,7 @@ describe('client filter()', () => { } }); - it('should return the client "BRUCE WAYNE" matching the search argument with his id', async() => { + it('should return the client "Bruce Wayne" matching the search argument with his id', async() => { const tx = await models.Client.beginTransaction({}); try { @@ -55,7 +55,7 @@ describe('client filter()', () => { const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('BRUCE WAYNE'); + expect(firstResult.name).toEqual('Bruce Wayne'); await tx.rollback(); } catch (e) { @@ -64,20 +64,20 @@ describe('client filter()', () => { } }); - it('should return the client "BRUCE WAYNE" matching the name argument', async() => { + it('should return the client "Bruce Wayne" matching the name argument', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}, args: {name: 'BRUCE WAYNE'}}; + const ctx = {req: {accessToken: {userId: 1}}, args: {name: 'Bruce Wayne'}}; const filter = {}; const result = await models.Client.filter(ctx, filter, options); const firstResult = result[0]; expect(result.length).toEqual(1); - expect(firstResult.name).toEqual('BRUCE WAYNE'); + expect(firstResult.name).toEqual('Bruce Wayne'); await tx.rollback(); } catch (e) { @@ -123,7 +123,7 @@ describe('client filter()', () => { const firstClient = result[0]; expect(result.length).toEqual(1); - expect(firstClient.name).toEqual('MAX EISENHARDT'); + expect(firstClient.name).toEqual('Max Eisenhardt'); await tx.rollback(); } catch (e) { diff --git a/modules/client/back/methods/client/specs/getCard.spec.js b/modules/client/back/methods/client/specs/getCard.spec.js index db7296c77..962e0a2d4 100644 --- a/modules/client/back/methods/client/specs/getCard.spec.js +++ b/modules/client/back/methods/client/specs/getCard.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('Client getCard()', () => { - it('should receive a formated card of BRUCE WAYNE', async() => { + it('should receive a formated card of Bruce Wayne', async() => { const tx = await models.Client.beginTransaction({}); try { @@ -12,7 +12,7 @@ describe('Client getCard()', () => { const result = await models.Client.getCard(ctx, id, options); expect(result.id).toEqual(id); - expect(result.name).toEqual('BRUCE WAYNE'); + expect(result.name).toEqual('Bruce Wayne'); expect(result.debt).toEqual(jasmine.any(Number)); await tx.rollback(); diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js index 83d82e609..227f4c398 100644 --- a/modules/client/back/methods/client/specs/summary.spec.js +++ b/modules/client/back/methods/client/specs/summary.spec.js @@ -12,7 +12,7 @@ describe('client summary()', () => { const result = await models.Client.summary(ctx, clientId, options); expect(result.id).toEqual(clientId); - expect(result.name).toEqual('BRUCE WAYNE'); + expect(result.name).toEqual('Bruce Wayne'); await tx.rollback(); } catch (e) { diff --git a/modules/client/back/methods/defaulter/specs/filter.spec.js b/modules/client/back/methods/defaulter/specs/filter.spec.js index 99b3016af..0a970823e 100644 --- a/modules/client/back/methods/defaulter/specs/filter.spec.js +++ b/modules/client/back/methods/defaulter/specs/filter.spec.js @@ -52,7 +52,7 @@ describe('defaulter filter()', () => { const result = await models.Defaulter.filter(ctx, null, options); const firstRow = result[0]; - expect(firstRow.clientName).toEqual('PETTER PARKER'); + expect(firstRow.clientName).toEqual('Petter Parker'); await tx.rollback(); } catch (e) { diff --git a/modules/client/front/address/index/index.spec.js b/modules/client/front/address/index/index.spec.js index 0ca534231..2a1f0d19e 100644 --- a/modules/client/front/address/index/index.spec.js +++ b/modules/client/front/address/index/index.spec.js @@ -75,9 +75,9 @@ describe('Client', () => { }); it('should return a filter based on a search by name', () => { - const filter = controller.exprBuilder('search', 'BRUCE WAYNE'); + const filter = controller.exprBuilder('search', 'Bruce Wayne'); - expect(filter).toEqual({nickname: {like: '%BRUCE WAYNE%'}}); + expect(filter).toEqual({nickname: {like: '%Bruce Wayne%'}}); }); }); }); diff --git a/modules/client/front/web-access/index.spec.js b/modules/client/front/web-access/index.spec.js index 1407bbdb3..7325bf932 100644 --- a/modules/client/front/web-access/index.spec.js +++ b/modules/client/front/web-access/index.spec.js @@ -22,7 +22,7 @@ describe('Component VnClientWebAccess', () => { describe('$onChanges()', () => { it(`should pass client's account data to account then call isCustomer function`, () => { jest.spyOn(controller, 'isCustomer'); - controller.client = {client: 'BRUCE WAYNE', account: 'Wayne Industries'}; + controller.client = {client: 'Bruce Wayne', account: 'Wayne Industries'}; controller.account = {}; controller.$onChanges(); diff --git a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js index a6426e54d..2587b6657 100644 --- a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js @@ -57,7 +57,7 @@ describe('ticket-weekly filter()', () => { const result = await models.TicketWeekly.filter(ctx, null, options); const firstRow = result[0]; - expect(firstRow.clientName).toEqual('BRUCE WAYNE'); + expect(firstRow.clientName).toEqual('Bruce Wayne'); await tx.rollback(); } catch (e) { @@ -78,7 +78,7 @@ describe('ticket-weekly filter()', () => { const firstRow = result[0]; expect(firstRow.clientFk).toEqual(1101); - expect(firstRow.clientName).toEqual('BRUCE WAYNE'); + expect(firstRow.clientName).toEqual('Bruce Wayne'); await tx.rollback(); } catch (e) { From b1971095566ffe7a6c62ab1cd0925f25329affe1 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 10 Aug 2023 10:14:22 +0200 Subject: [PATCH 256/311] refs #5995 Requested changes --- .../back/methods/route/getExternalCmrs.js | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/modules/route/back/methods/route/getExternalCmrs.js b/modules/route/back/methods/route/getExternalCmrs.js index b7312d02e..5b08cf34a 100644 --- a/modules/route/back/methods/route/getExternalCmrs.js +++ b/modules/route/back/methods/route/getExternalCmrs.js @@ -73,23 +73,7 @@ module.exports = Self => { }; const conn = Self.dataSource.connector; - let where = buildFilter(params, (param, value) => { - switch (param) { - case 'cmrFk': - return {'cmrFk': value}; - case 'ticketFk': - return {'ticketFk': value}; - case 'country': - return {'country': value}; - case 'clientFk': - return {'clientFk': value}; - case 'hasCmrDms': - return {'hasCmrDms': value}; - case 'shipped': - return {'shipped': value}; - } - }); - + let where = buildFilter(params, (param, value) => {return {[param]: value}}); filter = mergeFilters(filter, {where}); if (!filter.where) { @@ -140,10 +124,10 @@ module.exports = Self => { `); stmt.merge(conn.makeSuffix(filter)); - let itemsIndex = stmts.push(stmt) - 1; + const itemsIndex = stmts.push(stmt) - 1; - let sql = ParameterizedSQL.join(stmts, ';'); - let result = await conn.executeStmt(sql); + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql); return itemsIndex === 0 ? result : result[itemsIndex]; }; }; From e5c47a2057706ee6fb175c3aa9165a640e6e33ed Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 10 Aug 2023 10:58:44 +0200 Subject: [PATCH 257/311] refs #6054 add changeLog --- CHANGELOG.md | 5 ++++- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6399235de..25fc30137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,17 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2332.01] - 2023-08-09 +## [2332.01] - 2023-08-10 ### Added - (Trabajadores -> Gestión documental) Soporte para Docuware - (General -> Agencia) Soporte para Viaexpress +- (Tickets -> SMS) Nueva sección en Lilium ### Changed - (General -> Tickets) Devuelve el motivo por el cual no es editable - (Desplegables -> Trabajadores) Mejorados +- (General -> Clientes) Razón social y dirección en mayúsculas ### Fixed +- (Clientes -> SMS) Al pasar el ratón por encima muestra el mensaje completo ## [2330.01] - 2023-07-27 diff --git a/package-lock.json b/package-lock.json index f87e3f64b..10b5e6b02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.34.01", + "version": "23.32.02", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 37e39d5a5..04d1f1c7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.32.01", + "version": "23.32.02", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From afc0c980650db7633ad07477dd504dffd2d14d1b Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 10 Aug 2023 11:05:37 +0200 Subject: [PATCH 258/311] Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev --- CHANGELOG.md | 5 +- db/changes/233202/00-ticketSmsACL.sql | 3 + modules/client/front/sms/index.html | 4 +- .../back/methods/route/getExternalCmrs.js | 133 ++++++++++++++++++ modules/route/back/models/route.js | 1 + modules/ticket/front/index.js | 1 + modules/ticket/front/routes.json | 12 +- modules/ticket/front/sms/index.html | 2 + modules/ticket/front/sms/index.js | 21 +++ package-lock.json | 2 +- 10 files changed, 179 insertions(+), 5 deletions(-) create mode 100644 db/changes/233202/00-ticketSmsACL.sql create mode 100644 modules/route/back/methods/route/getExternalCmrs.js create mode 100644 modules/ticket/front/sms/index.html create mode 100644 modules/ticket/front/sms/index.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 15fe58d7f..1f3570932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,17 +15,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -## [2332.01] - 2023-08-09 +## [2332.01] - 2023-08-10 ### Added - (Trabajadores -> Gestión documental) Soporte para Docuware - (General -> Agencia) Soporte para Viaexpress +- (Tickets -> SMS) Nueva sección en Lilium ### Changed - (General -> Tickets) Devuelve el motivo por el cual no es editable - (Desplegables -> Trabajadores) Mejorados +- (General -> Clientes) Razón social y dirección en mayúsculas ### Fixed +- (Clientes -> SMS) Al pasar el ratón por encima muestra el mensaje completo ## [2330.01] - 2023-07-27 diff --git a/db/changes/233202/00-ticketSmsACL.sql b/db/changes/233202/00-ticketSmsACL.sql new file mode 100644 index 000000000..a25a876f8 --- /dev/null +++ b/db/changes/233202/00-ticketSmsACL.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('TicketSms', 'find', 'READ', 'ALLOW', 'ROLE', 'salesPerson'); diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index 9abadd312..e2bc0785e 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -8,7 +8,7 @@ auto-load="true"> - + @@ -27,7 +27,7 @@ {{::clientSms.sms.destination}} - {{::clientSms.sms.message}} + {{::clientSms.sms.message}} {{::clientSms.sms.status}} {{::clientSms.sms.created | date:'dd/MM/yyyy HH:mm'}} diff --git a/modules/route/back/methods/route/getExternalCmrs.js b/modules/route/back/methods/route/getExternalCmrs.js new file mode 100644 index 000000000..5b08cf34a --- /dev/null +++ b/modules/route/back/methods/route/getExternalCmrs.js @@ -0,0 +1,133 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; + +module.exports = Self => { + Self.remoteMethod('getExternalCmrs', { + description: 'Returns an array of external cmrs', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + }, + { + arg: 'cmrFk', + type: 'integer', + description: 'Searchs the route by id', + }, + { + arg: 'ticketFk', + type: 'integer', + description: 'The worker id', + }, + { + arg: 'country', + type: 'string', + description: 'The agencyMode id', + }, + { + arg: 'clientFk', + type: 'integer', + description: 'The vehicle id', + }, + { + arg: 'hasCmrDms', + type: 'boolean', + description: 'The vehicle id', + }, + { + arg: 'shipped', + type: 'date', + description: 'The to date filter', + }, + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getExternalCmrs`, + verb: 'GET' + } + }); + + Self.getExternalCmrs = async( + filter, + cmrFk, + ticketFk, + country, + clientFk, + hasCmrDms, + shipped, + options + ) => { + const params = { + cmrFk, + ticketFk, + country, + clientFk, + hasCmrDms, + shipped, + }; + const conn = Self.dataSource.connector; + + let where = buildFilter(params, (param, value) => {return {[param]: value}}); + filter = mergeFilters(filter, {where}); + + if (!filter.where) { + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + filter.where = {'shipped': yesterday.toISOString().split('T')[0]} + } + + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + let stmts = []; + const stmt = new ParameterizedSQL(` + SELECT * + FROM ( + SELECT t.cmrFk, + t.id ticketFk, + co.country, + t.clientFk, + sub.id hasCmrDms, + DATE(t.shipped) shipped + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state s ON s.id = ts.stateFk + JOIN alertLevel al ON al.id = s.alertLevel + JOIN client c ON c.id = t.clientFk + JOIN address a ON a.id = t.addressFk + JOIN province p ON p.id = a.provinceFk + JOIN country co ON co.id = p.countryFk + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + JOIN warehouse w ON w.id = t.warehouseFk + LEFT JOIN ( + SELECT td.ticketFk, d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + JOIN dmsType dt ON dt.id = d.dmsTypeFk + WHERE dt.name = 'cmr' + ) sub ON sub.ticketFk = t.id + WHERE co.code <> 'ES' + AND am.name <> 'ABONO' + AND w.code = 'ALG' + AND dm.code = 'DELIVERY' + AND t.cmrFk + ) sub + `); + + stmt.merge(conn.makeSuffix(filter)); + const itemsIndex = stmts.push(stmt) - 1; + + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql); + return itemsIndex === 0 ? result : result[itemsIndex]; + }; +}; diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index a8d44cd05..7e61acf25 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -15,6 +15,7 @@ module.exports = Self => { require('../methods/route/sendSms')(Self); require('../methods/route/downloadZip')(Self); require('../methods/route/cmr')(Self); + require('../methods/route/getExternalCmrs')(Self); Self.validate('kmStart', validateDistance, { message: 'Distance must be lesser than 1000' diff --git a/modules/ticket/front/index.js b/modules/ticket/front/index.js index 029dc16a4..d805cb0f8 100644 --- a/modules/ticket/front/index.js +++ b/modules/ticket/front/index.js @@ -36,3 +36,4 @@ import './future'; import './future-search-panel'; import './advance'; import './advance-search-panel'; +import './sms'; diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index c86b3a1ef..e403ab02d 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -26,7 +26,8 @@ {"state": "ticket.card.components", "icon": "icon-components"}, {"state": "ticket.card.saleTracking", "icon": "assignment"}, {"state": "ticket.card.dms.index", "icon": "cloud_download"}, - {"state": "ticket.card.boxing", "icon": "science"} + {"state": "ticket.card.boxing", "icon": "science"}, + {"state": "ticket.card.sms", "icon": "sms"} ] }, "keybindings": [ @@ -287,6 +288,15 @@ "state": "ticket.advance", "component": "vn-ticket-advance", "description": "Advance tickets" + }, + { + "url": "/sms", + "state": "ticket.card.sms", + "component": "vn-ticket-sms", + "description": "Sms", + "params": { + "ticket": "$ctrl.ticket" + } } ] } diff --git a/modules/ticket/front/sms/index.html b/modules/ticket/front/sms/index.html new file mode 100644 index 000000000..7fb3b870e --- /dev/null +++ b/modules/ticket/front/sms/index.html @@ -0,0 +1,2 @@ + + diff --git a/modules/ticket/front/sms/index.js b/modules/ticket/front/sms/index.js new file mode 100644 index 000000000..69d54aafe --- /dev/null +++ b/modules/ticket/front/sms/index.js @@ -0,0 +1,21 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +class Controller extends Section { + constructor($element, $) { + super($element, $); + } + + async $onInit() { + this.$state.go('ticket.card.summary', {id: this.$params.id}); + window.location.href = await this.vnApp.getUrl(`ticket/${this.$params.id}/sms`); + } +} + +ngModule.vnComponent('vnTicketSms', { + template: require('./index.html'), + controller: Controller, + bindings: { + ticket: '<' + } +}); diff --git a/package-lock.json b/package-lock.json index f87e3f64b..10b5e6b02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.34.01", + "version": "23.32.02", "lockfileVersion": 2, "requires": true, "packages": { From 4719922883b4126491e8128d32cb243422d344ca Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 11 Aug 2023 13:20:02 +0200 Subject: [PATCH 259/311] refs #5941 fix(support-dialog): change message, test: fix e2e --- front/core/components/support-dialog/index.html | 4 ++-- front/core/locale/en.yml | 3 ++- front/core/locale/es.yml | 3 ++- front/salix/module.js | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/front/core/components/support-dialog/index.html b/front/core/components/support-dialog/index.html index 87887aa6f..d03e1b7f2 100644 --- a/front/core/components/support-dialog/index.html +++ b/front/core/components/support-dialog/index.html @@ -3,7 +3,7 @@
Send cau
@@ -11,7 +11,7 @@ - {{'This email contains more relevant information for the IT team' | translate}} + {{'By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.' | translate}}
diff --git a/front/core/locale/en.yml b/front/core/locale/en.yml index 99a9b8049..3f6cb7d71 100644 --- a/front/core/locale/en.yml +++ b/front/core/locale/en.yml @@ -13,4 +13,5 @@ Finalize: Finalize Previous: Back Load more: Load more Auto-scroll interrupted, please adjust the search: Auto-scroll interrupted, please adjust the search -General search: General search \ No newline at end of file +General search: General search +ExplainReason: Explain the reason why this error should not occur diff --git a/front/core/locale/es.yml b/front/core/locale/es.yml index 534989f4d..e9c2311b4 100644 --- a/front/core/locale/es.yml +++ b/front/core/locale/es.yml @@ -65,4 +65,5 @@ No data: Sin datos Undo changes: Deshacer cambios Load more results: Cargar más resultados Send cau: Enviar cau -This email contains more relevant information for the IT team: Este correo contiene más información relevante para el equipo de informática +By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc +ExplainReason: Explique el motivo por el que no deberia aparecer este fallo diff --git a/front/salix/module.js b/front/salix/module.js index 2bcac89f9..f8fa0faf0 100644 --- a/front/salix/module.js +++ b/front/salix/module.js @@ -151,7 +151,7 @@ function $exceptionHandler(vnApp, $window, $state, $injector) { const additonalData = { frontPath: $state.current.name, - httpRequest: cause.replace('Possibly unhandled rejection: ', ''), + httpRequest: cause?.replace('Possibly unhandled rejection: ', ''), backError: exception }; vnApp.showError(message, additonalData); From 8d0b3efa113a3309ec22f389c95131c9792aa4a2 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 14 Aug 2023 09:39:40 +0200 Subject: [PATCH 260/311] refs #4815 feat:DeviceLog Model --- db/changes/233401/01-deviceLog_acl.sql | 6 ++++ modules/worker/back/model-config.json | 3 ++ modules/worker/back/models/device-log.json | 40 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 db/changes/233401/01-deviceLog_acl.sql create mode 100644 modules/worker/back/models/device-log.json diff --git a/db/changes/233401/01-deviceLog_acl.sql b/db/changes/233401/01-deviceLog_acl.sql new file mode 100644 index 000000000..dd8bc936b --- /dev/null +++ b/db/changes/233401/01-deviceLog_acl.sql @@ -0,0 +1,6 @@ + +ALTER TABLE vn.deviceLog ADD serialNumber varchar(45) DEFAULT NULL NULL; + +INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId) +VALUES( 'DeviceLog', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index 60ec273a5..b261f895e 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -23,6 +23,9 @@ "Device": { "dataSource": "vn" }, + "DeviceLog": { + "dataSource": "vn" + }, "DeviceProduction": { "dataSource": "vn" }, diff --git a/modules/worker/back/models/device-log.json b/modules/worker/back/models/device-log.json new file mode 100644 index 000000000..9278b9038 --- /dev/null +++ b/modules/worker/back/models/device-log.json @@ -0,0 +1,40 @@ +{ + "name": "DeviceLog", + "base": "VnModel", + "options": { + "mysql": { + "table": "deviceLog" + } + }, + "properties": { + "id": { + "id": true, + "type": "number" + }, + "android_id": { + "type": "string" + }, + "userFk": { + "type": "number" + }, + "created": { + "type": "date" + }, + "nameApp": { + "type": "string" + }, + "versionApp": { + "type": "string" + }, + "deviceProductionFk": { + "type": "number" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "userFk" + } + } +} From 5924303ae2105e36b0c40413407c8c18fbf24442 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 14 Aug 2023 09:53:53 +0200 Subject: [PATCH 261/311] refs #5483 Dumped fixtures for vn.time removed --- db/dump/dumpedFixtures.sql | 10 ---------- db/export-data.sh | 1 - 2 files changed, 11 deletions(-) diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index e9bbf9bb3..be4828c2d 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -464,16 +464,6 @@ INSERT INTO `ticketUpdateAction` VALUES (1,'Cambiar los precios en el ticket','c /*!40000 ALTER TABLE `ticketUpdateAction` ENABLE KEYS */; UNLOCK TABLES; --- --- Dumping data for table `time` --- - -LOCK TABLES `time` WRITE; -/*!40000 ALTER TABLE `time` DISABLE KEYS */; -INSERT INTO `time` VALUES ('2007-12-31',200801,12,2007,31,1,200712,2008),('2008-01-01',200801,1,2008,1,1,200801,2008),('2008-01-02',200801,1,2008,2,1,200801,2008),('2008-01-03',200801,1,2008,3,1,200801,2008),('2008-01-04',200801,1,2008,4,1,200801,2008),('2008-01-05',200801,1,2008,5,1,200801,2008),('2008-01-06',200802,1,2008,6,2,200801,2008),('2008-01-07',200802,1,2008,7,2,200801,2008),('2008-01-08',200802,1,2008,8,2,200801,2008),('2008-01-09',200802,1,2008,9,2,200801,2008),('2008-01-10',200802,1,2008,10,2,200801,2008),('2008-01-11',200802,1,2008,11,2,200801,2008),('2008-01-12',200802,1,2008,12,2,200801,2008),('2008-01-13',200803,1,2008,13,3,200801,2008),('2008-01-14',200803,1,2008,14,3,200801,2008),('2008-01-15',200803,1,2008,15,3,200801,2008),('2008-01-16',200803,1,2008,16,3,200801,2008),('2008-01-17',200803,1,2008,17,3,200801,2008),('2008-01-18',200803,1,2008,18,3,200801,2008),('2008-01-19',200803,1,2008,19,3,200801,2008),('2008-01-20',200804,1,2008,20,4,200801,2008),('2008-01-21',200804,1,2008,21,4,200801,2008),('2008-01-22',200804,1,2008,22,4,200801,2008),('2008-01-23',200804,1,2008,23,4,200801,2008),('2008-01-24',200804,1,2008,24,4,200801,2008),('2008-01-25',200804,1,2008,25,4,200801,2008),('2008-01-26',200804,1,2008,26,4,200801,2008),('2008-01-27',200805,1,2008,27,5,200801,2008),('2008-01-28',200805,1,2008,28,5,200801,2008),('2008-01-29',200805,1,2008,29,5,200801,2008),('2008-01-30',200805,1,2008,30,5,200801,2008),('2008-01-31',200805,1,2008,31,5,200801,2008),('2008-02-01',200805,2,2008,1,5,200802,2008),('2008-02-02',200805,2,2008,2,5,200802,2008),('2008-02-03',200806,2,2008,3,6,200802,2008),('2008-02-04',200806,2,2008,4,6,200802,2008),('2008-02-05',200806,2,2008,5,6,200802,2008),('2008-02-06',200806,2,2008,6,6,200802,2008),('2008-02-07',200806,2,2008,7,6,200802,2008),('2008-02-08',200806,2,2008,8,6,200802,2008),('2008-02-09',200806,2,2008,9,6,200802,2008),('2008-02-10',200807,2,2008,10,7,200802,2008),('2008-02-11',200807,2,2008,11,7,200802,2008),('2008-02-12',200807,2,2008,12,7,200802,2008),('2008-02-13',200807,2,2008,13,7,200802,2008),('2008-02-14',200807,2,2008,14,7,200802,2008),('2008-02-15',200807,2,2008,15,7,200802,2008),('2008-02-16',200807,2,2008,16,7,200802,2008),('2008-02-17',200808,2,2008,17,8,200802,2008),('2008-02-18',200808,2,2008,18,8,200802,2008),('2008-02-19',200808,2,2008,19,8,200802,2008),('2008-02-20',200808,2,2008,20,8,200802,2008),('2008-02-21',200808,2,2008,21,8,200802,2008),('2008-02-22',200808,2,2008,22,8,200802,2008),('2008-02-23',200808,2,2008,23,8,200802,2008),('2008-02-24',200809,2,2008,24,9,200802,2008),('2008-02-25',200809,2,2008,25,9,200802,2008),('2008-02-26',200809,2,2008,26,9,200802,2008),('2008-02-27',200809,2,2008,27,9,200802,2008),('2008-02-28',200809,2,2008,28,9,200802,2008),('2008-02-29',200809,2,2008,29,9,200802,2008),('2008-03-01',200809,3,2008,1,9,200803,2008),('2008-03-02',200810,3,2008,2,10,200803,2008),('2008-03-03',200810,3,2008,3,10,200803,2008),('2008-03-04',200810,3,2008,4,10,200803,2008),('2008-03-05',200810,3,2008,5,10,200803,2008),('2008-03-06',200810,3,2008,6,10,200803,2008),('2008-03-07',200810,3,2008,7,10,200803,2008),('2008-03-08',200810,3,2008,8,10,200803,2008),('2008-03-09',200811,3,2008,9,11,200803,2008),('2008-03-10',200811,3,2008,10,11,200803,2008),('2008-03-11',200811,3,2008,11,11,200803,2008),('2008-03-12',200811,3,2008,12,11,200803,2008),('2008-03-13',200811,3,2008,13,11,200803,2008),('2008-03-14',200811,3,2008,14,11,200803,2008),('2008-03-15',200811,3,2008,15,11,200803,2008),('2008-03-16',200812,3,2008,16,12,200803,2008),('2008-03-17',200812,3,2008,17,12,200803,2008),('2008-03-18',200812,3,2008,18,12,200803,2008),('2008-03-19',200812,3,2008,19,12,200803,2008),('2008-03-20',200812,3,2008,20,12,200803,2008),('2008-03-21',200812,3,2008,21,12,200803,2008),('2008-03-22',200812,3,2008,22,12,200803,2008),('2008-03-23',200813,3,2008,23,13,200803,2008),('2008-03-24',200813,3,2008,24,13,200803,2008),('2008-03-25',200813,3,2008,25,13,200803,2008),('2008-03-26',200813,3,2008,26,13,200803,2008),('2008-03-27',200813,3,2008,27,13,200803,2008),('2008-03-28',200813,3,2008,28,13,200803,2008),('2008-03-29',200813,3,2008,29,13,200803,2008),('2008-03-30',200814,3,2008,30,14,200803,2008),('2008-03-31',200814,3,2008,31,14,200803,2008),('2008-04-01',200814,4,2008,1,14,200804,2008),('2008-04-02',200814,4,2008,2,14,200804,2008),('2008-04-03',200814,4,2008,3,14,200804,2008),('2008-04-04',200814,4,2008,4,14,200804,2008),('2008-04-05',200814,4,2008,5,14,200804,2008),('2008-04-06',200815,4,2008,6,15,200804,2008),('2008-04-07',200815,4,2008,7,15,200804,2008),('2008-04-08',200815,4,2008,8,15,200804,2008),('2008-04-09',200815,4,2008,9,15,200804,2008),('2008-04-10',200815,4,2008,10,15,200804,2008),('2008-04-11',200815,4,2008,11,15,200804,2008),('2008-04-12',200815,4,2008,12,15,200804,2008),('2008-04-13',200816,4,2008,13,16,200804,2008),('2008-04-14',200816,4,2008,14,16,200804,2008),('2008-04-15',200816,4,2008,15,16,200804,2008),('2008-04-16',200816,4,2008,16,16,200804,2008),('2008-04-17',200816,4,2008,17,16,200804,2008),('2008-04-18',200816,4,2008,18,16,200804,2008),('2008-04-19',200816,4,2008,19,16,200804,2008),('2008-04-20',200817,4,2008,20,17,200804,2008),('2008-04-21',200817,4,2008,21,17,200804,2008),('2008-04-22',200817,4,2008,22,17,200804,2008),('2008-04-23',200817,4,2008,23,17,200804,2008),('2008-04-24',200817,4,2008,24,17,200804,2008),('2008-04-25',200817,4,2008,25,17,200804,2008),('2008-04-26',200817,4,2008,26,17,200804,2008),('2008-04-27',200818,4,2008,27,18,200804,2008),('2008-04-28',200818,4,2008,28,18,200804,2008),('2008-04-29',200818,4,2008,29,18,200804,2008),('2008-04-30',200818,4,2008,30,18,200804,2008),('2008-05-01',200818,5,2008,1,18,200805,2008),('2008-05-02',200818,5,2008,2,18,200805,2008),('2008-05-03',200818,5,2008,3,18,200805,2008),('2008-05-04',200819,5,2008,4,19,200805,2008),('2008-05-05',200819,5,2008,5,19,200805,2008),('2008-05-06',200819,5,2008,6,19,200805,2008),('2008-05-07',200819,5,2008,7,19,200805,2008),('2008-05-08',200819,5,2008,8,19,200805,2008),('2008-05-09',200819,5,2008,9,19,200805,2008),('2008-05-10',200819,5,2008,10,19,200805,2008),('2008-05-11',200820,5,2008,11,20,200805,2008),('2008-05-12',200820,5,2008,12,20,200805,2008),('2008-05-13',200820,5,2008,13,20,200805,2008),('2008-05-14',200820,5,2008,14,20,200805,2008),('2008-05-15',200820,5,2008,15,20,200805,2008),('2008-05-16',200820,5,2008,16,20,200805,2008),('2008-05-17',200820,5,2008,17,20,200805,2008),('2008-05-18',200821,5,2008,18,21,200805,2008),('2008-05-19',200821,5,2008,19,21,200805,2008),('2008-05-20',200821,5,2008,20,21,200805,2008),('2008-05-21',200821,5,2008,21,21,200805,2008),('2008-05-22',200821,5,2008,22,21,200805,2008),('2008-05-23',200821,5,2008,23,21,200805,2008),('2008-05-24',200821,5,2008,24,21,200805,2008),('2008-05-25',200822,5,2008,25,22,200805,2008),('2008-05-26',200822,5,2008,26,22,200805,2008),('2008-05-27',200822,5,2008,27,22,200805,2008),('2008-05-28',200822,5,2008,28,22,200805,2008),('2008-05-29',200822,5,2008,29,22,200805,2008),('2008-05-30',200822,5,2008,30,22,200805,2008),('2008-05-31',200822,5,2008,31,22,200805,2008),('2008-06-01',200823,6,2008,1,23,200806,2008),('2008-06-02',200823,6,2008,2,23,200806,2008),('2008-06-03',200823,6,2008,3,23,200806,2008),('2008-06-04',200823,6,2008,4,23,200806,2008),('2008-06-05',200823,6,2008,5,23,200806,2008),('2008-06-06',200823,6,2008,6,23,200806,2008),('2008-06-07',200823,6,2008,7,23,200806,2008),('2008-06-08',200824,6,2008,8,24,200806,2008),('2008-06-09',200824,6,2008,9,24,200806,2008),('2008-06-10',200824,6,2008,10,24,200806,2008),('2008-06-11',200824,6,2008,11,24,200806,2008),('2008-06-12',200824,6,2008,12,24,200806,2008),('2008-06-13',200824,6,2008,13,24,200806,2008),('2008-06-14',200824,6,2008,14,24,200806,2008),('2008-06-15',200825,6,2008,15,25,200806,2008),('2008-06-16',200825,6,2008,16,25,200806,2008),('2008-06-17',200825,6,2008,17,25,200806,2008),('2008-06-18',200825,6,2008,18,25,200806,2008),('2008-06-19',200825,6,2008,19,25,200806,2008),('2008-06-20',200825,6,2008,20,25,200806,2008),('2008-06-21',200825,6,2008,21,25,200806,2008),('2008-06-22',200826,6,2008,22,26,200806,2008),('2008-06-23',200826,6,2008,23,26,200806,2008),('2008-06-24',200826,6,2008,24,26,200806,2008),('2008-06-25',200826,6,2008,25,26,200806,2008),('2008-06-26',200826,6,2008,26,26,200806,2008),('2008-06-27',200826,6,2008,27,26,200806,2008),('2008-06-28',200826,6,2008,28,26,200806,2008),('2008-06-29',200827,6,2008,29,27,200806,2008),('2008-06-30',200827,6,2008,30,27,200806,2008),('2008-07-01',200827,7,2008,1,27,200807,2008),('2008-07-02',200827,7,2008,2,27,200807,2008),('2008-07-03',200827,7,2008,3,27,200807,2008),('2008-07-04',200827,7,2008,4,27,200807,2008),('2008-07-05',200827,7,2008,5,27,200807,2008),('2008-07-06',200828,7,2008,6,28,200807,2008),('2008-07-07',200828,7,2008,7,28,200807,2008),('2008-07-08',200828,7,2008,8,28,200807,2008),('2008-07-09',200828,7,2008,9,28,200807,2008),('2008-07-10',200828,7,2008,10,28,200807,2008),('2008-07-11',200828,7,2008,11,28,200807,2008),('2008-07-12',200828,7,2008,12,28,200807,2008),('2008-07-13',200829,7,2008,13,29,200807,2008),('2008-07-14',200829,7,2008,14,29,200807,2008),('2008-07-15',200829,7,2008,15,29,200807,2008),('2008-07-16',200829,7,2008,16,29,200807,2008),('2008-07-17',200829,7,2008,17,29,200807,2008),('2008-07-18',200829,7,2008,18,29,200807,2008),('2008-07-19',200829,7,2008,19,29,200807,2008),('2008-07-20',200830,7,2008,20,30,200807,2008),('2008-07-21',200830,7,2008,21,30,200807,2008),('2008-07-22',200830,7,2008,22,30,200807,2008),('2008-07-23',200830,7,2008,23,30,200807,2008),('2008-07-24',200830,7,2008,24,30,200807,2008),('2008-07-25',200830,7,2008,25,30,200807,2008),('2008-07-26',200830,7,2008,26,30,200807,2008),('2008-07-27',200831,7,2008,27,31,200807,2008),('2008-07-28',200831,7,2008,28,31,200807,2008),('2008-07-29',200831,7,2008,29,31,200807,2008),('2008-07-30',200831,7,2008,30,31,200807,2008),('2008-07-31',200831,7,2008,31,31,200807,2008),('2008-08-01',200831,8,2008,1,31,200808,2008),('2008-08-02',200831,8,2008,2,31,200808,2008),('2008-08-03',200832,8,2008,3,32,200808,2008),('2008-08-04',200832,8,2008,4,32,200808,2008),('2008-08-05',200832,8,2008,5,32,200808,2008),('2008-08-06',200832,8,2008,6,32,200808,2008),('2008-08-07',200832,8,2008,7,32,200808,2008),('2008-08-08',200832,8,2008,8,32,200808,2008),('2008-08-09',200832,8,2008,9,32,200808,2008),('2008-08-10',200833,8,2008,10,33,200808,2008),('2008-08-11',200833,8,2008,11,33,200808,2008),('2008-08-12',200833,8,2008,12,33,200808,2008),('2008-08-13',200833,8,2008,13,33,200808,2008),('2008-08-14',200833,8,2008,14,33,200808,2008),('2008-08-15',200833,8,2008,15,33,200808,2008),('2008-08-16',200833,8,2008,16,33,200808,2008),('2008-08-17',200834,8,2008,17,34,200808,2008),('2008-08-18',200834,8,2008,18,34,200808,2008),('2008-08-19',200834,8,2008,19,34,200808,2008),('2008-08-20',200834,8,2008,20,34,200808,2008),('2008-08-21',200834,8,2008,21,34,200808,2008),('2008-08-22',200834,8,2008,22,34,200808,2008),('2008-08-23',200834,8,2008,23,34,200808,2008),('2008-08-24',200835,8,2008,24,35,200808,2008),('2008-08-25',200835,8,2008,25,35,200808,2008),('2008-08-26',200835,8,2008,26,35,200808,2008),('2008-08-27',200835,8,2008,27,35,200808,2008),('2008-08-28',200835,8,2008,28,35,200808,2008),('2008-08-29',200835,8,2008,29,35,200808,2008),('2008-08-30',200835,8,2008,30,35,200808,2008),('2008-08-31',200836,8,2008,31,36,200808,2008),('2008-09-01',200836,9,2008,1,36,200809,2008),('2008-09-02',200836,9,2008,2,36,200809,2008),('2008-09-03',200836,9,2008,3,36,200809,2008),('2008-09-04',200836,9,2008,4,36,200809,2008),('2008-09-05',200836,9,2008,5,36,200809,2008),('2008-09-06',200836,9,2008,6,36,200809,2008),('2008-09-07',200837,9,2008,7,37,200809,2008),('2008-09-08',200837,9,2008,8,37,200809,2008),('2008-09-09',200837,9,2008,9,37,200809,2008),('2008-09-10',200837,9,2008,10,37,200809,2008),('2008-09-11',200837,9,2008,11,37,200809,2008),('2008-09-12',200837,9,2008,12,37,200809,2008),('2008-09-13',200837,9,2008,13,37,200809,2008),('2008-09-14',200838,9,2008,14,38,200809,2008),('2008-09-15',200838,9,2008,15,38,200809,2008),('2008-09-16',200838,9,2008,16,38,200809,2008),('2008-09-17',200838,9,2008,17,38,200809,2008),('2008-09-18',200838,9,2008,18,38,200809,2008),('2008-09-19',200838,9,2008,19,38,200809,2008),('2008-09-20',200838,9,2008,20,38,200809,2008),('2008-09-21',200839,9,2008,21,39,200809,2008),('2008-09-22',200839,9,2008,22,39,200809,2008),('2008-09-23',200839,9,2008,23,39,200809,2008),('2008-09-24',200839,9,2008,24,39,200809,2008),('2008-09-25',200839,9,2008,25,39,200809,2008),('2008-09-26',200839,9,2008,26,39,200809,2008),('2008-09-27',200839,9,2008,27,39,200809,2008),('2008-09-28',200840,9,2008,28,40,200809,2008),('2008-09-29',200840,9,2008,29,40,200809,2008),('2008-09-30',200840,9,2008,30,40,200809,2008),('2008-10-01',200840,10,2008,1,40,200810,2008),('2008-10-02',200840,10,2008,2,40,200810,2008),('2008-10-03',200840,10,2008,3,40,200810,2008),('2008-10-04',200840,10,2008,4,40,200810,2008),('2008-10-05',200841,10,2008,5,41,200810,2008),('2008-10-06',200841,10,2008,6,41,200810,2008),('2008-10-07',200841,10,2008,7,41,200810,2008),('2008-10-08',200841,10,2008,8,41,200810,2008),('2008-10-09',200841,10,2008,9,41,200810,2008),('2008-10-10',200841,10,2008,10,41,200810,2008),('2008-10-11',200841,10,2008,11,41,200810,2008),('2008-10-12',200842,10,2008,12,42,200810,2008),('2008-10-13',200842,10,2008,13,42,200810,2008),('2008-10-14',200842,10,2008,14,42,200810,2008),('2008-10-15',200842,10,2008,15,42,200810,2008),('2008-10-16',200842,10,2008,16,42,200810,2008),('2008-10-17',200842,10,2008,17,42,200810,2008),('2008-10-18',200842,10,2008,18,42,200810,2008),('2008-10-19',200843,10,2008,19,43,200810,2008),('2008-10-20',200843,10,2008,20,43,200810,2008),('2008-10-21',200843,10,2008,21,43,200810,2008),('2008-10-22',200843,10,2008,22,43,200810,2008),('2008-10-23',200843,10,2008,23,43,200810,2008),('2008-10-24',200843,10,2008,24,43,200810,2008),('2008-10-25',200843,10,2008,25,43,200810,2008),('2008-10-26',200844,10,2008,26,44,200810,2008),('2008-10-27',200844,10,2008,27,44,200810,2008),('2008-10-28',200844,10,2008,28,44,200810,2008),('2008-10-29',200844,10,2008,29,44,200810,2008),('2008-10-30',200844,10,2008,30,44,200810,2008),('2008-10-31',200844,10,2008,31,44,200810,2008),('2008-11-01',200844,11,2008,1,44,200811,2008),('2008-11-02',200845,11,2008,2,45,200811,2008),('2008-11-03',200845,11,2008,3,45,200811,2008),('2008-11-04',200845,11,2008,4,45,200811,2008),('2008-11-05',200845,11,2008,5,45,200811,2008),('2008-11-06',200845,11,2008,6,45,200811,2008),('2008-11-07',200845,11,2008,7,45,200811,2008),('2008-11-08',200845,11,2008,8,45,200811,2008),('2008-11-09',200846,11,2008,9,46,200811,2008),('2008-11-10',200846,11,2008,10,46,200811,2008),('2008-11-11',200846,11,2008,11,46,200811,2008),('2008-11-12',200846,11,2008,12,46,200811,2008),('2008-11-13',200846,11,2008,13,46,200811,2008),('2008-11-14',200846,11,2008,14,46,200811,2008),('2008-11-15',200846,11,2008,15,46,200811,2008),('2008-11-16',200847,11,2008,16,47,200811,2008),('2008-11-17',200847,11,2008,17,47,200811,2008),('2008-11-18',200847,11,2008,18,47,200811,2008),('2008-11-19',200847,11,2008,19,47,200811,2008),('2008-11-20',200847,11,2008,20,47,200811,2008),('2008-11-21',200847,11,2008,21,47,200811,2008),('2008-11-22',200847,11,2008,22,47,200811,2008),('2008-11-23',200848,11,2008,23,48,200811,2008),('2008-11-24',200848,11,2008,24,48,200811,2008),('2008-11-25',200848,11,2008,25,48,200811,2008),('2008-11-26',200848,11,2008,26,48,200811,2008),('2008-11-27',200848,11,2008,27,48,200811,2008),('2008-11-28',200848,11,2008,28,48,200811,2008),('2008-11-29',200848,11,2008,29,48,200811,2008),('2008-11-30',200849,11,2008,30,49,200811,2008),('2008-12-01',200849,12,2008,1,49,200812,2009),('2008-12-02',200849,12,2008,2,49,200812,2009),('2008-12-03',200849,12,2008,3,49,200812,2009),('2008-12-04',200849,12,2008,4,49,200812,2009),('2008-12-05',200849,12,2008,5,49,200812,2009),('2008-12-06',200849,12,2008,6,49,200812,2009),('2008-12-07',200850,12,2008,7,50,200812,2009),('2008-12-08',200850,12,2008,8,50,200812,2009),('2008-12-09',200850,12,2008,9,50,200812,2009),('2008-12-10',200850,12,2008,10,50,200812,2009),('2008-12-11',200850,12,2008,11,50,200812,2009),('2008-12-12',200850,12,2008,12,50,200812,2009),('2008-12-13',200850,12,2008,13,50,200812,2009),('2008-12-14',200851,12,2008,14,51,200812,2009),('2008-12-15',200851,12,2008,15,51,200812,2009),('2008-12-16',200851,12,2008,16,51,200812,2009),('2008-12-17',200851,12,2008,17,51,200812,2009),('2008-12-18',200851,12,2008,18,51,200812,2009),('2008-12-19',200851,12,2008,19,51,200812,2009),('2008-12-20',200851,12,2008,20,51,200812,2009),('2008-12-21',200852,12,2008,21,52,200812,2009),('2008-12-22',200852,12,2008,22,52,200812,2009),('2008-12-23',200852,12,2008,23,52,200812,2009),('2008-12-24',200852,12,2008,24,52,200812,2009),('2008-12-25',200852,12,2008,25,52,200812,2009),('2008-12-26',200852,12,2008,26,52,200812,2009),('2008-12-27',200852,12,2008,27,52,200812,2009),('2008-12-28',200853,12,2008,28,53,200812,2009),('2008-12-29',200901,12,2008,29,53,200812,2009),('2008-12-30',200901,12,2008,30,53,200812,2009),('2008-12-31',200901,12,2008,31,53,200812,2009),('2009-01-01',200901,1,2009,1,53,200901,2009),('2009-01-02',200901,1,2009,2,53,200901,2009),('2009-01-03',200901,1,2009,3,53,200901,2009),('2009-01-04',200902,1,2009,4,1,200901,2009),('2009-01-05',200902,1,2009,5,1,200901,2009),('2009-01-06',200902,1,2009,6,1,200901,2009),('2009-01-07',200902,1,2009,7,1,200901,2009),('2009-01-08',200902,1,2009,8,1,200901,2009),('2009-01-09',200902,1,2009,9,1,200901,2009),('2009-01-10',200902,1,2009,10,1,200901,2009),('2009-01-11',200903,1,2009,11,2,200901,2009),('2009-01-12',200903,1,2009,12,2,200901,2009),('2009-01-13',200903,1,2009,13,2,200901,2009),('2009-01-14',200903,1,2009,14,2,200901,2009),('2009-01-15',200903,1,2009,15,2,200901,2009),('2009-01-16',200903,1,2009,16,2,200901,2009),('2009-01-17',200903,1,2009,17,2,200901,2009),('2009-01-18',200904,1,2009,18,3,200901,2009),('2009-01-19',200904,1,2009,19,3,200901,2009),('2009-01-20',200904,1,2009,20,3,200901,2009),('2009-01-21',200904,1,2009,21,3,200901,2009),('2009-01-22',200904,1,2009,22,3,200901,2009),('2009-01-23',200904,1,2009,23,3,200901,2009),('2009-01-24',200904,1,2009,24,3,200901,2009),('2009-01-25',200905,1,2009,25,4,200901,2009),('2009-01-26',200905,1,2009,26,4,200901,2009),('2009-01-27',200905,1,2009,27,4,200901,2009),('2009-01-28',200905,1,2009,28,4,200901,2009),('2009-01-29',200905,1,2009,29,4,200901,2009),('2009-01-30',200905,1,2009,30,4,200901,2009),('2009-01-31',200905,1,2009,31,4,200901,2009),('2009-02-01',200906,2,2009,1,5,200902,2009),('2009-02-02',200906,2,2009,2,5,200902,2009),('2009-02-03',200906,2,2009,3,5,200902,2009),('2009-02-04',200906,2,2009,4,5,200902,2009),('2009-02-05',200906,2,2009,5,5,200902,2009),('2009-02-06',200906,2,2009,6,5,200902,2009),('2009-02-07',200906,2,2009,7,5,200902,2009),('2009-02-08',200907,2,2009,8,6,200902,2009),('2009-02-09',200907,2,2009,9,6,200902,2009),('2009-02-10',200907,2,2009,10,6,200902,2009),('2009-02-11',200907,2,2009,11,6,200902,2009),('2009-02-12',200907,2,2009,12,6,200902,2009),('2009-02-13',200907,2,2009,13,6,200902,2009),('2009-02-14',200907,2,2009,14,6,200902,2009),('2009-02-15',200908,2,2009,15,7,200902,2009),('2009-02-16',200908,2,2009,16,7,200902,2009),('2009-02-17',200908,2,2009,17,7,200902,2009),('2009-02-18',200908,2,2009,18,7,200902,2009),('2009-02-19',200908,2,2009,19,7,200902,2009),('2009-02-20',200908,2,2009,20,7,200902,2009),('2009-02-21',200908,2,2009,21,7,200902,2009),('2009-02-22',200909,2,2009,22,8,200902,2009),('2009-02-23',200909,2,2009,23,8,200902,2009),('2009-02-24',200909,2,2009,24,8,200902,2009),('2009-02-25',200909,2,2009,25,8,200902,2009),('2009-02-26',200909,2,2009,26,8,200902,2009),('2009-02-27',200909,2,2009,27,8,200902,2009),('2009-02-28',200909,2,2009,28,8,200902,2009),('2009-03-01',200910,3,2009,1,9,200903,2009),('2009-03-02',200910,3,2009,2,9,200903,2009),('2009-03-03',200910,3,2009,3,9,200903,2009),('2009-03-04',200910,3,2009,4,9,200903,2009),('2009-03-05',200910,3,2009,5,9,200903,2009),('2009-03-06',200910,3,2009,6,9,200903,2009),('2009-03-07',200910,3,2009,7,9,200903,2009),('2009-03-08',200911,3,2009,8,10,200903,2009),('2009-03-09',200911,3,2009,9,10,200903,2009),('2009-03-10',200911,3,2009,10,10,200903,2009),('2009-03-11',200911,3,2009,11,10,200903,2009),('2009-03-12',200911,3,2009,12,10,200903,2009),('2009-03-13',200911,3,2009,13,10,200903,2009),('2009-03-14',200911,3,2009,14,10,200903,2009),('2009-03-15',200912,3,2009,15,11,200903,2009),('2009-03-16',200912,3,2009,16,11,200903,2009),('2009-03-17',200912,3,2009,17,11,200903,2009),('2009-03-18',200912,3,2009,18,11,200903,2009),('2009-03-19',200912,3,2009,19,11,200903,2009),('2009-03-20',200912,3,2009,20,11,200903,2009),('2009-03-21',200912,3,2009,21,11,200903,2009),('2009-03-22',200913,3,2009,22,12,200903,2009),('2009-03-23',200913,3,2009,23,12,200903,2009),('2009-03-24',200913,3,2009,24,12,200903,2009),('2009-03-25',200913,3,2009,25,12,200903,2009),('2009-03-26',200913,3,2009,26,12,200903,2009),('2009-03-27',200913,3,2009,27,12,200903,2009),('2009-03-28',200913,3,2009,28,12,200903,2009),('2009-03-29',200914,3,2009,29,13,200903,2009),('2009-03-30',200914,3,2009,30,13,200903,2009),('2009-03-31',200914,3,2009,31,13,200903,2009),('2009-04-01',200914,4,2009,1,13,200904,2009),('2009-04-02',200914,4,2009,2,13,200904,2009),('2009-04-03',200914,4,2009,3,13,200904,2009),('2009-04-04',200914,4,2009,4,13,200904,2009),('2009-04-05',200915,4,2009,5,14,200904,2009),('2009-04-06',200915,4,2009,6,14,200904,2009),('2009-04-07',200915,4,2009,7,14,200904,2009),('2009-04-08',200915,4,2009,8,14,200904,2009),('2009-04-09',200915,4,2009,9,14,200904,2009),('2009-04-10',200915,4,2009,10,14,200904,2009),('2009-04-11',200915,4,2009,11,14,200904,2009),('2009-04-12',200916,4,2009,12,15,200904,2009),('2009-04-13',200916,4,2009,13,15,200904,2009),('2009-04-14',200916,4,2009,14,15,200904,2009),('2009-04-15',200916,4,2009,15,15,200904,2009),('2009-04-16',200916,4,2009,16,15,200904,2009),('2009-04-17',200916,4,2009,17,15,200904,2009),('2009-04-18',200916,4,2009,18,15,200904,2009),('2009-04-19',200917,4,2009,19,16,200904,2009),('2009-04-20',200917,4,2009,20,16,200904,2009),('2009-04-21',200917,4,2009,21,16,200904,2009),('2009-04-22',200917,4,2009,22,16,200904,2009),('2009-04-23',200917,4,2009,23,16,200904,2009),('2009-04-24',200917,4,2009,24,16,200904,2009),('2009-04-25',200917,4,2009,25,16,200904,2009),('2009-04-26',200918,4,2009,26,17,200904,2009),('2009-04-27',200918,4,2009,27,17,200904,2009),('2009-04-28',200918,4,2009,28,17,200904,2009),('2009-04-29',200918,4,2009,29,17,200904,2009),('2009-04-30',200918,4,2009,30,17,200904,2009),('2009-05-01',200918,5,2009,1,17,200905,2009),('2009-05-02',200918,5,2009,2,17,200905,2009),('2009-05-03',200919,5,2009,3,18,200905,2009),('2009-05-04',200919,5,2009,4,18,200905,2009),('2009-05-05',200919,5,2009,5,18,200905,2009),('2009-05-06',200919,5,2009,6,18,200905,2009),('2009-05-07',200919,5,2009,7,18,200905,2009),('2009-05-08',200919,5,2009,8,18,200905,2009),('2009-05-09',200919,5,2009,9,18,200905,2009),('2009-05-10',200920,5,2009,10,19,200905,2009),('2009-05-11',200920,5,2009,11,19,200905,2009),('2009-05-12',200920,5,2009,12,19,200905,2009),('2009-05-13',200920,5,2009,13,19,200905,2009),('2009-05-14',200920,5,2009,14,19,200905,2009),('2009-05-15',200920,5,2009,15,19,200905,2009),('2009-05-16',200920,5,2009,16,19,200905,2009),('2009-05-17',200921,5,2009,17,20,200905,2009),('2009-05-18',200921,5,2009,18,20,200905,2009),('2009-05-19',200921,5,2009,19,20,200905,2009),('2009-05-20',200921,5,2009,20,20,200905,2009),('2009-05-21',200921,5,2009,21,20,200905,2009),('2009-05-22',200921,5,2009,22,20,200905,2009),('2009-05-23',200921,5,2009,23,20,200905,2009),('2009-05-24',200922,5,2009,24,21,200905,2009),('2009-05-25',200922,5,2009,25,21,200905,2009),('2009-05-26',200922,5,2009,26,21,200905,2009),('2009-05-27',200922,5,2009,27,21,200905,2009),('2009-05-28',200922,5,2009,28,21,200905,2009),('2009-05-29',200922,5,2009,29,21,200905,2009),('2009-05-30',200922,5,2009,30,21,200905,2009),('2009-05-31',200923,5,2009,31,22,200905,2009),('2009-06-01',200923,6,2009,1,22,200906,2009),('2009-06-02',200923,6,2009,2,22,200906,2009),('2009-06-03',200923,6,2009,3,22,200906,2009),('2009-06-04',200923,6,2009,4,22,200906,2009),('2009-06-05',200923,6,2009,5,22,200906,2009),('2009-06-06',200923,6,2009,6,22,200906,2009),('2009-06-07',200924,6,2009,7,23,200906,2009),('2009-06-08',200924,6,2009,8,23,200906,2009),('2009-06-09',200924,6,2009,9,23,200906,2009),('2009-06-10',200924,6,2009,10,23,200906,2009),('2009-06-11',200924,6,2009,11,23,200906,2009),('2009-06-12',200924,6,2009,12,23,200906,2009),('2009-06-13',200924,6,2009,13,23,200906,2009),('2009-06-14',200925,6,2009,14,24,200906,2009),('2009-06-15',200925,6,2009,15,24,200906,2009),('2009-06-16',200925,6,2009,16,24,200906,2009),('2009-06-17',200925,6,2009,17,24,200906,2009),('2009-06-18',200925,6,2009,18,24,200906,2009),('2009-06-19',200925,6,2009,19,24,200906,2009),('2009-06-20',200925,6,2009,20,24,200906,2009),('2009-06-21',200926,6,2009,21,25,200906,2009),('2009-06-22',200926,6,2009,22,25,200906,2009),('2009-06-23',200926,6,2009,23,25,200906,2009),('2009-06-24',200926,6,2009,24,25,200906,2009),('2009-06-25',200926,6,2009,25,25,200906,2009),('2009-06-26',200926,6,2009,26,25,200906,2009),('2009-06-27',200926,6,2009,27,25,200906,2009),('2009-06-28',200927,6,2009,28,26,200906,2009),('2009-06-29',200927,6,2009,29,26,200906,2009),('2009-06-30',200927,6,2009,30,26,200906,2009),('2009-07-01',200927,7,2009,1,26,200907,2009),('2009-07-02',200927,7,2009,2,26,200907,2009),('2009-07-03',200927,7,2009,3,26,200907,2009),('2009-07-04',200927,7,2009,4,26,200907,2009),('2009-07-05',200928,7,2009,5,27,200907,2009),('2009-07-06',200928,7,2009,6,27,200907,2009),('2009-07-07',200928,7,2009,7,27,200907,2009),('2009-07-08',200928,7,2009,8,27,200907,2009),('2009-07-09',200928,7,2009,9,27,200907,2009),('2009-07-10',200928,7,2009,10,27,200907,2009),('2009-07-11',200928,7,2009,11,27,200907,2009),('2009-07-12',200929,7,2009,12,28,200907,2009),('2009-07-13',200929,7,2009,13,28,200907,2009),('2009-07-14',200929,7,2009,14,28,200907,2009),('2009-07-15',200929,7,2009,15,28,200907,2009),('2009-07-16',200929,7,2009,16,28,200907,2009),('2009-07-17',200929,7,2009,17,28,200907,2009),('2009-07-18',200929,7,2009,18,28,200907,2009),('2009-07-19',200930,7,2009,19,29,200907,2009),('2009-07-20',200930,7,2009,20,29,200907,2009),('2009-07-21',200930,7,2009,21,29,200907,2009),('2009-07-22',200930,7,2009,22,29,200907,2009),('2009-07-23',200930,7,2009,23,29,200907,2009),('2009-07-24',200930,7,2009,24,29,200907,2009),('2009-07-25',200930,7,2009,25,29,200907,2009),('2009-07-26',200931,7,2009,26,30,200907,2009),('2009-07-27',200931,7,2009,27,30,200907,2009),('2009-07-28',200931,7,2009,28,30,200907,2009),('2009-07-29',200931,7,2009,29,30,200907,2009),('2009-07-30',200931,7,2009,30,30,200907,2009),('2009-07-31',200931,7,2009,31,30,200907,2009),('2009-08-01',200931,8,2009,1,30,200908,2009),('2009-08-02',200932,8,2009,2,31,200908,2009),('2009-08-03',200932,8,2009,3,31,200908,2009),('2009-08-04',200932,8,2009,4,31,200908,2009),('2009-08-05',200932,8,2009,5,31,200908,2009),('2009-08-06',200932,8,2009,6,31,200908,2009),('2009-08-07',200932,8,2009,7,31,200908,2009),('2009-08-08',200932,8,2009,8,31,200908,2009),('2009-08-09',200933,8,2009,9,32,200908,2009),('2009-08-10',200933,8,2009,10,32,200908,2009),('2009-08-11',200933,8,2009,11,32,200908,2009),('2009-08-12',200933,8,2009,12,32,200908,2009),('2009-08-13',200933,8,2009,13,32,200908,2009),('2009-08-14',200933,8,2009,14,32,200908,2009),('2009-08-15',200933,8,2009,15,32,200908,2009),('2009-08-16',200934,8,2009,16,33,200908,2009),('2009-08-17',200934,8,2009,17,33,200908,2009),('2009-08-18',200934,8,2009,18,33,200908,2009),('2009-08-19',200934,8,2009,19,33,200908,2009),('2009-08-20',200934,8,2009,20,33,200908,2009),('2009-08-21',200934,8,2009,21,33,200908,2009),('2009-08-22',200934,8,2009,22,33,200908,2009),('2009-08-23',200935,8,2009,23,34,200908,2009),('2009-08-24',200935,8,2009,24,34,200908,2009),('2009-08-25',200935,8,2009,25,34,200908,2009),('2009-08-26',200935,8,2009,26,34,200908,2009),('2009-08-27',200935,8,2009,27,34,200908,2009),('2009-08-28',200935,8,2009,28,34,200908,2009),('2009-08-29',200935,8,2009,29,34,200908,2009),('2009-08-30',200936,8,2009,30,35,200908,2009),('2009-08-31',200936,8,2009,31,35,200908,2009),('2009-09-01',200936,9,2009,1,35,200909,2009),('2009-09-02',200936,9,2009,2,35,200909,2009),('2009-09-03',200936,9,2009,3,35,200909,2009),('2009-09-04',200936,9,2009,4,35,200909,2009),('2009-09-05',200936,9,2009,5,35,200909,2009),('2009-09-06',200937,9,2009,6,36,200909,2009),('2009-09-07',200937,9,2009,7,36,200909,2009),('2009-09-08',200937,9,2009,8,36,200909,2009),('2009-09-09',200937,9,2009,9,36,200909,2009),('2009-09-10',200937,9,2009,10,36,200909,2009),('2009-09-11',200937,9,2009,11,36,200909,2009),('2009-09-12',200937,9,2009,12,36,200909,2009),('2009-09-13',200938,9,2009,13,37,200909,2009),('2009-09-14',200938,9,2009,14,37,200909,2009),('2009-09-15',200938,9,2009,15,37,200909,2009),('2009-09-16',200938,9,2009,16,37,200909,2009),('2009-09-17',200938,9,2009,17,37,200909,2009),('2009-09-18',200938,9,2009,18,37,200909,2009),('2009-09-19',200938,9,2009,19,37,200909,2009),('2009-09-20',200939,9,2009,20,38,200909,2009),('2009-09-21',200939,9,2009,21,38,200909,2009),('2009-09-22',200939,9,2009,22,38,200909,2009),('2009-09-23',200939,9,2009,23,38,200909,2009),('2009-09-24',200939,9,2009,24,38,200909,2009),('2009-09-25',200939,9,2009,25,38,200909,2009),('2009-09-26',200939,9,2009,26,38,200909,2009),('2009-09-27',200940,9,2009,27,39,200909,2009),('2009-09-28',200940,9,2009,28,39,200909,2009),('2009-09-29',200940,9,2009,29,39,200909,2009),('2009-09-30',200940,9,2009,30,39,200909,2009),('2009-10-01',200940,10,2009,1,39,200910,2009),('2009-10-02',200940,10,2009,2,39,200910,2009),('2009-10-03',200940,10,2009,3,39,200910,2009),('2009-10-04',200941,10,2009,4,40,200910,2009),('2009-10-05',200941,10,2009,5,40,200910,2009),('2009-10-06',200941,10,2009,6,40,200910,2009),('2009-10-07',200941,10,2009,7,40,200910,2009),('2009-10-08',200941,10,2009,8,40,200910,2009),('2009-10-09',200941,10,2009,9,40,200910,2009),('2009-10-10',200941,10,2009,10,40,200910,2009),('2009-10-11',200942,10,2009,11,41,200910,2009),('2009-10-12',200942,10,2009,12,41,200910,2009),('2009-10-13',200942,10,2009,13,41,200910,2009),('2009-10-14',200942,10,2009,14,41,200910,2009),('2009-10-15',200942,10,2009,15,41,200910,2009),('2009-10-16',200942,10,2009,16,41,200910,2009),('2009-10-17',200942,10,2009,17,41,200910,2009),('2009-10-18',200943,10,2009,18,42,200910,2009),('2009-10-19',200943,10,2009,19,42,200910,2009),('2009-10-20',200943,10,2009,20,42,200910,2009),('2009-10-21',200943,10,2009,21,42,200910,2009),('2009-10-22',200943,10,2009,22,42,200910,2009),('2009-10-23',200943,10,2009,23,42,200910,2009),('2009-10-24',200943,10,2009,24,42,200910,2009),('2009-10-25',200944,10,2009,25,43,200910,2009),('2009-10-26',200944,10,2009,26,43,200910,2009),('2009-10-27',200944,10,2009,27,43,200910,2009),('2009-10-28',200944,10,2009,28,43,200910,2009),('2009-10-29',200944,10,2009,29,43,200910,2009),('2009-10-30',200944,10,2009,30,43,200910,2009),('2009-10-31',200944,10,2009,31,43,200910,2009),('2009-11-01',200945,11,2009,1,44,200911,2009),('2009-11-02',200945,11,2009,2,44,200911,2009),('2009-11-03',200945,11,2009,3,44,200911,2009),('2009-11-04',200945,11,2009,4,44,200911,2009),('2009-11-05',200945,11,2009,5,44,200911,2009),('2009-11-06',200945,11,2009,6,44,200911,2009),('2009-11-07',200945,11,2009,7,44,200911,2009),('2009-11-08',200946,11,2009,8,45,200911,2009),('2009-11-09',200946,11,2009,9,45,200911,2009),('2009-11-10',200946,11,2009,10,45,200911,2009),('2009-11-11',200946,11,2009,11,45,200911,2009),('2009-11-12',200946,11,2009,12,45,200911,2009),('2009-11-13',200946,11,2009,13,45,200911,2009),('2009-11-14',200946,11,2009,14,45,200911,2009),('2009-11-15',200947,11,2009,15,46,200911,2009),('2009-11-16',200947,11,2009,16,46,200911,2009),('2009-11-17',200947,11,2009,17,46,200911,2009),('2009-11-18',200947,11,2009,18,46,200911,2009),('2009-11-19',200947,11,2009,19,46,200911,2009),('2009-11-20',200947,11,2009,20,46,200911,2009),('2009-11-21',200947,11,2009,21,46,200911,2009),('2009-11-22',200948,11,2009,22,47,200911,2009),('2009-11-23',200948,11,2009,23,47,200911,2009),('2009-11-24',200948,11,2009,24,47,200911,2009),('2009-11-25',200948,11,2009,25,47,200911,2009),('2009-11-26',200948,11,2009,26,47,200911,2009),('2009-11-27',200948,11,2009,27,47,200911,2009),('2009-11-28',200948,11,2009,28,47,200911,2009),('2009-11-29',200949,11,2009,29,48,200911,2009),('2009-11-30',200949,11,2009,30,48,200911,2009),('2009-12-01',200949,12,2009,1,48,200912,2010),('2009-12-02',200949,12,2009,2,48,200912,2010),('2009-12-03',200949,12,2009,3,48,200912,2010),('2009-12-04',200949,12,2009,4,48,200912,2010),('2009-12-05',200949,12,2009,5,48,200912,2010),('2009-12-06',200950,12,2009,6,49,200912,2010),('2009-12-07',200950,12,2009,7,49,200912,2010),('2009-12-08',200950,12,2009,8,49,200912,2010),('2009-12-09',200950,12,2009,9,49,200912,2010),('2009-12-10',200950,12,2009,10,49,200912,2010),('2009-12-11',200950,12,2009,11,49,200912,2010),('2009-12-12',200950,12,2009,12,49,200912,2010),('2009-12-13',200951,12,2009,13,50,200912,2010),('2009-12-14',200951,12,2009,14,50,200912,2010),('2009-12-15',200951,12,2009,15,50,200912,2010),('2009-12-16',200951,12,2009,16,50,200912,2010),('2009-12-17',200951,12,2009,17,50,200912,2010),('2009-12-18',200951,12,2009,18,50,200912,2010),('2009-12-19',200951,12,2009,19,50,200912,2010),('2009-12-20',200952,12,2009,20,51,200912,2010),('2009-12-21',200952,12,2009,21,51,200912,2010),('2009-12-22',200952,12,2009,22,51,200912,2010),('2009-12-23',200952,12,2009,23,51,200912,2010),('2009-12-24',200952,12,2009,24,51,200912,2010),('2009-12-25',200952,12,2009,25,51,200912,2010),('2009-12-26',200952,12,2009,26,51,200912,2010),('2009-12-27',200953,12,2009,27,52,200912,2010),('2009-12-28',200952,12,2009,28,52,200912,2010),('2009-12-29',200952,12,2009,29,52,200912,2010),('2009-12-30',200952,12,2009,30,52,200912,2010),('2009-12-31',200952,12,2009,31,52,200912,2010),('2010-01-01',201001,1,2010,1,52,201001,2010),('2010-01-02',201001,1,2010,2,52,201001,2010),('2010-01-03',201002,1,2010,3,1,201001,2010),('2010-01-04',201001,1,2010,4,1,201001,2010),('2010-01-05',201001,1,2010,5,1,201001,2010),('2010-01-06',201001,1,2010,6,1,201001,2010),('2010-01-07',201001,1,2010,7,1,201001,2010),('2010-01-08',201001,1,2010,8,1,201001,2010),('2010-01-09',201001,1,2010,9,1,201001,2010),('2010-01-10',201002,1,2010,10,2,201001,2010),('2010-01-11',201002,1,2010,11,2,201001,2010),('2010-01-12',201002,1,2010,12,2,201001,2010),('2010-01-13',201002,1,2010,13,2,201001,2010),('2010-01-14',201002,1,2010,14,2,201001,2010),('2010-01-15',201002,1,2010,15,2,201001,2010),('2010-01-16',201002,1,2010,16,2,201001,2010),('2010-01-17',201003,1,2010,17,3,201001,2010),('2010-01-18',201003,1,2010,18,3,201001,2010),('2010-01-19',201003,1,2010,19,3,201001,2010),('2010-01-20',201003,1,2010,20,3,201001,2010),('2010-01-21',201003,1,2010,21,3,201001,2010),('2010-01-22',201003,1,2010,22,3,201001,2010),('2010-01-23',201003,1,2010,23,3,201001,2010),('2010-01-24',201004,1,2010,24,4,201001,2010),('2010-01-25',201004,1,2010,25,4,201001,2010),('2010-01-26',201004,1,2010,26,4,201001,2010),('2010-01-27',201004,1,2010,27,4,201001,2010),('2010-01-28',201004,1,2010,28,4,201001,2010),('2010-01-29',201004,1,2010,29,4,201001,2010),('2010-01-30',201004,1,2010,30,4,201001,2010),('2010-01-31',201005,1,2010,31,5,201001,2010),('2010-02-01',201005,2,2010,1,5,201002,2010),('2010-02-02',201005,2,2010,2,5,201002,2010),('2010-02-03',201005,2,2010,3,5,201002,2010),('2010-02-04',201005,2,2010,4,5,201002,2010),('2010-02-05',201005,2,2010,5,5,201002,2010),('2010-02-06',201005,2,2010,6,5,201002,2010),('2010-02-07',201006,2,2010,7,6,201002,2010),('2010-02-08',201006,2,2010,8,6,201002,2010),('2010-02-09',201006,2,2010,9,6,201002,2010),('2010-02-10',201006,2,2010,10,6,201002,2010),('2010-02-11',201006,2,2010,11,6,201002,2010),('2010-02-12',201006,2,2010,12,6,201002,2010),('2010-02-13',201006,2,2010,13,6,201002,2010),('2010-02-14',201007,2,2010,14,7,201002,2010),('2010-02-15',201007,2,2010,15,7,201002,2010),('2010-02-16',201007,2,2010,16,7,201002,2010),('2010-02-17',201007,2,2010,17,7,201002,2010),('2010-02-18',201007,2,2010,18,7,201002,2010),('2010-02-19',201007,2,2010,19,7,201002,2010),('2010-02-20',201007,2,2010,20,7,201002,2010),('2010-02-21',201008,2,2010,21,8,201002,2010),('2010-02-22',201008,2,2010,22,8,201002,2010),('2010-02-23',201008,2,2010,23,8,201002,2010),('2010-02-24',201008,2,2010,24,8,201002,2010),('2010-02-25',201008,2,2010,25,8,201002,2010),('2010-02-26',201008,2,2010,26,8,201002,2010),('2010-02-27',201008,2,2010,27,8,201002,2010),('2010-02-28',201009,2,2010,28,9,201002,2010),('2010-03-01',201009,3,2010,1,9,201003,2010),('2010-03-02',201009,3,2010,2,9,201003,2010),('2010-03-03',201009,3,2010,3,9,201003,2010),('2010-03-04',201009,3,2010,4,9,201003,2010),('2010-03-05',201009,3,2010,5,9,201003,2010),('2010-03-06',201009,3,2010,6,9,201003,2010),('2010-03-07',201010,3,2010,7,10,201003,2010),('2010-03-08',201010,3,2010,8,10,201003,2010),('2010-03-09',201010,3,2010,9,10,201003,2010),('2010-03-10',201010,3,2010,10,10,201003,2010),('2010-03-11',201010,3,2010,11,10,201003,2010),('2010-03-12',201010,3,2010,12,10,201003,2010),('2010-03-13',201010,3,2010,13,10,201003,2010),('2010-03-14',201011,3,2010,14,11,201003,2010),('2010-03-15',201011,3,2010,15,11,201003,2010),('2010-03-16',201011,3,2010,16,11,201003,2010),('2010-03-17',201011,3,2010,17,11,201003,2010),('2010-03-18',201011,3,2010,18,11,201003,2010),('2010-03-19',201011,3,2010,19,11,201003,2010),('2010-03-20',201011,3,2010,20,11,201003,2010),('2010-03-21',201012,3,2010,21,12,201003,2010),('2010-03-22',201012,3,2010,22,12,201003,2010),('2010-03-23',201012,3,2010,23,12,201003,2010),('2010-03-24',201012,3,2010,24,12,201003,2010),('2010-03-25',201012,3,2010,25,12,201003,2010),('2010-03-26',201012,3,2010,26,12,201003,2010),('2010-03-27',201012,3,2010,27,12,201003,2010),('2010-03-28',201013,3,2010,28,13,201003,2010),('2010-03-29',201013,3,2010,29,13,201003,2010),('2010-03-30',201013,3,2010,30,13,201003,2010),('2010-03-31',201013,3,2010,31,13,201003,2010),('2010-04-01',201013,4,2010,1,13,201004,2010),('2010-04-02',201013,4,2010,2,13,201004,2010),('2010-04-03',201013,4,2010,3,13,201004,2010),('2010-04-04',201014,4,2010,4,14,201004,2010),('2010-04-05',201014,4,2010,5,14,201004,2010),('2010-04-06',201014,4,2010,6,14,201004,2010),('2010-04-07',201014,4,2010,7,14,201004,2010),('2010-04-08',201014,4,2010,8,14,201004,2010),('2010-04-09',201014,4,2010,9,14,201004,2010),('2010-04-10',201014,4,2010,10,14,201004,2010),('2010-04-11',201015,4,2010,11,15,201004,2010),('2010-04-12',201015,4,2010,12,15,201004,2010),('2010-04-13',201015,4,2010,13,15,201004,2010),('2010-04-14',201015,4,2010,14,15,201004,2010),('2010-04-15',201015,4,2010,15,15,201004,2010),('2010-04-16',201015,4,2010,16,15,201004,2010),('2010-04-17',201015,4,2010,17,15,201004,2010),('2010-04-18',201016,4,2010,18,16,201004,2010),('2010-04-19',201016,4,2010,19,16,201004,2010),('2010-04-20',201016,4,2010,20,16,201004,2010),('2010-04-21',201016,4,2010,21,16,201004,2010),('2010-04-22',201016,4,2010,22,16,201004,2010),('2010-04-23',201016,4,2010,23,16,201004,2010),('2010-04-24',201016,4,2010,24,16,201004,2010),('2010-04-25',201017,4,2010,25,17,201004,2010),('2010-04-26',201017,4,2010,26,17,201004,2010),('2010-04-27',201017,4,2010,27,17,201004,2010),('2010-04-28',201017,4,2010,28,17,201004,2010),('2010-04-29',201017,4,2010,29,17,201004,2010),('2010-04-30',201017,4,2010,30,17,201004,2010),('2010-05-01',201017,5,2010,1,17,201005,2010),('2010-05-02',201018,5,2010,2,18,201005,2010),('2010-05-03',201018,5,2010,3,18,201005,2010),('2010-05-04',201018,5,2010,4,18,201005,2010),('2010-05-05',201018,5,2010,5,18,201005,2010),('2010-05-06',201018,5,2010,6,18,201005,2010),('2010-05-07',201018,5,2010,7,18,201005,2010),('2010-05-08',201018,5,2010,8,18,201005,2010),('2010-05-09',201019,5,2010,9,19,201005,2010),('2010-05-10',201019,5,2010,10,19,201005,2010),('2010-05-11',201019,5,2010,11,19,201005,2010),('2010-05-12',201019,5,2010,12,19,201005,2010),('2010-05-13',201019,5,2010,13,19,201005,2010),('2010-05-14',201019,5,2010,14,19,201005,2010),('2010-05-15',201019,5,2010,15,19,201005,2010),('2010-05-16',201020,5,2010,16,20,201005,2010),('2010-05-17',201020,5,2010,17,20,201005,2010),('2010-05-18',201020,5,2010,18,20,201005,2010),('2010-05-19',201020,5,2010,19,20,201005,2010),('2010-05-20',201020,5,2010,20,20,201005,2010),('2010-05-21',201020,5,2010,21,20,201005,2010),('2010-05-22',201020,5,2010,22,20,201005,2010),('2010-05-23',201021,5,2010,23,21,201005,2010),('2010-05-24',201021,5,2010,24,21,201005,2010),('2010-05-25',201021,5,2010,25,21,201005,2010),('2010-05-26',201021,5,2010,26,21,201005,2010),('2010-05-27',201021,5,2010,27,21,201005,2010),('2010-05-28',201021,5,2010,28,21,201005,2010),('2010-05-29',201021,5,2010,29,21,201005,2010),('2010-05-30',201022,5,2010,30,22,201005,2010),('2010-05-31',201022,5,2010,31,22,201005,2010),('2010-06-01',201022,6,2010,1,22,201006,2010),('2010-06-02',201022,6,2010,2,22,201006,2010),('2010-06-03',201022,6,2010,3,22,201006,2010),('2010-06-04',201022,6,2010,4,22,201006,2010),('2010-06-05',201022,6,2010,5,22,201006,2010),('2010-06-06',201023,6,2010,6,23,201006,2010),('2010-06-07',201023,6,2010,7,23,201006,2010),('2010-06-08',201023,6,2010,8,23,201006,2010),('2010-06-09',201023,6,2010,9,23,201006,2010),('2010-06-10',201023,6,2010,10,23,201006,2010),('2010-06-11',201023,6,2010,11,23,201006,2010),('2010-06-12',201023,6,2010,12,23,201006,2010),('2010-06-13',201024,6,2010,13,24,201006,2010),('2010-06-14',201024,6,2010,14,24,201006,2010),('2010-06-15',201024,6,2010,15,24,201006,2010),('2010-06-16',201024,6,2010,16,24,201006,2010),('2010-06-17',201024,6,2010,17,24,201006,2010),('2010-06-18',201024,6,2010,18,24,201006,2010),('2010-06-19',201024,6,2010,19,24,201006,2010),('2010-06-20',201025,6,2010,20,25,201006,2010),('2010-06-21',201025,6,2010,21,25,201006,2010),('2010-06-22',201025,6,2010,22,25,201006,2010),('2010-06-23',201025,6,2010,23,25,201006,2010),('2010-06-24',201025,6,2010,24,25,201006,2010),('2010-06-25',201025,6,2010,25,25,201006,2010),('2010-06-26',201025,6,2010,26,25,201006,2010),('2010-06-27',201026,6,2010,27,26,201006,2010),('2010-06-28',201026,6,2010,28,26,201006,2010),('2010-06-29',201026,6,2010,29,26,201006,2010),('2010-06-30',201026,6,2010,30,26,201006,2010),('2010-07-01',201026,7,2010,1,26,201007,2010),('2010-07-02',201026,7,2010,2,26,201007,2010),('2010-07-03',201026,7,2010,3,26,201007,2010),('2010-07-04',201027,7,2010,4,27,201007,2010),('2010-07-05',201027,7,2010,5,27,201007,2010),('2010-07-06',201027,7,2010,6,27,201007,2010),('2010-07-07',201027,7,2010,7,27,201007,2010),('2010-07-08',201027,7,2010,8,27,201007,2010),('2010-07-09',201027,7,2010,9,27,201007,2010),('2010-07-10',201027,7,2010,10,27,201007,2010),('2010-07-11',201028,7,2010,11,28,201007,2010),('2010-07-12',201028,7,2010,12,28,201007,2010),('2010-07-13',201028,7,2010,13,28,201007,2010),('2010-07-14',201028,7,2010,14,28,201007,2010),('2010-07-15',201028,7,2010,15,28,201007,2010),('2010-07-16',201028,7,2010,16,28,201007,2010),('2010-07-17',201028,7,2010,17,28,201007,2010),('2010-07-18',201029,7,2010,18,29,201007,2010),('2010-07-19',201029,7,2010,19,29,201007,2010),('2010-07-20',201029,7,2010,20,29,201007,2010),('2010-07-21',201029,7,2010,21,29,201007,2010),('2010-07-22',201029,7,2010,22,29,201007,2010),('2010-07-23',201029,7,2010,23,29,201007,2010),('2010-07-24',201029,7,2010,24,29,201007,2010),('2010-07-25',201030,7,2010,25,30,201007,2010),('2010-07-26',201030,7,2010,26,30,201007,2010),('2010-07-27',201030,7,2010,27,30,201007,2010),('2010-07-28',201030,7,2010,28,30,201007,2010),('2010-07-29',201030,7,2010,29,30,201007,2010),('2010-07-30',201030,7,2010,30,30,201007,2010),('2010-07-31',201030,7,2010,31,30,201007,2010),('2010-08-01',201031,8,2010,1,31,201008,2010),('2010-08-02',201031,8,2010,2,31,201008,2010),('2010-08-03',201031,8,2010,3,31,201008,2010),('2010-08-04',201031,8,2010,4,31,201008,2010),('2010-08-05',201031,8,2010,5,31,201008,2010),('2010-08-06',201031,8,2010,6,31,201008,2010),('2010-08-07',201031,8,2010,7,31,201008,2010),('2010-08-08',201032,8,2010,8,32,201008,2010),('2010-08-09',201032,8,2010,9,32,201008,2010),('2010-08-10',201032,8,2010,10,32,201008,2010),('2010-08-11',201032,8,2010,11,32,201008,2010),('2010-08-12',201032,8,2010,12,32,201008,2010),('2010-08-13',201032,8,2010,13,32,201008,2010),('2010-08-14',201032,8,2010,14,32,201008,2010),('2010-08-15',201033,8,2010,15,33,201008,2010),('2010-08-16',201033,8,2010,16,33,201008,2010),('2010-08-17',201033,8,2010,17,33,201008,2010),('2010-08-18',201033,8,2010,18,33,201008,2010),('2010-08-19',201033,8,2010,19,33,201008,2010),('2010-08-20',201033,8,2010,20,33,201008,2010),('2010-08-21',201033,8,2010,21,33,201008,2010),('2010-08-22',201034,8,2010,22,34,201008,2010),('2010-08-23',201034,8,2010,23,34,201008,2010),('2010-08-24',201034,8,2010,24,34,201008,2010),('2010-08-25',201034,8,2010,25,34,201008,2010),('2010-08-26',201034,8,2010,26,34,201008,2010),('2010-08-27',201034,8,2010,27,34,201008,2010),('2010-08-28',201034,8,2010,28,34,201008,2010),('2010-08-29',201035,8,2010,29,35,201008,2010),('2010-08-30',201035,8,2010,30,35,201008,2010),('2010-08-31',201035,8,2010,31,35,201008,2010),('2010-09-01',201035,9,2010,1,35,201009,2010),('2010-09-02',201035,9,2010,2,35,201009,2010),('2010-09-03',201035,9,2010,3,35,201009,2010),('2010-09-04',201035,9,2010,4,35,201009,2010),('2010-09-05',201036,9,2010,5,36,201009,2010),('2010-09-06',201036,9,2010,6,36,201009,2010),('2010-09-07',201036,9,2010,7,36,201009,2010),('2010-09-08',201036,9,2010,8,36,201009,2010),('2010-09-09',201036,9,2010,9,36,201009,2010),('2010-09-10',201036,9,2010,10,36,201009,2010),('2010-09-11',201036,9,2010,11,36,201009,2010),('2010-09-12',201037,9,2010,12,37,201009,2010),('2010-09-13',201037,9,2010,13,37,201009,2010),('2010-09-14',201037,9,2010,14,37,201009,2010),('2010-09-15',201037,9,2010,15,37,201009,2010),('2010-09-16',201037,9,2010,16,37,201009,2010),('2010-09-17',201037,9,2010,17,37,201009,2010),('2010-09-18',201037,9,2010,18,37,201009,2010),('2010-09-19',201038,9,2010,19,38,201009,2010),('2010-09-20',201038,9,2010,20,38,201009,2010),('2010-09-21',201038,9,2010,21,38,201009,2010),('2010-09-22',201038,9,2010,22,38,201009,2010),('2010-09-23',201038,9,2010,23,38,201009,2010),('2010-09-24',201038,9,2010,24,38,201009,2010),('2010-09-25',201038,9,2010,25,38,201009,2010),('2010-09-26',201039,9,2010,26,39,201009,2010),('2010-09-27',201039,9,2010,27,39,201009,2010),('2010-09-28',201039,9,2010,28,39,201009,2010),('2010-09-29',201039,9,2010,29,39,201009,2010),('2010-09-30',201039,9,2010,30,39,201009,2010),('2010-10-01',201039,10,2010,1,39,201010,2010),('2010-10-02',201039,10,2010,2,39,201010,2010),('2010-10-03',201040,10,2010,3,40,201010,2010),('2010-10-04',201040,10,2010,4,40,201010,2010),('2010-10-05',201040,10,2010,5,40,201010,2010),('2010-10-06',201040,10,2010,6,40,201010,2010),('2010-10-07',201040,10,2010,7,40,201010,2010),('2010-10-08',201040,10,2010,8,40,201010,2010),('2010-10-09',201040,10,2010,9,40,201010,2010),('2010-10-10',201041,10,2010,10,41,201010,2010),('2010-10-11',201041,10,2010,11,41,201010,2010),('2010-10-12',201041,10,2010,12,41,201010,2010),('2010-10-13',201041,10,2010,13,41,201010,2010),('2010-10-14',201041,10,2010,14,41,201010,2010),('2010-10-15',201041,10,2010,15,41,201010,2010),('2010-10-16',201041,10,2010,16,41,201010,2010),('2010-10-17',201042,10,2010,17,42,201010,2010),('2010-10-18',201042,10,2010,18,42,201010,2010),('2010-10-19',201042,10,2010,19,42,201010,2010),('2010-10-20',201042,10,2010,20,42,201010,2010),('2010-10-21',201042,10,2010,21,42,201010,2010),('2010-10-22',201042,10,2010,22,42,201010,2010),('2010-10-23',201042,10,2010,23,42,201010,2010),('2010-10-24',201043,10,2010,24,43,201010,2010),('2010-10-25',201043,10,2010,25,43,201010,2010),('2010-10-26',201043,10,2010,26,43,201010,2010),('2010-10-27',201043,10,2010,27,43,201010,2010),('2010-10-28',201043,10,2010,28,43,201010,2010),('2010-10-29',201043,10,2010,29,43,201010,2010),('2010-10-30',201043,10,2010,30,43,201010,2010),('2010-10-31',201044,10,2010,31,44,201010,2010),('2010-11-01',201044,11,2010,1,44,201011,2010),('2010-11-02',201044,11,2010,2,44,201011,2010),('2010-11-03',201044,11,2010,3,44,201011,2010),('2010-11-04',201044,11,2010,4,44,201011,2010),('2010-11-05',201044,11,2010,5,44,201011,2010),('2010-11-06',201044,11,2010,6,44,201011,2010),('2010-11-07',201045,11,2010,7,45,201011,2010),('2010-11-08',201045,11,2010,8,45,201011,2010),('2010-11-09',201045,11,2010,9,45,201011,2010),('2010-11-10',201045,11,2010,10,45,201011,2010),('2010-11-11',201045,11,2010,11,45,201011,2010),('2010-11-12',201045,11,2010,12,45,201011,2010),('2010-11-13',201045,11,2010,13,45,201011,2010),('2010-11-14',201046,11,2010,14,46,201011,2010),('2010-11-15',201046,11,2010,15,46,201011,2010),('2010-11-16',201046,11,2010,16,46,201011,2010),('2010-11-17',201046,11,2010,17,46,201011,2010),('2010-11-18',201046,11,2010,18,46,201011,2010),('2010-11-19',201046,11,2010,19,46,201011,2010),('2010-11-20',201046,11,2010,20,46,201011,2010),('2010-11-21',201047,11,2010,21,47,201011,2010),('2010-11-22',201047,11,2010,22,47,201011,2010),('2010-11-23',201047,11,2010,23,47,201011,2010),('2010-11-24',201047,11,2010,24,47,201011,2010),('2010-11-25',201047,11,2010,25,47,201011,2010),('2010-11-26',201047,11,2010,26,47,201011,2010),('2010-11-27',201047,11,2010,27,47,201011,2010),('2010-11-28',201048,11,2010,28,48,201011,2010),('2010-11-29',201048,11,2010,29,48,201011,2010),('2010-11-30',201048,11,2010,30,48,201011,2010),('2010-12-01',201048,12,2010,1,48,201012,2011),('2010-12-02',201048,12,2010,2,48,201012,2011),('2010-12-03',201048,12,2010,3,48,201012,2011),('2010-12-04',201048,12,2010,4,48,201012,2011),('2010-12-05',201049,12,2010,5,49,201012,2011),('2010-12-06',201049,12,2010,6,49,201012,2011),('2010-12-07',201049,12,2010,7,49,201012,2011),('2010-12-08',201049,12,2010,8,49,201012,2011),('2010-12-09',201049,12,2010,9,49,201012,2011),('2010-12-10',201049,12,2010,10,49,201012,2011),('2010-12-11',201049,12,2010,11,49,201012,2011),('2010-12-12',201050,12,2010,12,50,201012,2011),('2010-12-13',201050,12,2010,13,50,201012,2011),('2010-12-14',201050,12,2010,14,50,201012,2011),('2010-12-15',201050,12,2010,15,50,201012,2011),('2010-12-16',201050,12,2010,16,50,201012,2011),('2010-12-17',201050,12,2010,17,50,201012,2011),('2010-12-18',201050,12,2010,18,50,201012,2011),('2010-12-19',201051,12,2010,19,51,201012,2011),('2010-12-20',201051,12,2010,20,51,201012,2011),('2010-12-21',201051,12,2010,21,51,201012,2011),('2010-12-22',201051,12,2010,22,51,201012,2011),('2010-12-23',201051,12,2010,23,51,201012,2011),('2010-12-24',201051,12,2010,24,51,201012,2011),('2010-12-25',201051,12,2010,25,51,201012,2011),('2010-12-26',201052,12,2010,26,52,201012,2011),('2010-12-27',201052,12,2010,27,52,201012,2011),('2010-12-28',201052,12,2010,28,52,201012,2011),('2010-12-29',201052,12,2010,29,52,201012,2011),('2010-12-30',201052,12,2010,30,52,201012,2011),('2010-12-31',201052,12,2010,31,52,201012,2011),('2011-01-01',201052,1,2011,1,52,201101,2011),('2011-01-02',201053,1,2011,2,1,201101,2011),('2011-01-03',201101,1,2011,3,1,201101,2011),('2011-01-04',201101,1,2011,4,1,201101,2011),('2011-01-05',201101,1,2011,5,1,201101,2011),('2011-01-06',201101,1,2011,6,1,201101,2011),('2011-01-07',201101,1,2011,7,1,201101,2011),('2011-01-08',201101,1,2011,8,1,201101,2011),('2011-01-09',201102,1,2011,9,2,201101,2011),('2011-01-10',201102,1,2011,10,2,201101,2011),('2011-01-11',201102,1,2011,11,2,201101,2011),('2011-01-12',201102,1,2011,12,2,201101,2011),('2011-01-13',201102,1,2011,13,2,201101,2011),('2011-01-14',201102,1,2011,14,2,201101,2011),('2011-01-15',201102,1,2011,15,2,201101,2011),('2011-01-16',201103,1,2011,16,3,201101,2011),('2011-01-17',201103,1,2011,17,3,201101,2011),('2011-01-18',201103,1,2011,18,3,201101,2011),('2011-01-19',201103,1,2011,19,3,201101,2011),('2011-01-20',201103,1,2011,20,3,201101,2011),('2011-01-21',201103,1,2011,21,3,201101,2011),('2011-01-22',201103,1,2011,22,3,201101,2011),('2011-01-23',201104,1,2011,23,4,201101,2011),('2011-01-24',201104,1,2011,24,4,201101,2011),('2011-01-25',201104,1,2011,25,4,201101,2011),('2011-01-26',201104,1,2011,26,4,201101,2011),('2011-01-27',201104,1,2011,27,4,201101,2011),('2011-01-28',201104,1,2011,28,4,201101,2011),('2011-01-29',201104,1,2011,29,4,201101,2011),('2011-01-30',201105,1,2011,30,5,201101,2011),('2011-01-31',201105,1,2011,31,5,201101,2011),('2011-02-01',201105,2,2011,1,5,201102,2011),('2011-02-02',201105,2,2011,2,5,201102,2011),('2011-02-03',201105,2,2011,3,5,201102,2011),('2011-02-04',201105,2,2011,4,5,201102,2011),('2011-02-05',201105,2,2011,5,5,201102,2011),('2011-02-06',201106,2,2011,6,6,201102,2011),('2011-02-07',201106,2,2011,7,6,201102,2011),('2011-02-08',201106,2,2011,8,6,201102,2011),('2011-02-09',201106,2,2011,9,6,201102,2011),('2011-02-10',201106,2,2011,10,6,201102,2011),('2011-02-11',201106,2,2011,11,6,201102,2011),('2011-02-12',201106,2,2011,12,6,201102,2011),('2011-02-13',201107,2,2011,13,7,201102,2011),('2011-02-14',201107,2,2011,14,7,201102,2011),('2011-02-15',201107,2,2011,15,7,201102,2011),('2011-02-16',201107,2,2011,16,7,201102,2011),('2011-02-17',201107,2,2011,17,7,201102,2011),('2011-02-18',201107,2,2011,18,7,201102,2011),('2011-02-19',201107,2,2011,19,7,201102,2011),('2011-02-20',201108,2,2011,20,8,201102,2011),('2011-02-21',201108,2,2011,21,8,201102,2011),('2011-02-22',201108,2,2011,22,8,201102,2011),('2011-02-23',201108,2,2011,23,8,201102,2011),('2011-02-24',201108,2,2011,24,8,201102,2011),('2011-02-25',201108,2,2011,25,8,201102,2011),('2011-02-26',201108,2,2011,26,8,201102,2011),('2011-02-27',201109,2,2011,27,9,201102,2011),('2011-02-28',201109,2,2011,28,9,201102,2011),('2011-03-01',201109,3,2011,1,9,201103,2011),('2011-03-02',201109,3,2011,2,9,201103,2011),('2011-03-03',201109,3,2011,3,9,201103,2011),('2011-03-04',201109,3,2011,4,9,201103,2011),('2011-03-05',201109,3,2011,5,9,201103,2011),('2011-03-06',201110,3,2011,6,10,201103,2011),('2011-03-07',201110,3,2011,7,10,201103,2011),('2011-03-08',201110,3,2011,8,10,201103,2011),('2011-03-09',201110,3,2011,9,10,201103,2011),('2011-03-10',201110,3,2011,10,10,201103,2011),('2011-03-11',201110,3,2011,11,10,201103,2011),('2011-03-12',201110,3,2011,12,10,201103,2011),('2011-03-13',201111,3,2011,13,11,201103,2011),('2011-03-14',201111,3,2011,14,11,201103,2011),('2011-03-15',201111,3,2011,15,11,201103,2011),('2011-03-16',201111,3,2011,16,11,201103,2011),('2011-03-17',201111,3,2011,17,11,201103,2011),('2011-03-18',201111,3,2011,18,11,201103,2011),('2011-03-19',201111,3,2011,19,11,201103,2011),('2011-03-20',201112,3,2011,20,12,201103,2011),('2011-03-21',201112,3,2011,21,12,201103,2011),('2011-03-22',201112,3,2011,22,12,201103,2011),('2011-03-23',201112,3,2011,23,12,201103,2011),('2011-03-24',201112,3,2011,24,12,201103,2011),('2011-03-25',201112,3,2011,25,12,201103,2011),('2011-03-26',201112,3,2011,26,12,201103,2011),('2011-03-27',201113,3,2011,27,13,201103,2011),('2011-03-28',201113,3,2011,28,13,201103,2011),('2011-03-29',201113,3,2011,29,13,201103,2011),('2011-03-30',201113,3,2011,30,13,201103,2011),('2011-03-31',201113,3,2011,31,13,201103,2011),('2011-04-01',201113,4,2011,1,13,201104,2011),('2011-04-02',201113,4,2011,2,13,201104,2011),('2011-04-03',201114,4,2011,3,14,201104,2011),('2011-04-04',201114,4,2011,4,14,201104,2011),('2011-04-05',201114,4,2011,5,14,201104,2011),('2011-04-06',201114,4,2011,6,14,201104,2011),('2011-04-07',201114,4,2011,7,14,201104,2011),('2011-04-08',201114,4,2011,8,14,201104,2011),('2011-04-09',201114,4,2011,9,14,201104,2011),('2011-04-10',201115,4,2011,10,15,201104,2011),('2011-04-11',201115,4,2011,11,15,201104,2011),('2011-04-12',201115,4,2011,12,15,201104,2011),('2011-04-13',201115,4,2011,13,15,201104,2011),('2011-04-14',201115,4,2011,14,15,201104,2011),('2011-04-15',201115,4,2011,15,15,201104,2011),('2011-04-16',201115,4,2011,16,15,201104,2011),('2011-04-17',201116,4,2011,17,16,201104,2011),('2011-04-18',201116,4,2011,18,16,201104,2011),('2011-04-19',201116,4,2011,19,16,201104,2011),('2011-04-20',201116,4,2011,20,16,201104,2011),('2011-04-21',201116,4,2011,21,16,201104,2011),('2011-04-22',201116,4,2011,22,16,201104,2011),('2011-04-23',201116,4,2011,23,16,201104,2011),('2011-04-24',201117,4,2011,24,17,201104,2011),('2011-04-25',201117,4,2011,25,17,201104,2011),('2011-04-26',201117,4,2011,26,17,201104,2011),('2011-04-27',201117,4,2011,27,17,201104,2011),('2011-04-28',201117,4,2011,28,17,201104,2011),('2011-04-29',201117,4,2011,29,17,201104,2011),('2011-04-30',201117,4,2011,30,17,201104,2011),('2011-05-01',201118,5,2011,1,18,201105,2011),('2011-05-02',201118,5,2011,2,18,201105,2011),('2011-05-03',201118,5,2011,3,18,201105,2011),('2011-05-04',201118,5,2011,4,18,201105,2011),('2011-05-05',201118,5,2011,5,18,201105,2011),('2011-05-06',201118,5,2011,6,18,201105,2011),('2011-05-07',201118,5,2011,7,18,201105,2011),('2011-05-08',201119,5,2011,8,19,201105,2011),('2011-05-09',201119,5,2011,9,19,201105,2011),('2011-05-10',201119,5,2011,10,19,201105,2011),('2011-05-11',201119,5,2011,11,19,201105,2011),('2011-05-12',201119,5,2011,12,19,201105,2011),('2011-05-13',201119,5,2011,13,19,201105,2011),('2011-05-14',201119,5,2011,14,19,201105,2011),('2011-05-15',201120,5,2011,15,20,201105,2011),('2011-05-16',201120,5,2011,16,20,201105,2011),('2011-05-17',201120,5,2011,17,20,201105,2011),('2011-05-18',201120,5,2011,18,20,201105,2011),('2011-05-19',201120,5,2011,19,20,201105,2011),('2011-05-20',201120,5,2011,20,20,201105,2011),('2011-05-21',201120,5,2011,21,20,201105,2011),('2011-05-22',201121,5,2011,22,21,201105,2011),('2011-05-23',201121,5,2011,23,21,201105,2011),('2011-05-24',201121,5,2011,24,21,201105,2011),('2011-05-25',201121,5,2011,25,21,201105,2011),('2011-05-26',201121,5,2011,26,21,201105,2011),('2011-05-27',201121,5,2011,27,21,201105,2011),('2011-05-28',201121,5,2011,28,21,201105,2011),('2011-05-29',201122,5,2011,29,22,201105,2011),('2011-05-30',201122,5,2011,30,22,201105,2011),('2011-05-31',201122,5,2011,31,22,201105,2011),('2011-06-01',201122,6,2011,1,22,201106,2011),('2011-06-02',201122,6,2011,2,22,201106,2011),('2011-06-03',201122,6,2011,3,22,201106,2011),('2011-06-04',201122,6,2011,4,22,201106,2011),('2011-06-05',201123,6,2011,5,23,201106,2011),('2011-06-06',201123,6,2011,6,23,201106,2011),('2011-06-07',201123,6,2011,7,23,201106,2011),('2011-06-08',201123,6,2011,8,23,201106,2011),('2011-06-09',201123,6,2011,9,23,201106,2011),('2011-06-10',201123,6,2011,10,23,201106,2011),('2011-06-11',201123,6,2011,11,23,201106,2011),('2011-06-12',201124,6,2011,12,24,201106,2011),('2011-06-13',201124,6,2011,13,24,201106,2011),('2011-06-14',201124,6,2011,14,24,201106,2011),('2011-06-15',201124,6,2011,15,24,201106,2011),('2011-06-16',201124,6,2011,16,24,201106,2011),('2011-06-17',201124,6,2011,17,24,201106,2011),('2011-06-18',201124,6,2011,18,24,201106,2011),('2011-06-19',201125,6,2011,19,25,201106,2011),('2011-06-20',201125,6,2011,20,25,201106,2011),('2011-06-21',201125,6,2011,21,25,201106,2011),('2011-06-22',201125,6,2011,22,25,201106,2011),('2011-06-23',201125,6,2011,23,25,201106,2011),('2011-06-24',201125,6,2011,24,25,201106,2011),('2011-06-25',201125,6,2011,25,25,201106,2011),('2011-06-26',201126,6,2011,26,26,201106,2011),('2011-06-27',201126,6,2011,27,26,201106,2011),('2011-06-28',201126,6,2011,28,26,201106,2011),('2011-06-29',201126,6,2011,29,26,201106,2011),('2011-06-30',201126,6,2011,30,26,201106,2011),('2011-07-01',201126,7,2011,1,26,201107,2011),('2011-07-02',201126,7,2011,2,26,201107,2011),('2011-07-03',201127,7,2011,3,27,201107,2011),('2011-07-04',201127,7,2011,4,27,201107,2011),('2011-07-05',201127,7,2011,5,27,201107,2011),('2011-07-06',201127,7,2011,6,27,201107,2011),('2011-07-07',201127,7,2011,7,27,201107,2011),('2011-07-08',201127,7,2011,8,27,201107,2011),('2011-07-09',201127,7,2011,9,27,201107,2011),('2011-07-10',201128,7,2011,10,28,201107,2011),('2011-07-11',201128,7,2011,11,28,201107,2011),('2011-07-12',201128,7,2011,12,28,201107,2011),('2011-07-13',201128,7,2011,13,28,201107,2011),('2011-07-14',201128,7,2011,14,28,201107,2011),('2011-07-15',201128,7,2011,15,28,201107,2011),('2011-07-16',201128,7,2011,16,28,201107,2011),('2011-07-17',201129,7,2011,17,29,201107,2011),('2011-07-18',201129,7,2011,18,29,201107,2011),('2011-07-19',201129,7,2011,19,29,201107,2011),('2011-07-20',201129,7,2011,20,29,201107,2011),('2011-07-21',201129,7,2011,21,29,201107,2011),('2011-07-22',201129,7,2011,22,29,201107,2011),('2011-07-23',201129,7,2011,23,29,201107,2011),('2011-07-24',201130,7,2011,24,30,201107,2011),('2011-07-25',201130,7,2011,25,30,201107,2011),('2011-07-26',201130,7,2011,26,30,201107,2011),('2011-07-27',201130,7,2011,27,30,201107,2011),('2011-07-28',201130,7,2011,28,30,201107,2011),('2011-07-29',201130,7,2011,29,30,201107,2011),('2011-07-30',201130,7,2011,30,30,201107,2011),('2011-07-31',201131,7,2011,31,31,201107,2011),('2011-08-01',201131,8,2011,1,31,201108,2011),('2011-08-02',201131,8,2011,2,31,201108,2011),('2011-08-03',201131,8,2011,3,31,201108,2011),('2011-08-04',201131,8,2011,4,31,201108,2011),('2011-08-05',201131,8,2011,5,31,201108,2011),('2011-08-06',201131,8,2011,6,31,201108,2011),('2011-08-07',201132,8,2011,7,32,201108,2011),('2011-08-08',201132,8,2011,8,32,201108,2011),('2011-08-09',201132,8,2011,9,32,201108,2011),('2011-08-10',201132,8,2011,10,32,201108,2011),('2011-08-11',201132,8,2011,11,32,201108,2011),('2011-08-12',201132,8,2011,12,32,201108,2011),('2011-08-13',201132,8,2011,13,32,201108,2011),('2011-08-14',201133,8,2011,14,33,201108,2011),('2011-08-15',201133,8,2011,15,33,201108,2011),('2011-08-16',201133,8,2011,16,33,201108,2011),('2011-08-17',201133,8,2011,17,33,201108,2011),('2011-08-18',201133,8,2011,18,33,201108,2011),('2011-08-19',201133,8,2011,19,33,201108,2011),('2011-08-20',201133,8,2011,20,33,201108,2011),('2011-08-21',201134,8,2011,21,34,201108,2011),('2011-08-22',201134,8,2011,22,34,201108,2011),('2011-08-23',201134,8,2011,23,34,201108,2011),('2011-08-24',201134,8,2011,24,34,201108,2011),('2011-08-25',201134,8,2011,25,34,201108,2011),('2011-08-26',201134,8,2011,26,34,201108,2011),('2011-08-27',201134,8,2011,27,34,201108,2011),('2011-08-28',201135,8,2011,28,35,201108,2011),('2011-08-29',201135,8,2011,29,35,201108,2011),('2011-08-30',201135,8,2011,30,35,201108,2011),('2011-08-31',201135,8,2011,31,35,201108,2011),('2011-09-01',201135,9,2011,1,35,201109,2011),('2011-09-02',201135,9,2011,2,35,201109,2011),('2011-09-03',201135,9,2011,3,35,201109,2011),('2011-09-04',201136,9,2011,4,36,201109,2011),('2011-09-05',201136,9,2011,5,36,201109,2011),('2011-09-06',201136,9,2011,6,36,201109,2011),('2011-09-07',201136,9,2011,7,36,201109,2011),('2011-09-08',201136,9,2011,8,36,201109,2011),('2011-09-09',201136,9,2011,9,36,201109,2011),('2011-09-10',201136,9,2011,10,36,201109,2011),('2011-09-11',201137,9,2011,11,37,201109,2011),('2011-09-12',201137,9,2011,12,37,201109,2011),('2011-09-13',201137,9,2011,13,37,201109,2011),('2011-09-14',201137,9,2011,14,37,201109,2011),('2011-09-15',201137,9,2011,15,37,201109,2011),('2011-09-16',201137,9,2011,16,37,201109,2011),('2011-09-17',201137,9,2011,17,37,201109,2011),('2011-09-18',201138,9,2011,18,38,201109,2011),('2011-09-19',201138,9,2011,19,38,201109,2011),('2011-09-20',201138,9,2011,20,38,201109,2011),('2011-09-21',201138,9,2011,21,38,201109,2011),('2011-09-22',201138,9,2011,22,38,201109,2011),('2011-09-23',201138,9,2011,23,38,201109,2011),('2011-09-24',201138,9,2011,24,38,201109,2011),('2011-09-25',201139,9,2011,25,39,201109,2011),('2011-09-26',201139,9,2011,26,39,201109,2011),('2011-09-27',201139,9,2011,27,39,201109,2011),('2011-09-28',201139,9,2011,28,39,201109,2011),('2011-09-29',201139,9,2011,29,39,201109,2011),('2011-09-30',201139,9,2011,30,39,201109,2011),('2011-10-01',201139,10,2011,1,39,201110,2011),('2011-10-02',201140,10,2011,2,40,201110,2011),('2011-10-03',201140,10,2011,3,40,201110,2011),('2011-10-04',201140,10,2011,4,40,201110,2011),('2011-10-05',201140,10,2011,5,40,201110,2011),('2011-10-06',201140,10,2011,6,40,201110,2011),('2011-10-07',201140,10,2011,7,40,201110,2011),('2011-10-08',201140,10,2011,8,40,201110,2011),('2011-10-09',201141,10,2011,9,41,201110,2011),('2011-10-10',201141,10,2011,10,41,201110,2011),('2011-10-11',201141,10,2011,11,41,201110,2011),('2011-10-12',201141,10,2011,12,41,201110,2011),('2011-10-13',201141,10,2011,13,41,201110,2011),('2011-10-14',201141,10,2011,14,41,201110,2011),('2011-10-15',201141,10,2011,15,41,201110,2011),('2011-10-16',201142,10,2011,16,42,201110,2011),('2011-10-17',201142,10,2011,17,42,201110,2011),('2011-10-18',201142,10,2011,18,42,201110,2011),('2011-10-19',201142,10,2011,19,42,201110,2011),('2011-10-20',201142,10,2011,20,42,201110,2011),('2011-10-21',201142,10,2011,21,42,201110,2011),('2011-10-22',201142,10,2011,22,42,201110,2011),('2011-10-23',201143,10,2011,23,43,201110,2011),('2011-10-24',201143,10,2011,24,43,201110,2011),('2011-10-25',201143,10,2011,25,43,201110,2011),('2011-10-26',201143,10,2011,26,43,201110,2011),('2011-10-27',201143,10,2011,27,43,201110,2011),('2011-10-28',201143,10,2011,28,43,201110,2011),('2011-10-29',201143,10,2011,29,43,201110,2011),('2011-10-30',201144,10,2011,30,44,201110,2011),('2011-10-31',201144,10,2011,31,44,201110,2011),('2011-11-01',201144,11,2011,1,44,201111,2011),('2011-11-02',201144,11,2011,2,44,201111,2011),('2011-11-03',201144,11,2011,3,44,201111,2011),('2011-11-04',201144,11,2011,4,44,201111,2011),('2011-11-05',201144,11,2011,5,44,201111,2011),('2011-11-06',201145,11,2011,6,45,201111,2011),('2011-11-07',201145,11,2011,7,45,201111,2011),('2011-11-08',201145,11,2011,8,45,201111,2011),('2011-11-09',201145,11,2011,9,45,201111,2011),('2011-11-10',201145,11,2011,10,45,201111,2011),('2011-11-11',201145,11,2011,11,45,201111,2011),('2011-11-12',201145,11,2011,12,45,201111,2011),('2011-11-13',201146,11,2011,13,46,201111,2011),('2011-11-14',201146,11,2011,14,46,201111,2011),('2011-11-15',201146,11,2011,15,46,201111,2011),('2011-11-16',201146,11,2011,16,46,201111,2011),('2011-11-17',201146,11,2011,17,46,201111,2011),('2011-11-18',201146,11,2011,18,46,201111,2011),('2011-11-19',201146,11,2011,19,46,201111,2011),('2011-11-20',201147,11,2011,20,47,201111,2011),('2011-11-21',201147,11,2011,21,47,201111,2011),('2011-11-22',201147,11,2011,22,47,201111,2011),('2011-11-23',201147,11,2011,23,47,201111,2011),('2011-11-24',201147,11,2011,24,47,201111,2011),('2011-11-25',201147,11,2011,25,47,201111,2011),('2011-11-26',201147,11,2011,26,47,201111,2011),('2011-11-27',201148,11,2011,27,48,201111,2011),('2011-11-28',201148,11,2011,28,48,201111,2011),('2011-11-29',201148,11,2011,29,48,201111,2011),('2011-11-30',201148,11,2011,30,48,201111,2011),('2011-12-01',201148,12,2011,1,48,201112,2012),('2011-12-02',201148,12,2011,2,48,201112,2012),('2011-12-03',201148,12,2011,3,48,201112,2012),('2011-12-04',201149,12,2011,4,49,201112,2012),('2011-12-05',201149,12,2011,5,49,201112,2012),('2011-12-06',201149,12,2011,6,49,201112,2012),('2011-12-07',201149,12,2011,7,49,201112,2012),('2011-12-08',201149,12,2011,8,49,201112,2012),('2011-12-09',201149,12,2011,9,49,201112,2012),('2011-12-10',201149,12,2011,10,49,201112,2012),('2011-12-11',201150,12,2011,11,50,201112,2012),('2011-12-12',201150,12,2011,12,50,201112,2012),('2011-12-13',201150,12,2011,13,50,201112,2012),('2011-12-14',201150,12,2011,14,50,201112,2012),('2011-12-15',201150,12,2011,15,50,201112,2012),('2011-12-16',201150,12,2011,16,50,201112,2012),('2011-12-17',201150,12,2011,17,50,201112,2012),('2011-12-18',201151,12,2011,18,51,201112,2012),('2011-12-19',201151,12,2011,19,51,201112,2012),('2011-12-20',201151,12,2011,20,51,201112,2012),('2011-12-21',201151,12,2011,21,51,201112,2012),('2011-12-22',201151,12,2011,22,51,201112,2012),('2011-12-23',201151,12,2011,23,51,201112,2012),('2011-12-24',201151,12,2011,24,51,201112,2012),('2011-12-25',201152,12,2011,25,52,201112,2012),('2011-12-26',201152,12,2011,26,52,201112,2012),('2011-12-27',201152,12,2011,27,52,201112,2012),('2011-12-28',201152,12,2011,28,52,201112,2012),('2011-12-29',201152,12,2011,29,52,201112,2012),('2011-12-30',201152,12,2011,30,52,201112,2012),('2011-12-31',201152,12,2011,31,52,201112,2012),('2012-01-01',201153,1,2012,1,1,201201,2012),('2012-01-02',201201,1,2012,2,1,201201,2012),('2012-01-03',201201,1,2012,3,1,201201,2012),('2012-01-04',201201,1,2012,4,1,201201,2012),('2012-01-05',201201,1,2012,5,1,201201,2012),('2012-01-06',201201,1,2012,6,1,201201,2012),('2012-01-07',201201,1,2012,7,1,201201,2012),('2012-01-08',201202,1,2012,8,2,201201,2012),('2012-01-09',201202,1,2012,9,2,201201,2012),('2012-01-10',201202,1,2012,10,2,201201,2012),('2012-01-11',201202,1,2012,11,2,201201,2012),('2012-01-12',201202,1,2012,12,2,201201,2012),('2012-01-13',201202,1,2012,13,2,201201,2012),('2012-01-14',201202,1,2012,14,2,201201,2012),('2012-01-15',201203,1,2012,15,3,201201,2012),('2012-01-16',201203,1,2012,16,3,201201,2012),('2012-01-17',201203,1,2012,17,3,201201,2012),('2012-01-18',201203,1,2012,18,3,201201,2012),('2012-01-19',201203,1,2012,19,3,201201,2012),('2012-01-20',201203,1,2012,20,3,201201,2012),('2012-01-21',201203,1,2012,21,3,201201,2012),('2012-01-22',201204,1,2012,22,4,201201,2012),('2012-01-23',201204,1,2012,23,4,201201,2012),('2012-01-24',201204,1,2012,24,4,201201,2012),('2012-01-25',201204,1,2012,25,4,201201,2012),('2012-01-26',201204,1,2012,26,4,201201,2012),('2012-01-27',201204,1,2012,27,4,201201,2012),('2012-01-28',201204,1,2012,28,4,201201,2012),('2012-01-29',201205,1,2012,29,5,201201,2012),('2012-01-30',201205,1,2012,30,5,201201,2012),('2012-01-31',201205,1,2012,31,5,201201,2012),('2012-02-01',201205,2,2012,1,5,201202,2012),('2012-02-02',201205,2,2012,2,5,201202,2012),('2012-02-03',201205,2,2012,3,5,201202,2012),('2012-02-04',201205,2,2012,4,5,201202,2012),('2012-02-05',201206,2,2012,5,6,201202,2012),('2012-02-06',201206,2,2012,6,6,201202,2012),('2012-02-07',201206,2,2012,7,6,201202,2012),('2012-02-08',201206,2,2012,8,6,201202,2012),('2012-02-09',201206,2,2012,9,6,201202,2012),('2012-02-10',201206,2,2012,10,6,201202,2012),('2012-02-11',201206,2,2012,11,6,201202,2012),('2012-02-12',201207,2,2012,12,7,201202,2012),('2012-02-13',201207,2,2012,13,7,201202,2012),('2012-02-14',201207,2,2012,14,7,201202,2012),('2012-02-15',201207,2,2012,15,7,201202,2012),('2012-02-16',201207,2,2012,16,7,201202,2012),('2012-02-17',201207,2,2012,17,7,201202,2012),('2012-02-18',201207,2,2012,18,7,201202,2012),('2012-02-19',201208,2,2012,19,8,201202,2012),('2012-02-20',201208,2,2012,20,8,201202,2012),('2012-02-21',201208,2,2012,21,8,201202,2012),('2012-02-22',201208,2,2012,22,8,201202,2012),('2012-02-23',201208,2,2012,23,8,201202,2012),('2012-02-24',201208,2,2012,24,8,201202,2012),('2012-02-25',201208,2,2012,25,8,201202,2012),('2012-02-26',201209,2,2012,26,9,201202,2012),('2012-02-27',201209,2,2012,27,9,201202,2012),('2012-02-28',201209,2,2012,28,9,201202,2012),('2012-02-29',201209,2,2012,29,9,201202,2012),('2012-03-01',201209,3,2012,1,9,201203,2012),('2012-03-02',201209,3,2012,2,9,201203,2012),('2012-03-03',201209,3,2012,3,9,201203,2012),('2012-03-04',201210,3,2012,4,10,201203,2012),('2012-03-05',201210,3,2012,5,10,201203,2012),('2012-03-06',201210,3,2012,6,10,201203,2012),('2012-03-07',201210,3,2012,7,10,201203,2012),('2012-03-08',201210,3,2012,8,10,201203,2012),('2012-03-09',201210,3,2012,9,10,201203,2012),('2012-03-10',201210,3,2012,10,10,201203,2012),('2012-03-11',201211,3,2012,11,11,201203,2012),('2012-03-12',201211,3,2012,12,11,201203,2012),('2012-03-13',201211,3,2012,13,11,201203,2012),('2012-03-14',201211,3,2012,14,11,201203,2012),('2012-03-15',201211,3,2012,15,11,201203,2012),('2012-03-16',201211,3,2012,16,11,201203,2012),('2012-03-17',201211,3,2012,17,11,201203,2012),('2012-03-18',201212,3,2012,18,12,201203,2012),('2012-03-19',201212,3,2012,19,12,201203,2012),('2012-03-20',201212,3,2012,20,12,201203,2012),('2012-03-21',201212,3,2012,21,12,201203,2012),('2012-03-22',201212,3,2012,22,12,201203,2012),('2012-03-23',201212,3,2012,23,12,201203,2012),('2012-03-24',201212,3,2012,24,12,201203,2012),('2012-03-25',201213,3,2012,25,13,201203,2012),('2012-03-26',201213,3,2012,26,13,201203,2012),('2012-03-27',201213,3,2012,27,13,201203,2012),('2012-03-28',201213,3,2012,28,13,201203,2012),('2012-03-29',201213,3,2012,29,13,201203,2012),('2012-03-30',201213,3,2012,30,13,201203,2012),('2012-03-31',201213,3,2012,31,13,201203,2012),('2012-04-01',201214,4,2012,1,14,201204,2012),('2012-04-02',201214,4,2012,2,14,201204,2012),('2012-04-03',201214,4,2012,3,14,201204,2012),('2012-04-04',201214,4,2012,4,14,201204,2012),('2012-04-05',201214,4,2012,5,14,201204,2012),('2012-04-06',201214,4,2012,6,14,201204,2012),('2012-04-07',201214,4,2012,7,14,201204,2012),('2012-04-08',201215,4,2012,8,15,201204,2012),('2012-04-09',201215,4,2012,9,15,201204,2012),('2012-04-10',201215,4,2012,10,15,201204,2012),('2012-04-11',201215,4,2012,11,15,201204,2012),('2012-04-12',201215,4,2012,12,15,201204,2012),('2012-04-13',201215,4,2012,13,15,201204,2012),('2012-04-14',201215,4,2012,14,15,201204,2012),('2012-04-15',201216,4,2012,15,16,201204,2012),('2012-04-16',201216,4,2012,16,16,201204,2012),('2012-04-17',201216,4,2012,17,16,201204,2012),('2012-04-18',201216,4,2012,18,16,201204,2012),('2012-04-19',201216,4,2012,19,16,201204,2012),('2012-04-20',201216,4,2012,20,16,201204,2012),('2012-04-21',201216,4,2012,21,16,201204,2012),('2012-04-22',201217,4,2012,22,17,201204,2012),('2012-04-23',201217,4,2012,23,17,201204,2012),('2012-04-24',201217,4,2012,24,17,201204,2012),('2012-04-25',201217,4,2012,25,17,201204,2012),('2012-04-26',201217,4,2012,26,17,201204,2012),('2012-04-27',201217,4,2012,27,17,201204,2012),('2012-04-28',201217,4,2012,28,17,201204,2012),('2012-04-29',201218,4,2012,29,18,201204,2012),('2012-04-30',201218,4,2012,30,18,201204,2012),('2012-05-01',201218,5,2012,1,18,201205,2012),('2012-05-02',201218,5,2012,2,18,201205,2012),('2012-05-03',201218,5,2012,3,18,201205,2012),('2012-05-04',201218,5,2012,4,18,201205,2012),('2012-05-05',201218,5,2012,5,18,201205,2012),('2012-05-06',201219,5,2012,6,19,201205,2012),('2012-05-07',201219,5,2012,7,19,201205,2012),('2012-05-08',201219,5,2012,8,19,201205,2012),('2012-05-09',201219,5,2012,9,19,201205,2012),('2012-05-10',201219,5,2012,10,19,201205,2012),('2012-05-11',201219,5,2012,11,19,201205,2012),('2012-05-12',201219,5,2012,12,19,201205,2012),('2012-05-13',201220,5,2012,13,20,201205,2012),('2012-05-14',201220,5,2012,14,20,201205,2012),('2012-05-15',201220,5,2012,15,20,201205,2012),('2012-05-16',201220,5,2012,16,20,201205,2012),('2012-05-17',201220,5,2012,17,20,201205,2012),('2012-05-18',201220,5,2012,18,20,201205,2012),('2012-05-19',201220,5,2012,19,20,201205,2012),('2012-05-20',201221,5,2012,20,21,201205,2012),('2012-05-21',201221,5,2012,21,21,201205,2012),('2012-05-22',201221,5,2012,22,21,201205,2012),('2012-05-23',201221,5,2012,23,21,201205,2012),('2012-05-24',201221,5,2012,24,21,201205,2012),('2012-05-25',201221,5,2012,25,21,201205,2012),('2012-05-26',201221,5,2012,26,21,201205,2012),('2012-05-27',201222,5,2012,27,22,201205,2012),('2012-05-28',201222,5,2012,28,22,201205,2012),('2012-05-29',201222,5,2012,29,22,201205,2012),('2012-05-30',201222,5,2012,30,22,201205,2012),('2012-05-31',201222,5,2012,31,22,201205,2012),('2012-06-01',201222,6,2012,1,22,201206,2012),('2012-06-02',201222,6,2012,2,22,201206,2012),('2012-06-03',201223,6,2012,3,23,201206,2012),('2012-06-04',201223,6,2012,4,23,201206,2012),('2012-06-05',201223,6,2012,5,23,201206,2012),('2012-06-06',201223,6,2012,6,23,201206,2012),('2012-06-07',201223,6,2012,7,23,201206,2012),('2012-06-08',201223,6,2012,8,23,201206,2012),('2012-06-09',201223,6,2012,9,23,201206,2012),('2012-06-10',201224,6,2012,10,24,201206,2012),('2012-06-11',201224,6,2012,11,24,201206,2012),('2012-06-12',201224,6,2012,12,24,201206,2012),('2012-06-13',201224,6,2012,13,24,201206,2012),('2012-06-14',201224,6,2012,14,24,201206,2012),('2012-06-15',201224,6,2012,15,24,201206,2012),('2012-06-16',201224,6,2012,16,24,201206,2012),('2012-06-17',201225,6,2012,17,25,201206,2012),('2012-06-18',201225,6,2012,18,25,201206,2012),('2012-06-19',201225,6,2012,19,25,201206,2012),('2012-06-20',201225,6,2012,20,25,201206,2012),('2012-06-21',201225,6,2012,21,25,201206,2012),('2012-06-22',201225,6,2012,22,25,201206,2012),('2012-06-23',201225,6,2012,23,25,201206,2012),('2012-06-24',201226,6,2012,24,26,201206,2012),('2012-06-25',201226,6,2012,25,26,201206,2012),('2012-06-26',201226,6,2012,26,26,201206,2012),('2012-06-27',201226,6,2012,27,26,201206,2012),('2012-06-28',201226,6,2012,28,26,201206,2012),('2012-06-29',201226,6,2012,29,26,201206,2012),('2012-06-30',201226,6,2012,30,26,201206,2012),('2012-07-01',201227,7,2012,1,27,201207,2012),('2012-07-02',201227,7,2012,2,27,201207,2012),('2012-07-03',201227,7,2012,3,27,201207,2012),('2012-07-04',201227,7,2012,4,27,201207,2012),('2012-07-05',201227,7,2012,5,27,201207,2012),('2012-07-06',201227,7,2012,6,27,201207,2012),('2012-07-07',201227,7,2012,7,27,201207,2012),('2012-07-08',201228,7,2012,8,28,201207,2012),('2012-07-09',201228,7,2012,9,28,201207,2012),('2012-07-10',201228,7,2012,10,28,201207,2012),('2012-07-11',201228,7,2012,11,28,201207,2012),('2012-07-12',201228,7,2012,12,28,201207,2012),('2012-07-13',201228,7,2012,13,28,201207,2012),('2012-07-14',201228,7,2012,14,28,201207,2012),('2012-07-15',201229,7,2012,15,29,201207,2012),('2012-07-16',201229,7,2012,16,29,201207,2012),('2012-07-17',201229,7,2012,17,29,201207,2012),('2012-07-18',201229,7,2012,18,29,201207,2012),('2012-07-19',201229,7,2012,19,29,201207,2012),('2012-07-20',201229,7,2012,20,29,201207,2012),('2012-07-21',201229,7,2012,21,29,201207,2012),('2012-07-22',201230,7,2012,22,30,201207,2012),('2012-07-23',201230,7,2012,23,30,201207,2012),('2012-07-24',201230,7,2012,24,30,201207,2012),('2012-07-25',201230,7,2012,25,30,201207,2012),('2012-07-26',201230,7,2012,26,30,201207,2012),('2012-07-27',201230,7,2012,27,30,201207,2012),('2012-07-28',201230,7,2012,28,30,201207,2012),('2012-07-29',201231,7,2012,29,31,201207,2012),('2012-07-30',201231,7,2012,30,31,201207,2012),('2012-07-31',201231,7,2012,31,31,201207,2012),('2012-08-01',201231,8,2012,1,31,201208,2012),('2012-08-02',201231,8,2012,2,31,201208,2012),('2012-08-03',201231,8,2012,3,31,201208,2012),('2012-08-04',201231,8,2012,4,31,201208,2012),('2012-08-05',201232,8,2012,5,32,201208,2012),('2012-08-06',201232,8,2012,6,32,201208,2012),('2012-08-07',201232,8,2012,7,32,201208,2012),('2012-08-08',201232,8,2012,8,32,201208,2012),('2012-08-09',201232,8,2012,9,32,201208,2012),('2012-08-10',201232,8,2012,10,32,201208,2012),('2012-08-11',201232,8,2012,11,32,201208,2012),('2012-08-12',201233,8,2012,12,33,201208,2012),('2012-08-13',201233,8,2012,13,33,201208,2012),('2012-08-14',201233,8,2012,14,33,201208,2012),('2012-08-15',201233,8,2012,15,33,201208,2012),('2012-08-16',201233,8,2012,16,33,201208,2012),('2012-08-17',201233,8,2012,17,33,201208,2012),('2012-08-18',201233,8,2012,18,33,201208,2012),('2012-08-19',201234,8,2012,19,34,201208,2012),('2012-08-20',201234,8,2012,20,34,201208,2012),('2012-08-21',201234,8,2012,21,34,201208,2012),('2012-08-22',201234,8,2012,22,34,201208,2012),('2012-08-23',201234,8,2012,23,34,201208,2012),('2012-08-24',201234,8,2012,24,34,201208,2012),('2012-08-25',201234,8,2012,25,34,201208,2012),('2012-08-26',201235,8,2012,26,35,201208,2012),('2012-08-27',201235,8,2012,27,35,201208,2012),('2012-08-28',201235,8,2012,28,35,201208,2012),('2012-08-29',201235,8,2012,29,35,201208,2012),('2012-08-30',201235,8,2012,30,35,201208,2012),('2012-08-31',201235,8,2012,31,35,201208,2012),('2012-09-01',201235,9,2012,1,35,201209,2012),('2012-09-02',201236,9,2012,2,36,201209,2012),('2012-09-03',201236,9,2012,3,36,201209,2012),('2012-09-04',201236,9,2012,4,36,201209,2012),('2012-09-05',201236,9,2012,5,36,201209,2012),('2012-09-06',201236,9,2012,6,36,201209,2012),('2012-09-07',201236,9,2012,7,36,201209,2012),('2012-09-08',201236,9,2012,8,36,201209,2012),('2012-09-09',201237,9,2012,9,37,201209,2012),('2012-09-10',201237,9,2012,10,37,201209,2012),('2012-09-11',201237,9,2012,11,37,201209,2012),('2012-09-12',201237,9,2012,12,37,201209,2012),('2012-09-13',201237,9,2012,13,37,201209,2012),('2012-09-14',201237,9,2012,14,37,201209,2012),('2012-09-15',201237,9,2012,15,37,201209,2012),('2012-09-16',201238,9,2012,16,38,201209,2012),('2012-09-17',201238,9,2012,17,38,201209,2012),('2012-09-18',201238,9,2012,18,38,201209,2012),('2012-09-19',201238,9,2012,19,38,201209,2012),('2012-09-20',201238,9,2012,20,38,201209,2012),('2012-09-21',201238,9,2012,21,38,201209,2012),('2012-09-22',201238,9,2012,22,38,201209,2012),('2012-09-23',201239,9,2012,23,39,201209,2012),('2012-09-24',201239,9,2012,24,39,201209,2012),('2012-09-25',201239,9,2012,25,39,201209,2012),('2012-09-26',201239,9,2012,26,39,201209,2012),('2012-09-27',201239,9,2012,27,39,201209,2012),('2012-09-28',201239,9,2012,28,39,201209,2012),('2012-09-29',201239,9,2012,29,39,201209,2012),('2012-09-30',201240,9,2012,30,40,201209,2012),('2012-10-01',201240,10,2012,1,40,201210,2012),('2012-10-02',201240,10,2012,2,40,201210,2012),('2012-10-03',201240,10,2012,3,40,201210,2012),('2012-10-04',201240,10,2012,4,40,201210,2012),('2012-10-05',201240,10,2012,5,40,201210,2012),('2012-10-06',201240,10,2012,6,40,201210,2012),('2012-10-07',201241,10,2012,7,41,201210,2012),('2012-10-08',201241,10,2012,8,41,201210,2012),('2012-10-09',201241,10,2012,9,41,201210,2012),('2012-10-10',201241,10,2012,10,41,201210,2012),('2012-10-11',201241,10,2012,11,41,201210,2012),('2012-10-12',201241,10,2012,12,41,201210,2012),('2012-10-13',201241,10,2012,13,41,201210,2012),('2012-10-14',201242,10,2012,14,42,201210,2012),('2012-10-15',201242,10,2012,15,42,201210,2012),('2012-10-16',201242,10,2012,16,42,201210,2012),('2012-10-17',201242,10,2012,17,42,201210,2012),('2012-10-18',201242,10,2012,18,42,201210,2012),('2012-10-19',201242,10,2012,19,42,201210,2012),('2012-10-20',201242,10,2012,20,42,201210,2012),('2012-10-21',201243,10,2012,21,43,201210,2012),('2012-10-22',201243,10,2012,22,43,201210,2012),('2012-10-23',201243,10,2012,23,43,201210,2012),('2012-10-24',201243,10,2012,24,43,201210,2012),('2012-10-25',201243,10,2012,25,43,201210,2012),('2012-10-26',201243,10,2012,26,43,201210,2012),('2012-10-27',201243,10,2012,27,43,201210,2012),('2012-10-28',201244,10,2012,28,44,201210,2012),('2012-10-29',201244,10,2012,29,44,201210,2012),('2012-10-30',201244,10,2012,30,44,201210,2012),('2012-10-31',201244,10,2012,31,44,201210,2012),('2012-11-01',201244,11,2012,1,44,201211,2012),('2012-11-02',201244,11,2012,2,44,201211,2012),('2012-11-03',201244,11,2012,3,44,201211,2012),('2012-11-04',201245,11,2012,4,45,201211,2012),('2012-11-05',201245,11,2012,5,45,201211,2012),('2012-11-06',201245,11,2012,6,45,201211,2012),('2012-11-07',201245,11,2012,7,45,201211,2012),('2012-11-08',201245,11,2012,8,45,201211,2012),('2012-11-09',201245,11,2012,9,45,201211,2012),('2012-11-10',201245,11,2012,10,45,201211,2012),('2012-11-11',201246,11,2012,11,46,201211,2012),('2012-11-12',201246,11,2012,12,46,201211,2012),('2012-11-13',201246,11,2012,13,46,201211,2012),('2012-11-14',201246,11,2012,14,46,201211,2012),('2012-11-15',201246,11,2012,15,46,201211,2012),('2012-11-16',201246,11,2012,16,46,201211,2012),('2012-11-17',201246,11,2012,17,46,201211,2012),('2012-11-18',201247,11,2012,18,47,201211,2012),('2012-11-19',201247,11,2012,19,47,201211,2012),('2012-11-20',201247,11,2012,20,47,201211,2012),('2012-11-21',201247,11,2012,21,47,201211,2012),('2012-11-22',201247,11,2012,22,47,201211,2012),('2012-11-23',201247,11,2012,23,47,201211,2012),('2012-11-24',201247,11,2012,24,47,201211,2012),('2012-11-25',201248,11,2012,25,48,201211,2012),('2012-11-26',201248,11,2012,26,48,201211,2012),('2012-11-27',201248,11,2012,27,48,201211,2012),('2012-11-28',201248,11,2012,28,48,201211,2012),('2012-11-29',201248,11,2012,29,48,201211,2012),('2012-11-30',201248,11,2012,30,48,201211,2012),('2012-12-01',201248,12,2012,1,48,201212,2013),('2012-12-02',201249,12,2012,2,49,201212,2013),('2012-12-03',201249,12,2012,3,49,201212,2013),('2012-12-04',201249,12,2012,4,49,201212,2013),('2012-12-05',201249,12,2012,5,49,201212,2013),('2012-12-06',201249,12,2012,6,49,201212,2013),('2012-12-07',201249,12,2012,7,49,201212,2013),('2012-12-08',201249,12,2012,8,49,201212,2013),('2012-12-09',201250,12,2012,9,50,201212,2013),('2012-12-10',201250,12,2012,10,50,201212,2013),('2012-12-11',201250,12,2012,11,50,201212,2013),('2012-12-12',201250,12,2012,12,50,201212,2013),('2012-12-13',201250,12,2012,13,50,201212,2013),('2012-12-14',201250,12,2012,14,50,201212,2013),('2012-12-15',201250,12,2012,15,50,201212,2013),('2012-12-16',201251,12,2012,16,51,201212,2013),('2012-12-17',201251,12,2012,17,51,201212,2013),('2012-12-18',201251,12,2012,18,51,201212,2013),('2012-12-19',201251,12,2012,19,51,201212,2013),('2012-12-20',201251,12,2012,20,51,201212,2013),('2012-12-21',201251,12,2012,21,51,201212,2013),('2012-12-22',201251,12,2012,22,51,201212,2013),('2012-12-23',201252,12,2012,23,52,201212,2013),('2012-12-24',201252,12,2012,24,52,201212,2013),('2012-12-25',201252,12,2012,25,52,201212,2013),('2012-12-26',201252,12,2012,26,52,201212,2013),('2012-12-27',201252,12,2012,27,52,201212,2013),('2012-12-28',201252,12,2012,28,52,201212,2013),('2012-12-29',201252,12,2012,29,52,201212,2013),('2012-12-30',201301,12,2012,30,1,201212,2013),('2012-12-31',201301,12,2012,31,1,201212,2013),('2013-01-01',201301,1,2013,1,1,201301,2013),('2013-01-02',201301,1,2013,2,1,201301,2013),('2013-01-03',201301,1,2013,3,1,201301,2013),('2013-01-04',201301,1,2013,4,1,201301,2013),('2013-01-05',201301,1,2013,5,1,201301,2013),('2013-01-06',201302,1,2013,6,2,201301,2013),('2013-01-07',201302,1,2013,7,2,201301,2013),('2013-01-08',201302,1,2013,8,2,201301,2013),('2013-01-09',201302,1,2013,9,2,201301,2013),('2013-01-10',201302,1,2013,10,2,201301,2013),('2013-01-11',201302,1,2013,11,2,201301,2013),('2013-01-12',201302,1,2013,12,2,201301,2013),('2013-01-13',201303,1,2013,13,3,201301,2013),('2013-01-14',201303,1,2013,14,3,201301,2013),('2013-01-15',201303,1,2013,15,3,201301,2013),('2013-01-16',201303,1,2013,16,3,201301,2013),('2013-01-17',201303,1,2013,17,3,201301,2013),('2013-01-18',201303,1,2013,18,3,201301,2013),('2013-01-19',201303,1,2013,19,3,201301,2013),('2013-01-20',201304,1,2013,20,4,201301,2013),('2013-01-21',201304,1,2013,21,4,201301,2013),('2013-01-22',201304,1,2013,22,4,201301,2013),('2013-01-23',201304,1,2013,23,4,201301,2013),('2013-01-24',201304,1,2013,24,4,201301,2013),('2013-01-25',201304,1,2013,25,4,201301,2013),('2013-01-26',201304,1,2013,26,4,201301,2013),('2013-01-27',201305,1,2013,27,5,201301,2013),('2013-01-28',201305,1,2013,28,5,201301,2013),('2013-01-29',201305,1,2013,29,5,201301,2013),('2013-01-30',201305,1,2013,30,5,201301,2013),('2013-01-31',201305,1,2013,31,5,201301,2013),('2013-02-01',201305,2,2013,1,5,201302,2013),('2013-02-02',201305,2,2013,2,5,201302,2013),('2013-02-03',201306,2,2013,3,6,201302,2013),('2013-02-04',201306,2,2013,4,6,201302,2013),('2013-02-05',201306,2,2013,5,6,201302,2013),('2013-02-06',201306,2,2013,6,6,201302,2013),('2013-02-07',201306,2,2013,7,6,201302,2013),('2013-02-08',201306,2,2013,8,6,201302,2013),('2013-02-09',201306,2,2013,9,6,201302,2013),('2013-02-10',201307,2,2013,10,7,201302,2013),('2013-02-11',201307,2,2013,11,7,201302,2013),('2013-02-12',201307,2,2013,12,7,201302,2013),('2013-02-13',201307,2,2013,13,7,201302,2013),('2013-02-14',201307,2,2013,14,7,201302,2013),('2013-02-15',201307,2,2013,15,7,201302,2013),('2013-02-16',201307,2,2013,16,7,201302,2013),('2013-02-17',201308,2,2013,17,8,201302,2013),('2013-02-18',201308,2,2013,18,8,201302,2013),('2013-02-19',201308,2,2013,19,8,201302,2013),('2013-02-20',201308,2,2013,20,8,201302,2013),('2013-02-21',201308,2,2013,21,8,201302,2013),('2013-02-22',201308,2,2013,22,8,201302,2013),('2013-02-23',201308,2,2013,23,8,201302,2013),('2013-02-24',201309,2,2013,24,9,201302,2013),('2013-02-25',201309,2,2013,25,9,201302,2013),('2013-02-26',201309,2,2013,26,9,201302,2013),('2013-02-27',201309,2,2013,27,9,201302,2013),('2013-02-28',201309,2,2013,28,9,201302,2013),('2013-03-01',201309,3,2013,1,9,201303,2013),('2013-03-02',201309,3,2013,2,9,201303,2013),('2013-03-03',201310,3,2013,3,10,201303,2013),('2013-03-04',201310,3,2013,4,10,201303,2013),('2013-03-05',201310,3,2013,5,10,201303,2013),('2013-03-06',201310,3,2013,6,10,201303,2013),('2013-03-07',201310,3,2013,7,10,201303,2013),('2013-03-08',201310,3,2013,8,10,201303,2013),('2013-03-09',201310,3,2013,9,10,201303,2013),('2013-03-10',201311,3,2013,10,11,201303,2013),('2013-03-11',201311,3,2013,11,11,201303,2013),('2013-03-12',201311,3,2013,12,11,201303,2013),('2013-03-13',201311,3,2013,13,11,201303,2013),('2013-03-14',201311,3,2013,14,11,201303,2013),('2013-03-15',201311,3,2013,15,11,201303,2013),('2013-03-16',201311,3,2013,16,11,201303,2013),('2013-03-17',201312,3,2013,17,12,201303,2013),('2013-03-18',201312,3,2013,18,12,201303,2013),('2013-03-19',201312,3,2013,19,12,201303,2013),('2013-03-20',201312,3,2013,20,12,201303,2013),('2013-03-21',201312,3,2013,21,12,201303,2013),('2013-03-22',201312,3,2013,22,12,201303,2013),('2013-03-23',201312,3,2013,23,12,201303,2013),('2013-03-24',201313,3,2013,24,13,201303,2013),('2013-03-25',201313,3,2013,25,13,201303,2013),('2013-03-26',201313,3,2013,26,13,201303,2013),('2013-03-27',201313,3,2013,27,13,201303,2013),('2013-03-28',201313,3,2013,28,13,201303,2013),('2013-03-29',201313,3,2013,29,13,201303,2013),('2013-03-30',201313,3,2013,30,13,201303,2013),('2013-03-31',201314,3,2013,31,14,201303,2013),('2013-04-01',201314,4,2013,1,14,201304,2013),('2013-04-02',201314,4,2013,2,14,201304,2013),('2013-04-03',201314,4,2013,3,14,201304,2013),('2013-04-04',201314,4,2013,4,14,201304,2013),('2013-04-05',201314,4,2013,5,14,201304,2013),('2013-04-06',201314,4,2013,6,14,201304,2013),('2013-04-07',201315,4,2013,7,15,201304,2013),('2013-04-08',201315,4,2013,8,15,201304,2013),('2013-04-09',201315,4,2013,9,15,201304,2013),('2013-04-10',201315,4,2013,10,15,201304,2013),('2013-04-11',201315,4,2013,11,15,201304,2013),('2013-04-12',201315,4,2013,12,15,201304,2013),('2013-04-13',201315,4,2013,13,15,201304,2013),('2013-04-14',201316,4,2013,14,16,201304,2013),('2013-04-15',201316,4,2013,15,16,201304,2013),('2013-04-16',201316,4,2013,16,16,201304,2013),('2013-04-17',201316,4,2013,17,16,201304,2013),('2013-04-18',201316,4,2013,18,16,201304,2013),('2013-04-19',201316,4,2013,19,16,201304,2013),('2013-04-20',201316,4,2013,20,16,201304,2013),('2013-04-21',201317,4,2013,21,17,201304,2013),('2013-04-22',201317,4,2013,22,17,201304,2013),('2013-04-23',201317,4,2013,23,17,201304,2013),('2013-04-24',201317,4,2013,24,17,201304,2013),('2013-04-25',201317,4,2013,25,17,201304,2013),('2013-04-26',201317,4,2013,26,17,201304,2013),('2013-04-27',201317,4,2013,27,17,201304,2013),('2013-04-28',201318,4,2013,28,18,201304,2013),('2013-04-29',201318,4,2013,29,18,201304,2013),('2013-04-30',201318,4,2013,30,18,201304,2013),('2013-05-01',201318,5,2013,1,18,201305,2013),('2013-05-02',201318,5,2013,2,18,201305,2013),('2013-05-03',201318,5,2013,3,18,201305,2013),('2013-05-04',201318,5,2013,4,18,201305,2013),('2013-05-05',201319,5,2013,5,19,201305,2013),('2013-05-06',201319,5,2013,6,19,201305,2013),('2013-05-07',201319,5,2013,7,19,201305,2013),('2013-05-08',201319,5,2013,8,19,201305,2013),('2013-05-09',201319,5,2013,9,19,201305,2013),('2013-05-10',201319,5,2013,10,19,201305,2013),('2013-05-11',201319,5,2013,11,19,201305,2013),('2013-05-12',201320,5,2013,12,20,201305,2013),('2013-05-13',201320,5,2013,13,20,201305,2013),('2013-05-14',201320,5,2013,14,20,201305,2013),('2013-05-15',201320,5,2013,15,20,201305,2013),('2013-05-16',201320,5,2013,16,20,201305,2013),('2013-05-17',201320,5,2013,17,20,201305,2013),('2013-05-18',201320,5,2013,18,20,201305,2013),('2013-05-19',201321,5,2013,19,21,201305,2013),('2013-05-20',201321,5,2013,20,21,201305,2013),('2013-05-21',201321,5,2013,21,21,201305,2013),('2013-05-22',201321,5,2013,22,21,201305,2013),('2013-05-23',201321,5,2013,23,21,201305,2013),('2013-05-24',201321,5,2013,24,21,201305,2013),('2013-05-25',201321,5,2013,25,21,201305,2013),('2013-05-26',201322,5,2013,26,22,201305,2013),('2013-05-27',201322,5,2013,27,22,201305,2013),('2013-05-28',201322,5,2013,28,22,201305,2013),('2013-05-29',201322,5,2013,29,22,201305,2013),('2013-05-30',201322,5,2013,30,22,201305,2013),('2013-05-31',201322,5,2013,31,22,201305,2013),('2013-06-01',201322,6,2013,1,22,201306,2013),('2013-06-02',201323,6,2013,2,23,201306,2013),('2013-06-03',201323,6,2013,3,23,201306,2013),('2013-06-04',201323,6,2013,4,23,201306,2013),('2013-06-05',201323,6,2013,5,23,201306,2013),('2013-06-06',201323,6,2013,6,23,201306,2013),('2013-06-07',201323,6,2013,7,23,201306,2013),('2013-06-08',201323,6,2013,8,23,201306,2013),('2013-06-09',201324,6,2013,9,24,201306,2013),('2013-06-10',201324,6,2013,10,24,201306,2013),('2013-06-11',201324,6,2013,11,24,201306,2013),('2013-06-12',201324,6,2013,12,24,201306,2013),('2013-06-13',201324,6,2013,13,24,201306,2013),('2013-06-14',201324,6,2013,14,24,201306,2013),('2013-06-15',201324,6,2013,15,24,201306,2013),('2013-06-16',201325,6,2013,16,25,201306,2013),('2013-06-17',201325,6,2013,17,25,201306,2013),('2013-06-18',201325,6,2013,18,25,201306,2013),('2013-06-19',201325,6,2013,19,25,201306,2013),('2013-06-20',201325,6,2013,20,25,201306,2013),('2013-06-21',201325,6,2013,21,25,201306,2013),('2013-06-22',201325,6,2013,22,25,201306,2013),('2013-06-23',201326,6,2013,23,26,201306,2013),('2013-06-24',201326,6,2013,24,26,201306,2013),('2013-06-25',201326,6,2013,25,26,201306,2013),('2013-06-26',201326,6,2013,26,26,201306,2013),('2013-06-27',201326,6,2013,27,26,201306,2013),('2013-06-28',201326,6,2013,28,26,201306,2013),('2013-06-29',201326,6,2013,29,26,201306,2013),('2013-06-30',201327,6,2013,30,27,201306,2013),('2013-07-01',201327,7,2013,1,27,201307,2013),('2013-07-02',201327,7,2013,2,27,201307,2013),('2013-07-03',201327,7,2013,3,27,201307,2013),('2013-07-04',201327,7,2013,4,27,201307,2013),('2013-07-05',201327,7,2013,5,27,201307,2013),('2013-07-06',201327,7,2013,6,27,201307,2013),('2013-07-07',201328,7,2013,7,28,201307,2013),('2013-07-08',201328,7,2013,8,28,201307,2013),('2013-07-09',201328,7,2013,9,28,201307,2013),('2013-07-10',201328,7,2013,10,28,201307,2013),('2013-07-11',201328,7,2013,11,28,201307,2013),('2013-07-12',201328,7,2013,12,28,201307,2013),('2013-07-13',201328,7,2013,13,28,201307,2013),('2013-07-14',201329,7,2013,14,29,201307,2013),('2013-07-15',201329,7,2013,15,29,201307,2013),('2013-07-16',201329,7,2013,16,29,201307,2013),('2013-07-17',201329,7,2013,17,29,201307,2013),('2013-07-18',201329,7,2013,18,29,201307,2013),('2013-07-19',201329,7,2013,19,29,201307,2013),('2013-07-20',201329,7,2013,20,29,201307,2013),('2013-07-21',201330,7,2013,21,30,201307,2013),('2013-07-22',201330,7,2013,22,30,201307,2013),('2013-07-23',201330,7,2013,23,30,201307,2013),('2013-07-24',201330,7,2013,24,30,201307,2013),('2013-07-25',201330,7,2013,25,30,201307,2013),('2013-07-26',201330,7,2013,26,30,201307,2013),('2013-07-27',201330,7,2013,27,30,201307,2013),('2013-07-28',201331,7,2013,28,31,201307,2013),('2013-07-29',201331,7,2013,29,31,201307,2013),('2013-07-30',201331,7,2013,30,31,201307,2013),('2013-07-31',201331,7,2013,31,31,201307,2013),('2013-08-01',201331,8,2013,1,31,201308,2013),('2013-08-02',201331,8,2013,2,31,201308,2013),('2013-08-03',201331,8,2013,3,31,201308,2013),('2013-08-04',201332,8,2013,4,32,201308,2013),('2013-08-05',201332,8,2013,5,32,201308,2013),('2013-08-06',201332,8,2013,6,32,201308,2013),('2013-08-07',201332,8,2013,7,32,201308,2013),('2013-08-08',201332,8,2013,8,32,201308,2013),('2013-08-09',201332,8,2013,9,32,201308,2013),('2013-08-10',201332,8,2013,10,32,201308,2013),('2013-08-11',201333,8,2013,11,33,201308,2013),('2013-08-12',201333,8,2013,12,33,201308,2013),('2013-08-13',201333,8,2013,13,33,201308,2013),('2013-08-14',201333,8,2013,14,33,201308,2013),('2013-08-15',201333,8,2013,15,33,201308,2013),('2013-08-16',201333,8,2013,16,33,201308,2013),('2013-08-17',201333,8,2013,17,33,201308,2013),('2013-08-18',201334,8,2013,18,34,201308,2013),('2013-08-19',201334,8,2013,19,34,201308,2013),('2013-08-20',201334,8,2013,20,34,201308,2013),('2013-08-21',201334,8,2013,21,34,201308,2013),('2013-08-22',201334,8,2013,22,34,201308,2013),('2013-08-23',201334,8,2013,23,34,201308,2013),('2013-08-24',201334,8,2013,24,34,201308,2013),('2013-08-25',201335,8,2013,25,35,201308,2013),('2013-08-26',201335,8,2013,26,35,201308,2013),('2013-08-27',201335,8,2013,27,35,201308,2013),('2013-08-28',201335,8,2013,28,35,201308,2013),('2013-08-29',201335,8,2013,29,35,201308,2013),('2013-08-30',201335,8,2013,30,35,201308,2013),('2013-08-31',201335,8,2013,31,35,201308,2013),('2013-09-01',201336,9,2013,1,36,201309,2013),('2013-09-02',201336,9,2013,2,36,201309,2013),('2013-09-03',201336,9,2013,3,36,201309,2013),('2013-09-04',201336,9,2013,4,36,201309,2013),('2013-09-05',201336,9,2013,5,36,201309,2013),('2013-09-06',201336,9,2013,6,36,201309,2013),('2013-09-07',201336,9,2013,7,36,201309,2013),('2013-09-08',201337,9,2013,8,37,201309,2013),('2013-09-09',201337,9,2013,9,37,201309,2013),('2013-09-10',201337,9,2013,10,37,201309,2013),('2013-09-11',201337,9,2013,11,37,201309,2013),('2013-09-12',201337,9,2013,12,37,201309,2013),('2013-09-13',201337,9,2013,13,37,201309,2013),('2013-09-14',201337,9,2013,14,37,201309,2013),('2013-09-15',201338,9,2013,15,38,201309,2013),('2013-09-16',201338,9,2013,16,38,201309,2013),('2013-09-17',201338,9,2013,17,38,201309,2013),('2013-09-18',201338,9,2013,18,38,201309,2013),('2013-09-19',201338,9,2013,19,38,201309,2013),('2013-09-20',201338,9,2013,20,38,201309,2013),('2013-09-21',201338,9,2013,21,38,201309,2013),('2013-09-22',201339,9,2013,22,39,201309,2013),('2013-09-23',201339,9,2013,23,39,201309,2013),('2013-09-24',201339,9,2013,24,39,201309,2013),('2013-09-25',201339,9,2013,25,39,201309,2013),('2013-09-26',201339,9,2013,26,39,201309,2013),('2013-09-27',201339,9,2013,27,39,201309,2013),('2013-09-28',201339,9,2013,28,39,201309,2013),('2013-09-29',201340,9,2013,29,40,201309,2013),('2013-09-30',201340,9,2013,30,40,201309,2013),('2013-10-01',201340,10,2013,1,40,201310,2013),('2013-10-02',201340,10,2013,2,40,201310,2013),('2013-10-03',201340,10,2013,3,40,201310,2013),('2013-10-04',201340,10,2013,4,40,201310,2013),('2013-10-05',201340,10,2013,5,40,201310,2013),('2013-10-06',201341,10,2013,6,41,201310,2013),('2013-10-07',201341,10,2013,7,41,201310,2013),('2013-10-08',201341,10,2013,8,41,201310,2013),('2013-10-09',201341,10,2013,9,41,201310,2013),('2013-10-10',201341,10,2013,10,41,201310,2013),('2013-10-11',201341,10,2013,11,41,201310,2013),('2013-10-12',201341,10,2013,12,41,201310,2013),('2013-10-13',201342,10,2013,13,42,201310,2013),('2013-10-14',201342,10,2013,14,42,201310,2013),('2013-10-15',201342,10,2013,15,42,201310,2013),('2013-10-16',201342,10,2013,16,42,201310,2013),('2013-10-17',201342,10,2013,17,42,201310,2013),('2013-10-18',201342,10,2013,18,42,201310,2013),('2013-10-19',201342,10,2013,19,42,201310,2013),('2013-10-20',201343,10,2013,20,43,201310,2013),('2013-10-21',201343,10,2013,21,43,201310,2013),('2013-10-22',201343,10,2013,22,43,201310,2013),('2013-10-23',201343,10,2013,23,43,201310,2013),('2013-10-24',201343,10,2013,24,43,201310,2013),('2013-10-25',201343,10,2013,25,43,201310,2013),('2013-10-26',201343,10,2013,26,43,201310,2013),('2013-10-27',201344,10,2013,27,44,201310,2013),('2013-10-28',201344,10,2013,28,44,201310,2013),('2013-10-29',201344,10,2013,29,44,201310,2013),('2013-10-30',201344,10,2013,30,44,201310,2013),('2013-10-31',201344,10,2013,31,44,201310,2013),('2013-11-01',201344,11,2013,1,44,201311,2013),('2013-11-02',201344,11,2013,2,44,201311,2013),('2013-11-03',201345,11,2013,3,45,201311,2013),('2013-11-04',201345,11,2013,4,45,201311,2013),('2013-11-05',201345,11,2013,5,45,201311,2013),('2013-11-06',201345,11,2013,6,45,201311,2013),('2013-11-07',201345,11,2013,7,45,201311,2013),('2013-11-08',201345,11,2013,8,45,201311,2013),('2013-11-09',201345,11,2013,9,45,201311,2013),('2013-11-10',201346,11,2013,10,46,201311,2013),('2013-11-11',201346,11,2013,11,46,201311,2013),('2013-11-12',201346,11,2013,12,46,201311,2013),('2013-11-13',201346,11,2013,13,46,201311,2013),('2013-11-14',201346,11,2013,14,46,201311,2013),('2013-11-15',201346,11,2013,15,46,201311,2013),('2013-11-16',201346,11,2013,16,46,201311,2013),('2013-11-17',201347,11,2013,17,47,201311,2013),('2013-11-18',201347,11,2013,18,47,201311,2013),('2013-11-19',201347,11,2013,19,47,201311,2013),('2013-11-20',201347,11,2013,20,47,201311,2013),('2013-11-21',201347,11,2013,21,47,201311,2013),('2013-11-22',201347,11,2013,22,47,201311,2013),('2013-11-23',201347,11,2013,23,47,201311,2013),('2013-11-24',201348,11,2013,24,48,201311,2013),('2013-11-25',201348,11,2013,25,48,201311,2013),('2013-11-26',201348,11,2013,26,48,201311,2013),('2013-11-27',201348,11,2013,27,48,201311,2013),('2013-11-28',201348,11,2013,28,48,201311,2013),('2013-11-29',201348,11,2013,29,48,201311,2013),('2013-11-30',201348,11,2013,30,48,201311,2013),('2013-12-01',201349,12,2013,1,49,201312,2014),('2013-12-02',201349,12,2013,2,49,201312,2014),('2013-12-03',201349,12,2013,3,49,201312,2014),('2013-12-04',201349,12,2013,4,49,201312,2014),('2013-12-05',201349,12,2013,5,49,201312,2014),('2013-12-06',201349,12,2013,6,49,201312,2014),('2013-12-07',201349,12,2013,7,49,201312,2014),('2013-12-08',201350,12,2013,8,50,201312,2014),('2013-12-09',201350,12,2013,9,50,201312,2014),('2013-12-10',201350,12,2013,10,50,201312,2014),('2013-12-11',201350,12,2013,11,50,201312,2014),('2013-12-12',201350,12,2013,12,50,201312,2014),('2013-12-13',201350,12,2013,13,50,201312,2014),('2013-12-14',201350,12,2013,14,50,201312,2014),('2013-12-15',201351,12,2013,15,51,201312,2014),('2013-12-16',201351,12,2013,16,51,201312,2014),('2013-12-17',201351,12,2013,17,51,201312,2014),('2013-12-18',201351,12,2013,18,51,201312,2014),('2013-12-19',201351,12,2013,19,51,201312,2014),('2013-12-20',201351,12,2013,20,51,201312,2014),('2013-12-21',201351,12,2013,21,51,201312,2014),('2013-12-22',201352,12,2013,22,52,201312,2014),('2013-12-23',201352,12,2013,23,52,201312,2014),('2013-12-24',201352,12,2013,24,52,201312,2014),('2013-12-25',201352,12,2013,25,52,201312,2014),('2013-12-26',201352,12,2013,26,52,201312,2014),('2013-12-27',201352,12,2013,27,52,201312,2014),('2013-12-28',201352,12,2013,28,52,201312,2014),('2013-12-29',201401,12,2013,29,1,201312,2014),('2013-12-30',201401,12,2013,30,1,201312,2014),('2013-12-31',201401,12,2013,31,1,201312,2014),('2014-01-01',201401,1,2014,1,1,201401,2014),('2014-01-02',201401,1,2014,2,1,201401,2014),('2014-01-03',201401,1,2014,3,1,201401,2014),('2014-01-04',201401,1,2014,4,1,201401,2014),('2014-01-05',201402,1,2014,5,2,201401,2014),('2014-01-06',201402,1,2014,6,2,201401,2014),('2014-01-07',201402,1,2014,7,2,201401,2014),('2014-01-08',201402,1,2014,8,2,201401,2014),('2014-01-09',201402,1,2014,9,2,201401,2014),('2014-01-10',201402,1,2014,10,2,201401,2014),('2014-01-11',201402,1,2014,11,2,201401,2014),('2014-01-12',201403,1,2014,12,3,201401,2014),('2014-01-13',201403,1,2014,13,3,201401,2014),('2014-01-14',201403,1,2014,14,3,201401,2014),('2014-01-15',201403,1,2014,15,3,201401,2014),('2014-01-16',201403,1,2014,16,3,201401,2014),('2014-01-17',201403,1,2014,17,3,201401,2014),('2014-01-18',201403,1,2014,18,3,201401,2014),('2014-01-19',201404,1,2014,19,4,201401,2014),('2014-01-20',201404,1,2014,20,4,201401,2014),('2014-01-21',201404,1,2014,21,4,201401,2014),('2014-01-22',201404,1,2014,22,4,201401,2014),('2014-01-23',201404,1,2014,23,4,201401,2014),('2014-01-24',201404,1,2014,24,4,201401,2014),('2014-01-25',201404,1,2014,25,4,201401,2014),('2014-01-26',201405,1,2014,26,5,201401,2014),('2014-01-27',201405,1,2014,27,5,201401,2014),('2014-01-28',201405,1,2014,28,5,201401,2014),('2014-01-29',201405,1,2014,29,5,201401,2014),('2014-01-30',201405,1,2014,30,5,201401,2014),('2014-01-31',201405,1,2014,31,5,201401,2014),('2014-02-01',201405,2,2014,1,5,201402,2014),('2014-02-02',201406,2,2014,2,6,201402,2014),('2014-02-03',201406,2,2014,3,6,201402,2014),('2014-02-04',201406,2,2014,4,6,201402,2014),('2014-02-05',201406,2,2014,5,6,201402,2014),('2014-02-06',201406,2,2014,6,6,201402,2014),('2014-02-07',201406,2,2014,7,6,201402,2014),('2014-02-08',201406,2,2014,8,6,201402,2014),('2014-02-09',201407,2,2014,9,7,201402,2014),('2014-02-10',201407,2,2014,10,7,201402,2014),('2014-02-11',201407,2,2014,11,7,201402,2014),('2014-02-12',201407,2,2014,12,7,201402,2014),('2014-02-13',201407,2,2014,13,7,201402,2014),('2014-02-14',201407,2,2014,14,7,201402,2014),('2014-02-15',201407,2,2014,15,7,201402,2014),('2014-02-16',201408,2,2014,16,8,201402,2014),('2014-02-17',201408,2,2014,17,8,201402,2014),('2014-02-18',201408,2,2014,18,8,201402,2014),('2014-02-19',201408,2,2014,19,8,201402,2014),('2014-02-20',201408,2,2014,20,8,201402,2014),('2014-02-21',201408,2,2014,21,8,201402,2014),('2014-02-22',201408,2,2014,22,8,201402,2014),('2014-02-23',201409,2,2014,23,9,201402,2014),('2014-02-24',201409,2,2014,24,9,201402,2014),('2014-02-25',201409,2,2014,25,9,201402,2014),('2014-02-26',201409,2,2014,26,9,201402,2014),('2014-02-27',201409,2,2014,27,9,201402,2014),('2014-02-28',201409,2,2014,28,9,201402,2014),('2014-03-01',201409,3,2014,1,9,201403,2014),('2014-03-02',201410,3,2014,2,10,201403,2014),('2014-03-03',201410,3,2014,3,10,201403,2014),('2014-03-04',201410,3,2014,4,10,201403,2014),('2014-03-05',201410,3,2014,5,10,201403,2014),('2014-03-06',201410,3,2014,6,10,201403,2014),('2014-03-07',201410,3,2014,7,10,201403,2014),('2014-03-08',201410,3,2014,8,10,201403,2014),('2014-03-09',201411,3,2014,9,11,201403,2014),('2014-03-10',201411,3,2014,10,11,201403,2014),('2014-03-11',201411,3,2014,11,11,201403,2014),('2014-03-12',201411,3,2014,12,11,201403,2014),('2014-03-13',201411,3,2014,13,11,201403,2014),('2014-03-14',201411,3,2014,14,11,201403,2014),('2014-03-15',201411,3,2014,15,11,201403,2014),('2014-03-16',201412,3,2014,16,12,201403,2014),('2014-03-17',201412,3,2014,17,12,201403,2014),('2014-03-18',201412,3,2014,18,12,201403,2014),('2014-03-19',201412,3,2014,19,12,201403,2014),('2014-03-20',201412,3,2014,20,12,201403,2014),('2014-03-21',201412,3,2014,21,12,201403,2014),('2014-03-22',201412,3,2014,22,12,201403,2014),('2014-03-23',201413,3,2014,23,13,201403,2014),('2014-03-24',201413,3,2014,24,13,201403,2014),('2014-03-25',201413,3,2014,25,13,201403,2014),('2014-03-26',201413,3,2014,26,13,201403,2014),('2014-03-27',201413,3,2014,27,13,201403,2014),('2014-03-28',201413,3,2014,28,13,201403,2014),('2014-03-29',201413,3,2014,29,13,201403,2014),('2014-03-30',201414,3,2014,30,14,201403,2014),('2014-03-31',201414,3,2014,31,14,201403,2014),('2014-04-01',201414,4,2014,1,14,201404,2014),('2014-04-02',201414,4,2014,2,14,201404,2014),('2014-04-03',201414,4,2014,3,14,201404,2014),('2014-04-04',201414,4,2014,4,14,201404,2014),('2014-04-05',201414,4,2014,5,14,201404,2014),('2014-04-06',201415,4,2014,6,15,201404,2014),('2014-04-07',201415,4,2014,7,15,201404,2014),('2014-04-08',201415,4,2014,8,15,201404,2014),('2014-04-09',201415,4,2014,9,15,201404,2014),('2014-04-10',201415,4,2014,10,15,201404,2014),('2014-04-11',201415,4,2014,11,15,201404,2014),('2014-04-12',201415,4,2014,12,15,201404,2014),('2014-04-13',201416,4,2014,13,16,201404,2014),('2014-04-14',201416,4,2014,14,16,201404,2014),('2014-04-15',201416,4,2014,15,16,201404,2014),('2014-04-16',201416,4,2014,16,16,201404,2014),('2014-04-17',201416,4,2014,17,16,201404,2014),('2014-04-18',201416,4,2014,18,16,201404,2014),('2014-04-19',201416,4,2014,19,16,201404,2014),('2014-04-20',201417,4,2014,20,17,201404,2014),('2014-04-21',201417,4,2014,21,17,201404,2014),('2014-04-22',201417,4,2014,22,17,201404,2014),('2014-04-23',201417,4,2014,23,17,201404,2014),('2014-04-24',201417,4,2014,24,17,201404,2014),('2014-04-25',201417,4,2014,25,17,201404,2014),('2014-04-26',201417,4,2014,26,17,201404,2014),('2014-04-27',201418,4,2014,27,18,201404,2014),('2014-04-28',201418,4,2014,28,18,201404,2014),('2014-04-29',201418,4,2014,29,18,201404,2014),('2014-04-30',201418,4,2014,30,18,201404,2014),('2014-05-01',201418,5,2014,1,18,201405,2014),('2014-05-02',201418,5,2014,2,18,201405,2014),('2014-05-03',201418,5,2014,3,18,201405,2014),('2014-05-04',201419,5,2014,4,19,201405,2014),('2014-05-05',201419,5,2014,5,19,201405,2014),('2014-05-06',201419,5,2014,6,19,201405,2014),('2014-05-07',201419,5,2014,7,19,201405,2014),('2014-05-08',201419,5,2014,8,19,201405,2014),('2014-05-09',201419,5,2014,9,19,201405,2014),('2014-05-10',201419,5,2014,10,19,201405,2014),('2014-05-11',201420,5,2014,11,20,201405,2014),('2014-05-12',201420,5,2014,12,20,201405,2014),('2014-05-13',201420,5,2014,13,20,201405,2014),('2014-05-14',201420,5,2014,14,20,201405,2014),('2014-05-15',201420,5,2014,15,20,201405,2014),('2014-05-16',201420,5,2014,16,20,201405,2014),('2014-05-17',201420,5,2014,17,20,201405,2014),('2014-05-18',201421,5,2014,18,21,201405,2014),('2014-05-19',201421,5,2014,19,21,201405,2014),('2014-05-20',201421,5,2014,20,21,201405,2014),('2014-05-21',201421,5,2014,21,21,201405,2014),('2014-05-22',201421,5,2014,22,21,201405,2014),('2014-05-23',201421,5,2014,23,21,201405,2014),('2014-05-24',201421,5,2014,24,21,201405,2014),('2014-05-25',201422,5,2014,25,22,201405,2014),('2014-05-26',201422,5,2014,26,22,201405,2014),('2014-05-27',201422,5,2014,27,22,201405,2014),('2014-05-28',201422,5,2014,28,22,201405,2014),('2014-05-29',201422,5,2014,29,22,201405,2014),('2014-05-30',201422,5,2014,30,22,201405,2014),('2014-05-31',201422,5,2014,31,22,201405,2014),('2014-06-01',201423,6,2014,1,23,201406,2014),('2014-06-02',201423,6,2014,2,23,201406,2014),('2014-06-03',201423,6,2014,3,23,201406,2014),('2014-06-04',201423,6,2014,4,23,201406,2014),('2014-06-05',201423,6,2014,5,23,201406,2014),('2014-06-06',201423,6,2014,6,23,201406,2014),('2014-06-07',201423,6,2014,7,23,201406,2014),('2014-06-08',201424,6,2014,8,24,201406,2014),('2014-06-09',201424,6,2014,9,24,201406,2014),('2014-06-10',201424,6,2014,10,24,201406,2014),('2014-06-11',201424,6,2014,11,24,201406,2014),('2014-06-12',201424,6,2014,12,24,201406,2014),('2014-06-13',201424,6,2014,13,24,201406,2014),('2014-06-14',201424,6,2014,14,24,201406,2014),('2014-06-15',201425,6,2014,15,25,201406,2014),('2014-06-16',201425,6,2014,16,25,201406,2014),('2014-06-17',201425,6,2014,17,25,201406,2014),('2014-06-18',201425,6,2014,18,25,201406,2014),('2014-06-19',201425,6,2014,19,25,201406,2014),('2014-06-20',201425,6,2014,20,25,201406,2014),('2014-06-21',201425,6,2014,21,25,201406,2014),('2014-06-22',201426,6,2014,22,26,201406,2014),('2014-06-23',201426,6,2014,23,26,201406,2014),('2014-06-24',201426,6,2014,24,26,201406,2014),('2014-06-25',201426,6,2014,25,26,201406,2014),('2014-06-26',201426,6,2014,26,26,201406,2014),('2014-06-27',201426,6,2014,27,26,201406,2014),('2014-06-28',201426,6,2014,28,26,201406,2014),('2014-06-29',201427,6,2014,29,27,201406,2014),('2014-06-30',201427,6,2014,30,27,201406,2014),('2014-07-01',201427,7,2014,1,27,201407,2014),('2014-07-02',201427,7,2014,2,27,201407,2014),('2014-07-03',201427,7,2014,3,27,201407,2014),('2014-07-04',201427,7,2014,4,27,201407,2014),('2014-07-05',201427,7,2014,5,27,201407,2014),('2014-07-06',201428,7,2014,6,28,201407,2014),('2014-07-07',201428,7,2014,7,28,201407,2014),('2014-07-08',201428,7,2014,8,28,201407,2014),('2014-07-09',201428,7,2014,9,28,201407,2014),('2014-07-10',201428,7,2014,10,28,201407,2014),('2014-07-11',201428,7,2014,11,28,201407,2014),('2014-07-12',201428,7,2014,12,28,201407,2014),('2014-07-13',201429,7,2014,13,29,201407,2014),('2014-07-14',201429,7,2014,14,29,201407,2014),('2014-07-15',201429,7,2014,15,29,201407,2014),('2014-07-16',201429,7,2014,16,29,201407,2014),('2014-07-17',201429,7,2014,17,29,201407,2014),('2014-07-18',201429,7,2014,18,29,201407,2014),('2014-07-19',201429,7,2014,19,29,201407,2014),('2014-07-20',201430,7,2014,20,30,201407,2014),('2014-07-21',201430,7,2014,21,30,201407,2014),('2014-07-22',201430,7,2014,22,30,201407,2014),('2014-07-23',201430,7,2014,23,30,201407,2014),('2014-07-24',201430,7,2014,24,30,201407,2014),('2014-07-25',201430,7,2014,25,30,201407,2014),('2014-07-26',201430,7,2014,26,30,201407,2014),('2014-07-27',201431,7,2014,27,31,201407,2014),('2014-07-28',201431,7,2014,28,31,201407,2014),('2014-07-29',201431,7,2014,29,31,201407,2014),('2014-07-30',201431,7,2014,30,31,201407,2014),('2014-07-31',201431,7,2014,31,31,201407,2014),('2014-08-01',201431,8,2014,1,31,201408,2014),('2014-08-02',201431,8,2014,2,31,201408,2014),('2014-08-03',201432,8,2014,3,32,201408,2014),('2014-08-04',201432,8,2014,4,32,201408,2014),('2014-08-05',201432,8,2014,5,32,201408,2014),('2014-08-06',201432,8,2014,6,32,201408,2014),('2014-08-07',201432,8,2014,7,32,201408,2014),('2014-08-08',201432,8,2014,8,32,201408,2014),('2014-08-09',201432,8,2014,9,32,201408,2014),('2014-08-10',201433,8,2014,10,33,201408,2014),('2014-08-11',201433,8,2014,11,33,201408,2014),('2014-08-12',201433,8,2014,12,33,201408,2014),('2014-08-13',201433,8,2014,13,33,201408,2014),('2014-08-14',201433,8,2014,14,33,201408,2014),('2014-08-15',201433,8,2014,15,33,201408,2014),('2014-08-16',201433,8,2014,16,33,201408,2014),('2014-08-17',201434,8,2014,17,34,201408,2014),('2014-08-18',201434,8,2014,18,34,201408,2014),('2014-08-19',201434,8,2014,19,34,201408,2014),('2014-08-20',201434,8,2014,20,34,201408,2014),('2014-08-21',201434,8,2014,21,34,201408,2014),('2014-08-22',201434,8,2014,22,34,201408,2014),('2014-08-23',201434,8,2014,23,34,201408,2014),('2014-08-24',201435,8,2014,24,35,201408,2014),('2014-08-25',201435,8,2014,25,35,201408,2014),('2014-08-26',201435,8,2014,26,35,201408,2014),('2014-08-27',201435,8,2014,27,35,201408,2014),('2014-08-28',201435,8,2014,28,35,201408,2014),('2014-08-29',201435,8,2014,29,35,201408,2014),('2014-08-30',201435,8,2014,30,35,201408,2014),('2014-08-31',201436,8,2014,31,36,201408,2014),('2014-09-01',201436,9,2014,1,36,201409,2014),('2014-09-02',201436,9,2014,2,36,201409,2014),('2014-09-03',201436,9,2014,3,36,201409,2014),('2014-09-04',201436,9,2014,4,36,201409,2014),('2014-09-05',201436,9,2014,5,36,201409,2014),('2014-09-06',201436,9,2014,6,36,201409,2014),('2014-09-07',201437,9,2014,7,37,201409,2014),('2014-09-08',201437,9,2014,8,37,201409,2014),('2014-09-09',201437,9,2014,9,37,201409,2014),('2014-09-10',201437,9,2014,10,37,201409,2014),('2014-09-11',201437,9,2014,11,37,201409,2014),('2014-09-12',201437,9,2014,12,37,201409,2014),('2014-09-13',201437,9,2014,13,37,201409,2014),('2014-09-14',201438,9,2014,14,38,201409,2014),('2014-09-15',201438,9,2014,15,38,201409,2014),('2014-09-16',201438,9,2014,16,38,201409,2014),('2014-09-17',201438,9,2014,17,38,201409,2014),('2014-09-18',201438,9,2014,18,38,201409,2014),('2014-09-19',201438,9,2014,19,38,201409,2014),('2014-09-20',201438,9,2014,20,38,201409,2014),('2014-09-21',201439,9,2014,21,39,201409,2014),('2014-09-22',201439,9,2014,22,39,201409,2014),('2014-09-23',201439,9,2014,23,39,201409,2014),('2014-09-24',201439,9,2014,24,39,201409,2014),('2014-09-25',201439,9,2014,25,39,201409,2014),('2014-09-26',201439,9,2014,26,39,201409,2014),('2014-09-27',201439,9,2014,27,39,201409,2014),('2014-09-28',201440,9,2014,28,40,201409,2014),('2014-09-29',201440,9,2014,29,40,201409,2014),('2014-09-30',201440,9,2014,30,40,201409,2014),('2014-10-01',201440,10,2014,1,40,201410,2014),('2014-10-02',201440,10,2014,2,40,201410,2014),('2014-10-03',201440,10,2014,3,40,201410,2014),('2014-10-04',201440,10,2014,4,40,201410,2014),('2014-10-05',201441,10,2014,5,41,201410,2014),('2014-10-06',201441,10,2014,6,41,201410,2014),('2014-10-07',201441,10,2014,7,41,201410,2014),('2014-10-08',201441,10,2014,8,41,201410,2014),('2014-10-09',201441,10,2014,9,41,201410,2014),('2014-10-10',201441,10,2014,10,41,201410,2014),('2014-10-11',201441,10,2014,11,41,201410,2014),('2014-10-12',201442,10,2014,12,42,201410,2014),('2014-10-13',201442,10,2014,13,42,201410,2014),('2014-10-14',201442,10,2014,14,42,201410,2014),('2014-10-15',201442,10,2014,15,42,201410,2014),('2014-10-16',201442,10,2014,16,42,201410,2014),('2014-10-17',201442,10,2014,17,42,201410,2014),('2014-10-18',201442,10,2014,18,42,201410,2014),('2014-10-19',201443,10,2014,19,43,201410,2014),('2014-10-20',201443,10,2014,20,43,201410,2014),('2014-10-21',201443,10,2014,21,43,201410,2014),('2014-10-22',201443,10,2014,22,43,201410,2014),('2014-10-23',201443,10,2014,23,43,201410,2014),('2014-10-24',201443,10,2014,24,43,201410,2014),('2014-10-25',201443,10,2014,25,43,201410,2014),('2014-10-26',201444,10,2014,26,44,201410,2014),('2014-10-27',201444,10,2014,27,44,201410,2014),('2014-10-28',201444,10,2014,28,44,201410,2014),('2014-10-29',201444,10,2014,29,44,201410,2014),('2014-10-30',201444,10,2014,30,44,201410,2014),('2014-10-31',201444,10,2014,31,44,201410,2014),('2014-11-01',201444,11,2014,1,44,201411,2014),('2014-11-02',201445,11,2014,2,45,201411,2014),('2014-11-03',201445,11,2014,3,45,201411,2014),('2014-11-04',201445,11,2014,4,45,201411,2014),('2014-11-05',201445,11,2014,5,45,201411,2014),('2014-11-06',201445,11,2014,6,45,201411,2014),('2014-11-07',201445,11,2014,7,45,201411,2014),('2014-11-08',201445,11,2014,8,45,201411,2014),('2014-11-09',201446,11,2014,9,46,201411,2014),('2014-11-10',201446,11,2014,10,46,201411,2014),('2014-11-11',201446,11,2014,11,46,201411,2014),('2014-11-12',201446,11,2014,12,46,201411,2014),('2014-11-13',201446,11,2014,13,46,201411,2014),('2014-11-14',201446,11,2014,14,46,201411,2014),('2014-11-15',201446,11,2014,15,46,201411,2014),('2014-11-16',201447,11,2014,16,47,201411,2014),('2014-11-17',201447,11,2014,17,47,201411,2014),('2014-11-18',201447,11,2014,18,47,201411,2014),('2014-11-19',201447,11,2014,19,47,201411,2014),('2014-11-20',201447,11,2014,20,47,201411,2014),('2014-11-21',201447,11,2014,21,47,201411,2014),('2014-11-22',201447,11,2014,22,47,201411,2014),('2014-11-23',201448,11,2014,23,48,201411,2014),('2014-11-24',201448,11,2014,24,48,201411,2014),('2014-11-25',201448,11,2014,25,48,201411,2014),('2014-11-26',201448,11,2014,26,48,201411,2014),('2014-11-27',201448,11,2014,27,48,201411,2014),('2014-11-28',201448,11,2014,28,48,201411,2014),('2014-11-29',201448,11,2014,29,48,201411,2014),('2014-11-30',201449,11,2014,30,49,201411,2014),('2014-12-01',201449,12,2014,1,49,201412,2015),('2014-12-02',201449,12,2014,2,49,201412,2015),('2014-12-03',201449,12,2014,3,49,201412,2015),('2014-12-04',201449,12,2014,4,49,201412,2015),('2014-12-05',201449,12,2014,5,49,201412,2015),('2014-12-06',201449,12,2014,6,49,201412,2015),('2014-12-07',201450,12,2014,7,50,201412,2015),('2014-12-08',201450,12,2014,8,50,201412,2015),('2014-12-09',201450,12,2014,9,50,201412,2015),('2014-12-10',201450,12,2014,10,50,201412,2015),('2014-12-11',201450,12,2014,11,50,201412,2015),('2014-12-12',201450,12,2014,12,50,201412,2015),('2014-12-13',201450,12,2014,13,50,201412,2015),('2014-12-14',201451,12,2014,14,51,201412,2015),('2014-12-15',201451,12,2014,15,51,201412,2015),('2014-12-16',201451,12,2014,16,51,201412,2015),('2014-12-17',201451,12,2014,17,51,201412,2015),('2014-12-18',201451,12,2014,18,51,201412,2015),('2014-12-19',201451,12,2014,19,51,201412,2015),('2014-12-20',201451,12,2014,20,51,201412,2015),('2014-12-21',201452,12,2014,21,52,201412,2015),('2014-12-22',201452,12,2014,22,52,201412,2015),('2014-12-23',201452,12,2014,23,52,201412,2015),('2014-12-24',201452,12,2014,24,52,201412,2015),('2014-12-25',201452,12,2014,25,52,201412,2015),('2014-12-26',201452,12,2014,26,52,201412,2015),('2014-12-27',201452,12,2014,27,52,201412,2015),('2014-12-28',201453,12,2014,28,53,201412,2015),('2014-12-29',201453,12,2014,29,53,201412,2015),('2014-12-30',201453,12,2014,30,53,201412,2015),('2014-12-31',201453,12,2014,31,53,201412,2015),('2015-01-01',201453,1,2015,1,53,201501,2015),('2015-01-02',201453,1,2015,2,53,201501,2015),('2015-01-03',201453,1,2015,3,53,201501,2015),('2015-01-04',201501,1,2015,4,1,201501,2015),('2015-01-05',201501,1,2015,5,1,201501,2015),('2015-01-06',201501,1,2015,6,1,201501,2015),('2015-01-07',201501,1,2015,7,1,201501,2015),('2015-01-08',201501,1,2015,8,1,201501,2015),('2015-01-09',201501,1,2015,9,1,201501,2015),('2015-01-10',201501,1,2015,10,1,201501,2015),('2015-01-11',201502,1,2015,11,2,201501,2015),('2015-01-12',201502,1,2015,12,2,201501,2015),('2015-01-13',201502,1,2015,13,2,201501,2015),('2015-01-14',201502,1,2015,14,2,201501,2015),('2015-01-15',201502,1,2015,15,2,201501,2015),('2015-01-16',201502,1,2015,16,2,201501,2015),('2015-01-17',201502,1,2015,17,2,201501,2015),('2015-01-18',201503,1,2015,18,3,201501,2015),('2015-01-19',201503,1,2015,19,3,201501,2015),('2015-01-20',201503,1,2015,20,3,201501,2015),('2015-01-21',201503,1,2015,21,3,201501,2015),('2015-01-22',201503,1,2015,22,3,201501,2015),('2015-01-23',201503,1,2015,23,3,201501,2015),('2015-01-24',201503,1,2015,24,3,201501,2015),('2015-01-25',201504,1,2015,25,4,201501,2015),('2015-01-26',201504,1,2015,26,4,201501,2015),('2015-01-27',201504,1,2015,27,4,201501,2015),('2015-01-28',201504,1,2015,28,4,201501,2015),('2015-01-29',201504,1,2015,29,4,201501,2015),('2015-01-30',201504,1,2015,30,4,201501,2015),('2015-01-31',201504,1,2015,31,4,201501,2015),('2015-02-01',201505,2,2015,1,5,201502,2015),('2015-02-02',201505,2,2015,2,5,201502,2015),('2015-02-03',201505,2,2015,3,5,201502,2015),('2015-02-04',201505,2,2015,4,5,201502,2015),('2015-02-05',201505,2,2015,5,5,201502,2015),('2015-02-06',201505,2,2015,6,5,201502,2015),('2015-02-07',201505,2,2015,7,5,201502,2015),('2015-02-08',201506,2,2015,8,6,201502,2015),('2015-02-09',201506,2,2015,9,6,201502,2015),('2015-02-10',201506,2,2015,10,6,201502,2015),('2015-02-11',201506,2,2015,11,6,201502,2015),('2015-02-12',201506,2,2015,12,6,201502,2015),('2015-02-13',201506,2,2015,13,6,201502,2015),('2015-02-14',201506,2,2015,14,6,201502,2015),('2015-02-15',201507,2,2015,15,7,201502,2015),('2015-02-16',201507,2,2015,16,7,201502,2015),('2015-02-17',201507,2,2015,17,7,201502,2015),('2015-02-18',201507,2,2015,18,7,201502,2015),('2015-02-19',201507,2,2015,19,7,201502,2015),('2015-02-20',201507,2,2015,20,7,201502,2015),('2015-02-21',201507,2,2015,21,7,201502,2015),('2015-02-22',201508,2,2015,22,8,201502,2015),('2015-02-23',201508,2,2015,23,8,201502,2015),('2015-02-24',201508,2,2015,24,8,201502,2015),('2015-02-25',201508,2,2015,25,8,201502,2015),('2015-02-26',201508,2,2015,26,8,201502,2015),('2015-02-27',201508,2,2015,27,8,201502,2015),('2015-02-28',201508,2,2015,28,8,201502,2015),('2015-03-01',201509,3,2015,1,9,201503,2015),('2015-03-02',201509,3,2015,2,9,201503,2015),('2015-03-03',201509,3,2015,3,9,201503,2015),('2015-03-04',201509,3,2015,4,9,201503,2015),('2015-03-05',201509,3,2015,5,9,201503,2015),('2015-03-06',201509,3,2015,6,9,201503,2015),('2015-03-07',201509,3,2015,7,9,201503,2015),('2015-03-08',201510,3,2015,8,10,201503,2015),('2015-03-09',201510,3,2015,9,10,201503,2015),('2015-03-10',201510,3,2015,10,10,201503,2015),('2015-03-11',201510,3,2015,11,10,201503,2015),('2015-03-12',201510,3,2015,12,10,201503,2015),('2015-03-13',201510,3,2015,13,10,201503,2015),('2015-03-14',201510,3,2015,14,10,201503,2015),('2015-03-15',201511,3,2015,15,11,201503,2015),('2015-03-16',201511,3,2015,16,11,201503,2015),('2015-03-17',201511,3,2015,17,11,201503,2015),('2015-03-18',201511,3,2015,18,11,201503,2015),('2015-03-19',201511,3,2015,19,11,201503,2015),('2015-03-20',201511,3,2015,20,11,201503,2015),('2015-03-21',201511,3,2015,21,11,201503,2015),('2015-03-22',201512,3,2015,22,12,201503,2015),('2015-03-23',201512,3,2015,23,12,201503,2015),('2015-03-24',201512,3,2015,24,12,201503,2015),('2015-03-25',201512,3,2015,25,12,201503,2015),('2015-03-26',201512,3,2015,26,12,201503,2015),('2015-03-27',201512,3,2015,27,12,201503,2015),('2015-03-28',201512,3,2015,28,12,201503,2015),('2015-03-29',201513,3,2015,29,13,201503,2015),('2015-03-30',201513,3,2015,30,13,201503,2015),('2015-03-31',201513,3,2015,31,13,201503,2015),('2015-04-01',201513,4,2015,1,13,201504,2015),('2015-04-02',201513,4,2015,2,13,201504,2015),('2015-04-03',201513,4,2015,3,13,201504,2015),('2015-04-04',201513,4,2015,4,13,201504,2015),('2015-04-05',201514,4,2015,5,14,201504,2015),('2015-04-06',201514,4,2015,6,14,201504,2015),('2015-04-07',201514,4,2015,7,14,201504,2015),('2015-04-08',201514,4,2015,8,14,201504,2015),('2015-04-09',201514,4,2015,9,14,201504,2015),('2015-04-10',201514,4,2015,10,14,201504,2015),('2015-04-11',201514,4,2015,11,14,201504,2015),('2015-04-12',201515,4,2015,12,15,201504,2015),('2015-04-13',201515,4,2015,13,15,201504,2015),('2015-04-14',201515,4,2015,14,15,201504,2015),('2015-04-15',201515,4,2015,15,15,201504,2015),('2015-04-16',201515,4,2015,16,15,201504,2015),('2015-04-17',201515,4,2015,17,15,201504,2015),('2015-04-18',201515,4,2015,18,15,201504,2015),('2015-04-19',201516,4,2015,19,16,201504,2015),('2015-04-20',201516,4,2015,20,16,201504,2015),('2015-04-21',201516,4,2015,21,16,201504,2015),('2015-04-22',201516,4,2015,22,16,201504,2015),('2015-04-23',201516,4,2015,23,16,201504,2015),('2015-04-24',201516,4,2015,24,16,201504,2015),('2015-04-25',201516,4,2015,25,16,201504,2015),('2015-04-26',201517,4,2015,26,17,201504,2015),('2015-04-27',201517,4,2015,27,17,201504,2015),('2015-04-28',201517,4,2015,28,17,201504,2015),('2015-04-29',201517,4,2015,29,17,201504,2015),('2015-04-30',201517,4,2015,30,17,201504,2015),('2015-05-01',201517,5,2015,1,17,201505,2015),('2015-05-02',201517,5,2015,2,17,201505,2015),('2015-05-03',201518,5,2015,3,18,201505,2015),('2015-05-04',201518,5,2015,4,18,201505,2015),('2015-05-05',201518,5,2015,5,18,201505,2015),('2015-05-06',201518,5,2015,6,18,201505,2015),('2015-05-07',201518,5,2015,7,18,201505,2015),('2015-05-08',201518,5,2015,8,18,201505,2015),('2015-05-09',201518,5,2015,9,18,201505,2015),('2015-05-10',201519,5,2015,10,19,201505,2015),('2015-05-11',201519,5,2015,11,19,201505,2015),('2015-05-12',201519,5,2015,12,19,201505,2015),('2015-05-13',201519,5,2015,13,19,201505,2015),('2015-05-14',201519,5,2015,14,19,201505,2015),('2015-05-15',201519,5,2015,15,19,201505,2015),('2015-05-16',201519,5,2015,16,19,201505,2015),('2015-05-17',201520,5,2015,17,20,201505,2015),('2015-05-18',201520,5,2015,18,20,201505,2015),('2015-05-19',201520,5,2015,19,20,201505,2015),('2015-05-20',201520,5,2015,20,20,201505,2015),('2015-05-21',201520,5,2015,21,20,201505,2015),('2015-05-22',201520,5,2015,22,20,201505,2015),('2015-05-23',201520,5,2015,23,20,201505,2015),('2015-05-24',201521,5,2015,24,21,201505,2015),('2015-05-25',201521,5,2015,25,21,201505,2015),('2015-05-26',201521,5,2015,26,21,201505,2015),('2015-05-27',201521,5,2015,27,21,201505,2015),('2015-05-28',201521,5,2015,28,21,201505,2015),('2015-05-29',201521,5,2015,29,21,201505,2015),('2015-05-30',201521,5,2015,30,21,201505,2015),('2015-05-31',201522,5,2015,31,22,201505,2015),('2015-06-01',201522,6,2015,1,22,201506,2015),('2015-06-02',201522,6,2015,2,22,201506,2015),('2015-06-03',201522,6,2015,3,22,201506,2015),('2015-06-04',201522,6,2015,4,22,201506,2015),('2015-06-05',201522,6,2015,5,22,201506,2015),('2015-06-06',201522,6,2015,6,22,201506,2015),('2015-06-07',201523,6,2015,7,23,201506,2015),('2015-06-08',201523,6,2015,8,23,201506,2015),('2015-06-09',201523,6,2015,9,23,201506,2015),('2015-06-10',201523,6,2015,10,23,201506,2015),('2015-06-11',201523,6,2015,11,23,201506,2015),('2015-06-12',201523,6,2015,12,23,201506,2015),('2015-06-13',201523,6,2015,13,23,201506,2015),('2015-06-14',201524,6,2015,14,24,201506,2015),('2015-06-15',201524,6,2015,15,24,201506,2015),('2015-06-16',201524,6,2015,16,24,201506,2015),('2015-06-17',201524,6,2015,17,24,201506,2015),('2015-06-18',201524,6,2015,18,24,201506,2015),('2015-06-19',201524,6,2015,19,24,201506,2015),('2015-06-20',201524,6,2015,20,24,201506,2015),('2015-06-21',201525,6,2015,21,25,201506,2015),('2015-06-22',201525,6,2015,22,25,201506,2015),('2015-06-23',201525,6,2015,23,25,201506,2015),('2015-06-24',201525,6,2015,24,25,201506,2015),('2015-06-25',201525,6,2015,25,25,201506,2015),('2015-06-26',201525,6,2015,26,25,201506,2015),('2015-06-27',201525,6,2015,27,25,201506,2015),('2015-06-28',201526,6,2015,28,26,201506,2015),('2015-06-29',201526,6,2015,29,26,201506,2015),('2015-06-30',201526,6,2015,30,26,201506,2015),('2015-07-01',201526,7,2015,1,26,201507,2015),('2015-07-02',201526,7,2015,2,26,201507,2015),('2015-07-03',201526,7,2015,3,26,201507,2015),('2015-07-04',201526,7,2015,4,26,201507,2015),('2015-07-05',201527,7,2015,5,27,201507,2015),('2015-07-06',201527,7,2015,6,27,201507,2015),('2015-07-07',201527,7,2015,7,27,201507,2015),('2015-07-08',201527,7,2015,8,27,201507,2015),('2015-07-09',201527,7,2015,9,27,201507,2015),('2015-07-10',201527,7,2015,10,27,201507,2015),('2015-07-11',201527,7,2015,11,27,201507,2015),('2015-07-12',201528,7,2015,12,28,201507,2015),('2015-07-13',201528,7,2015,13,28,201507,2015),('2015-07-14',201528,7,2015,14,28,201507,2015),('2015-07-15',201528,7,2015,15,28,201507,2015),('2015-07-16',201528,7,2015,16,28,201507,2015),('2015-07-17',201528,7,2015,17,28,201507,2015),('2015-07-18',201528,7,2015,18,28,201507,2015),('2015-07-19',201529,7,2015,19,29,201507,2015),('2015-07-20',201529,7,2015,20,29,201507,2015),('2015-07-21',201529,7,2015,21,29,201507,2015),('2015-07-22',201529,7,2015,22,29,201507,2015),('2015-07-23',201529,7,2015,23,29,201507,2015),('2015-07-24',201529,7,2015,24,29,201507,2015),('2015-07-25',201529,7,2015,25,29,201507,2015),('2015-07-26',201530,7,2015,26,30,201507,2015),('2015-07-27',201530,7,2015,27,30,201507,2015),('2015-07-28',201530,7,2015,28,30,201507,2015),('2015-07-29',201530,7,2015,29,30,201507,2015),('2015-07-30',201530,7,2015,30,30,201507,2015),('2015-07-31',201530,7,2015,31,30,201507,2015),('2015-08-01',201530,8,2015,1,30,201508,2015),('2015-08-02',201531,8,2015,2,31,201508,2015),('2015-08-03',201531,8,2015,3,31,201508,2015),('2015-08-04',201531,8,2015,4,31,201508,2015),('2015-08-05',201531,8,2015,5,31,201508,2015),('2015-08-06',201531,8,2015,6,31,201508,2015),('2015-08-07',201531,8,2015,7,31,201508,2015),('2015-08-08',201531,8,2015,8,31,201508,2015),('2015-08-09',201532,8,2015,9,32,201508,2015),('2015-08-10',201532,8,2015,10,32,201508,2015),('2015-08-11',201532,8,2015,11,32,201508,2015),('2015-08-12',201532,8,2015,12,32,201508,2015),('2015-08-13',201532,8,2015,13,32,201508,2015),('2015-08-14',201532,8,2015,14,32,201508,2015),('2015-08-15',201532,8,2015,15,32,201508,2015),('2015-08-16',201533,8,2015,16,33,201508,2015),('2015-08-17',201533,8,2015,17,33,201508,2015),('2015-08-18',201533,8,2015,18,33,201508,2015),('2015-08-19',201533,8,2015,19,33,201508,2015),('2015-08-20',201533,8,2015,20,33,201508,2015),('2015-08-21',201533,8,2015,21,33,201508,2015),('2015-08-22',201533,8,2015,22,33,201508,2015),('2015-08-23',201534,8,2015,23,34,201508,2015),('2015-08-24',201534,8,2015,24,34,201508,2015),('2015-08-25',201534,8,2015,25,34,201508,2015),('2015-08-26',201534,8,2015,26,34,201508,2015),('2015-08-27',201534,8,2015,27,34,201508,2015),('2015-08-28',201534,8,2015,28,34,201508,2015),('2015-08-29',201534,8,2015,29,34,201508,2015),('2015-08-30',201535,8,2015,30,35,201508,2015),('2015-08-31',201535,8,2015,31,35,201508,2015),('2015-09-01',201535,9,2015,1,35,201509,2015),('2015-09-02',201535,9,2015,2,35,201509,2015),('2015-09-03',201535,9,2015,3,35,201509,2015),('2015-09-04',201535,9,2015,4,35,201509,2015),('2015-09-05',201535,9,2015,5,35,201509,2015),('2015-09-06',201536,9,2015,6,36,201509,2015),('2015-09-07',201536,9,2015,7,36,201509,2015),('2015-09-08',201536,9,2015,8,36,201509,2015),('2015-09-09',201536,9,2015,9,36,201509,2015),('2015-09-10',201536,9,2015,10,36,201509,2015),('2015-09-11',201536,9,2015,11,36,201509,2015),('2015-09-12',201536,9,2015,12,36,201509,2015),('2015-09-13',201537,9,2015,13,37,201509,2015),('2015-09-14',201537,9,2015,14,37,201509,2015),('2015-09-15',201537,9,2015,15,37,201509,2015),('2015-09-16',201537,9,2015,16,37,201509,2015),('2015-09-17',201537,9,2015,17,37,201509,2015),('2015-09-18',201537,9,2015,18,37,201509,2015),('2015-09-19',201537,9,2015,19,37,201509,2015),('2015-09-20',201538,9,2015,20,38,201509,2015),('2015-09-21',201538,9,2015,21,38,201509,2015),('2015-09-22',201538,9,2015,22,38,201509,2015),('2015-09-23',201538,9,2015,23,38,201509,2015),('2015-09-24',201538,9,2015,24,38,201509,2015),('2015-09-25',201538,9,2015,25,38,201509,2015),('2015-09-26',201538,9,2015,26,38,201509,2015),('2015-09-27',201539,9,2015,27,39,201509,2015),('2015-09-28',201539,9,2015,28,39,201509,2015),('2015-09-29',201539,9,2015,29,39,201509,2015),('2015-09-30',201539,9,2015,30,39,201509,2015),('2015-10-01',201539,10,2015,1,39,201510,2015),('2015-10-02',201539,10,2015,2,39,201510,2015),('2015-10-03',201539,10,2015,3,39,201510,2015),('2015-10-04',201540,10,2015,4,40,201510,2015),('2015-10-05',201540,10,2015,5,40,201510,2015),('2015-10-06',201540,10,2015,6,40,201510,2015),('2015-10-07',201540,10,2015,7,40,201510,2015),('2015-10-08',201540,10,2015,8,40,201510,2015),('2015-10-09',201540,10,2015,9,40,201510,2015),('2015-10-10',201540,10,2015,10,40,201510,2015),('2015-10-11',201541,10,2015,11,41,201510,2015),('2015-10-12',201541,10,2015,12,41,201510,2015),('2015-10-13',201541,10,2015,13,41,201510,2015),('2015-10-14',201541,10,2015,14,41,201510,2015),('2015-10-15',201541,10,2015,15,41,201510,2015),('2015-10-16',201541,10,2015,16,41,201510,2015),('2015-10-17',201541,10,2015,17,41,201510,2015),('2015-10-18',201542,10,2015,18,42,201510,2015),('2015-10-19',201542,10,2015,19,42,201510,2015),('2015-10-20',201542,10,2015,20,42,201510,2015),('2015-10-21',201542,10,2015,21,42,201510,2015),('2015-10-22',201542,10,2015,22,42,201510,2015),('2015-10-23',201542,10,2015,23,42,201510,2015),('2015-10-24',201542,10,2015,24,42,201510,2015),('2015-10-25',201543,10,2015,25,43,201510,2015),('2015-10-26',201543,10,2015,26,43,201510,2015),('2015-10-27',201543,10,2015,27,43,201510,2015),('2015-10-28',201543,10,2015,28,43,201510,2015),('2015-10-29',201543,10,2015,29,43,201510,2015),('2015-10-30',201543,10,2015,30,43,201510,2015),('2015-10-31',201543,10,2015,31,43,201510,2015),('2015-11-01',201544,11,2015,1,44,201511,2015),('2015-11-02',201544,11,2015,2,44,201511,2015),('2015-11-03',201544,11,2015,3,44,201511,2015),('2015-11-04',201544,11,2015,4,44,201511,2015),('2015-11-05',201544,11,2015,5,44,201511,2015),('2015-11-06',201544,11,2015,6,44,201511,2015),('2015-11-07',201544,11,2015,7,44,201511,2015),('2015-11-08',201545,11,2015,8,45,201511,2015),('2015-11-09',201545,11,2015,9,45,201511,2015),('2015-11-10',201545,11,2015,10,45,201511,2015),('2015-11-11',201545,11,2015,11,45,201511,2015),('2015-11-12',201545,11,2015,12,45,201511,2015),('2015-11-13',201545,11,2015,13,45,201511,2015),('2015-11-14',201545,11,2015,14,45,201511,2015),('2015-11-15',201546,11,2015,15,46,201511,2015),('2015-11-16',201546,11,2015,16,46,201511,2015),('2015-11-17',201546,11,2015,17,46,201511,2015),('2015-11-18',201546,11,2015,18,46,201511,2015),('2015-11-19',201546,11,2015,19,46,201511,2015),('2015-11-20',201546,11,2015,20,46,201511,2015),('2015-11-21',201546,11,2015,21,46,201511,2015),('2015-11-22',201547,11,2015,22,47,201511,2015),('2015-11-23',201547,11,2015,23,47,201511,2015),('2015-11-24',201547,11,2015,24,47,201511,2015),('2015-11-25',201547,11,2015,25,47,201511,2015),('2015-11-26',201547,11,2015,26,47,201511,2015),('2015-11-27',201547,11,2015,27,47,201511,2015),('2015-11-28',201547,11,2015,28,47,201511,2015),('2015-11-29',201548,11,2015,29,48,201511,2015),('2015-11-30',201548,11,2015,30,48,201511,2015),('2015-12-01',201548,12,2015,1,48,201512,2016),('2015-12-02',201548,12,2015,2,48,201512,2016),('2015-12-03',201548,12,2015,3,48,201512,2016),('2015-12-04',201548,12,2015,4,48,201512,2016),('2015-12-05',201548,12,2015,5,48,201512,2016),('2015-12-06',201549,12,2015,6,49,201512,2016),('2015-12-07',201549,12,2015,7,49,201512,2016),('2015-12-08',201549,12,2015,8,49,201512,2016),('2015-12-09',201549,12,2015,9,49,201512,2016),('2015-12-10',201549,12,2015,10,49,201512,2016),('2015-12-11',201549,12,2015,11,49,201512,2016),('2015-12-12',201549,12,2015,12,49,201512,2016),('2015-12-13',201550,12,2015,13,50,201512,2016),('2015-12-14',201550,12,2015,14,50,201512,2016),('2015-12-15',201550,12,2015,15,50,201512,2016),('2015-12-16',201550,12,2015,16,50,201512,2016),('2015-12-17',201550,12,2015,17,50,201512,2016),('2015-12-18',201550,12,2015,18,50,201512,2016),('2015-12-19',201550,12,2015,19,50,201512,2016),('2015-12-20',201551,12,2015,20,51,201512,2016),('2015-12-21',201551,12,2015,21,51,201512,2016),('2015-12-22',201551,12,2015,22,51,201512,2016),('2015-12-23',201551,12,2015,23,51,201512,2016),('2015-12-24',201551,12,2015,24,51,201512,2016),('2015-12-25',201551,12,2015,25,51,201512,2016),('2015-12-26',201551,12,2015,26,51,201512,2016),('2015-12-27',201552,12,2015,27,52,201512,2016),('2015-12-28',201552,12,2015,28,52,201512,2016),('2015-12-29',201552,12,2015,29,52,201512,2016),('2015-12-30',201552,12,2015,30,52,201512,2016),('2015-12-31',201552,12,2015,31,52,201512,2016),('2016-01-01',201552,1,2016,1,1,201601,2016),('2016-01-02',201552,1,2016,2,1,201601,2016),('2016-01-03',201601,1,2016,3,1,201601,2016),('2016-01-04',201601,1,2016,4,1,201601,2016),('2016-01-05',201601,1,2016,5,1,201601,2016),('2016-01-06',201601,1,2016,6,1,201601,2016),('2016-01-07',201601,1,2016,7,1,201601,2016),('2016-01-08',201601,1,2016,8,1,201601,2016),('2016-01-09',201601,1,2016,9,1,201601,2016),('2016-01-10',201602,1,2016,10,2,201601,2016),('2016-01-11',201602,1,2016,11,2,201601,2016),('2016-01-12',201602,1,2016,12,2,201601,2016),('2016-01-13',201602,1,2016,13,2,201601,2016),('2016-01-14',201602,1,2016,14,2,201601,2016),('2016-01-15',201602,1,2016,15,2,201601,2016),('2016-01-16',201602,1,2016,16,2,201601,2016),('2016-01-17',201603,1,2016,17,3,201601,2016),('2016-01-18',201603,1,2016,18,3,201601,2016),('2016-01-19',201603,1,2016,19,3,201601,2016),('2016-01-20',201603,1,2016,20,3,201601,2016),('2016-01-21',201603,1,2016,21,3,201601,2016),('2016-01-22',201603,1,2016,22,3,201601,2016),('2016-01-23',201603,1,2016,23,3,201601,2016),('2016-01-24',201604,1,2016,24,4,201601,2016),('2016-01-25',201604,1,2016,25,4,201601,2016),('2016-01-26',201604,1,2016,26,4,201601,2016),('2016-01-27',201604,1,2016,27,4,201601,2016),('2016-01-28',201604,1,2016,28,4,201601,2016),('2016-01-29',201604,1,2016,29,4,201601,2016),('2016-01-30',201604,1,2016,30,4,201601,2016),('2016-01-31',201605,1,2016,31,5,201601,2016),('2016-02-01',201605,2,2016,1,5,201602,2016),('2016-02-02',201605,2,2016,2,5,201602,2016),('2016-02-03',201605,2,2016,3,5,201602,2016),('2016-02-04',201605,2,2016,4,5,201602,2016),('2016-02-05',201605,2,2016,5,5,201602,2016),('2016-02-06',201605,2,2016,6,5,201602,2016),('2016-02-07',201606,2,2016,7,6,201602,2016),('2016-02-08',201606,2,2016,8,6,201602,2016),('2016-02-09',201606,2,2016,9,6,201602,2016),('2016-02-10',201606,2,2016,10,6,201602,2016),('2016-02-11',201606,2,2016,11,6,201602,2016),('2016-02-12',201606,2,2016,12,6,201602,2016),('2016-02-13',201606,2,2016,13,6,201602,2016),('2016-02-14',201607,2,2016,14,7,201602,2016),('2016-02-15',201607,2,2016,15,7,201602,2016),('2016-02-16',201607,2,2016,16,7,201602,2016),('2016-02-17',201607,2,2016,17,7,201602,2016),('2016-02-18',201607,2,2016,18,7,201602,2016),('2016-02-19',201607,2,2016,19,7,201602,2016),('2016-02-20',201607,2,2016,20,7,201602,2016),('2016-02-21',201608,2,2016,21,8,201602,2016),('2016-02-22',201608,2,2016,22,8,201602,2016),('2016-02-23',201608,2,2016,23,8,201602,2016),('2016-02-24',201608,2,2016,24,8,201602,2016),('2016-02-25',201608,2,2016,25,8,201602,2016),('2016-02-26',201608,2,2016,26,8,201602,2016),('2016-02-27',201608,2,2016,27,8,201602,2016),('2016-02-28',201609,2,2016,28,9,201602,2016),('2016-02-29',201609,2,2016,29,9,201602,2016),('2016-03-01',201609,3,2016,1,9,201603,2016),('2016-03-02',201609,3,2016,2,9,201603,2016),('2016-03-03',201609,3,2016,3,9,201603,2016),('2016-03-04',201609,3,2016,4,9,201603,2016),('2016-03-05',201609,3,2016,5,9,201603,2016),('2016-03-06',201610,3,2016,6,10,201603,2016),('2016-03-07',201610,3,2016,7,10,201603,2016),('2016-03-08',201610,3,2016,8,10,201603,2016),('2016-03-09',201610,3,2016,9,10,201603,2016),('2016-03-10',201610,3,2016,10,10,201603,2016),('2016-03-11',201610,3,2016,11,10,201603,2016),('2016-03-12',201610,3,2016,12,10,201603,2016),('2016-03-13',201611,3,2016,13,11,201603,2016),('2016-03-14',201611,3,2016,14,11,201603,2016),('2016-03-15',201611,3,2016,15,11,201603,2016),('2016-03-16',201611,3,2016,16,11,201603,2016),('2016-03-17',201611,3,2016,17,11,201603,2016),('2016-03-18',201611,3,2016,18,11,201603,2016),('2016-03-19',201611,3,2016,19,11,201603,2016),('2016-03-20',201612,3,2016,20,12,201603,2016),('2016-03-21',201612,3,2016,21,12,201603,2016),('2016-03-22',201612,3,2016,22,12,201603,2016),('2016-03-23',201612,3,2016,23,12,201603,2016),('2016-03-24',201612,3,2016,24,12,201603,2016),('2016-03-25',201612,3,2016,25,12,201603,2016),('2016-03-26',201612,3,2016,26,12,201603,2016),('2016-03-27',201613,3,2016,27,13,201603,2016),('2016-03-28',201613,3,2016,28,13,201603,2016),('2016-03-29',201613,3,2016,29,13,201603,2016),('2016-03-30',201613,3,2016,30,13,201603,2016),('2016-03-31',201613,3,2016,31,13,201603,2016),('2016-04-01',201613,4,2016,1,13,201604,2016),('2016-04-02',201613,4,2016,2,13,201604,2016),('2016-04-03',201614,4,2016,3,14,201604,2016),('2016-04-04',201614,4,2016,4,14,201604,2016),('2016-04-05',201614,4,2016,5,14,201604,2016),('2016-04-06',201614,4,2016,6,14,201604,2016),('2016-04-07',201614,4,2016,7,14,201604,2016),('2016-04-08',201614,4,2016,8,14,201604,2016),('2016-04-09',201614,4,2016,9,14,201604,2016),('2016-04-10',201615,4,2016,10,15,201604,2016),('2016-04-11',201615,4,2016,11,15,201604,2016),('2016-04-12',201615,4,2016,12,15,201604,2016),('2016-04-13',201615,4,2016,13,15,201604,2016),('2016-04-14',201615,4,2016,14,15,201604,2016),('2016-04-15',201615,4,2016,15,15,201604,2016),('2016-04-16',201615,4,2016,16,15,201604,2016),('2016-04-17',201616,4,2016,17,16,201604,2016),('2016-04-18',201616,4,2016,18,16,201604,2016),('2016-04-19',201616,4,2016,19,16,201604,2016),('2016-04-20',201616,4,2016,20,16,201604,2016),('2016-04-21',201616,4,2016,21,16,201604,2016),('2016-04-22',201616,4,2016,22,16,201604,2016),('2016-04-23',201616,4,2016,23,16,201604,2016),('2016-04-24',201617,4,2016,24,17,201604,2016),('2016-04-25',201617,4,2016,25,17,201604,2016),('2016-04-26',201617,4,2016,26,17,201604,2016),('2016-04-27',201617,4,2016,27,17,201604,2016),('2016-04-28',201617,4,2016,28,17,201604,2016),('2016-04-29',201617,4,2016,29,17,201604,2016),('2016-04-30',201617,4,2016,30,17,201604,2016),('2016-05-01',201618,5,2016,1,18,201605,2016),('2016-05-02',201618,5,2016,2,18,201605,2016),('2016-05-03',201618,5,2016,3,18,201605,2016),('2016-05-04',201618,5,2016,4,18,201605,2016),('2016-05-05',201618,5,2016,5,18,201605,2016),('2016-05-06',201618,5,2016,6,18,201605,2016),('2016-05-07',201618,5,2016,7,18,201605,2016),('2016-05-08',201619,5,2016,8,19,201605,2016),('2016-05-09',201619,5,2016,9,19,201605,2016),('2016-05-10',201619,5,2016,10,19,201605,2016),('2016-05-11',201619,5,2016,11,19,201605,2016),('2016-05-12',201619,5,2016,12,19,201605,2016),('2016-05-13',201619,5,2016,13,19,201605,2016),('2016-05-14',201619,5,2016,14,19,201605,2016),('2016-05-15',201620,5,2016,15,20,201605,2016),('2016-05-16',201620,5,2016,16,20,201605,2016),('2016-05-17',201620,5,2016,17,20,201605,2016),('2016-05-18',201620,5,2016,18,20,201605,2016),('2016-05-19',201620,5,2016,19,20,201605,2016),('2016-05-20',201620,5,2016,20,20,201605,2016),('2016-05-21',201620,5,2016,21,20,201605,2016),('2016-05-22',201621,5,2016,22,21,201605,2016),('2016-05-23',201621,5,2016,23,21,201605,2016),('2016-05-24',201621,5,2016,24,21,201605,2016),('2016-05-25',201621,5,2016,25,21,201605,2016),('2016-05-26',201621,5,2016,26,21,201605,2016),('2016-05-27',201621,5,2016,27,21,201605,2016),('2016-05-28',201621,5,2016,28,21,201605,2016),('2016-05-29',201622,5,2016,29,22,201605,2016),('2016-05-30',201622,5,2016,30,22,201605,2016),('2016-05-31',201622,5,2016,31,22,201605,2016),('2016-06-01',201622,6,2016,1,22,201606,2016),('2016-06-02',201622,6,2016,2,22,201606,2016),('2016-06-03',201622,6,2016,3,22,201606,2016),('2016-06-04',201622,6,2016,4,22,201606,2016),('2016-06-05',201623,6,2016,5,23,201606,2016),('2016-06-06',201623,6,2016,6,23,201606,2016),('2016-06-07',201623,6,2016,7,23,201606,2016),('2016-06-08',201623,6,2016,8,23,201606,2016),('2016-06-09',201623,6,2016,9,23,201606,2016),('2016-06-10',201623,6,2016,10,23,201606,2016),('2016-06-11',201623,6,2016,11,23,201606,2016),('2016-06-12',201624,6,2016,12,24,201606,2016),('2016-06-13',201624,6,2016,13,24,201606,2016),('2016-06-14',201624,6,2016,14,24,201606,2016),('2016-06-15',201624,6,2016,15,24,201606,2016),('2016-06-16',201624,6,2016,16,24,201606,2016),('2016-06-17',201624,6,2016,17,24,201606,2016),('2016-06-18',201624,6,2016,18,24,201606,2016),('2016-06-19',201625,6,2016,19,25,201606,2016),('2016-06-20',201625,6,2016,20,25,201606,2016),('2016-06-21',201625,6,2016,21,25,201606,2016),('2016-06-22',201625,6,2016,22,25,201606,2016),('2016-06-23',201625,6,2016,23,25,201606,2016),('2016-06-24',201625,6,2016,24,25,201606,2016),('2016-06-25',201625,6,2016,25,25,201606,2016),('2016-06-26',201626,6,2016,26,26,201606,2016),('2016-06-27',201626,6,2016,27,26,201606,2016),('2016-06-28',201626,6,2016,28,26,201606,2016),('2016-06-29',201626,6,2016,29,26,201606,2016),('2016-06-30',201626,6,2016,30,26,201606,2016),('2016-07-01',201626,7,2016,1,26,201607,2016),('2016-07-02',201626,7,2016,2,26,201607,2016),('2016-07-03',201627,7,2016,3,27,201607,2016),('2016-07-04',201627,7,2016,4,27,201607,2016),('2016-07-05',201627,7,2016,5,27,201607,2016),('2016-07-06',201627,7,2016,6,27,201607,2016),('2016-07-07',201627,7,2016,7,27,201607,2016),('2016-07-08',201627,7,2016,8,27,201607,2016),('2016-07-09',201627,7,2016,9,27,201607,2016),('2016-07-10',201628,7,2016,10,28,201607,2016),('2016-07-11',201628,7,2016,11,28,201607,2016),('2016-07-12',201628,7,2016,12,28,201607,2016),('2016-07-13',201628,7,2016,13,28,201607,2016),('2016-07-14',201628,7,2016,14,28,201607,2016),('2016-07-15',201628,7,2016,15,28,201607,2016),('2016-07-16',201628,7,2016,16,28,201607,2016),('2016-07-17',201629,7,2016,17,29,201607,2016),('2016-07-18',201629,7,2016,18,29,201607,2016),('2016-07-19',201629,7,2016,19,29,201607,2016),('2016-07-20',201629,7,2016,20,29,201607,2016),('2016-07-21',201629,7,2016,21,29,201607,2016),('2016-07-22',201629,7,2016,22,29,201607,2016),('2016-07-23',201629,7,2016,23,29,201607,2016),('2016-07-24',201630,7,2016,24,30,201607,2016),('2016-07-25',201630,7,2016,25,30,201607,2016),('2016-07-26',201630,7,2016,26,30,201607,2016),('2016-07-27',201630,7,2016,27,30,201607,2016),('2016-07-28',201630,7,2016,28,30,201607,2016),('2016-07-29',201630,7,2016,29,30,201607,2016),('2016-07-30',201630,7,2016,30,30,201607,2016),('2016-07-31',201631,7,2016,31,31,201607,2016),('2016-08-01',201631,8,2016,1,31,201608,2016),('2016-08-02',201631,8,2016,2,31,201608,2016),('2016-08-03',201631,8,2016,3,31,201608,2016),('2016-08-04',201631,8,2016,4,31,201608,2016),('2016-08-05',201631,8,2016,5,31,201608,2016),('2016-08-06',201631,8,2016,6,31,201608,2016),('2016-08-07',201632,8,2016,7,32,201608,2016),('2016-08-08',201632,8,2016,8,32,201608,2016),('2016-08-09',201632,8,2016,9,32,201608,2016),('2016-08-10',201632,8,2016,10,32,201608,2016),('2016-08-11',201632,8,2016,11,32,201608,2016),('2016-08-12',201632,8,2016,12,32,201608,2016),('2016-08-13',201632,8,2016,13,32,201608,2016),('2016-08-14',201633,8,2016,14,33,201608,2016),('2016-08-15',201633,8,2016,15,33,201608,2016),('2016-08-16',201633,8,2016,16,33,201608,2016),('2016-08-17',201633,8,2016,17,33,201608,2016),('2016-08-18',201633,8,2016,18,33,201608,2016),('2016-08-19',201633,8,2016,19,33,201608,2016),('2016-08-20',201633,8,2016,20,33,201608,2016),('2016-08-21',201634,8,2016,21,34,201608,2016),('2016-08-22',201634,8,2016,22,34,201608,2016),('2016-08-23',201634,8,2016,23,34,201608,2016),('2016-08-24',201634,8,2016,24,34,201608,2016),('2016-08-25',201634,8,2016,25,34,201608,2016),('2016-08-26',201634,8,2016,26,34,201608,2016),('2016-08-27',201634,8,2016,27,34,201608,2016),('2016-08-28',201635,8,2016,28,35,201608,2016),('2016-08-29',201635,8,2016,29,35,201608,2016),('2016-08-30',201635,8,2016,30,35,201608,2016),('2016-08-31',201635,8,2016,31,35,201608,2016),('2016-09-01',201635,9,2016,1,35,201609,2016),('2016-09-02',201635,9,2016,2,35,201609,2016),('2016-09-03',201635,9,2016,3,35,201609,2016),('2016-09-04',201636,9,2016,4,36,201609,2016),('2016-09-05',201636,9,2016,5,36,201609,2016),('2016-09-06',201636,9,2016,6,36,201609,2016),('2016-09-07',201636,9,2016,7,36,201609,2016),('2016-09-08',201636,9,2016,8,36,201609,2016),('2016-09-09',201636,9,2016,9,36,201609,2016),('2016-09-10',201636,9,2016,10,36,201609,2016),('2016-09-11',201637,9,2016,11,37,201609,2016),('2016-09-12',201637,9,2016,12,37,201609,2016),('2016-09-13',201637,9,2016,13,37,201609,2016),('2016-09-14',201637,9,2016,14,37,201609,2016),('2016-09-15',201637,9,2016,15,37,201609,2016),('2016-09-16',201637,9,2016,16,37,201609,2016),('2016-09-17',201637,9,2016,17,37,201609,2016),('2016-09-18',201638,9,2016,18,38,201609,2016),('2016-09-19',201638,9,2016,19,38,201609,2016),('2016-09-20',201638,9,2016,20,38,201609,2016),('2016-09-21',201638,9,2016,21,38,201609,2016),('2016-09-22',201638,9,2016,22,38,201609,2016),('2016-09-23',201638,9,2016,23,38,201609,2016),('2016-09-24',201638,9,2016,24,38,201609,2016),('2016-09-25',201639,9,2016,25,39,201609,2016),('2016-09-26',201639,9,2016,26,39,201609,2016),('2016-09-27',201639,9,2016,27,39,201609,2016),('2016-09-28',201639,9,2016,28,39,201609,2016),('2016-09-29',201639,9,2016,29,39,201609,2016),('2016-09-30',201639,9,2016,30,39,201609,2016),('2016-10-01',201639,10,2016,1,39,201610,2016),('2016-10-02',201640,10,2016,2,40,201610,2016),('2016-10-03',201640,10,2016,3,40,201610,2016),('2016-10-04',201640,10,2016,4,40,201610,2016),('2016-10-05',201640,10,2016,5,40,201610,2016),('2016-10-06',201640,10,2016,6,40,201610,2016),('2016-10-07',201640,10,2016,7,40,201610,2016),('2016-10-08',201640,10,2016,8,40,201610,2016),('2016-10-09',201641,10,2016,9,41,201610,2016),('2016-10-10',201641,10,2016,10,41,201610,2016),('2016-10-11',201641,10,2016,11,41,201610,2016),('2016-10-12',201641,10,2016,12,41,201610,2016),('2016-10-13',201641,10,2016,13,41,201610,2016),('2016-10-14',201641,10,2016,14,41,201610,2016),('2016-10-15',201641,10,2016,15,41,201610,2016),('2016-10-16',201642,10,2016,16,42,201610,2016),('2016-10-17',201642,10,2016,17,42,201610,2016),('2016-10-18',201642,10,2016,18,42,201610,2016),('2016-10-19',201642,10,2016,19,42,201610,2016),('2016-10-20',201642,10,2016,20,42,201610,2016),('2016-10-21',201642,10,2016,21,42,201610,2016),('2016-10-22',201642,10,2016,22,42,201610,2016),('2016-10-23',201643,10,2016,23,43,201610,2016),('2016-10-24',201643,10,2016,24,43,201610,2016),('2016-10-25',201643,10,2016,25,43,201610,2016),('2016-10-26',201643,10,2016,26,43,201610,2016),('2016-10-27',201643,10,2016,27,43,201610,2016),('2016-10-28',201643,10,2016,28,43,201610,2016),('2016-10-29',201643,10,2016,29,43,201610,2016),('2016-10-30',201644,10,2016,30,44,201610,2016),('2016-10-31',201644,10,2016,31,44,201610,2016),('2016-11-01',201644,11,2016,1,44,201611,2016),('2016-11-02',201644,11,2016,2,44,201611,2016),('2016-11-03',201644,11,2016,3,44,201611,2016),('2016-11-04',201644,11,2016,4,44,201611,2016),('2016-11-05',201644,11,2016,5,44,201611,2016),('2016-11-06',201645,11,2016,6,45,201611,2016),('2016-11-07',201645,11,2016,7,45,201611,2016),('2016-11-08',201645,11,2016,8,45,201611,2016),('2016-11-09',201645,11,2016,9,45,201611,2016),('2016-11-10',201645,11,2016,10,45,201611,2016),('2016-11-11',201645,11,2016,11,45,201611,2016),('2016-11-12',201645,11,2016,12,45,201611,2016),('2016-11-13',201646,11,2016,13,46,201611,2016),('2016-11-14',201646,11,2016,14,46,201611,2016),('2016-11-15',201646,11,2016,15,46,201611,2016),('2016-11-16',201646,11,2016,16,46,201611,2016),('2016-11-17',201646,11,2016,17,46,201611,2016),('2016-11-18',201646,11,2016,18,46,201611,2016),('2016-11-19',201646,11,2016,19,46,201611,2016),('2016-11-20',201647,11,2016,20,47,201611,2016),('2016-11-21',201647,11,2016,21,47,201611,2016),('2016-11-22',201647,11,2016,22,47,201611,2016),('2016-11-23',201647,11,2016,23,47,201611,2016),('2016-11-24',201647,11,2016,24,47,201611,2016),('2016-11-25',201647,11,2016,25,47,201611,2016),('2016-11-26',201647,11,2016,26,47,201611,2016),('2016-11-27',201648,11,2016,27,48,201611,2016),('2016-11-28',201648,11,2016,28,48,201611,2016),('2016-11-29',201648,11,2016,29,48,201611,2016),('2016-11-30',201648,11,2016,30,48,201611,2016),('2016-12-01',201648,12,2016,1,48,201612,2017),('2016-12-02',201648,12,2016,2,48,201612,2017),('2016-12-03',201648,12,2016,3,48,201612,2017),('2016-12-04',201649,12,2016,4,49,201612,2017),('2016-12-05',201649,12,2016,5,49,201612,2017),('2016-12-06',201649,12,2016,6,49,201612,2017),('2016-12-07',201649,12,2016,7,49,201612,2017),('2016-12-08',201649,12,2016,8,49,201612,2017),('2016-12-09',201649,12,2016,9,49,201612,2017),('2016-12-10',201649,12,2016,10,49,201612,2017),('2016-12-11',201650,12,2016,11,50,201612,2017),('2016-12-12',201650,12,2016,12,50,201612,2017),('2016-12-13',201650,12,2016,13,50,201612,2017),('2016-12-14',201650,12,2016,14,50,201612,2017),('2016-12-15',201650,12,2016,15,50,201612,2017),('2016-12-16',201650,12,2016,16,50,201612,2017),('2016-12-17',201650,12,2016,17,50,201612,2017),('2016-12-18',201651,12,2016,18,51,201612,2017),('2016-12-19',201651,12,2016,19,51,201612,2017),('2016-12-20',201651,12,2016,20,51,201612,2017),('2016-12-21',201651,12,2016,21,51,201612,2017),('2016-12-22',201651,12,2016,22,51,201612,2017),('2016-12-23',201651,12,2016,23,51,201612,2017),('2016-12-24',201651,12,2016,24,51,201612,2017),('2016-12-25',201652,12,2016,25,52,201612,2017),('2016-12-26',201652,12,2016,26,52,201612,2017),('2016-12-27',201652,12,2016,27,52,201612,2017),('2016-12-28',201652,12,2016,28,52,201612,2017),('2016-12-29',201652,12,2016,29,52,201612,2017),('2016-12-30',201652,12,2016,30,52,201612,2017),('2016-12-31',201652,12,2016,31,52,201612,2017),('2017-01-01',201701,1,2017,1,1,201701,2017),('2017-01-02',201701,1,2017,2,1,201701,2017),('2017-01-03',201701,1,2017,3,1,201701,2017),('2017-01-04',201701,1,2017,4,1,201701,2017),('2017-01-05',201701,1,2017,5,1,201701,2017),('2017-01-06',201701,1,2017,6,1,201701,2017),('2017-01-07',201701,1,2017,7,1,201701,2017),('2017-01-08',201702,1,2017,8,2,201701,2017),('2017-01-09',201702,1,2017,9,2,201701,2017),('2017-01-10',201702,1,2017,10,2,201701,2017),('2017-01-11',201702,1,2017,11,2,201701,2017),('2017-01-12',201702,1,2017,12,2,201701,2017),('2017-01-13',201702,1,2017,13,2,201701,2017),('2017-01-14',201702,1,2017,14,2,201701,2017),('2017-01-15',201703,1,2017,15,3,201701,2017),('2017-01-16',201703,1,2017,16,3,201701,2017),('2017-01-17',201703,1,2017,17,3,201701,2017),('2017-01-18',201703,1,2017,18,3,201701,2017),('2017-01-19',201703,1,2017,19,3,201701,2017),('2017-01-20',201703,1,2017,20,3,201701,2017),('2017-01-21',201703,1,2017,21,3,201701,2017),('2017-01-22',201704,1,2017,22,4,201701,2017),('2017-01-23',201704,1,2017,23,4,201701,2017),('2017-01-24',201704,1,2017,24,4,201701,2017),('2017-01-25',201704,1,2017,25,4,201701,2017),('2017-01-26',201704,1,2017,26,4,201701,2017),('2017-01-27',201704,1,2017,27,4,201701,2017),('2017-01-28',201704,1,2017,28,4,201701,2017),('2017-01-29',201705,1,2017,29,5,201701,2017),('2017-01-30',201705,1,2017,30,5,201701,2017),('2017-01-31',201705,1,2017,31,5,201701,2017),('2017-02-01',201705,2,2017,1,5,201702,2017),('2017-02-02',201705,2,2017,2,5,201702,2017),('2017-02-03',201705,2,2017,3,5,201702,2017),('2017-02-04',201705,2,2017,4,5,201702,2017),('2017-02-05',201706,2,2017,5,6,201702,2017),('2017-02-06',201706,2,2017,6,6,201702,2017),('2017-02-07',201706,2,2017,7,6,201702,2017),('2017-02-08',201706,2,2017,8,6,201702,2017),('2017-02-09',201706,2,2017,9,6,201702,2017),('2017-02-10',201706,2,2017,10,6,201702,2017),('2017-02-11',201706,2,2017,11,6,201702,2017),('2017-02-12',201707,2,2017,12,7,201702,2017),('2017-02-13',201707,2,2017,13,7,201702,2017),('2017-02-14',201707,2,2017,14,7,201702,2017),('2017-02-15',201707,2,2017,15,7,201702,2017),('2017-02-16',201707,2,2017,16,7,201702,2017),('2017-02-17',201707,2,2017,17,7,201702,2017),('2017-02-18',201707,2,2017,18,7,201702,2017),('2017-02-19',201708,2,2017,19,8,201702,2017),('2017-02-20',201708,2,2017,20,8,201702,2017),('2017-02-21',201708,2,2017,21,8,201702,2017),('2017-02-22',201708,2,2017,22,8,201702,2017),('2017-02-23',201708,2,2017,23,8,201702,2017),('2017-02-24',201708,2,2017,24,8,201702,2017),('2017-02-25',201708,2,2017,25,8,201702,2017),('2017-02-26',201709,2,2017,26,9,201702,2017),('2017-02-27',201709,2,2017,27,9,201702,2017),('2017-02-28',201709,2,2017,28,9,201702,2017),('2017-03-01',201709,3,2017,1,9,201703,2017),('2017-03-02',201709,3,2017,2,9,201703,2017),('2017-03-03',201709,3,2017,3,9,201703,2017),('2017-03-04',201709,3,2017,4,9,201703,2017),('2017-03-05',201710,3,2017,5,10,201703,2017),('2017-03-06',201710,3,2017,6,10,201703,2017),('2017-03-07',201710,3,2017,7,10,201703,2017),('2017-03-08',201710,3,2017,8,10,201703,2017),('2017-03-09',201710,3,2017,9,10,201703,2017),('2017-03-10',201710,3,2017,10,10,201703,2017),('2017-03-11',201710,3,2017,11,10,201703,2017),('2017-03-12',201711,3,2017,12,11,201703,2017),('2017-03-13',201711,3,2017,13,11,201703,2017),('2017-03-14',201711,3,2017,14,11,201703,2017),('2017-03-15',201711,3,2017,15,11,201703,2017),('2017-03-16',201711,3,2017,16,11,201703,2017),('2017-03-17',201711,3,2017,17,11,201703,2017),('2017-03-18',201711,3,2017,18,11,201703,2017),('2017-03-19',201712,3,2017,19,12,201703,2017),('2017-03-20',201712,3,2017,20,12,201703,2017),('2017-03-21',201712,3,2017,21,12,201703,2017),('2017-03-22',201712,3,2017,22,12,201703,2017),('2017-03-23',201712,3,2017,23,12,201703,2017),('2017-03-24',201712,3,2017,24,12,201703,2017),('2017-03-25',201712,3,2017,25,12,201703,2017),('2017-03-26',201713,3,2017,26,13,201703,2017),('2017-03-27',201713,3,2017,27,13,201703,2017),('2017-03-28',201713,3,2017,28,13,201703,2017),('2017-03-29',201713,3,2017,29,13,201703,2017),('2017-03-30',201713,3,2017,30,13,201703,2017),('2017-03-31',201713,3,2017,31,13,201703,2017),('2017-04-01',201713,4,2017,1,13,201704,2017),('2017-04-02',201714,4,2017,2,14,201704,2017),('2017-04-03',201714,4,2017,3,14,201704,2017),('2017-04-04',201714,4,2017,4,14,201704,2017),('2017-04-05',201714,4,2017,5,14,201704,2017),('2017-04-06',201714,4,2017,6,14,201704,2017),('2017-04-07',201714,4,2017,7,14,201704,2017),('2017-04-08',201714,4,2017,8,14,201704,2017),('2017-04-09',201715,4,2017,9,15,201704,2017),('2017-04-10',201715,4,2017,10,15,201704,2017),('2017-04-11',201715,4,2017,11,15,201704,2017),('2017-04-12',201715,4,2017,12,15,201704,2017),('2017-04-13',201715,4,2017,13,15,201704,2017),('2017-04-14',201715,4,2017,14,15,201704,2017),('2017-04-15',201715,4,2017,15,15,201704,2017),('2017-04-16',201716,4,2017,16,16,201704,2017),('2017-04-17',201716,4,2017,17,16,201704,2017),('2017-04-18',201716,4,2017,18,16,201704,2017),('2017-04-19',201716,4,2017,19,16,201704,2017),('2017-04-20',201716,4,2017,20,16,201704,2017),('2017-04-21',201716,4,2017,21,16,201704,2017),('2017-04-22',201716,4,2017,22,16,201704,2017),('2017-04-23',201717,4,2017,23,17,201704,2017),('2017-04-24',201717,4,2017,24,17,201704,2017),('2017-04-25',201717,4,2017,25,17,201704,2017),('2017-04-26',201717,4,2017,26,17,201704,2017),('2017-04-27',201717,4,2017,27,17,201704,2017),('2017-04-28',201717,4,2017,28,17,201704,2017),('2017-04-29',201717,4,2017,29,17,201704,2017),('2017-04-30',201718,4,2017,30,18,201704,2017),('2017-05-01',201718,5,2017,1,18,201705,2017),('2017-05-02',201718,5,2017,2,18,201705,2017),('2017-05-03',201718,5,2017,3,18,201705,2017),('2017-05-04',201718,5,2017,4,18,201705,2017),('2017-05-05',201718,5,2017,5,18,201705,2017),('2017-05-06',201718,5,2017,6,18,201705,2017),('2017-05-07',201719,5,2017,7,19,201705,2017),('2017-05-08',201719,5,2017,8,19,201705,2017),('2017-05-09',201719,5,2017,9,19,201705,2017),('2017-05-10',201719,5,2017,10,19,201705,2017),('2017-05-11',201719,5,2017,11,19,201705,2017),('2017-05-12',201719,5,2017,12,19,201705,2017),('2017-05-13',201719,5,2017,13,19,201705,2017),('2017-05-14',201720,5,2017,14,20,201705,2017),('2017-05-15',201720,5,2017,15,20,201705,2017),('2017-05-16',201720,5,2017,16,20,201705,2017),('2017-05-17',201720,5,2017,17,20,201705,2017),('2017-05-18',201720,5,2017,18,20,201705,2017),('2017-05-19',201720,5,2017,19,20,201705,2017),('2017-05-20',201720,5,2017,20,20,201705,2017),('2017-05-21',201721,5,2017,21,21,201705,2017),('2017-05-22',201721,5,2017,22,21,201705,2017),('2017-05-23',201721,5,2017,23,21,201705,2017),('2017-05-24',201721,5,2017,24,21,201705,2017),('2017-05-25',201721,5,2017,25,21,201705,2017),('2017-05-26',201721,5,2017,26,21,201705,2017),('2017-05-27',201721,5,2017,27,21,201705,2017),('2017-05-28',201722,5,2017,28,22,201705,2017),('2017-05-29',201722,5,2017,29,22,201705,2017),('2017-05-30',201722,5,2017,30,22,201705,2017),('2017-05-31',201722,5,2017,31,22,201705,2017),('2017-06-01',201722,6,2017,1,22,201706,2017),('2017-06-02',201722,6,2017,2,22,201706,2017),('2017-06-03',201722,6,2017,3,22,201706,2017),('2017-06-04',201723,6,2017,4,23,201706,2017),('2017-06-05',201723,6,2017,5,23,201706,2017),('2017-06-06',201723,6,2017,6,23,201706,2017),('2017-06-07',201723,6,2017,7,23,201706,2017),('2017-06-08',201723,6,2017,8,23,201706,2017),('2017-06-09',201723,6,2017,9,23,201706,2017),('2017-06-10',201723,6,2017,10,23,201706,2017),('2017-06-11',201724,6,2017,11,24,201706,2017),('2017-06-12',201724,6,2017,12,24,201706,2017),('2017-06-13',201724,6,2017,13,24,201706,2017),('2017-06-14',201724,6,2017,14,24,201706,2017),('2017-06-15',201724,6,2017,15,24,201706,2017),('2017-06-16',201724,6,2017,16,24,201706,2017),('2017-06-17',201724,6,2017,17,24,201706,2017),('2017-06-18',201725,6,2017,18,25,201706,2017),('2017-06-19',201725,6,2017,19,25,201706,2017),('2017-06-20',201725,6,2017,20,25,201706,2017),('2017-06-21',201725,6,2017,21,25,201706,2017),('2017-06-22',201725,6,2017,22,25,201706,2017),('2017-06-23',201725,6,2017,23,25,201706,2017),('2017-06-24',201725,6,2017,24,25,201706,2017),('2017-06-25',201726,6,2017,25,26,201706,2017),('2017-06-26',201726,6,2017,26,26,201706,2017),('2017-06-27',201726,6,2017,27,26,201706,2017),('2017-06-28',201726,6,2017,28,26,201706,2017),('2017-06-29',201726,6,2017,29,26,201706,2017),('2017-06-30',201726,6,2017,30,26,201706,2017),('2017-07-01',201726,7,2017,1,26,201707,2017),('2017-07-02',201727,7,2017,2,27,201707,2017),('2017-07-03',201727,7,2017,3,27,201707,2017),('2017-07-04',201727,7,2017,4,27,201707,2017),('2017-07-05',201727,7,2017,5,27,201707,2017),('2017-07-06',201727,7,2017,6,27,201707,2017),('2017-07-07',201727,7,2017,7,27,201707,2017),('2017-07-08',201727,7,2017,8,27,201707,2017),('2017-07-09',201728,7,2017,9,28,201707,2017),('2017-07-10',201728,7,2017,10,28,201707,2017),('2017-07-11',201728,7,2017,11,28,201707,2017),('2017-07-12',201728,7,2017,12,28,201707,2017),('2017-07-13',201728,7,2017,13,28,201707,2017),('2017-07-14',201728,7,2017,14,28,201707,2017),('2017-07-15',201728,7,2017,15,28,201707,2017),('2017-07-16',201729,7,2017,16,29,201707,2017),('2017-07-17',201729,7,2017,17,29,201707,2017),('2017-07-18',201729,7,2017,18,29,201707,2017),('2017-07-19',201729,7,2017,19,29,201707,2017),('2017-07-20',201729,7,2017,20,29,201707,2017),('2017-07-21',201729,7,2017,21,29,201707,2017),('2017-07-22',201729,7,2017,22,29,201707,2017),('2017-07-23',201730,7,2017,23,30,201707,2017),('2017-07-24',201730,7,2017,24,30,201707,2017),('2017-07-25',201730,7,2017,25,30,201707,2017),('2017-07-26',201730,7,2017,26,30,201707,2017),('2017-07-27',201730,7,2017,27,30,201707,2017),('2017-07-28',201730,7,2017,28,30,201707,2017),('2017-07-29',201730,7,2017,29,30,201707,2017),('2017-07-30',201731,7,2017,30,31,201707,2017),('2017-07-31',201731,7,2017,31,31,201707,2017),('2017-08-01',201731,8,2017,1,31,201708,2017),('2017-08-02',201731,8,2017,2,31,201708,2017),('2017-08-03',201731,8,2017,3,31,201708,2017),('2017-08-04',201731,8,2017,4,31,201708,2017),('2017-08-05',201731,8,2017,5,31,201708,2017),('2017-08-06',201732,8,2017,6,32,201708,2017),('2017-08-07',201732,8,2017,7,32,201708,2017),('2017-08-08',201732,8,2017,8,32,201708,2017),('2017-08-09',201732,8,2017,9,32,201708,2017),('2017-08-10',201732,8,2017,10,32,201708,2017),('2017-08-11',201732,8,2017,11,32,201708,2017),('2017-08-12',201732,8,2017,12,32,201708,2017),('2017-08-13',201733,8,2017,13,33,201708,2017),('2017-08-14',201733,8,2017,14,33,201708,2017),('2017-08-15',201733,8,2017,15,33,201708,2017),('2017-08-16',201733,8,2017,16,33,201708,2017),('2017-08-17',201733,8,2017,17,33,201708,2017),('2017-08-18',201733,8,2017,18,33,201708,2017),('2017-08-19',201733,8,2017,19,33,201708,2017),('2017-08-20',201734,8,2017,20,34,201708,2017),('2017-08-21',201734,8,2017,21,34,201708,2017),('2017-08-22',201734,8,2017,22,34,201708,2017),('2017-08-23',201734,8,2017,23,34,201708,2017),('2017-08-24',201734,8,2017,24,34,201708,2017),('2017-08-25',201734,8,2017,25,34,201708,2017),('2017-08-26',201734,8,2017,26,34,201708,2017),('2017-08-27',201735,8,2017,27,35,201708,2017),('2017-08-28',201735,8,2017,28,35,201708,2017),('2017-08-29',201735,8,2017,29,35,201708,2017),('2017-08-30',201735,8,2017,30,35,201708,2017),('2017-08-31',201735,8,2017,31,35,201708,2017),('2017-09-01',201735,9,2017,1,35,201709,2017),('2017-09-02',201735,9,2017,2,35,201709,2017),('2017-09-03',201736,9,2017,3,36,201709,2017),('2017-09-04',201736,9,2017,4,36,201709,2017),('2017-09-05',201736,9,2017,5,36,201709,2017),('2017-09-06',201736,9,2017,6,36,201709,2017),('2017-09-07',201736,9,2017,7,36,201709,2017),('2017-09-08',201736,9,2017,8,36,201709,2017),('2017-09-09',201736,9,2017,9,36,201709,2017),('2017-09-10',201737,9,2017,10,37,201709,2017),('2017-09-11',201737,9,2017,11,37,201709,2017),('2017-09-12',201737,9,2017,12,37,201709,2017),('2017-09-13',201737,9,2017,13,37,201709,2017),('2017-09-14',201737,9,2017,14,37,201709,2017),('2017-09-15',201737,9,2017,15,37,201709,2017),('2017-09-16',201737,9,2017,16,37,201709,2017),('2017-09-17',201738,9,2017,17,38,201709,2017),('2017-09-18',201738,9,2017,18,38,201709,2017),('2017-09-19',201738,9,2017,19,38,201709,2017),('2017-09-20',201738,9,2017,20,38,201709,2017),('2017-09-21',201738,9,2017,21,38,201709,2017),('2017-09-22',201738,9,2017,22,38,201709,2017),('2017-09-23',201738,9,2017,23,38,201709,2017),('2017-09-24',201739,9,2017,24,39,201709,2017),('2017-09-25',201739,9,2017,25,39,201709,2017),('2017-09-26',201739,9,2017,26,39,201709,2017),('2017-09-27',201739,9,2017,27,39,201709,2017),('2017-09-28',201739,9,2017,28,39,201709,2017),('2017-09-29',201739,9,2017,29,39,201709,2017),('2017-09-30',201739,9,2017,30,39,201709,2017),('2017-10-01',201740,10,2017,1,40,201710,2017),('2017-10-02',201740,10,2017,2,40,201710,2017),('2017-10-03',201740,10,2017,3,40,201710,2017),('2017-10-04',201740,10,2017,4,40,201710,2017),('2017-10-05',201740,10,2017,5,40,201710,2017),('2017-10-06',201740,10,2017,6,40,201710,2017),('2017-10-07',201740,10,2017,7,40,201710,2017),('2017-10-08',201741,10,2017,8,41,201710,2017),('2017-10-09',201741,10,2017,9,41,201710,2017),('2017-10-10',201741,10,2017,10,41,201710,2017),('2017-10-11',201741,10,2017,11,41,201710,2017),('2017-10-12',201741,10,2017,12,41,201710,2017),('2017-10-13',201741,10,2017,13,41,201710,2017),('2017-10-14',201741,10,2017,14,41,201710,2017),('2017-10-15',201742,10,2017,15,42,201710,2017),('2017-10-16',201742,10,2017,16,42,201710,2017),('2017-10-17',201742,10,2017,17,42,201710,2017),('2017-10-18',201742,10,2017,18,42,201710,2017),('2017-10-19',201742,10,2017,19,42,201710,2017),('2017-10-20',201742,10,2017,20,42,201710,2017),('2017-10-21',201742,10,2017,21,42,201710,2017),('2017-10-22',201743,10,2017,22,43,201710,2017),('2017-10-23',201743,10,2017,23,43,201710,2017),('2017-10-24',201743,10,2017,24,43,201710,2017),('2017-10-25',201743,10,2017,25,43,201710,2017),('2017-10-26',201743,10,2017,26,43,201710,2017),('2017-10-27',201743,10,2017,27,43,201710,2017),('2017-10-28',201743,10,2017,28,43,201710,2017),('2017-10-29',201744,10,2017,29,44,201710,2017),('2017-10-30',201744,10,2017,30,44,201710,2017),('2017-10-31',201744,10,2017,31,44,201710,2017),('2017-11-01',201744,11,2017,1,44,201711,2017),('2017-11-02',201744,11,2017,2,44,201711,2017),('2017-11-03',201744,11,2017,3,44,201711,2017),('2017-11-04',201744,11,2017,4,44,201711,2017),('2017-11-05',201745,11,2017,5,45,201711,2017),('2017-11-06',201745,11,2017,6,45,201711,2017),('2017-11-07',201745,11,2017,7,45,201711,2017),('2017-11-08',201745,11,2017,8,45,201711,2017),('2017-11-09',201745,11,2017,9,45,201711,2017),('2017-11-10',201745,11,2017,10,45,201711,2017),('2017-11-11',201745,11,2017,11,45,201711,2017),('2017-11-12',201746,11,2017,12,46,201711,2017),('2017-11-13',201746,11,2017,13,46,201711,2017),('2017-11-14',201746,11,2017,14,46,201711,2017),('2017-11-15',201746,11,2017,15,46,201711,2017),('2017-11-16',201746,11,2017,16,46,201711,2017),('2017-11-17',201746,11,2017,17,46,201711,2017),('2017-11-18',201746,11,2017,18,46,201711,2017),('2017-11-19',201747,11,2017,19,47,201711,2017),('2017-11-20',201747,11,2017,20,47,201711,2017),('2017-11-21',201747,11,2017,21,47,201711,2017),('2017-11-22',201747,11,2017,22,47,201711,2017),('2017-11-23',201747,11,2017,23,47,201711,2017),('2017-11-24',201747,11,2017,24,47,201711,2017),('2017-11-25',201747,11,2017,25,47,201711,2017),('2017-11-26',201748,11,2017,26,48,201711,2017),('2017-11-27',201748,11,2017,27,48,201711,2017),('2017-11-28',201748,11,2017,28,48,201711,2017),('2017-11-29',201748,11,2017,29,48,201711,2017),('2017-11-30',201748,11,2017,30,48,201711,2017),('2017-12-01',201748,12,2017,1,48,201712,2018),('2017-12-02',201748,12,2017,2,48,201712,2018),('2017-12-03',201749,12,2017,3,49,201712,2018),('2017-12-04',201749,12,2017,4,49,201712,2018),('2017-12-05',201749,12,2017,5,49,201712,2018),('2017-12-06',201749,12,2017,6,49,201712,2018),('2017-12-07',201749,12,2017,7,49,201712,2018),('2017-12-08',201749,12,2017,8,49,201712,2018),('2017-12-09',201749,12,2017,9,49,201712,2018),('2017-12-10',201750,12,2017,10,50,201712,2018),('2017-12-11',201750,12,2017,11,50,201712,2018),('2017-12-12',201750,12,2017,12,50,201712,2018),('2017-12-13',201750,12,2017,13,50,201712,2018),('2017-12-14',201750,12,2017,14,50,201712,2018),('2017-12-15',201750,12,2017,15,50,201712,2018),('2017-12-16',201750,12,2017,16,50,201712,2018),('2017-12-17',201751,12,2017,17,51,201712,2018),('2017-12-18',201751,12,2017,18,51,201712,2018),('2017-12-19',201751,12,2017,19,51,201712,2018),('2017-12-20',201751,12,2017,20,51,201712,2018),('2017-12-21',201751,12,2017,21,51,201712,2018),('2017-12-22',201751,12,2017,22,51,201712,2018),('2017-12-23',201751,12,2017,23,51,201712,2018),('2017-12-24',201752,12,2017,24,52,201712,2018),('2017-12-25',201752,12,2017,25,52,201712,2018),('2017-12-26',201752,12,2017,26,52,201712,2018),('2017-12-27',201752,12,2017,27,52,201712,2018),('2017-12-28',201752,12,2017,28,52,201712,2018),('2017-12-29',201752,12,2017,29,52,201712,2018),('2017-12-30',201752,12,2017,30,52,201712,2018),('2017-12-31',201801,12,2017,31,1,201712,2018),('2018-01-01',201801,1,2018,1,1,201801,2018),('2018-01-02',201801,1,2018,2,1,201801,2018),('2018-01-03',201801,1,2018,3,1,201801,2018),('2018-01-04',201801,1,2018,4,1,201801,2018),('2018-01-05',201801,1,2018,5,1,201801,2018),('2018-01-06',201801,1,2018,6,1,201801,2018),('2018-01-07',201802,1,2018,7,2,201801,2018),('2018-01-08',201802,1,2018,8,2,201801,2018),('2018-01-09',201802,1,2018,9,2,201801,2018),('2018-01-10',201802,1,2018,10,2,201801,2018),('2018-01-11',201802,1,2018,11,2,201801,2018),('2018-01-12',201802,1,2018,12,2,201801,2018),('2018-01-13',201802,1,2018,13,2,201801,2018),('2018-01-14',201803,1,2018,14,3,201801,2018),('2018-01-15',201803,1,2018,15,3,201801,2018),('2018-01-16',201803,1,2018,16,3,201801,2018),('2018-01-17',201803,1,2018,17,3,201801,2018),('2018-01-18',201803,1,2018,18,3,201801,2018),('2018-01-19',201803,1,2018,19,3,201801,2018),('2018-01-20',201803,1,2018,20,3,201801,2018),('2018-01-21',201804,1,2018,21,4,201801,2018),('2018-01-22',201804,1,2018,22,4,201801,2018),('2018-01-23',201804,1,2018,23,4,201801,2018),('2018-01-24',201804,1,2018,24,4,201801,2018),('2018-01-25',201804,1,2018,25,4,201801,2018),('2018-01-26',201804,1,2018,26,4,201801,2018),('2018-01-27',201804,1,2018,27,4,201801,2018),('2018-01-28',201805,1,2018,28,5,201801,2018),('2018-01-29',201805,1,2018,29,5,201801,2018),('2018-01-30',201805,1,2018,30,5,201801,2018),('2018-01-31',201805,1,2018,31,5,201801,2018),('2018-02-01',201805,2,2018,1,5,201802,2018),('2018-02-02',201805,2,2018,2,5,201802,2018),('2018-02-03',201805,2,2018,3,5,201802,2018),('2018-02-04',201806,2,2018,4,6,201802,2018),('2018-02-05',201806,2,2018,5,6,201802,2018),('2018-02-06',201806,2,2018,6,6,201802,2018),('2018-02-07',201806,2,2018,7,6,201802,2018),('2018-02-08',201806,2,2018,8,6,201802,2018),('2018-02-09',201806,2,2018,9,6,201802,2018),('2018-02-10',201806,2,2018,10,6,201802,2018),('2018-02-11',201807,2,2018,11,7,201802,2018),('2018-02-12',201807,2,2018,12,7,201802,2018),('2018-02-13',201807,2,2018,13,7,201802,2018),('2018-02-14',201807,2,2018,14,7,201802,2018),('2018-02-15',201807,2,2018,15,7,201802,2018),('2018-02-16',201807,2,2018,16,7,201802,2018),('2018-02-17',201807,2,2018,17,7,201802,2018),('2018-02-18',201808,2,2018,18,8,201802,2018),('2018-02-19',201808,2,2018,19,8,201802,2018),('2018-02-20',201808,2,2018,20,8,201802,2018),('2018-02-21',201808,2,2018,21,8,201802,2018),('2018-02-22',201808,2,2018,22,8,201802,2018),('2018-02-23',201808,2,2018,23,8,201802,2018),('2018-02-24',201808,2,2018,24,8,201802,2018),('2018-02-25',201809,2,2018,25,9,201802,2018),('2018-02-26',201809,2,2018,26,9,201802,2018),('2018-02-27',201809,2,2018,27,9,201802,2018),('2018-02-28',201809,2,2018,28,9,201802,2018),('2018-03-01',201809,3,2018,1,9,201803,2018),('2018-03-02',201809,3,2018,2,9,201803,2018),('2018-03-03',201809,3,2018,3,9,201803,2018),('2018-03-04',201810,3,2018,4,10,201803,2018),('2018-03-05',201810,3,2018,5,10,201803,2018),('2018-03-06',201810,3,2018,6,10,201803,2018),('2018-03-07',201810,3,2018,7,10,201803,2018),('2018-03-08',201810,3,2018,8,10,201803,2018),('2018-03-09',201810,3,2018,9,10,201803,2018),('2018-03-10',201810,3,2018,10,10,201803,2018),('2018-03-11',201811,3,2018,11,11,201803,2018),('2018-03-12',201811,3,2018,12,11,201803,2018),('2018-03-13',201811,3,2018,13,11,201803,2018),('2018-03-14',201811,3,2018,14,11,201803,2018),('2018-03-15',201811,3,2018,15,11,201803,2018),('2018-03-16',201811,3,2018,16,11,201803,2018),('2018-03-17',201811,3,2018,17,11,201803,2018),('2018-03-18',201812,3,2018,18,12,201803,2018),('2018-03-19',201812,3,2018,19,12,201803,2018),('2018-03-20',201812,3,2018,20,12,201803,2018),('2018-03-21',201812,3,2018,21,12,201803,2018),('2018-03-22',201812,3,2018,22,12,201803,2018),('2018-03-23',201812,3,2018,23,12,201803,2018),('2018-03-24',201812,3,2018,24,12,201803,2018),('2018-03-25',201813,3,2018,25,13,201803,2018),('2018-03-26',201813,3,2018,26,13,201803,2018),('2018-03-27',201813,3,2018,27,13,201803,2018),('2018-03-28',201813,3,2018,28,13,201803,2018),('2018-03-29',201813,3,2018,29,13,201803,2018),('2018-03-30',201813,3,2018,30,13,201803,2018),('2018-03-31',201813,3,2018,31,13,201803,2018),('2018-04-01',201814,4,2018,1,14,201804,2018),('2018-04-02',201814,4,2018,2,14,201804,2018),('2018-04-03',201814,4,2018,3,14,201804,2018),('2018-04-04',201814,4,2018,4,14,201804,2018),('2018-04-05',201814,4,2018,5,14,201804,2018),('2018-04-06',201814,4,2018,6,14,201804,2018),('2018-04-07',201814,4,2018,7,14,201804,2018),('2018-04-08',201815,4,2018,8,15,201804,2018),('2018-04-09',201815,4,2018,9,15,201804,2018),('2018-04-10',201815,4,2018,10,15,201804,2018),('2018-04-11',201815,4,2018,11,15,201804,2018),('2018-04-12',201815,4,2018,12,15,201804,2018),('2018-04-13',201815,4,2018,13,15,201804,2018),('2018-04-14',201815,4,2018,14,15,201804,2018),('2018-04-15',201816,4,2018,15,16,201804,2018),('2018-04-16',201816,4,2018,16,16,201804,2018),('2018-04-17',201816,4,2018,17,16,201804,2018),('2018-04-18',201816,4,2018,18,16,201804,2018),('2018-04-19',201816,4,2018,19,16,201804,2018),('2018-04-20',201816,4,2018,20,16,201804,2018),('2018-04-21',201816,4,2018,21,16,201804,2018),('2018-04-22',201817,4,2018,22,17,201804,2018),('2018-04-23',201817,4,2018,23,17,201804,2018),('2018-04-24',201817,4,2018,24,17,201804,2018),('2018-04-25',201817,4,2018,25,17,201804,2018),('2018-04-26',201817,4,2018,26,17,201804,2018),('2018-04-27',201817,4,2018,27,17,201804,2018),('2018-04-28',201817,4,2018,28,17,201804,2018),('2018-04-29',201818,4,2018,29,18,201804,2018),('2018-04-30',201818,4,2018,30,18,201804,2018),('2018-05-01',201818,5,2018,1,18,201805,2018),('2018-05-02',201818,5,2018,2,18,201805,2018),('2018-05-03',201818,5,2018,3,18,201805,2018),('2018-05-04',201818,5,2018,4,18,201805,2018),('2018-05-05',201818,5,2018,5,18,201805,2018),('2018-05-06',201819,5,2018,6,19,201805,2018),('2018-05-07',201819,5,2018,7,19,201805,2018),('2018-05-08',201819,5,2018,8,19,201805,2018),('2018-05-09',201819,5,2018,9,19,201805,2018),('2018-05-10',201819,5,2018,10,19,201805,2018),('2018-05-11',201819,5,2018,11,19,201805,2018),('2018-05-12',201819,5,2018,12,19,201805,2018),('2018-05-13',201820,5,2018,13,20,201805,2018),('2018-05-14',201820,5,2018,14,20,201805,2018),('2018-05-15',201820,5,2018,15,20,201805,2018),('2018-05-16',201820,5,2018,16,20,201805,2018),('2018-05-17',201820,5,2018,17,20,201805,2018),('2018-05-18',201820,5,2018,18,20,201805,2018),('2018-05-19',201820,5,2018,19,20,201805,2018),('2018-05-20',201821,5,2018,20,21,201805,2018),('2018-05-21',201821,5,2018,21,21,201805,2018),('2018-05-22',201821,5,2018,22,21,201805,2018),('2018-05-23',201821,5,2018,23,21,201805,2018),('2018-05-24',201821,5,2018,24,21,201805,2018),('2018-05-25',201821,5,2018,25,21,201805,2018),('2018-05-26',201821,5,2018,26,21,201805,2018),('2018-05-27',201822,5,2018,27,22,201805,2018),('2018-05-28',201822,5,2018,28,22,201805,2018),('2018-05-29',201822,5,2018,29,22,201805,2018),('2018-05-30',201822,5,2018,30,22,201805,2018),('2018-05-31',201822,5,2018,31,22,201805,2018),('2018-06-01',201822,6,2018,1,22,201806,2018),('2018-06-02',201822,6,2018,2,22,201806,2018),('2018-06-03',201823,6,2018,3,23,201806,2018),('2018-06-04',201823,6,2018,4,23,201806,2018),('2018-06-05',201823,6,2018,5,23,201806,2018),('2018-06-06',201823,6,2018,6,23,201806,2018),('2018-06-07',201823,6,2018,7,23,201806,2018),('2018-06-08',201823,6,2018,8,23,201806,2018),('2018-06-09',201823,6,2018,9,23,201806,2018),('2018-06-10',201824,6,2018,10,24,201806,2018),('2018-06-11',201824,6,2018,11,24,201806,2018),('2018-06-12',201824,6,2018,12,24,201806,2018),('2018-06-13',201824,6,2018,13,24,201806,2018),('2018-06-14',201824,6,2018,14,24,201806,2018),('2018-06-15',201824,6,2018,15,24,201806,2018),('2018-06-16',201824,6,2018,16,24,201806,2018),('2018-06-17',201825,6,2018,17,25,201806,2018),('2018-06-18',201825,6,2018,18,25,201806,2018),('2018-06-19',201825,6,2018,19,25,201806,2018),('2018-06-20',201825,6,2018,20,25,201806,2018),('2018-06-21',201825,6,2018,21,25,201806,2018),('2018-06-22',201825,6,2018,22,25,201806,2018),('2018-06-23',201825,6,2018,23,25,201806,2018),('2018-06-24',201826,6,2018,24,26,201806,2018),('2018-06-25',201826,6,2018,25,26,201806,2018),('2018-06-26',201826,6,2018,26,26,201806,2018),('2018-06-27',201826,6,2018,27,26,201806,2018),('2018-06-28',201826,6,2018,28,26,201806,2018),('2018-06-29',201826,6,2018,29,26,201806,2018),('2018-06-30',201826,6,2018,30,26,201806,2018),('2018-07-01',201827,7,2018,1,27,201807,2018),('2018-07-02',201827,7,2018,2,27,201807,2018),('2018-07-03',201827,7,2018,3,27,201807,2018),('2018-07-04',201827,7,2018,4,27,201807,2018),('2018-07-05',201827,7,2018,5,27,201807,2018),('2018-07-06',201827,7,2018,6,27,201807,2018),('2018-07-07',201827,7,2018,7,27,201807,2018),('2018-07-08',201828,7,2018,8,28,201807,2018),('2018-07-09',201828,7,2018,9,28,201807,2018),('2018-07-10',201828,7,2018,10,28,201807,2018),('2018-07-11',201828,7,2018,11,28,201807,2018),('2018-07-12',201828,7,2018,12,28,201807,2018),('2018-07-13',201828,7,2018,13,28,201807,2018),('2018-07-14',201828,7,2018,14,28,201807,2018),('2018-07-15',201829,7,2018,15,29,201807,2018),('2018-07-16',201829,7,2018,16,29,201807,2018),('2018-07-17',201829,7,2018,17,29,201807,2018),('2018-07-18',201829,7,2018,18,29,201807,2018),('2018-07-19',201829,7,2018,19,29,201807,2018),('2018-07-20',201829,7,2018,20,29,201807,2018),('2018-07-21',201829,7,2018,21,29,201807,2018),('2018-07-22',201830,7,2018,22,30,201807,2018),('2018-07-23',201830,7,2018,23,30,201807,2018),('2018-07-24',201830,7,2018,24,30,201807,2018),('2018-07-25',201830,7,2018,25,30,201807,2018),('2018-07-26',201830,7,2018,26,30,201807,2018),('2018-07-27',201830,7,2018,27,30,201807,2018),('2018-07-28',201830,7,2018,28,30,201807,2018),('2018-07-29',201831,7,2018,29,31,201807,2018),('2018-07-30',201831,7,2018,30,31,201807,2018),('2018-07-31',201831,7,2018,31,31,201807,2018),('2018-08-01',201831,8,2018,1,31,201808,2018),('2018-08-02',201831,8,2018,2,31,201808,2018),('2018-08-03',201831,8,2018,3,31,201808,2018),('2018-08-04',201831,8,2018,4,31,201808,2018),('2018-08-05',201832,8,2018,5,32,201808,2018),('2018-08-06',201832,8,2018,6,32,201808,2018),('2018-08-07',201832,8,2018,7,32,201808,2018),('2018-08-08',201832,8,2018,8,32,201808,2018),('2018-08-09',201832,8,2018,9,32,201808,2018),('2018-08-10',201832,8,2018,10,32,201808,2018),('2018-08-11',201832,8,2018,11,32,201808,2018),('2018-08-12',201833,8,2018,12,33,201808,2018),('2018-08-13',201833,8,2018,13,33,201808,2018),('2018-08-14',201833,8,2018,14,33,201808,2018),('2018-08-15',201833,8,2018,15,33,201808,2018),('2018-08-16',201833,8,2018,16,33,201808,2018),('2018-08-17',201833,8,2018,17,33,201808,2018),('2018-08-18',201833,8,2018,18,33,201808,2018),('2018-08-19',201834,8,2018,19,34,201808,2018),('2018-08-20',201834,8,2018,20,34,201808,2018),('2018-08-21',201834,8,2018,21,34,201808,2018),('2018-08-22',201834,8,2018,22,34,201808,2018),('2018-08-23',201834,8,2018,23,34,201808,2018),('2018-08-24',201834,8,2018,24,34,201808,2018),('2018-08-25',201834,8,2018,25,34,201808,2018),('2018-08-26',201835,8,2018,26,35,201808,2018),('2018-08-27',201835,8,2018,27,35,201808,2018),('2018-08-28',201835,8,2018,28,35,201808,2018),('2018-08-29',201835,8,2018,29,35,201808,2018),('2018-08-30',201835,8,2018,30,35,201808,2018),('2018-08-31',201835,8,2018,31,35,201808,2018),('2018-09-01',201835,9,2018,1,35,201809,2018),('2018-09-02',201836,9,2018,2,36,201809,2018),('2018-09-03',201836,9,2018,3,36,201809,2018),('2018-09-04',201836,9,2018,4,36,201809,2018),('2018-09-05',201836,9,2018,5,36,201809,2018),('2018-09-06',201836,9,2018,6,36,201809,2018),('2018-09-07',201836,9,2018,7,36,201809,2018),('2018-09-08',201836,9,2018,8,36,201809,2018),('2018-09-09',201837,9,2018,9,37,201809,2018),('2018-09-10',201837,9,2018,10,37,201809,2018),('2018-09-11',201837,9,2018,11,37,201809,2018),('2018-09-12',201837,9,2018,12,37,201809,2018),('2018-09-13',201837,9,2018,13,37,201809,2018),('2018-09-14',201837,9,2018,14,37,201809,2018),('2018-09-15',201837,9,2018,15,37,201809,2018),('2018-09-16',201838,9,2018,16,38,201809,2018),('2018-09-17',201838,9,2018,17,38,201809,2018),('2018-09-18',201838,9,2018,18,38,201809,2018),('2018-09-19',201838,9,2018,19,38,201809,2018),('2018-09-20',201838,9,2018,20,38,201809,2018),('2018-09-21',201838,9,2018,21,38,201809,2018),('2018-09-22',201838,9,2018,22,38,201809,2018),('2018-09-23',201839,9,2018,23,39,201809,2018),('2018-09-24',201839,9,2018,24,39,201809,2018),('2018-09-25',201839,9,2018,25,39,201809,2018),('2018-09-26',201839,9,2018,26,39,201809,2018),('2018-09-27',201839,9,2018,27,39,201809,2018),('2018-09-28',201839,9,2018,28,39,201809,2018),('2018-09-29',201839,9,2018,29,39,201809,2018),('2018-09-30',201840,9,2018,30,40,201809,2018),('2018-10-01',201840,10,2018,1,40,201810,2018),('2018-10-02',201840,10,2018,2,40,201810,2018),('2018-10-03',201840,10,2018,3,40,201810,2018),('2018-10-04',201840,10,2018,4,40,201810,2018),('2018-10-05',201840,10,2018,5,40,201810,2018),('2018-10-06',201840,10,2018,6,40,201810,2018),('2018-10-07',201841,10,2018,7,41,201810,2018),('2018-10-08',201841,10,2018,8,41,201810,2018),('2018-10-09',201841,10,2018,9,41,201810,2018),('2018-10-10',201841,10,2018,10,41,201810,2018),('2018-10-11',201841,10,2018,11,41,201810,2018),('2018-10-12',201841,10,2018,12,41,201810,2018),('2018-10-13',201841,10,2018,13,41,201810,2018),('2018-10-14',201842,10,2018,14,42,201810,2018),('2018-10-15',201842,10,2018,15,42,201810,2018),('2018-10-16',201842,10,2018,16,42,201810,2018),('2018-10-17',201842,10,2018,17,42,201810,2018),('2018-10-18',201842,10,2018,18,42,201810,2018),('2018-10-19',201842,10,2018,19,42,201810,2018),('2018-10-20',201842,10,2018,20,42,201810,2018),('2018-10-21',201843,10,2018,21,43,201810,2018),('2018-10-22',201843,10,2018,22,43,201810,2018),('2018-10-23',201843,10,2018,23,43,201810,2018),('2018-10-24',201843,10,2018,24,43,201810,2018),('2018-10-25',201843,10,2018,25,43,201810,2018),('2018-10-26',201843,10,2018,26,43,201810,2018),('2018-10-27',201843,10,2018,27,43,201810,2018),('2018-10-28',201844,10,2018,28,44,201810,2018),('2018-10-29',201844,10,2018,29,44,201810,2018),('2018-10-30',201844,10,2018,30,44,201810,2018),('2018-10-31',201844,10,2018,31,44,201810,2018),('2018-11-01',201844,11,2018,1,44,201811,2018),('2018-11-02',201844,11,2018,2,44,201811,2018),('2018-11-03',201844,11,2018,3,44,201811,2018),('2018-11-04',201845,11,2018,4,45,201811,2018),('2018-11-05',201845,11,2018,5,45,201811,2018),('2018-11-06',201845,11,2018,6,45,201811,2018),('2018-11-07',201845,11,2018,7,45,201811,2018),('2018-11-08',201845,11,2018,8,45,201811,2018),('2018-11-09',201845,11,2018,9,45,201811,2018),('2018-11-10',201845,11,2018,10,45,201811,2018),('2018-11-11',201846,11,2018,11,46,201811,2018),('2018-11-12',201846,11,2018,12,46,201811,2018),('2018-11-13',201846,11,2018,13,46,201811,2018),('2018-11-14',201846,11,2018,14,46,201811,2018),('2018-11-15',201846,11,2018,15,46,201811,2018),('2018-11-16',201846,11,2018,16,46,201811,2018),('2018-11-17',201846,11,2018,17,46,201811,2018),('2018-11-18',201847,11,2018,18,47,201811,2018),('2018-11-19',201847,11,2018,19,47,201811,2018),('2018-11-20',201847,11,2018,20,47,201811,2018),('2018-11-21',201847,11,2018,21,47,201811,2018),('2018-11-22',201847,11,2018,22,47,201811,2018),('2018-11-23',201847,11,2018,23,47,201811,2018),('2018-11-24',201847,11,2018,24,47,201811,2018),('2018-11-25',201848,11,2018,25,48,201811,2018),('2018-11-26',201848,11,2018,26,48,201811,2018),('2018-11-27',201848,11,2018,27,48,201811,2018),('2018-11-28',201848,11,2018,28,48,201811,2018),('2018-11-29',201848,11,2018,29,48,201811,2018),('2018-11-30',201848,11,2018,30,48,201811,2018),('2018-12-01',201848,12,2018,1,48,201812,2019),('2018-12-02',201849,12,2018,2,49,201812,2019),('2018-12-03',201849,12,2018,3,49,201812,2019),('2018-12-04',201849,12,2018,4,49,201812,2019),('2018-12-05',201849,12,2018,5,49,201812,2019),('2018-12-06',201849,12,2018,6,49,201812,2019),('2018-12-07',201849,12,2018,7,49,201812,2019),('2018-12-08',201849,12,2018,8,49,201812,2019),('2018-12-09',201850,12,2018,9,50,201812,2019),('2018-12-10',201850,12,2018,10,50,201812,2019),('2018-12-11',201850,12,2018,11,50,201812,2019),('2018-12-12',201850,12,2018,12,50,201812,2019),('2018-12-13',201850,12,2018,13,50,201812,2019),('2018-12-14',201850,12,2018,14,50,201812,2019),('2018-12-15',201850,12,2018,15,50,201812,2019),('2018-12-16',201851,12,2018,16,51,201812,2019),('2018-12-17',201851,12,2018,17,51,201812,2019),('2018-12-18',201851,12,2018,18,51,201812,2019),('2018-12-19',201851,12,2018,19,51,201812,2019),('2018-12-20',201851,12,2018,20,51,201812,2019),('2018-12-21',201851,12,2018,21,51,201812,2019),('2018-12-22',201851,12,2018,22,51,201812,2019),('2018-12-23',201852,12,2018,23,52,201812,2019),('2018-12-24',201852,12,2018,24,52,201812,2019),('2018-12-25',201852,12,2018,25,52,201812,2019),('2018-12-26',201852,12,2018,26,52,201812,2019),('2018-12-27',201852,12,2018,27,52,201812,2019),('2018-12-28',201852,12,2018,28,52,201812,2019),('2018-12-29',201852,12,2018,29,52,201812,2019),('2018-12-30',201901,12,2018,30,1,201812,2019),('2018-12-31',201901,12,2018,31,1,201812,2019),('2019-01-01',201901,1,2019,1,1,201901,2019),('2019-01-02',201901,1,2019,2,1,201901,2019),('2019-01-03',201901,1,2019,3,1,201901,2019),('2019-01-04',201901,1,2019,4,1,201901,2019),('2019-01-05',201901,1,2019,5,1,201901,2019),('2019-01-06',201902,1,2019,6,2,201901,2019),('2019-01-07',201902,1,2019,7,2,201901,2019),('2019-01-08',201902,1,2019,8,2,201901,2019),('2019-01-09',201902,1,2019,9,2,201901,2019),('2019-01-10',201902,1,2019,10,2,201901,2019),('2019-01-11',201902,1,2019,11,2,201901,2019),('2019-01-12',201902,1,2019,12,2,201901,2019),('2019-01-13',201903,1,2019,13,3,201901,2019),('2019-01-14',201903,1,2019,14,3,201901,2019),('2019-01-15',201903,1,2019,15,3,201901,2019),('2019-01-16',201903,1,2019,16,3,201901,2019),('2019-01-17',201903,1,2019,17,3,201901,2019),('2019-01-18',201903,1,2019,18,3,201901,2019),('2019-01-19',201903,1,2019,19,3,201901,2019),('2019-01-20',201904,1,2019,20,4,201901,2019),('2019-01-21',201904,1,2019,21,4,201901,2019),('2019-01-22',201904,1,2019,22,4,201901,2019),('2019-01-23',201904,1,2019,23,4,201901,2019),('2019-01-24',201904,1,2019,24,4,201901,2019),('2019-01-25',201904,1,2019,25,4,201901,2019),('2019-01-26',201904,1,2019,26,4,201901,2019),('2019-01-27',201905,1,2019,27,5,201901,2019),('2019-01-28',201905,1,2019,28,5,201901,2019),('2019-01-29',201905,1,2019,29,5,201901,2019),('2019-01-30',201905,1,2019,30,5,201901,2019),('2019-01-31',201905,1,2019,31,5,201901,2019),('2019-02-01',201905,2,2019,1,5,201902,2019),('2019-02-02',201905,2,2019,2,5,201902,2019),('2019-02-03',201906,2,2019,3,6,201902,2019),('2019-02-04',201906,2,2019,4,6,201902,2019),('2019-02-05',201906,2,2019,5,6,201902,2019),('2019-02-06',201906,2,2019,6,6,201902,2019),('2019-02-07',201906,2,2019,7,6,201902,2019),('2019-02-08',201906,2,2019,8,6,201902,2019),('2019-02-09',201906,2,2019,9,6,201902,2019),('2019-02-10',201907,2,2019,10,7,201902,2019),('2019-02-11',201907,2,2019,11,7,201902,2019),('2019-02-12',201907,2,2019,12,7,201902,2019),('2019-02-13',201907,2,2019,13,7,201902,2019),('2019-02-14',201907,2,2019,14,7,201902,2019),('2019-02-15',201907,2,2019,15,7,201902,2019),('2019-02-16',201907,2,2019,16,7,201902,2019),('2019-02-17',201908,2,2019,17,8,201902,2019),('2019-02-18',201908,2,2019,18,8,201902,2019),('2019-02-19',201908,2,2019,19,8,201902,2019),('2019-02-20',201908,2,2019,20,8,201902,2019),('2019-02-21',201908,2,2019,21,8,201902,2019),('2019-02-22',201908,2,2019,22,8,201902,2019),('2019-02-23',201908,2,2019,23,8,201902,2019),('2019-02-24',201909,2,2019,24,9,201902,2019),('2019-02-25',201909,2,2019,25,9,201902,2019),('2019-02-26',201909,2,2019,26,9,201902,2019),('2019-02-27',201909,2,2019,27,9,201902,2019),('2019-02-28',201909,2,2019,28,9,201902,2019),('2019-03-01',201909,3,2019,1,9,201903,2019),('2019-03-02',201909,3,2019,2,9,201903,2019),('2019-03-03',201910,3,2019,3,10,201903,2019),('2019-03-04',201910,3,2019,4,10,201903,2019),('2019-03-05',201910,3,2019,5,10,201903,2019),('2019-03-06',201910,3,2019,6,10,201903,2019),('2019-03-07',201910,3,2019,7,10,201903,2019),('2019-03-08',201910,3,2019,8,10,201903,2019),('2019-03-09',201910,3,2019,9,10,201903,2019),('2019-03-10',201911,3,2019,10,11,201903,2019),('2019-03-11',201911,3,2019,11,11,201903,2019),('2019-03-12',201911,3,2019,12,11,201903,2019),('2019-03-13',201911,3,2019,13,11,201903,2019),('2019-03-14',201911,3,2019,14,11,201903,2019),('2019-03-15',201911,3,2019,15,11,201903,2019),('2019-03-16',201911,3,2019,16,11,201903,2019),('2019-03-17',201912,3,2019,17,12,201903,2019),('2019-03-18',201912,3,2019,18,12,201903,2019),('2019-03-19',201912,3,2019,19,12,201903,2019),('2019-03-20',201912,3,2019,20,12,201903,2019),('2019-03-21',201912,3,2019,21,12,201903,2019),('2019-03-22',201912,3,2019,22,12,201903,2019),('2019-03-23',201912,3,2019,23,12,201903,2019),('2019-03-24',201913,3,2019,24,13,201903,2019),('2019-03-25',201913,3,2019,25,13,201903,2019),('2019-03-26',201913,3,2019,26,13,201903,2019),('2019-03-27',201913,3,2019,27,13,201903,2019),('2019-03-28',201913,3,2019,28,13,201903,2019),('2019-03-29',201913,3,2019,29,13,201903,2019),('2019-03-30',201913,3,2019,30,13,201903,2019),('2019-03-31',201914,3,2019,31,14,201903,2019),('2019-04-01',201914,4,2019,1,14,201904,2019),('2019-04-02',201914,4,2019,2,14,201904,2019),('2019-04-03',201914,4,2019,3,14,201904,2019),('2019-04-04',201914,4,2019,4,14,201904,2019),('2019-04-05',201914,4,2019,5,14,201904,2019),('2019-04-06',201914,4,2019,6,14,201904,2019),('2019-04-07',201915,4,2019,7,15,201904,2019),('2019-04-08',201915,4,2019,8,15,201904,2019),('2019-04-09',201915,4,2019,9,15,201904,2019),('2019-04-10',201915,4,2019,10,15,201904,2019),('2019-04-11',201915,4,2019,11,15,201904,2019),('2019-04-12',201915,4,2019,12,15,201904,2019),('2019-04-13',201915,4,2019,13,15,201904,2019),('2019-04-14',201916,4,2019,14,16,201904,2019),('2019-04-15',201916,4,2019,15,16,201904,2019),('2019-04-16',201916,4,2019,16,16,201904,2019),('2019-04-17',201916,4,2019,17,16,201904,2019),('2019-04-18',201916,4,2019,18,16,201904,2019),('2019-04-19',201916,4,2019,19,16,201904,2019),('2019-04-20',201916,4,2019,20,16,201904,2019),('2019-04-21',201917,4,2019,21,17,201904,2019),('2019-04-22',201917,4,2019,22,17,201904,2019),('2019-04-23',201917,4,2019,23,17,201904,2019),('2019-04-24',201917,4,2019,24,17,201904,2019),('2019-04-25',201917,4,2019,25,17,201904,2019),('2019-04-26',201917,4,2019,26,17,201904,2019),('2019-04-27',201917,4,2019,27,17,201904,2019),('2019-04-28',201918,4,2019,28,18,201904,2019),('2019-04-29',201918,4,2019,29,18,201904,2019),('2019-04-30',201918,4,2019,30,18,201904,2019),('2019-05-01',201918,5,2019,1,18,201905,2019),('2019-05-02',201918,5,2019,2,18,201905,2019),('2019-05-03',201918,5,2019,3,18,201905,2019),('2019-05-04',201918,5,2019,4,18,201905,2019),('2019-05-05',201919,5,2019,5,19,201905,2019),('2019-05-06',201919,5,2019,6,19,201905,2019),('2019-05-07',201919,5,2019,7,19,201905,2019),('2019-05-08',201919,5,2019,8,19,201905,2019),('2019-05-09',201919,5,2019,9,19,201905,2019),('2019-05-10',201919,5,2019,10,19,201905,2019),('2019-05-11',201919,5,2019,11,19,201905,2019),('2019-05-12',201920,5,2019,12,20,201905,2019),('2019-05-13',201920,5,2019,13,20,201905,2019),('2019-05-14',201920,5,2019,14,20,201905,2019),('2019-05-15',201920,5,2019,15,20,201905,2019),('2019-05-16',201920,5,2019,16,20,201905,2019),('2019-05-17',201920,5,2019,17,20,201905,2019),('2019-05-18',201920,5,2019,18,20,201905,2019),('2019-05-19',201921,5,2019,19,21,201905,2019),('2019-05-20',201921,5,2019,20,21,201905,2019),('2019-05-21',201921,5,2019,21,21,201905,2019),('2019-05-22',201921,5,2019,22,21,201905,2019),('2019-05-23',201921,5,2019,23,21,201905,2019),('2019-05-24',201921,5,2019,24,21,201905,2019),('2019-05-25',201921,5,2019,25,21,201905,2019),('2019-05-26',201922,5,2019,26,22,201905,2019),('2019-05-27',201922,5,2019,27,22,201905,2019),('2019-05-28',201922,5,2019,28,22,201905,2019),('2019-05-29',201922,5,2019,29,22,201905,2019),('2019-05-30',201922,5,2019,30,22,201905,2019),('2019-05-31',201922,5,2019,31,22,201905,2019),('2019-06-01',201922,6,2019,1,22,201906,2019),('2019-06-02',201923,6,2019,2,23,201906,2019),('2019-06-03',201923,6,2019,3,23,201906,2019),('2019-06-04',201923,6,2019,4,23,201906,2019),('2019-06-05',201923,6,2019,5,23,201906,2019),('2019-06-06',201923,6,2019,6,23,201906,2019),('2019-06-07',201923,6,2019,7,23,201906,2019),('2019-06-08',201923,6,2019,8,23,201906,2019),('2019-06-09',201924,6,2019,9,24,201906,2019),('2019-06-10',201924,6,2019,10,24,201906,2019),('2019-06-11',201924,6,2019,11,24,201906,2019),('2019-06-12',201924,6,2019,12,24,201906,2019),('2019-06-13',201924,6,2019,13,24,201906,2019),('2019-06-14',201924,6,2019,14,24,201906,2019),('2019-06-15',201924,6,2019,15,24,201906,2019),('2019-06-16',201925,6,2019,16,25,201906,2019),('2019-06-17',201925,6,2019,17,25,201906,2019),('2019-06-18',201925,6,2019,18,25,201906,2019),('2019-06-19',201925,6,2019,19,25,201906,2019),('2019-06-20',201925,6,2019,20,25,201906,2019),('2019-06-21',201925,6,2019,21,25,201906,2019),('2019-06-22',201925,6,2019,22,25,201906,2019),('2019-06-23',201926,6,2019,23,26,201906,2019),('2019-06-24',201926,6,2019,24,26,201906,2019),('2019-06-25',201926,6,2019,25,26,201906,2019),('2019-06-26',201926,6,2019,26,26,201906,2019),('2019-06-27',201926,6,2019,27,26,201906,2019),('2019-06-28',201926,6,2019,28,26,201906,2019),('2019-06-29',201926,6,2019,29,26,201906,2019),('2019-06-30',201927,6,2019,30,27,201906,2019),('2019-07-01',201927,7,2019,1,27,201907,2019),('2019-07-02',201927,7,2019,2,27,201907,2019),('2019-07-03',201927,7,2019,3,27,201907,2019),('2019-07-04',201927,7,2019,4,27,201907,2019),('2019-07-05',201927,7,2019,5,27,201907,2019),('2019-07-06',201927,7,2019,6,27,201907,2019),('2019-07-07',201928,7,2019,7,28,201907,2019),('2019-07-08',201928,7,2019,8,28,201907,2019),('2019-07-09',201928,7,2019,9,28,201907,2019),('2019-07-10',201928,7,2019,10,28,201907,2019),('2019-07-11',201928,7,2019,11,28,201907,2019),('2019-07-12',201928,7,2019,12,28,201907,2019),('2019-07-13',201928,7,2019,13,28,201907,2019),('2019-07-14',201929,7,2019,14,29,201907,2019),('2019-07-15',201929,7,2019,15,29,201907,2019),('2019-07-16',201929,7,2019,16,29,201907,2019),('2019-07-17',201929,7,2019,17,29,201907,2019),('2019-07-18',201929,7,2019,18,29,201907,2019),('2019-07-19',201929,7,2019,19,29,201907,2019),('2019-07-20',201929,7,2019,20,29,201907,2019),('2019-07-21',201930,7,2019,21,30,201907,2019),('2019-07-22',201930,7,2019,22,30,201907,2019),('2019-07-23',201930,7,2019,23,30,201907,2019),('2019-07-24',201930,7,2019,24,30,201907,2019),('2019-07-25',201930,7,2019,25,30,201907,2019),('2019-07-26',201930,7,2019,26,30,201907,2019),('2019-07-27',201930,7,2019,27,30,201907,2019),('2019-07-28',201931,7,2019,28,31,201907,2019),('2019-07-29',201931,7,2019,29,31,201907,2019),('2019-07-30',201931,7,2019,30,31,201907,2019),('2019-07-31',201931,7,2019,31,31,201907,2019),('2019-08-01',201931,8,2019,1,31,201908,2019),('2019-08-02',201931,8,2019,2,31,201908,2019),('2019-08-03',201931,8,2019,3,31,201908,2019),('2019-08-04',201932,8,2019,4,32,201908,2019),('2019-08-05',201932,8,2019,5,32,201908,2019),('2019-08-06',201932,8,2019,6,32,201908,2019),('2019-08-07',201932,8,2019,7,32,201908,2019),('2019-08-08',201932,8,2019,8,32,201908,2019),('2019-08-09',201932,8,2019,9,32,201908,2019),('2019-08-10',201932,8,2019,10,32,201908,2019),('2019-08-11',201933,8,2019,11,33,201908,2019),('2019-08-12',201933,8,2019,12,33,201908,2019),('2019-08-13',201933,8,2019,13,33,201908,2019),('2019-08-14',201933,8,2019,14,33,201908,2019),('2019-08-15',201933,8,2019,15,33,201908,2019),('2019-08-16',201933,8,2019,16,33,201908,2019),('2019-08-17',201933,8,2019,17,33,201908,2019),('2019-08-18',201934,8,2019,18,34,201908,2019),('2019-08-19',201934,8,2019,19,34,201908,2019),('2019-08-20',201934,8,2019,20,34,201908,2019),('2019-08-21',201934,8,2019,21,34,201908,2019),('2019-08-22',201934,8,2019,22,34,201908,2019),('2019-08-23',201934,8,2019,23,34,201908,2019),('2019-08-24',201934,8,2019,24,34,201908,2019),('2019-08-25',201935,8,2019,25,35,201908,2019),('2019-08-26',201935,8,2019,26,35,201908,2019),('2019-08-27',201935,8,2019,27,35,201908,2019),('2019-08-28',201935,8,2019,28,35,201908,2019),('2019-08-29',201935,8,2019,29,35,201908,2019),('2019-08-30',201935,8,2019,30,35,201908,2019),('2019-08-31',201935,8,2019,31,35,201908,2019),('2019-09-01',201936,9,2019,1,36,201909,2019),('2019-09-02',201936,9,2019,2,36,201909,2019),('2019-09-03',201936,9,2019,3,36,201909,2019),('2019-09-04',201936,9,2019,4,36,201909,2019),('2019-09-05',201936,9,2019,5,36,201909,2019),('2019-09-06',201936,9,2019,6,36,201909,2019),('2019-09-07',201936,9,2019,7,36,201909,2019),('2019-09-08',201937,9,2019,8,37,201909,2019),('2019-09-09',201937,9,2019,9,37,201909,2019),('2019-09-10',201937,9,2019,10,37,201909,2019),('2019-09-11',201937,9,2019,11,37,201909,2019),('2019-09-12',201937,9,2019,12,37,201909,2019),('2019-09-13',201937,9,2019,13,37,201909,2019),('2019-09-14',201937,9,2019,14,37,201909,2019),('2019-09-15',201938,9,2019,15,38,201909,2019),('2019-09-16',201938,9,2019,16,38,201909,2019),('2019-09-17',201938,9,2019,17,38,201909,2019),('2019-09-18',201938,9,2019,18,38,201909,2019),('2019-09-19',201938,9,2019,19,38,201909,2019),('2019-09-20',201938,9,2019,20,38,201909,2019),('2019-09-21',201938,9,2019,21,38,201909,2019),('2019-09-22',201939,9,2019,22,39,201909,2019),('2019-09-23',201939,9,2019,23,39,201909,2019),('2019-09-24',201939,9,2019,24,39,201909,2019),('2019-09-25',201939,9,2019,25,39,201909,2019),('2019-09-26',201939,9,2019,26,39,201909,2019),('2019-09-27',201939,9,2019,27,39,201909,2019),('2019-09-28',201939,9,2019,28,39,201909,2019),('2019-09-29',201940,9,2019,29,40,201909,2019),('2019-09-30',201940,9,2019,30,40,201909,2019),('2019-10-01',201940,10,2019,1,40,201910,2019),('2019-10-02',201940,10,2019,2,40,201910,2019),('2019-10-03',201940,10,2019,3,40,201910,2019),('2019-10-04',201940,10,2019,4,40,201910,2019),('2019-10-05',201940,10,2019,5,40,201910,2019),('2019-10-06',201941,10,2019,6,41,201910,2019),('2019-10-07',201941,10,2019,7,41,201910,2019),('2019-10-08',201941,10,2019,8,41,201910,2019),('2019-10-09',201941,10,2019,9,41,201910,2019),('2019-10-10',201941,10,2019,10,41,201910,2019),('2019-10-11',201941,10,2019,11,41,201910,2019),('2019-10-12',201941,10,2019,12,41,201910,2019),('2019-10-13',201942,10,2019,13,42,201910,2019),('2019-10-14',201942,10,2019,14,42,201910,2019),('2019-10-15',201942,10,2019,15,42,201910,2019),('2019-10-16',201942,10,2019,16,42,201910,2019),('2019-10-17',201942,10,2019,17,42,201910,2019),('2019-10-18',201942,10,2019,18,42,201910,2019),('2019-10-19',201942,10,2019,19,42,201910,2019),('2019-10-20',201943,10,2019,20,43,201910,2019),('2019-10-21',201943,10,2019,21,43,201910,2019),('2019-10-22',201943,10,2019,22,43,201910,2019),('2019-10-23',201943,10,2019,23,43,201910,2019),('2019-10-24',201943,10,2019,24,43,201910,2019),('2019-10-25',201943,10,2019,25,43,201910,2019),('2019-10-26',201943,10,2019,26,43,201910,2019),('2019-10-27',201944,10,2019,27,44,201910,2019),('2019-10-28',201944,10,2019,28,44,201910,2019),('2019-10-29',201944,10,2019,29,44,201910,2019),('2019-10-30',201944,10,2019,30,44,201910,2019),('2019-10-31',201944,10,2019,31,44,201910,2019),('2019-11-01',201944,11,2019,1,44,201911,2019),('2019-11-02',201944,11,2019,2,44,201911,2019),('2019-11-03',201945,11,2019,3,45,201911,2019),('2019-11-04',201945,11,2019,4,45,201911,2019),('2019-11-05',201945,11,2019,5,45,201911,2019),('2019-11-06',201945,11,2019,6,45,201911,2019),('2019-11-07',201945,11,2019,7,45,201911,2019),('2019-11-08',201945,11,2019,8,45,201911,2019),('2019-11-09',201945,11,2019,9,45,201911,2019),('2019-11-10',201946,11,2019,10,46,201911,2019),('2019-11-11',201946,11,2019,11,46,201911,2019),('2019-11-12',201946,11,2019,12,46,201911,2019),('2019-11-13',201946,11,2019,13,46,201911,2019),('2019-11-14',201946,11,2019,14,46,201911,2019),('2019-11-15',201946,11,2019,15,46,201911,2019),('2019-11-16',201946,11,2019,16,46,201911,2019),('2019-11-17',201947,11,2019,17,47,201911,2019),('2019-11-18',201947,11,2019,18,47,201911,2019),('2019-11-19',201947,11,2019,19,47,201911,2019),('2019-11-20',201947,11,2019,20,47,201911,2019),('2019-11-21',201947,11,2019,21,47,201911,2019),('2019-11-22',201947,11,2019,22,47,201911,2019),('2019-11-23',201947,11,2019,23,47,201911,2019),('2019-11-24',201948,11,2019,24,48,201911,2019),('2019-11-25',201948,11,2019,25,48,201911,2019),('2019-11-26',201948,11,2019,26,48,201911,2019),('2019-11-27',201948,11,2019,27,48,201911,2019),('2019-11-28',201948,11,2019,28,48,201911,2019),('2019-11-29',201948,11,2019,29,48,201911,2019),('2019-11-30',201948,11,2019,30,48,201911,2019),('2019-12-01',201949,12,2019,1,49,201912,2020),('2019-12-02',201949,12,2019,2,49,201912,2020),('2019-12-03',201949,12,2019,3,49,201912,2020),('2019-12-04',201949,12,2019,4,49,201912,2020),('2019-12-05',201949,12,2019,5,49,201912,2020),('2019-12-06',201949,12,2019,6,49,201912,2020),('2019-12-07',201949,12,2019,7,49,201912,2020),('2019-12-08',201950,12,2019,8,50,201912,2020),('2019-12-09',201950,12,2019,9,50,201912,2020),('2019-12-10',201950,12,2019,10,50,201912,2020),('2019-12-11',201950,12,2019,11,50,201912,2020),('2019-12-12',201950,12,2019,12,50,201912,2020),('2019-12-13',201950,12,2019,13,50,201912,2020),('2019-12-14',201950,12,2019,14,50,201912,2020),('2019-12-15',201951,12,2019,15,51,201912,2020),('2019-12-16',201951,12,2019,16,51,201912,2020),('2019-12-17',201951,12,2019,17,51,201912,2020),('2019-12-18',201951,12,2019,18,51,201912,2020),('2019-12-19',201951,12,2019,19,51,201912,2020),('2019-12-20',201951,12,2019,20,51,201912,2020),('2019-12-21',201951,12,2019,21,51,201912,2020),('2019-12-22',201952,12,2019,22,52,201912,2020),('2019-12-23',201952,12,2019,23,52,201912,2020),('2019-12-24',201952,12,2019,24,52,201912,2020),('2019-12-25',201952,12,2019,25,52,201912,2020),('2019-12-26',201952,12,2019,26,52,201912,2020),('2019-12-27',201952,12,2019,27,52,201912,2020),('2019-12-28',201952,12,2019,28,52,201912,2020),('2019-12-29',201953,12,2019,29,1,201912,2020),('2019-12-30',201953,12,2019,30,1,201912,2020),('2019-12-31',201953,12,2019,31,1,201912,2020),('2020-01-01',201953,1,2020,1,1,202001,2020),('2020-01-02',201953,1,2020,2,1,202001,2020),('2020-01-03',201953,1,2020,3,1,202001,2020),('2020-01-04',201953,1,2020,4,1,202001,2020),('2020-01-05',202001,1,2020,5,2,202001,2020),('2020-01-06',202001,1,2020,6,2,202001,2020),('2020-01-07',202001,1,2020,7,2,202001,2020),('2020-01-08',202001,1,2020,8,2,202001,2020),('2020-01-09',202001,1,2020,9,2,202001,2020),('2020-01-10',202001,1,2020,10,2,202001,2020),('2020-01-11',202001,1,2020,11,2,202001,2020),('2020-01-12',202002,1,2020,12,3,202001,2020),('2020-01-13',202002,1,2020,13,3,202001,2020),('2020-01-14',202002,1,2020,14,3,202001,2020),('2020-01-15',202002,1,2020,15,3,202001,2020),('2020-01-16',202002,1,2020,16,3,202001,2020),('2020-01-17',202002,1,2020,17,3,202001,2020),('2020-01-18',202002,1,2020,18,3,202001,2020),('2020-01-19',202003,1,2020,19,4,202001,2020),('2020-01-20',202003,1,2020,20,4,202001,2020),('2020-01-21',202003,1,2020,21,4,202001,2020),('2020-01-22',202003,1,2020,22,4,202001,2020),('2020-01-23',202003,1,2020,23,4,202001,2020),('2020-01-24',202003,1,2020,24,4,202001,2020),('2020-01-25',202003,1,2020,25,4,202001,2020),('2020-01-26',202004,1,2020,26,5,202001,2020),('2020-01-27',202004,1,2020,27,5,202001,2020),('2020-01-28',202004,1,2020,28,5,202001,2020),('2020-01-29',202004,1,2020,29,5,202001,2020),('2020-01-30',202004,1,2020,30,5,202001,2020),('2020-01-31',202004,1,2020,31,5,202001,2020),('2020-02-01',202004,2,2020,1,5,202002,2020),('2020-02-02',202005,2,2020,2,6,202002,2020),('2020-02-03',202005,2,2020,3,6,202002,2020),('2020-02-04',202005,2,2020,4,6,202002,2020),('2020-02-05',202005,2,2020,5,6,202002,2020),('2020-02-06',202005,2,2020,6,6,202002,2020),('2020-02-07',202005,2,2020,7,6,202002,2020),('2020-02-08',202005,2,2020,8,6,202002,2020),('2020-02-09',202006,2,2020,9,7,202002,2020),('2020-02-10',202006,2,2020,10,7,202002,2020),('2020-02-11',202006,2,2020,11,7,202002,2020),('2020-02-12',202006,2,2020,12,7,202002,2020),('2020-02-13',202006,2,2020,13,7,202002,2020),('2020-02-14',202006,2,2020,14,7,202002,2020),('2020-02-15',202006,2,2020,15,7,202002,2020),('2020-02-16',202007,2,2020,16,8,202002,2020),('2020-02-17',202007,2,2020,17,8,202002,2020),('2020-02-18',202007,2,2020,18,8,202002,2020),('2020-02-19',202007,2,2020,19,8,202002,2020),('2020-02-20',202007,2,2020,20,8,202002,2020),('2020-02-21',202007,2,2020,21,8,202002,2020),('2020-02-22',202007,2,2020,22,8,202002,2020),('2020-02-23',202008,2,2020,23,9,202002,2020),('2020-02-24',202008,2,2020,24,9,202002,2020),('2020-02-25',202008,2,2020,25,9,202002,2020),('2020-02-26',202008,2,2020,26,9,202002,2020),('2020-02-27',202008,2,2020,27,9,202002,2020),('2020-02-28',202008,2,2020,28,9,202002,2020),('2020-02-29',202008,2,2020,29,9,202002,2020),('2020-03-01',202009,3,2020,1,10,202003,2020),('2020-03-02',202009,3,2020,2,10,202003,2020),('2020-03-03',202009,3,2020,3,10,202003,2020),('2020-03-04',202009,3,2020,4,10,202003,2020),('2020-03-05',202009,3,2020,5,10,202003,2020),('2020-03-06',202009,3,2020,6,10,202003,2020),('2020-03-07',202009,3,2020,7,10,202003,2020),('2020-03-08',202010,3,2020,8,11,202003,2020),('2020-03-09',202010,3,2020,9,11,202003,2020),('2020-03-10',202010,3,2020,10,11,202003,2020),('2020-03-11',202010,3,2020,11,11,202003,2020),('2020-03-12',202010,3,2020,12,11,202003,2020),('2020-03-13',202010,3,2020,13,11,202003,2020),('2020-03-14',202010,3,2020,14,11,202003,2020),('2020-03-15',202011,3,2020,15,12,202003,2020),('2020-03-16',202011,3,2020,16,12,202003,2020),('2020-03-17',202011,3,2020,17,12,202003,2020),('2020-03-18',202011,3,2020,18,12,202003,2020),('2020-03-19',202011,3,2020,19,12,202003,2020),('2020-03-20',202011,3,2020,20,12,202003,2020),('2020-03-21',202011,3,2020,21,12,202003,2020),('2020-03-22',202012,3,2020,22,13,202003,2020),('2020-03-23',202012,3,2020,23,13,202003,2020),('2020-03-24',202012,3,2020,24,13,202003,2020),('2020-03-25',202012,3,2020,25,13,202003,2020),('2020-03-26',202012,3,2020,26,13,202003,2020),('2020-03-27',202012,3,2020,27,13,202003,2020),('2020-03-28',202012,3,2020,28,13,202003,2020),('2020-03-29',202013,3,2020,29,14,202003,2020),('2020-03-30',202013,3,2020,30,14,202003,2020),('2020-03-31',202013,3,2020,31,14,202003,2020),('2020-04-01',202013,4,2020,1,14,202004,2020),('2020-04-02',202013,4,2020,2,14,202004,2020),('2020-04-03',202013,4,2020,3,14,202004,2020),('2020-04-04',202013,4,2020,4,14,202004,2020),('2020-04-05',202014,4,2020,5,15,202004,2020),('2020-04-06',202014,4,2020,6,15,202004,2020),('2020-04-07',202014,4,2020,7,15,202004,2020),('2020-04-08',202014,4,2020,8,15,202004,2020),('2020-04-09',202014,4,2020,9,15,202004,2020),('2020-04-10',202014,4,2020,10,15,202004,2020),('2020-04-11',202014,4,2020,11,15,202004,2020),('2020-04-12',202015,4,2020,12,16,202004,2020),('2020-04-13',202015,4,2020,13,16,202004,2020),('2020-04-14',202015,4,2020,14,16,202004,2020),('2020-04-15',202015,4,2020,15,16,202004,2020),('2020-04-16',202015,4,2020,16,16,202004,2020),('2020-04-17',202015,4,2020,17,16,202004,2020),('2020-04-18',202015,4,2020,18,16,202004,2020),('2020-04-19',202016,4,2020,19,17,202004,2020),('2020-04-20',202016,4,2020,20,17,202004,2020),('2020-04-21',202016,4,2020,21,17,202004,2020),('2020-04-22',202016,4,2020,22,17,202004,2020),('2020-04-23',202016,4,2020,23,17,202004,2020),('2020-04-24',202016,4,2020,24,17,202004,2020),('2020-04-25',202016,4,2020,25,17,202004,2020),('2020-04-26',202017,4,2020,26,18,202004,2020),('2020-04-27',202017,4,2020,27,18,202004,2020),('2020-04-28',202017,4,2020,28,18,202004,2020),('2020-04-29',202017,4,2020,29,18,202004,2020),('2020-04-30',202017,4,2020,30,18,202004,2020),('2020-05-01',202017,5,2020,1,18,202005,2020),('2020-05-02',202017,5,2020,2,18,202005,2020),('2020-05-03',202018,5,2020,3,19,202005,2020),('2020-05-04',202018,5,2020,4,19,202005,2020),('2020-05-05',202018,5,2020,5,19,202005,2020),('2020-05-06',202018,5,2020,6,19,202005,2020),('2020-05-07',202018,5,2020,7,19,202005,2020),('2020-05-08',202018,5,2020,8,19,202005,2020),('2020-05-09',202018,5,2020,9,19,202005,2020),('2020-05-10',202019,5,2020,10,20,202005,2020),('2020-05-11',202019,5,2020,11,20,202005,2020),('2020-05-12',202019,5,2020,12,20,202005,2020),('2020-05-13',202019,5,2020,13,20,202005,2020),('2020-05-14',202019,5,2020,14,20,202005,2020),('2020-05-15',202019,5,2020,15,20,202005,2020),('2020-05-16',202019,5,2020,16,20,202005,2020),('2020-05-17',202020,5,2020,17,21,202005,2020),('2020-05-18',202020,5,2020,18,21,202005,2020),('2020-05-19',202020,5,2020,19,21,202005,2020),('2020-05-20',202020,5,2020,20,21,202005,2020),('2020-05-21',202020,5,2020,21,21,202005,2020),('2020-05-22',202020,5,2020,22,21,202005,2020),('2020-05-23',202020,5,2020,23,21,202005,2020),('2020-05-24',202021,5,2020,24,22,202005,2020),('2020-05-25',202021,5,2020,25,22,202005,2020),('2020-05-26',202021,5,2020,26,22,202005,2020),('2020-05-27',202021,5,2020,27,22,202005,2020),('2020-05-28',202021,5,2020,28,22,202005,2020),('2020-05-29',202021,5,2020,29,22,202005,2020),('2020-05-30',202021,5,2020,30,22,202005,2020),('2020-05-31',202022,5,2020,31,23,202005,2020),('2020-06-01',202022,6,2020,1,23,202006,2020),('2020-06-02',202022,6,2020,2,23,202006,2020),('2020-06-03',202022,6,2020,3,23,202006,2020),('2020-06-04',202022,6,2020,4,23,202006,2020),('2020-06-05',202022,6,2020,5,23,202006,2020),('2020-06-06',202022,6,2020,6,23,202006,2020),('2020-06-07',202023,6,2020,7,24,202006,2020),('2020-06-08',202023,6,2020,8,24,202006,2020),('2020-06-09',202023,6,2020,9,24,202006,2020),('2020-06-10',202023,6,2020,10,24,202006,2020),('2020-06-11',202023,6,2020,11,24,202006,2020),('2020-06-12',202023,6,2020,12,24,202006,2020),('2020-06-13',202023,6,2020,13,24,202006,2020),('2020-06-14',202024,6,2020,14,25,202006,2020),('2020-06-15',202024,6,2020,15,25,202006,2020),('2020-06-16',202024,6,2020,16,25,202006,2020),('2020-06-17',202024,6,2020,17,25,202006,2020),('2020-06-18',202024,6,2020,18,25,202006,2020),('2020-06-19',202024,6,2020,19,25,202006,2020),('2020-06-20',202024,6,2020,20,25,202006,2020),('2020-06-21',202025,6,2020,21,26,202006,2020),('2020-06-22',202025,6,2020,22,26,202006,2020),('2020-06-23',202025,6,2020,23,26,202006,2020),('2020-06-24',202025,6,2020,24,26,202006,2020),('2020-06-25',202025,6,2020,25,26,202006,2020),('2020-06-26',202025,6,2020,26,26,202006,2020),('2020-06-27',202025,6,2020,27,26,202006,2020),('2020-06-28',202026,6,2020,28,27,202006,2020),('2020-06-29',202026,6,2020,29,27,202006,2020),('2020-06-30',202026,6,2020,30,27,202006,2020),('2020-07-01',202026,7,2020,1,27,202007,2020),('2020-07-02',202026,7,2020,2,27,202007,2020),('2020-07-03',202026,7,2020,3,27,202007,2020),('2020-07-04',202026,7,2020,4,27,202007,2020),('2020-07-05',202027,7,2020,5,28,202007,2020),('2020-07-06',202027,7,2020,6,28,202007,2020),('2020-07-07',202027,7,2020,7,28,202007,2020),('2020-07-08',202027,7,2020,8,28,202007,2020),('2020-07-09',202027,7,2020,9,28,202007,2020),('2020-07-10',202027,7,2020,10,28,202007,2020),('2020-07-11',202027,7,2020,11,28,202007,2020),('2020-07-12',202028,7,2020,12,29,202007,2020),('2020-07-13',202028,7,2020,13,29,202007,2020),('2020-07-14',202028,7,2020,14,29,202007,2020),('2020-07-15',202028,7,2020,15,29,202007,2020),('2020-07-16',202028,7,2020,16,29,202007,2020),('2020-07-17',202028,7,2020,17,29,202007,2020),('2020-07-18',202028,7,2020,18,29,202007,2020),('2020-07-19',202029,7,2020,19,30,202007,2020),('2020-07-20',202029,7,2020,20,30,202007,2020),('2020-07-21',202029,7,2020,21,30,202007,2020),('2020-07-22',202029,7,2020,22,30,202007,2020),('2020-07-23',202029,7,2020,23,30,202007,2020),('2020-07-24',202029,7,2020,24,30,202007,2020),('2020-07-25',202029,7,2020,25,30,202007,2020),('2020-07-26',202030,7,2020,26,31,202007,2020),('2020-07-27',202030,7,2020,27,31,202007,2020),('2020-07-28',202030,7,2020,28,31,202007,2020),('2020-07-29',202030,7,2020,29,31,202007,2020),('2020-07-30',202030,7,2020,30,31,202007,2020),('2020-07-31',202030,7,2020,31,31,202007,2020),('2020-08-01',202030,8,2020,1,31,202008,2020),('2020-08-02',202031,8,2020,2,32,202008,2020),('2020-08-03',202031,8,2020,3,32,202008,2020),('2020-08-04',202031,8,2020,4,32,202008,2020),('2020-08-05',202031,8,2020,5,32,202008,2020),('2020-08-06',202031,8,2020,6,32,202008,2020),('2020-08-07',202031,8,2020,7,32,202008,2020),('2020-08-08',202031,8,2020,8,32,202008,2020),('2020-08-09',202032,8,2020,9,33,202008,2020),('2020-08-10',202032,8,2020,10,33,202008,2020),('2020-08-11',202032,8,2020,11,33,202008,2020),('2020-08-12',202032,8,2020,12,33,202008,2020),('2020-08-13',202032,8,2020,13,33,202008,2020),('2020-08-14',202032,8,2020,14,33,202008,2020),('2020-08-15',202032,8,2020,15,33,202008,2020),('2020-08-16',202033,8,2020,16,34,202008,2020),('2020-08-17',202033,8,2020,17,34,202008,2020),('2020-08-18',202033,8,2020,18,34,202008,2020),('2020-08-19',202033,8,2020,19,34,202008,2020),('2020-08-20',202033,8,2020,20,34,202008,2020),('2020-08-21',202033,8,2020,21,34,202008,2020),('2020-08-22',202033,8,2020,22,34,202008,2020),('2020-08-23',202034,8,2020,23,35,202008,2020),('2020-08-24',202034,8,2020,24,35,202008,2020),('2020-08-25',202034,8,2020,25,35,202008,2020),('2020-08-26',202034,8,2020,26,35,202008,2020),('2020-08-27',202034,8,2020,27,35,202008,2020),('2020-08-28',202034,8,2020,28,35,202008,2020),('2020-08-29',202034,8,2020,29,35,202008,2020),('2020-08-30',202035,8,2020,30,36,202008,2020),('2020-08-31',202035,8,2020,31,36,202008,2020),('2020-09-01',202035,9,2020,1,36,202009,2020),('2020-09-02',202035,9,2020,2,36,202009,2020),('2020-09-03',202035,9,2020,3,36,202009,2020),('2020-09-04',202035,9,2020,4,36,202009,2020),('2020-09-05',202035,9,2020,5,36,202009,2020),('2020-09-06',202036,9,2020,6,37,202009,2020),('2020-09-07',202036,9,2020,7,37,202009,2020),('2020-09-08',202036,9,2020,8,37,202009,2020),('2020-09-09',202036,9,2020,9,37,202009,2020),('2020-09-10',202036,9,2020,10,37,202009,2020),('2020-09-11',202036,9,2020,11,37,202009,2020),('2020-09-12',202036,9,2020,12,37,202009,2020),('2020-09-13',202037,9,2020,13,38,202009,2020),('2020-09-14',202037,9,2020,14,38,202009,2020),('2020-09-15',202037,9,2020,15,38,202009,2020),('2020-09-16',202037,9,2020,16,38,202009,2020),('2020-09-17',202037,9,2020,17,38,202009,2020),('2020-09-18',202037,9,2020,18,38,202009,2020),('2020-09-19',202037,9,2020,19,38,202009,2020),('2020-09-20',202038,9,2020,20,39,202009,2020),('2020-09-21',202038,9,2020,21,39,202009,2020),('2020-09-22',202038,9,2020,22,39,202009,2020),('2020-09-23',202038,9,2020,23,39,202009,2020),('2020-09-24',202038,9,2020,24,39,202009,2020),('2020-09-25',202038,9,2020,25,39,202009,2020),('2020-09-26',202038,9,2020,26,39,202009,2020),('2020-09-27',202039,9,2020,27,40,202009,2020),('2020-09-28',202039,9,2020,28,40,202009,2020),('2020-09-29',202039,9,2020,29,40,202009,2020),('2020-09-30',202039,9,2020,30,40,202009,2020),('2020-10-01',202039,10,2020,1,40,202010,2020),('2020-10-02',202039,10,2020,2,40,202010,2020),('2020-10-03',202039,10,2020,3,40,202010,2020),('2020-10-04',202040,10,2020,4,41,202010,2020),('2020-10-05',202040,10,2020,5,41,202010,2020),('2020-10-06',202040,10,2020,6,41,202010,2020),('2020-10-07',202040,10,2020,7,41,202010,2020),('2020-10-08',202040,10,2020,8,41,202010,2020),('2020-10-09',202040,10,2020,9,41,202010,2020),('2020-10-10',202040,10,2020,10,41,202010,2020),('2020-10-11',202041,10,2020,11,42,202010,2020),('2020-10-12',202041,10,2020,12,42,202010,2020),('2020-10-13',202041,10,2020,13,42,202010,2020),('2020-10-14',202041,10,2020,14,42,202010,2020),('2020-10-15',202041,10,2020,15,42,202010,2020),('2020-10-16',202041,10,2020,16,42,202010,2020),('2020-10-17',202041,10,2020,17,42,202010,2020),('2020-10-18',202042,10,2020,18,43,202010,2020),('2020-10-19',202042,10,2020,19,43,202010,2020),('2020-10-20',202042,10,2020,20,43,202010,2020),('2020-10-21',202042,10,2020,21,43,202010,2020),('2020-10-22',202042,10,2020,22,43,202010,2020),('2020-10-23',202042,10,2020,23,43,202010,2020),('2020-10-24',202042,10,2020,24,43,202010,2020),('2020-10-25',202043,10,2020,25,44,202010,2020),('2020-10-26',202043,10,2020,26,44,202010,2020),('2020-10-27',202043,10,2020,27,44,202010,2020),('2020-10-28',202043,10,2020,28,44,202010,2020),('2020-10-29',202043,10,2020,29,44,202010,2020),('2020-10-30',202043,10,2020,30,44,202010,2020),('2020-10-31',202043,10,2020,31,44,202010,2020),('2020-11-01',202044,11,2020,1,45,202011,2020),('2020-11-02',202044,11,2020,2,45,202011,2020),('2020-11-03',202044,11,2020,3,45,202011,2020),('2020-11-04',202044,11,2020,4,45,202011,2020),('2020-11-05',202044,11,2020,5,45,202011,2020),('2020-11-06',202044,11,2020,6,45,202011,2020),('2020-11-07',202044,11,2020,7,45,202011,2020),('2020-11-08',202045,11,2020,8,46,202011,2020),('2020-11-09',202045,11,2020,9,46,202011,2020),('2020-11-10',202045,11,2020,10,46,202011,2020),('2020-11-11',202045,11,2020,11,46,202011,2020),('2020-11-12',202045,11,2020,12,46,202011,2020),('2020-11-13',202045,11,2020,13,46,202011,2020),('2020-11-14',202045,11,2020,14,46,202011,2020),('2020-11-15',202046,11,2020,15,47,202011,2020),('2020-11-16',202046,11,2020,16,47,202011,2020),('2020-11-17',202046,11,2020,17,47,202011,2020),('2020-11-18',202046,11,2020,18,47,202011,2020),('2020-11-19',202046,11,2020,19,47,202011,2020),('2020-11-20',202046,11,2020,20,47,202011,2020),('2020-11-21',202046,11,2020,21,47,202011,2020),('2020-11-22',202047,11,2020,22,48,202011,2020),('2020-11-23',202047,11,2020,23,48,202011,2020),('2020-11-24',202047,11,2020,24,48,202011,2020),('2020-11-25',202047,11,2020,25,48,202011,2020),('2020-11-26',202047,11,2020,26,48,202011,2020),('2020-11-27',202047,11,2020,27,48,202011,2020),('2020-11-28',202047,11,2020,28,48,202011,2020),('2020-11-29',202048,11,2020,29,49,202011,2020),('2020-11-30',202048,11,2020,30,49,202011,2020),('2020-12-01',202048,12,2020,1,49,202012,2021),('2020-12-02',202048,12,2020,2,49,202012,2021),('2020-12-03',202048,12,2020,3,49,202012,2021),('2020-12-04',202048,12,2020,4,49,202012,2021),('2020-12-05',202048,12,2020,5,49,202012,2021),('2020-12-06',202049,12,2020,6,50,202012,2021),('2020-12-07',202049,12,2020,7,50,202012,2021),('2020-12-08',202049,12,2020,8,50,202012,2021),('2020-12-09',202049,12,2020,9,50,202012,2021),('2020-12-10',202049,12,2020,10,50,202012,2021),('2020-12-11',202049,12,2020,11,50,202012,2021),('2020-12-12',202049,12,2020,12,50,202012,2021),('2020-12-13',202050,12,2020,13,51,202012,2021),('2020-12-14',202050,12,2020,14,51,202012,2021),('2020-12-15',202050,12,2020,15,51,202012,2021),('2020-12-16',202050,12,2020,16,51,202012,2021),('2020-12-17',202050,12,2020,17,51,202012,2021),('2020-12-18',202050,12,2020,18,51,202012,2021),('2020-12-19',202050,12,2020,19,51,202012,2021),('2020-12-20',202051,12,2020,20,52,202012,2021),('2020-12-21',202051,12,2020,21,52,202012,2021),('2020-12-22',202051,12,2020,22,52,202012,2021),('2020-12-23',202051,12,2020,23,52,202012,2021),('2020-12-24',202051,12,2020,24,52,202012,2021),('2020-12-25',202051,12,2020,25,52,202012,2021),('2020-12-26',202051,12,2020,26,52,202012,2021),('2020-12-27',202052,12,2020,27,53,202012,2021),('2020-12-28',202052,12,2020,28,53,202012,2021),('2020-12-29',202052,12,2020,29,53,202012,2021),('2020-12-30',202052,12,2020,30,53,202012,2021),('2020-12-31',202052,12,2020,31,53,202012,2021),('2021-01-01',202101,1,2021,1,1,202101,2021),('2021-01-02',202101,1,2021,2,1,202101,2021),('2021-01-03',202101,1,2021,3,1,202101,2021),('2021-01-04',202101,1,2021,4,1,202101,2021),('2021-01-05',202101,1,2021,5,1,202101,2021),('2021-01-06',202101,1,2021,6,1,202101,2021),('2021-01-07',202101,1,2021,7,1,202101,2021),('2021-01-08',202101,1,2021,8,1,202101,2021),('2021-01-09',202101,1,2021,9,1,202101,2021),('2021-01-10',202102,1,2021,10,2,202101,2021),('2021-01-11',202102,1,2021,11,2,202101,2021),('2021-01-12',202102,1,2021,12,2,202101,2021),('2021-01-13',202102,1,2021,13,2,202101,2021),('2021-01-14',202102,1,2021,14,2,202101,2021),('2021-01-15',202102,1,2021,15,2,202101,2021),('2021-01-16',202102,1,2021,16,2,202101,2021),('2021-01-17',202103,1,2021,17,3,202101,2021),('2021-01-18',202103,1,2021,18,3,202101,2021),('2021-01-19',202103,1,2021,19,3,202101,2021),('2021-01-20',202103,1,2021,20,3,202101,2021),('2021-01-21',202103,1,2021,21,3,202101,2021),('2021-01-22',202103,1,2021,22,3,202101,2021),('2021-01-23',202103,1,2021,23,3,202101,2021),('2021-01-24',202104,1,2021,24,4,202101,2021),('2021-01-25',202104,1,2021,25,4,202101,2021),('2021-01-26',202104,1,2021,26,4,202101,2021),('2021-01-27',202104,1,2021,27,4,202101,2021),('2021-01-28',202104,1,2021,28,4,202101,2021),('2021-01-29',202104,1,2021,29,4,202101,2021),('2021-01-30',202104,1,2021,30,4,202101,2021),('2021-01-31',202105,1,2021,31,5,202101,2021),('2021-02-01',202105,2,2021,1,5,202102,2021),('2021-02-02',202105,2,2021,2,5,202102,2021),('2021-02-03',202105,2,2021,3,5,202102,2021),('2021-02-04',202105,2,2021,4,5,202102,2021),('2021-02-05',202105,2,2021,5,5,202102,2021),('2021-02-06',202105,2,2021,6,5,202102,2021),('2021-02-07',202106,2,2021,7,6,202102,2021),('2021-02-08',202106,2,2021,8,6,202102,2021),('2021-02-09',202106,2,2021,9,6,202102,2021),('2021-02-10',202106,2,2021,10,6,202102,2021),('2021-02-11',202106,2,2021,11,6,202102,2021),('2021-02-12',202106,2,2021,12,6,202102,2021),('2021-02-13',202106,2,2021,13,6,202102,2021),('2021-02-14',202107,2,2021,14,7,202102,2021),('2021-02-15',202107,2,2021,15,7,202102,2021),('2021-02-16',202107,2,2021,16,7,202102,2021),('2021-02-17',202107,2,2021,17,7,202102,2021),('2021-02-18',202107,2,2021,18,7,202102,2021),('2021-02-19',202107,2,2021,19,7,202102,2021),('2021-02-20',202107,2,2021,20,7,202102,2021),('2021-02-21',202108,2,2021,21,8,202102,2021),('2021-02-22',202108,2,2021,22,8,202102,2021),('2021-02-23',202108,2,2021,23,8,202102,2021),('2021-02-24',202108,2,2021,24,8,202102,2021),('2021-02-25',202108,2,2021,25,8,202102,2021),('2021-02-26',202108,2,2021,26,8,202102,2021),('2021-02-27',202108,2,2021,27,8,202102,2021),('2021-02-28',202109,2,2021,28,9,202102,2021),('2021-03-01',202109,3,2021,1,9,202103,2021),('2021-03-02',202109,3,2021,2,9,202103,2021),('2021-03-03',202109,3,2021,3,9,202103,2021),('2021-03-04',202109,3,2021,4,9,202103,2021),('2021-03-05',202109,3,2021,5,9,202103,2021),('2021-03-06',202109,3,2021,6,9,202103,2021),('2021-03-07',202110,3,2021,7,10,202103,2021),('2021-03-08',202110,3,2021,8,10,202103,2021),('2021-03-09',202110,3,2021,9,10,202103,2021),('2021-03-10',202110,3,2021,10,10,202103,2021),('2021-03-11',202110,3,2021,11,10,202103,2021),('2021-03-12',202110,3,2021,12,10,202103,2021),('2021-03-13',202110,3,2021,13,10,202103,2021),('2021-03-14',202111,3,2021,14,11,202103,2021),('2021-03-15',202111,3,2021,15,11,202103,2021),('2021-03-16',202111,3,2021,16,11,202103,2021),('2021-03-17',202111,3,2021,17,11,202103,2021),('2021-03-18',202111,3,2021,18,11,202103,2021),('2021-03-19',202111,3,2021,19,11,202103,2021),('2021-03-20',202111,3,2021,20,11,202103,2021),('2021-03-21',202112,3,2021,21,12,202103,2021),('2021-03-22',202112,3,2021,22,12,202103,2021),('2021-03-23',202112,3,2021,23,12,202103,2021),('2021-03-24',202112,3,2021,24,12,202103,2021),('2021-03-25',202112,3,2021,25,12,202103,2021),('2021-03-26',202112,3,2021,26,12,202103,2021),('2021-03-27',202112,3,2021,27,12,202103,2021),('2021-03-28',202113,3,2021,28,13,202103,2021),('2021-03-29',202113,3,2021,29,13,202103,2021),('2021-03-30',202113,3,2021,30,13,202103,2021),('2021-03-31',202113,3,2021,31,13,202103,2021),('2021-04-01',202113,4,2021,1,13,202104,2021),('2021-04-02',202113,4,2021,2,13,202104,2021),('2021-04-03',202113,4,2021,3,13,202104,2021),('2021-04-04',202114,4,2021,4,14,202104,2021),('2021-04-05',202114,4,2021,5,14,202104,2021),('2021-04-06',202114,4,2021,6,14,202104,2021),('2021-04-07',202114,4,2021,7,14,202104,2021),('2021-04-08',202114,4,2021,8,14,202104,2021),('2021-04-09',202114,4,2021,9,14,202104,2021),('2021-04-10',202114,4,2021,10,14,202104,2021),('2021-04-11',202115,4,2021,11,15,202104,2021),('2021-04-12',202115,4,2021,12,15,202104,2021),('2021-04-13',202115,4,2021,13,15,202104,2021),('2021-04-14',202115,4,2021,14,15,202104,2021),('2021-04-15',202115,4,2021,15,15,202104,2021),('2021-04-16',202115,4,2021,16,15,202104,2021),('2021-04-17',202115,4,2021,17,15,202104,2021),('2021-04-18',202116,4,2021,18,16,202104,2021),('2021-04-19',202116,4,2021,19,16,202104,2021),('2021-04-20',202116,4,2021,20,16,202104,2021),('2021-04-21',202116,4,2021,21,16,202104,2021),('2021-04-22',202116,4,2021,22,16,202104,2021),('2021-04-23',202116,4,2021,23,16,202104,2021),('2021-04-24',202116,4,2021,24,16,202104,2021),('2021-04-25',202117,4,2021,25,17,202104,2021),('2021-04-26',202117,4,2021,26,17,202104,2021),('2021-04-27',202117,4,2021,27,17,202104,2021),('2021-04-28',202117,4,2021,28,17,202104,2021),('2021-04-29',202117,4,2021,29,17,202104,2021),('2021-04-30',202117,4,2021,30,17,202104,2021),('2021-05-01',202117,5,2021,1,17,202105,2021),('2021-05-02',202118,5,2021,2,18,202105,2021),('2021-05-03',202118,5,2021,3,18,202105,2021),('2021-05-04',202118,5,2021,4,18,202105,2021),('2021-05-05',202118,5,2021,5,18,202105,2021),('2021-05-06',202118,5,2021,6,18,202105,2021),('2021-05-07',202118,5,2021,7,18,202105,2021),('2021-05-08',202118,5,2021,8,18,202105,2021),('2021-05-09',202119,5,2021,9,19,202105,2021),('2021-05-10',202119,5,2021,10,19,202105,2021),('2021-05-11',202119,5,2021,11,19,202105,2021),('2021-05-12',202119,5,2021,12,19,202105,2021),('2021-05-13',202119,5,2021,13,19,202105,2021),('2021-05-14',202119,5,2021,14,19,202105,2021),('2021-05-15',202119,5,2021,15,19,202105,2021),('2021-05-16',202120,5,2021,16,20,202105,2021),('2021-05-17',202120,5,2021,17,20,202105,2021),('2021-05-18',202120,5,2021,18,20,202105,2021),('2021-05-19',202120,5,2021,19,20,202105,2021),('2021-05-20',202120,5,2021,20,20,202105,2021),('2021-05-21',202120,5,2021,21,20,202105,2021),('2021-05-22',202120,5,2021,22,20,202105,2021),('2021-05-23',202121,5,2021,23,21,202105,2021),('2021-05-24',202121,5,2021,24,21,202105,2021),('2021-05-25',202121,5,2021,25,21,202105,2021),('2021-05-26',202121,5,2021,26,21,202105,2021),('2021-05-27',202121,5,2021,27,21,202105,2021),('2021-05-28',202121,5,2021,28,21,202105,2021),('2021-05-29',202121,5,2021,29,21,202105,2021),('2021-05-30',202122,5,2021,30,22,202105,2021),('2021-05-31',202122,5,2021,31,22,202105,2021),('2021-06-01',202122,6,2021,1,22,202106,2021),('2021-06-02',202122,6,2021,2,22,202106,2021),('2021-06-03',202122,6,2021,3,22,202106,2021),('2021-06-04',202122,6,2021,4,22,202106,2021),('2021-06-05',202122,6,2021,5,22,202106,2021),('2021-06-06',202123,6,2021,6,23,202106,2021),('2021-06-07',202123,6,2021,7,23,202106,2021),('2021-06-08',202123,6,2021,8,23,202106,2021),('2021-06-09',202123,6,2021,9,23,202106,2021),('2021-06-10',202123,6,2021,10,23,202106,2021),('2021-06-11',202123,6,2021,11,23,202106,2021),('2021-06-12',202123,6,2021,12,23,202106,2021),('2021-06-13',202124,6,2021,13,24,202106,2021),('2021-06-14',202124,6,2021,14,24,202106,2021),('2021-06-15',202124,6,2021,15,24,202106,2021),('2021-06-16',202124,6,2021,16,24,202106,2021),('2021-06-17',202124,6,2021,17,24,202106,2021),('2021-06-18',202124,6,2021,18,24,202106,2021),('2021-06-19',202124,6,2021,19,24,202106,2021),('2021-06-20',202125,6,2021,20,25,202106,2021),('2021-06-21',202125,6,2021,21,25,202106,2021),('2021-06-22',202125,6,2021,22,25,202106,2021),('2021-06-23',202125,6,2021,23,25,202106,2021),('2021-06-24',202125,6,2021,24,25,202106,2021),('2021-06-25',202125,6,2021,25,25,202106,2021),('2021-06-26',202125,6,2021,26,25,202106,2021),('2021-06-27',202126,6,2021,27,26,202106,2021),('2021-06-28',202126,6,2021,28,26,202106,2021),('2021-06-29',202126,6,2021,29,26,202106,2021),('2021-06-30',202126,6,2021,30,26,202106,2021),('2021-07-01',202126,7,2021,1,26,202107,2021),('2021-07-02',202126,7,2021,2,26,202107,2021),('2021-07-03',202126,7,2021,3,26,202107,2021),('2021-07-04',202127,7,2021,4,27,202107,2021),('2021-07-05',202127,7,2021,5,27,202107,2021),('2021-07-06',202127,7,2021,6,27,202107,2021),('2021-07-07',202127,7,2021,7,27,202107,2021),('2021-07-08',202127,7,2021,8,27,202107,2021),('2021-07-09',202127,7,2021,9,27,202107,2021),('2021-07-10',202127,7,2021,10,27,202107,2021),('2021-07-11',202128,7,2021,11,28,202107,2021),('2021-07-12',202128,7,2021,12,28,202107,2021),('2021-07-13',202128,7,2021,13,28,202107,2021),('2021-07-14',202128,7,2021,14,28,202107,2021),('2021-07-15',202128,7,2021,15,28,202107,2021),('2021-07-16',202128,7,2021,16,28,202107,2021),('2021-07-17',202128,7,2021,17,28,202107,2021),('2021-07-18',202129,7,2021,18,29,202107,2021),('2021-07-19',202129,7,2021,19,29,202107,2021),('2021-07-20',202129,7,2021,20,29,202107,2021),('2021-07-21',202129,7,2021,21,29,202107,2021),('2021-07-22',202129,7,2021,22,29,202107,2021),('2021-07-23',202129,7,2021,23,29,202107,2021),('2021-07-24',202129,7,2021,24,29,202107,2021),('2021-07-25',202130,7,2021,25,30,202107,2021),('2021-07-26',202130,7,2021,26,30,202107,2021),('2021-07-27',202130,7,2021,27,30,202107,2021),('2021-07-28',202130,7,2021,28,30,202107,2021),('2021-07-29',202130,7,2021,29,30,202107,2021),('2021-07-30',202130,7,2021,30,30,202107,2021),('2021-07-31',202130,7,2021,31,30,202107,2021),('2021-08-01',202131,8,2021,1,31,202108,2021),('2021-08-02',202131,8,2021,2,31,202108,2021),('2021-08-03',202131,8,2021,3,31,202108,2021),('2021-08-04',202131,8,2021,4,31,202108,2021),('2021-08-05',202131,8,2021,5,31,202108,2021),('2021-08-06',202131,8,2021,6,31,202108,2021),('2021-08-07',202131,8,2021,7,31,202108,2021),('2021-08-08',202132,8,2021,8,32,202108,2021),('2021-08-09',202132,8,2021,9,32,202108,2021),('2021-08-10',202132,8,2021,10,32,202108,2021),('2021-08-11',202132,8,2021,11,32,202108,2021),('2021-08-12',202132,8,2021,12,32,202108,2021),('2021-08-13',202132,8,2021,13,32,202108,2021),('2021-08-14',202132,8,2021,14,32,202108,2021),('2021-08-15',202133,8,2021,15,33,202108,2021),('2021-08-16',202133,8,2021,16,33,202108,2021),('2021-08-17',202133,8,2021,17,33,202108,2021),('2021-08-18',202133,8,2021,18,33,202108,2021),('2021-08-19',202133,8,2021,19,33,202108,2021),('2021-08-20',202133,8,2021,20,33,202108,2021),('2021-08-21',202133,8,2021,21,33,202108,2021),('2021-08-22',202134,8,2021,22,34,202108,2021),('2021-08-23',202134,8,2021,23,34,202108,2021),('2021-08-24',202134,8,2021,24,34,202108,2021),('2021-08-25',202134,8,2021,25,34,202108,2021),('2021-08-26',202134,8,2021,26,34,202108,2021),('2021-08-27',202134,8,2021,27,34,202108,2021),('2021-08-28',202134,8,2021,28,34,202108,2021),('2021-08-29',202135,8,2021,29,35,202108,2021),('2021-08-30',202135,8,2021,30,35,202108,2021),('2021-08-31',202135,8,2021,31,35,202108,2021),('2021-09-01',202135,9,2021,1,35,202109,2021),('2021-09-02',202135,9,2021,2,35,202109,2021),('2021-09-03',202135,9,2021,3,35,202109,2021),('2021-09-04',202135,9,2021,4,35,202109,2021),('2021-09-05',202136,9,2021,5,36,202109,2021),('2021-09-06',202136,9,2021,6,36,202109,2021),('2021-09-07',202136,9,2021,7,36,202109,2021),('2021-09-08',202136,9,2021,8,36,202109,2021),('2021-09-09',202136,9,2021,9,36,202109,2021),('2021-09-10',202136,9,2021,10,36,202109,2021),('2021-09-11',202136,9,2021,11,36,202109,2021),('2021-09-12',202137,9,2021,12,37,202109,2021),('2021-09-13',202137,9,2021,13,37,202109,2021),('2021-09-14',202137,9,2021,14,37,202109,2021),('2021-09-15',202137,9,2021,15,37,202109,2021),('2021-09-16',202137,9,2021,16,37,202109,2021),('2021-09-17',202137,9,2021,17,37,202109,2021),('2021-09-18',202137,9,2021,18,37,202109,2021),('2021-09-19',202138,9,2021,19,38,202109,2021),('2021-09-20',202138,9,2021,20,38,202109,2021),('2021-09-21',202138,9,2021,21,38,202109,2021),('2021-09-22',202138,9,2021,22,38,202109,2021),('2021-09-23',202138,9,2021,23,38,202109,2021),('2021-09-24',202138,9,2021,24,38,202109,2021),('2021-09-25',202138,9,2021,25,38,202109,2021),('2021-09-26',202139,9,2021,26,39,202109,2021),('2021-09-27',202139,9,2021,27,39,202109,2021),('2021-09-28',202139,9,2021,28,39,202109,2021),('2021-09-29',202139,9,2021,29,39,202109,2021),('2021-09-30',202139,9,2021,30,39,202109,2021),('2021-10-01',202139,10,2021,1,39,202110,2021),('2021-10-02',202139,10,2021,2,39,202110,2021),('2021-10-03',202140,10,2021,3,40,202110,2021),('2021-10-04',202140,10,2021,4,40,202110,2021),('2021-10-05',202140,10,2021,5,40,202110,2021),('2021-10-06',202140,10,2021,6,40,202110,2021),('2021-10-07',202140,10,2021,7,40,202110,2021),('2021-10-08',202140,10,2021,8,40,202110,2021),('2021-10-09',202140,10,2021,9,40,202110,2021),('2021-10-10',202141,10,2021,10,41,202110,2021),('2021-10-11',202141,10,2021,11,41,202110,2021),('2021-10-12',202141,10,2021,12,41,202110,2021),('2021-10-13',202141,10,2021,13,41,202110,2021),('2021-10-14',202141,10,2021,14,41,202110,2021),('2021-10-15',202141,10,2021,15,41,202110,2021),('2021-10-16',202141,10,2021,16,41,202110,2021),('2021-10-17',202142,10,2021,17,42,202110,2021),('2021-10-18',202142,10,2021,18,42,202110,2021),('2021-10-19',202142,10,2021,19,42,202110,2021),('2021-10-20',202142,10,2021,20,42,202110,2021),('2021-10-21',202142,10,2021,21,42,202110,2021),('2021-10-22',202142,10,2021,22,42,202110,2021),('2021-10-23',202142,10,2021,23,42,202110,2021),('2021-10-24',202143,10,2021,24,43,202110,2021),('2021-10-25',202143,10,2021,25,43,202110,2021),('2021-10-26',202143,10,2021,26,43,202110,2021),('2021-10-27',202143,10,2021,27,43,202110,2021),('2021-10-28',202143,10,2021,28,43,202110,2021),('2021-10-29',202143,10,2021,29,43,202110,2021),('2021-10-30',202143,10,2021,30,43,202110,2021),('2021-10-31',202144,10,2021,31,44,202110,2021),('2021-11-01',202144,11,2021,1,44,202111,2021),('2021-11-02',202144,11,2021,2,44,202111,2021),('2021-11-03',202144,11,2021,3,44,202111,2021),('2021-11-04',202144,11,2021,4,44,202111,2021),('2021-11-05',202144,11,2021,5,44,202111,2021),('2021-11-06',202144,11,2021,6,44,202111,2021),('2021-11-07',202145,11,2021,7,45,202111,2021),('2021-11-08',202145,11,2021,8,45,202111,2021),('2021-11-09',202145,11,2021,9,45,202111,2021),('2021-11-10',202145,11,2021,10,45,202111,2021),('2021-11-11',202145,11,2021,11,45,202111,2021),('2021-11-12',202145,11,2021,12,45,202111,2021),('2021-11-13',202145,11,2021,13,45,202111,2021),('2021-11-14',202146,11,2021,14,46,202111,2021),('2021-11-15',202146,11,2021,15,46,202111,2021),('2021-11-16',202146,11,2021,16,46,202111,2021),('2021-11-17',202146,11,2021,17,46,202111,2021),('2021-11-18',202146,11,2021,18,46,202111,2021),('2021-11-19',202146,11,2021,19,46,202111,2021),('2021-11-20',202146,11,2021,20,46,202111,2021),('2021-11-21',202147,11,2021,21,47,202111,2021),('2021-11-22',202147,11,2021,22,47,202111,2021),('2021-11-23',202147,11,2021,23,47,202111,2021),('2021-11-24',202147,11,2021,24,47,202111,2021),('2021-11-25',202147,11,2021,25,47,202111,2021),('2021-11-26',202147,11,2021,26,47,202111,2021),('2021-11-27',202147,11,2021,27,47,202111,2021),('2021-11-28',202148,11,2021,28,48,202111,2021),('2021-11-29',202148,11,2021,29,48,202111,2021),('2021-11-30',202148,11,2021,30,48,202111,2021),('2021-12-01',202148,12,2021,1,48,202112,2022),('2021-12-02',202148,12,2021,2,48,202112,2022),('2021-12-03',202148,12,2021,3,48,202112,2022),('2021-12-04',202148,12,2021,4,48,202112,2022),('2021-12-05',202149,12,2021,5,49,202112,2022),('2021-12-06',202149,12,2021,6,49,202112,2022),('2021-12-07',202149,12,2021,7,49,202112,2022),('2021-12-08',202149,12,2021,8,49,202112,2022),('2021-12-09',202149,12,2021,9,49,202112,2022),('2021-12-10',202149,12,2021,10,49,202112,2022),('2021-12-11',202149,12,2021,11,49,202112,2022),('2021-12-12',202150,12,2021,12,50,202112,2022),('2021-12-13',202150,12,2021,13,50,202112,2022),('2021-12-14',202150,12,2021,14,50,202112,2022),('2021-12-15',202150,12,2021,15,50,202112,2022),('2021-12-16',202150,12,2021,16,50,202112,2022),('2021-12-17',202150,12,2021,17,50,202112,2022),('2021-12-18',202150,12,2021,18,50,202112,2022),('2021-12-19',202151,12,2021,19,51,202112,2022),('2021-12-20',202151,12,2021,20,51,202112,2022),('2021-12-21',202151,12,2021,21,51,202112,2022),('2021-12-22',202151,12,2021,22,51,202112,2022),('2021-12-23',202151,12,2021,23,51,202112,2022),('2021-12-24',202151,12,2021,24,51,202112,2022),('2021-12-25',202151,12,2021,25,51,202112,2022),('2021-12-26',202152,12,2021,26,52,202112,2022),('2021-12-27',202152,12,2021,27,52,202112,2022),('2021-12-28',202152,12,2021,28,52,202112,2022),('2021-12-29',202152,12,2021,29,52,202112,2022),('2021-12-30',202152,12,2021,30,52,202112,2022),('2021-12-31',202152,12,2021,31,52,202112,2022),('2022-01-01',202152,1,2022,1,52,202201,2022),('2022-01-02',202201,1,2022,2,1,202201,2022),('2022-01-03',202201,1,2022,3,1,202201,2022),('2022-01-04',202201,1,2022,4,1,202201,2022),('2022-01-05',202201,1,2022,5,1,202201,2022),('2022-01-06',202201,1,2022,6,1,202201,2022),('2022-01-07',202201,1,2022,7,1,202201,2022),('2022-01-08',202201,1,2022,8,1,202201,2022),('2022-01-09',202202,1,2022,9,2,202201,2022),('2022-01-10',202202,1,2022,10,2,202201,2022),('2022-01-11',202202,1,2022,11,2,202201,2022),('2022-01-12',202202,1,2022,12,2,202201,2022),('2022-01-13',202202,1,2022,13,2,202201,2022),('2022-01-14',202202,1,2022,14,2,202201,2022),('2022-01-15',202202,1,2022,15,2,202201,2022),('2022-01-16',202203,1,2022,16,3,202201,2022),('2022-01-17',202203,1,2022,17,3,202201,2022),('2022-01-18',202203,1,2022,18,3,202201,2022),('2022-01-19',202203,1,2022,19,3,202201,2022),('2022-01-20',202203,1,2022,20,3,202201,2022),('2022-01-21',202203,1,2022,21,3,202201,2022),('2022-01-22',202203,1,2022,22,3,202201,2022),('2022-01-23',202204,1,2022,23,4,202201,2022),('2022-01-24',202204,1,2022,24,4,202201,2022),('2022-01-25',202204,1,2022,25,4,202201,2022),('2022-01-26',202204,1,2022,26,4,202201,2022),('2022-01-27',202204,1,2022,27,4,202201,2022),('2022-01-28',202204,1,2022,28,4,202201,2022),('2022-01-29',202204,1,2022,29,4,202201,2022),('2022-01-30',202205,1,2022,30,5,202201,2022),('2022-01-31',202205,1,2022,31,5,202201,2022),('2022-02-01',202205,2,2022,1,5,202202,2022),('2022-02-02',202205,2,2022,2,5,202202,2022),('2022-02-03',202205,2,2022,3,5,202202,2022),('2022-02-04',202205,2,2022,4,5,202202,2022),('2022-02-05',202205,2,2022,5,5,202202,2022),('2022-02-06',202206,2,2022,6,6,202202,2022),('2022-02-07',202206,2,2022,7,6,202202,2022),('2022-02-08',202206,2,2022,8,6,202202,2022),('2022-02-09',202206,2,2022,9,6,202202,2022),('2022-02-10',202206,2,2022,10,6,202202,2022),('2022-02-11',202206,2,2022,11,6,202202,2022),('2022-02-12',202206,2,2022,12,6,202202,2022),('2022-02-13',202207,2,2022,13,7,202202,2022),('2022-02-14',202207,2,2022,14,7,202202,2022),('2022-02-15',202207,2,2022,15,7,202202,2022),('2022-02-16',202207,2,2022,16,7,202202,2022),('2022-02-17',202207,2,2022,17,7,202202,2022),('2022-02-18',202207,2,2022,18,7,202202,2022),('2022-02-19',202207,2,2022,19,7,202202,2022),('2022-02-20',202208,2,2022,20,8,202202,2022),('2022-02-21',202208,2,2022,21,8,202202,2022),('2022-02-22',202208,2,2022,22,8,202202,2022),('2022-02-23',202208,2,2022,23,8,202202,2022),('2022-02-24',202208,2,2022,24,8,202202,2022),('2022-02-25',202208,2,2022,25,8,202202,2022),('2022-02-26',202208,2,2022,26,8,202202,2022),('2022-02-27',202209,2,2022,27,9,202202,2022),('2022-02-28',202209,2,2022,28,9,202202,2022),('2022-03-01',202209,3,2022,1,9,202203,2022),('2022-03-02',202209,3,2022,2,9,202203,2022),('2022-03-03',202209,3,2022,3,9,202203,2022),('2022-03-04',202209,3,2022,4,9,202203,2022),('2022-03-05',202209,3,2022,5,9,202203,2022),('2022-03-06',202210,3,2022,6,10,202203,2022),('2022-03-07',202210,3,2022,7,10,202203,2022),('2022-03-08',202210,3,2022,8,10,202203,2022),('2022-03-09',202210,3,2022,9,10,202203,2022),('2022-03-10',202210,3,2022,10,10,202203,2022),('2022-03-11',202210,3,2022,11,10,202203,2022),('2022-03-12',202210,3,2022,12,10,202203,2022),('2022-03-13',202211,3,2022,13,11,202203,2022),('2022-03-14',202211,3,2022,14,11,202203,2022),('2022-03-15',202211,3,2022,15,11,202203,2022),('2022-03-16',202211,3,2022,16,11,202203,2022),('2022-03-17',202211,3,2022,17,11,202203,2022),('2022-03-18',202211,3,2022,18,11,202203,2022),('2022-03-19',202211,3,2022,19,11,202203,2022),('2022-03-20',202212,3,2022,20,12,202203,2022),('2022-03-21',202212,3,2022,21,12,202203,2022),('2022-03-22',202212,3,2022,22,12,202203,2022),('2022-03-23',202212,3,2022,23,12,202203,2022),('2022-03-24',202212,3,2022,24,12,202203,2022),('2022-03-25',202212,3,2022,25,12,202203,2022),('2022-03-26',202212,3,2022,26,12,202203,2022),('2022-03-27',202213,3,2022,27,13,202203,2022),('2022-03-28',202213,3,2022,28,13,202203,2022),('2022-03-29',202213,3,2022,29,13,202203,2022),('2022-03-30',202213,3,2022,30,13,202203,2022),('2022-03-31',202213,3,2022,31,13,202203,2022),('2022-04-01',202213,4,2022,1,13,202204,2022),('2022-04-02',202213,4,2022,2,13,202204,2022),('2022-04-03',202214,4,2022,3,14,202204,2022),('2022-04-04',202214,4,2022,4,14,202204,2022),('2022-04-05',202214,4,2022,5,14,202204,2022),('2022-04-06',202214,4,2022,6,14,202204,2022),('2022-04-07',202214,4,2022,7,14,202204,2022),('2022-04-08',202214,4,2022,8,14,202204,2022),('2022-04-09',202214,4,2022,9,14,202204,2022),('2022-04-10',202215,4,2022,10,15,202204,2022),('2022-04-11',202215,4,2022,11,15,202204,2022),('2022-04-12',202215,4,2022,12,15,202204,2022),('2022-04-13',202215,4,2022,13,15,202204,2022),('2022-04-14',202215,4,2022,14,15,202204,2022),('2022-04-15',202215,4,2022,15,15,202204,2022),('2022-04-16',202215,4,2022,16,15,202204,2022),('2022-04-17',202216,4,2022,17,16,202204,2022),('2022-04-18',202216,4,2022,18,16,202204,2022),('2022-04-19',202216,4,2022,19,16,202204,2022),('2022-04-20',202216,4,2022,20,16,202204,2022),('2022-04-21',202216,4,2022,21,16,202204,2022),('2022-04-22',202216,4,2022,22,16,202204,2022),('2022-04-23',202216,4,2022,23,16,202204,2022),('2022-04-24',202217,4,2022,24,17,202204,2022),('2022-04-25',202217,4,2022,25,17,202204,2022),('2022-04-26',202217,4,2022,26,17,202204,2022),('2022-04-27',202217,4,2022,27,17,202204,2022),('2022-04-28',202217,4,2022,28,17,202204,2022),('2022-04-29',202217,4,2022,29,17,202204,2022),('2022-04-30',202217,4,2022,30,17,202204,2022),('2022-05-01',202218,5,2022,1,18,202205,2022),('2022-05-02',202218,5,2022,2,18,202205,2022),('2022-05-03',202218,5,2022,3,18,202205,2022),('2022-05-04',202218,5,2022,4,18,202205,2022),('2022-05-05',202218,5,2022,5,18,202205,2022),('2022-05-06',202218,5,2022,6,18,202205,2022),('2022-05-07',202218,5,2022,7,18,202205,2022),('2022-05-08',202219,5,2022,8,19,202205,2022),('2022-05-09',202219,5,2022,9,19,202205,2022),('2022-05-10',202219,5,2022,10,19,202205,2022),('2022-05-11',202219,5,2022,11,19,202205,2022),('2022-05-12',202219,5,2022,12,19,202205,2022),('2022-05-13',202219,5,2022,13,19,202205,2022),('2022-05-14',202219,5,2022,14,19,202205,2022),('2022-05-15',202220,5,2022,15,20,202205,2022),('2022-05-16',202220,5,2022,16,20,202205,2022),('2022-05-17',202220,5,2022,17,20,202205,2022),('2022-05-18',202220,5,2022,18,20,202205,2022),('2022-05-19',202220,5,2022,19,20,202205,2022),('2022-05-20',202220,5,2022,20,20,202205,2022),('2022-05-21',202220,5,2022,21,20,202205,2022),('2022-05-22',202221,5,2022,22,21,202205,2022),('2022-05-23',202221,5,2022,23,21,202205,2022),('2022-05-24',202221,5,2022,24,21,202205,2022),('2022-05-25',202221,5,2022,25,21,202205,2022),('2022-05-26',202221,5,2022,26,21,202205,2022),('2022-05-27',202221,5,2022,27,21,202205,2022),('2022-05-28',202221,5,2022,28,21,202205,2022),('2022-05-29',202222,5,2022,29,22,202205,2022),('2022-05-30',202222,5,2022,30,22,202205,2022),('2022-05-31',202222,5,2022,31,22,202205,2022),('2022-06-01',202222,6,2022,1,22,202206,2022),('2022-06-02',202222,6,2022,2,22,202206,2022),('2022-06-03',202222,6,2022,3,22,202206,2022),('2022-06-04',202222,6,2022,4,22,202206,2022),('2022-06-05',202223,6,2022,5,23,202206,2022),('2022-06-06',202223,6,2022,6,23,202206,2022),('2022-06-07',202223,6,2022,7,23,202206,2022),('2022-06-08',202223,6,2022,8,23,202206,2022),('2022-06-09',202223,6,2022,9,23,202206,2022),('2022-06-10',202223,6,2022,10,23,202206,2022),('2022-06-11',202223,6,2022,11,23,202206,2022),('2022-06-12',202224,6,2022,12,24,202206,2022),('2022-06-13',202224,6,2022,13,24,202206,2022),('2022-06-14',202224,6,2022,14,24,202206,2022),('2022-06-15',202224,6,2022,15,24,202206,2022),('2022-06-16',202224,6,2022,16,24,202206,2022),('2022-06-17',202224,6,2022,17,24,202206,2022),('2022-06-18',202224,6,2022,18,24,202206,2022),('2022-06-19',202225,6,2022,19,25,202206,2022),('2022-06-20',202225,6,2022,20,25,202206,2022),('2022-06-21',202225,6,2022,21,25,202206,2022),('2022-06-22',202225,6,2022,22,25,202206,2022),('2022-06-23',202225,6,2022,23,25,202206,2022),('2022-06-24',202225,6,2022,24,25,202206,2022),('2022-06-25',202225,6,2022,25,25,202206,2022),('2022-06-26',202226,6,2022,26,26,202206,2022),('2022-06-27',202226,6,2022,27,26,202206,2022),('2022-06-28',202226,6,2022,28,26,202206,2022),('2022-06-29',202226,6,2022,29,26,202206,2022),('2022-06-30',202226,6,2022,30,26,202206,2022),('2022-07-01',202226,7,2022,1,26,202207,2022),('2022-07-02',202226,7,2022,2,26,202207,2022),('2022-07-03',202227,7,2022,3,27,202207,2022),('2022-07-04',202227,7,2022,4,27,202207,2022),('2022-07-05',202227,7,2022,5,27,202207,2022),('2022-07-06',202227,7,2022,6,27,202207,2022),('2022-07-07',202227,7,2022,7,27,202207,2022),('2022-07-08',202227,7,2022,8,27,202207,2022),('2022-07-09',202227,7,2022,9,27,202207,2022),('2022-07-10',202228,7,2022,10,28,202207,2022),('2022-07-11',202228,7,2022,11,28,202207,2022),('2022-07-12',202228,7,2022,12,28,202207,2022),('2022-07-13',202228,7,2022,13,28,202207,2022),('2022-07-14',202228,7,2022,14,28,202207,2022),('2022-07-15',202228,7,2022,15,28,202207,2022),('2022-07-16',202228,7,2022,16,28,202207,2022),('2022-07-17',202229,7,2022,17,29,202207,2022),('2022-07-18',202229,7,2022,18,29,202207,2022),('2022-07-19',202229,7,2022,19,29,202207,2022),('2022-07-20',202229,7,2022,20,29,202207,2022),('2022-07-21',202229,7,2022,21,29,202207,2022),('2022-07-22',202229,7,2022,22,29,202207,2022),('2022-07-23',202229,7,2022,23,29,202207,2022),('2022-07-24',202230,7,2022,24,30,202207,2022),('2022-07-25',202230,7,2022,25,30,202207,2022),('2022-07-26',202230,7,2022,26,30,202207,2022),('2022-07-27',202230,7,2022,27,30,202207,2022),('2022-07-28',202230,7,2022,28,30,202207,2022),('2022-07-29',202230,7,2022,29,30,202207,2022),('2022-07-30',202230,7,2022,30,30,202207,2022),('2022-07-31',202231,7,2022,31,31,202207,2022),('2022-08-01',202231,8,2022,1,31,202208,2022),('2022-08-02',202231,8,2022,2,31,202208,2022),('2022-08-03',202231,8,2022,3,31,202208,2022),('2022-08-04',202231,8,2022,4,31,202208,2022),('2022-08-05',202231,8,2022,5,31,202208,2022),('2022-08-06',202231,8,2022,6,31,202208,2022),('2022-08-07',202232,8,2022,7,32,202208,2022),('2022-08-08',202232,8,2022,8,32,202208,2022),('2022-08-09',202232,8,2022,9,32,202208,2022),('2022-08-10',202232,8,2022,10,32,202208,2022),('2022-08-11',202232,8,2022,11,32,202208,2022),('2022-08-12',202232,8,2022,12,32,202208,2022),('2022-08-13',202232,8,2022,13,32,202208,2022),('2022-08-14',202233,8,2022,14,33,202208,2022),('2022-08-15',202233,8,2022,15,33,202208,2022),('2022-08-16',202233,8,2022,16,33,202208,2022),('2022-08-17',202233,8,2022,17,33,202208,2022),('2022-08-18',202233,8,2022,18,33,202208,2022),('2022-08-19',202233,8,2022,19,33,202208,2022),('2022-08-20',202233,8,2022,20,33,202208,2022),('2022-08-21',202234,8,2022,21,34,202208,2022),('2022-08-22',202234,8,2022,22,34,202208,2022),('2022-08-23',202234,8,2022,23,34,202208,2022),('2022-08-24',202234,8,2022,24,34,202208,2022),('2022-08-25',202234,8,2022,25,34,202208,2022),('2022-08-26',202234,8,2022,26,34,202208,2022),('2022-08-27',202234,8,2022,27,34,202208,2022),('2022-08-28',202235,8,2022,28,35,202208,2022),('2022-08-29',202235,8,2022,29,35,202208,2022),('2022-08-30',202235,8,2022,30,35,202208,2022),('2022-08-31',202235,8,2022,31,35,202208,2022),('2022-09-01',202235,9,2022,1,35,202209,2022),('2022-09-02',202235,9,2022,2,35,202209,2022),('2022-09-03',202235,9,2022,3,35,202209,2022),('2022-09-04',202236,9,2022,4,36,202209,2022),('2022-09-05',202236,9,2022,5,36,202209,2022),('2022-09-06',202236,9,2022,6,36,202209,2022),('2022-09-07',202236,9,2022,7,36,202209,2022),('2022-09-08',202236,9,2022,8,36,202209,2022),('2022-09-09',202236,9,2022,9,36,202209,2022),('2022-09-10',202236,9,2022,10,36,202209,2022),('2022-09-11',202237,9,2022,11,37,202209,2022),('2022-09-12',202237,9,2022,12,37,202209,2022),('2022-09-13',202237,9,2022,13,37,202209,2022),('2022-09-14',202237,9,2022,14,37,202209,2022),('2022-09-15',202237,9,2022,15,37,202209,2022),('2022-09-16',202237,9,2022,16,37,202209,2022),('2022-09-17',202237,9,2022,17,37,202209,2022),('2022-09-18',202238,9,2022,18,38,202209,2022),('2022-09-19',202238,9,2022,19,38,202209,2022),('2022-09-20',202238,9,2022,20,38,202209,2022),('2022-09-21',202238,9,2022,21,38,202209,2022),('2022-09-22',202238,9,2022,22,38,202209,2022),('2022-09-23',202238,9,2022,23,38,202209,2022),('2022-09-24',202238,9,2022,24,38,202209,2022),('2022-09-25',202239,9,2022,25,39,202209,2022),('2022-09-26',202239,9,2022,26,39,202209,2022),('2022-09-27',202239,9,2022,27,39,202209,2022),('2022-09-28',202239,9,2022,28,39,202209,2022),('2022-09-29',202239,9,2022,29,39,202209,2022),('2022-09-30',202239,9,2022,30,39,202209,2022),('2022-10-01',202239,10,2022,1,39,202210,2022),('2022-10-02',202240,10,2022,2,40,202210,2022),('2022-10-03',202240,10,2022,3,40,202210,2022),('2022-10-04',202240,10,2022,4,40,202210,2022),('2022-10-05',202240,10,2022,5,40,202210,2022),('2022-10-06',202240,10,2022,6,40,202210,2022),('2022-10-07',202240,10,2022,7,40,202210,2022),('2022-10-08',202240,10,2022,8,40,202210,2022),('2022-10-09',202241,10,2022,9,41,202210,2022),('2022-10-10',202241,10,2022,10,41,202210,2022),('2022-10-11',202241,10,2022,11,41,202210,2022),('2022-10-12',202241,10,2022,12,41,202210,2022),('2022-10-13',202241,10,2022,13,41,202210,2022),('2022-10-14',202241,10,2022,14,41,202210,2022),('2022-10-15',202241,10,2022,15,41,202210,2022),('2022-10-16',202242,10,2022,16,42,202210,2022),('2022-10-17',202242,10,2022,17,42,202210,2022),('2022-10-18',202242,10,2022,18,42,202210,2022),('2022-10-19',202242,10,2022,19,42,202210,2022),('2022-10-20',202242,10,2022,20,42,202210,2022),('2022-10-21',202242,10,2022,21,42,202210,2022),('2022-10-22',202242,10,2022,22,42,202210,2022),('2022-10-23',202243,10,2022,23,43,202210,2022),('2022-10-24',202243,10,2022,24,43,202210,2022),('2022-10-25',202243,10,2022,25,43,202210,2022),('2022-10-26',202243,10,2022,26,43,202210,2022),('2022-10-27',202243,10,2022,27,43,202210,2022),('2022-10-28',202243,10,2022,28,43,202210,2022),('2022-10-29',202243,10,2022,29,43,202210,2022),('2022-10-30',202244,10,2022,30,44,202210,2022),('2022-10-31',202244,10,2022,31,44,202210,2022),('2022-11-01',202244,11,2022,1,44,202211,2022),('2022-11-02',202244,11,2022,2,44,202211,2022),('2022-11-03',202244,11,2022,3,44,202211,2022),('2022-11-04',202244,11,2022,4,44,202211,2022),('2022-11-05',202244,11,2022,5,44,202211,2022),('2022-11-06',202245,11,2022,6,45,202211,2022),('2022-11-07',202245,11,2022,7,45,202211,2022),('2022-11-08',202245,11,2022,8,45,202211,2022),('2022-11-09',202245,11,2022,9,45,202211,2022),('2022-11-10',202245,11,2022,10,45,202211,2022),('2022-11-11',202245,11,2022,11,45,202211,2022),('2022-11-12',202245,11,2022,12,45,202211,2022),('2022-11-13',202246,11,2022,13,46,202211,2022),('2022-11-14',202246,11,2022,14,46,202211,2022),('2022-11-15',202246,11,2022,15,46,202211,2022),('2022-11-16',202246,11,2022,16,46,202211,2022),('2022-11-17',202246,11,2022,17,46,202211,2022),('2022-11-18',202246,11,2022,18,46,202211,2022),('2022-11-19',202246,11,2022,19,46,202211,2022),('2022-11-20',202247,11,2022,20,47,202211,2022),('2022-11-21',202247,11,2022,21,47,202211,2022),('2022-11-22',202247,11,2022,22,47,202211,2022),('2022-11-23',202247,11,2022,23,47,202211,2022),('2022-11-24',202247,11,2022,24,47,202211,2022),('2022-11-25',202247,11,2022,25,47,202211,2022),('2022-11-26',202247,11,2022,26,47,202211,2022),('2022-11-27',202248,11,2022,27,48,202211,2022),('2022-11-28',202248,11,2022,28,48,202211,2022),('2022-11-29',202248,11,2022,29,48,202211,2022),('2022-11-30',202248,11,2022,30,48,202211,2022),('2022-12-01',202248,12,2022,1,48,202212,2023),('2022-12-02',202248,12,2022,2,48,202212,2023),('2022-12-03',202248,12,2022,3,48,202212,2023),('2022-12-04',202249,12,2022,4,49,202212,2023),('2022-12-05',202249,12,2022,5,49,202212,2023),('2022-12-06',202249,12,2022,6,49,202212,2023),('2022-12-07',202249,12,2022,7,49,202212,2023),('2022-12-08',202249,12,2022,8,49,202212,2023),('2022-12-09',202249,12,2022,9,49,202212,2023),('2022-12-10',202249,12,2022,10,49,202212,2023),('2022-12-11',202250,12,2022,11,50,202212,2023),('2022-12-12',202250,12,2022,12,50,202212,2023),('2022-12-13',202250,12,2022,13,50,202212,2023),('2022-12-14',202250,12,2022,14,50,202212,2023),('2022-12-15',202250,12,2022,15,50,202212,2023),('2022-12-16',202250,12,2022,16,50,202212,2023),('2022-12-17',202250,12,2022,17,50,202212,2023),('2022-12-18',202251,12,2022,18,51,202212,2023),('2022-12-19',202251,12,2022,19,51,202212,2023),('2022-12-20',202251,12,2022,20,51,202212,2023),('2022-12-21',202251,12,2022,21,51,202212,2023),('2022-12-22',202251,12,2022,22,51,202212,2023),('2022-12-23',202251,12,2022,23,51,202212,2023),('2022-12-24',202251,12,2022,24,51,202212,2023),('2022-12-25',202252,12,2022,25,52,202212,2023),('2022-12-26',202252,12,2022,26,52,202212,2023),('2022-12-27',202252,12,2022,27,52,202212,2023),('2022-12-28',202252,12,2022,28,52,202212,2023),('2022-12-29',202252,12,2022,29,52,202212,2023),('2022-12-30',202252,12,2022,30,52,202212,2023),('2022-12-31',202252,12,2022,31,52,202212,2023),('2023-01-01',202301,1,2023,1,1,202301,2023),('2023-01-02',202301,1,2023,2,1,202301,2023),('2023-01-03',202301,1,2023,3,1,202301,2023),('2023-01-04',202301,1,2023,4,1,202301,2023),('2023-01-05',202301,1,2023,5,1,202301,2023),('2023-01-06',202301,1,2023,6,1,202301,2023),('2023-01-07',202301,1,2023,7,1,202301,2023),('2023-01-08',202302,1,2023,8,2,202301,2023),('2023-01-09',202302,1,2023,9,2,202301,2023),('2023-01-10',202302,1,2023,10,2,202301,2023),('2023-01-11',202302,1,2023,11,2,202301,2023),('2023-01-12',202302,1,2023,12,2,202301,2023),('2023-01-13',202302,1,2023,13,2,202301,2023),('2023-01-14',202302,1,2023,14,2,202301,2023),('2023-01-15',202303,1,2023,15,3,202301,2023),('2023-01-16',202303,1,2023,16,3,202301,2023),('2023-01-17',202303,1,2023,17,3,202301,2023),('2023-01-18',202303,1,2023,18,3,202301,2023),('2023-01-19',202303,1,2023,19,3,202301,2023),('2023-01-20',202303,1,2023,20,3,202301,2023),('2023-01-21',202303,1,2023,21,3,202301,2023),('2023-01-22',202304,1,2023,22,4,202301,2023),('2023-01-23',202304,1,2023,23,4,202301,2023),('2023-01-24',202304,1,2023,24,4,202301,2023),('2023-01-25',202304,1,2023,25,4,202301,2023),('2023-01-26',202304,1,2023,26,4,202301,2023),('2023-01-27',202304,1,2023,27,4,202301,2023),('2023-01-28',202304,1,2023,28,4,202301,2023),('2023-01-29',202305,1,2023,29,5,202301,2023),('2023-01-30',202305,1,2023,30,5,202301,2023),('2023-01-31',202305,1,2023,31,5,202301,2023),('2023-02-01',202305,2,2023,1,5,202302,2023),('2023-02-02',202305,2,2023,2,5,202302,2023),('2023-02-03',202305,2,2023,3,5,202302,2023),('2023-02-04',202305,2,2023,4,5,202302,2023),('2023-02-05',202306,2,2023,5,6,202302,2023),('2023-02-06',202306,2,2023,6,6,202302,2023),('2023-02-07',202306,2,2023,7,6,202302,2023),('2023-02-08',202306,2,2023,8,6,202302,2023),('2023-02-09',202306,2,2023,9,6,202302,2023),('2023-02-10',202306,2,2023,10,6,202302,2023),('2023-02-11',202306,2,2023,11,6,202302,2023),('2023-02-12',202307,2,2023,12,7,202302,2023),('2023-02-13',202307,2,2023,13,7,202302,2023),('2023-02-14',202307,2,2023,14,7,202302,2023),('2023-02-15',202307,2,2023,15,7,202302,2023),('2023-02-16',202307,2,2023,16,7,202302,2023),('2023-02-17',202307,2,2023,17,7,202302,2023),('2023-02-18',202307,2,2023,18,7,202302,2023),('2023-02-19',202308,2,2023,19,8,202302,2023),('2023-02-20',202308,2,2023,20,8,202302,2023),('2023-02-21',202308,2,2023,21,8,202302,2023),('2023-02-22',202308,2,2023,22,8,202302,2023),('2023-02-23',202308,2,2023,23,8,202302,2023),('2023-02-24',202308,2,2023,24,8,202302,2023),('2023-02-25',202308,2,2023,25,8,202302,2023),('2023-02-26',202309,2,2023,26,9,202302,2023),('2023-02-27',202309,2,2023,27,9,202302,2023),('2023-02-28',202309,2,2023,28,9,202302,2023),('2023-03-01',202309,3,2023,1,9,202303,2023),('2023-03-02',202309,3,2023,2,9,202303,2023),('2023-03-03',202309,3,2023,3,9,202303,2023),('2023-03-04',202309,3,2023,4,9,202303,2023),('2023-03-05',202310,3,2023,5,10,202303,2023),('2023-03-06',202310,3,2023,6,10,202303,2023),('2023-03-07',202310,3,2023,7,10,202303,2023),('2023-03-08',202310,3,2023,8,10,202303,2023),('2023-03-09',202310,3,2023,9,10,202303,2023),('2023-03-10',202310,3,2023,10,10,202303,2023),('2023-03-11',202310,3,2023,11,10,202303,2023),('2023-03-12',202311,3,2023,12,11,202303,2023),('2023-03-13',202311,3,2023,13,11,202303,2023),('2023-03-14',202311,3,2023,14,11,202303,2023),('2023-03-15',202311,3,2023,15,11,202303,2023),('2023-03-16',202311,3,2023,16,11,202303,2023),('2023-03-17',202311,3,2023,17,11,202303,2023),('2023-03-18',202311,3,2023,18,11,202303,2023),('2023-03-19',202312,3,2023,19,12,202303,2023),('2023-03-20',202312,3,2023,20,12,202303,2023),('2023-03-21',202312,3,2023,21,12,202303,2023),('2023-03-22',202312,3,2023,22,12,202303,2023),('2023-03-23',202312,3,2023,23,12,202303,2023),('2023-03-24',202312,3,2023,24,12,202303,2023),('2023-03-25',202312,3,2023,25,12,202303,2023),('2023-03-26',202313,3,2023,26,13,202303,2023),('2023-03-27',202313,3,2023,27,13,202303,2023),('2023-03-28',202313,3,2023,28,13,202303,2023),('2023-03-29',202313,3,2023,29,13,202303,2023),('2023-03-30',202313,3,2023,30,13,202303,2023),('2023-03-31',202313,3,2023,31,13,202303,2023),('2023-04-01',202313,4,2023,1,13,202304,2023),('2023-04-02',202314,4,2023,2,14,202304,2023),('2023-04-03',202314,4,2023,3,14,202304,2023),('2023-04-04',202314,4,2023,4,14,202304,2023),('2023-04-05',202314,4,2023,5,14,202304,2023),('2023-04-06',202314,4,2023,6,14,202304,2023),('2023-04-07',202314,4,2023,7,14,202304,2023),('2023-04-08',202314,4,2023,8,14,202304,2023),('2023-04-09',202315,4,2023,9,15,202304,2023),('2023-04-10',202315,4,2023,10,15,202304,2023),('2023-04-11',202315,4,2023,11,15,202304,2023),('2023-04-12',202315,4,2023,12,15,202304,2023),('2023-04-13',202315,4,2023,13,15,202304,2023),('2023-04-14',202315,4,2023,14,15,202304,2023),('2023-04-15',202315,4,2023,15,15,202304,2023),('2023-04-16',202316,4,2023,16,16,202304,2023),('2023-04-17',202316,4,2023,17,16,202304,2023),('2023-04-18',202316,4,2023,18,16,202304,2023),('2023-04-19',202316,4,2023,19,16,202304,2023),('2023-04-20',202316,4,2023,20,16,202304,2023),('2023-04-21',202316,4,2023,21,16,202304,2023),('2023-04-22',202316,4,2023,22,16,202304,2023),('2023-04-23',202317,4,2023,23,17,202304,2023),('2023-04-24',202317,4,2023,24,17,202304,2023),('2023-04-25',202317,4,2023,25,17,202304,2023),('2023-04-26',202317,4,2023,26,17,202304,2023),('2023-04-27',202317,4,2023,27,17,202304,2023),('2023-04-28',202317,4,2023,28,17,202304,2023),('2023-04-29',202317,4,2023,29,17,202304,2023),('2023-04-30',202318,4,2023,30,18,202304,2023),('2023-05-01',202318,5,2023,1,18,202305,2023),('2023-05-02',202318,5,2023,2,18,202305,2023),('2023-05-03',202318,5,2023,3,18,202305,2023),('2023-05-04',202318,5,2023,4,18,202305,2023),('2023-05-05',202318,5,2023,5,18,202305,2023),('2023-05-06',202318,5,2023,6,18,202305,2023),('2023-05-07',202319,5,2023,7,19,202305,2023),('2023-05-08',202319,5,2023,8,19,202305,2023),('2023-05-09',202319,5,2023,9,19,202305,2023),('2023-05-10',202319,5,2023,10,19,202305,2023),('2023-05-11',202319,5,2023,11,19,202305,2023),('2023-05-12',202319,5,2023,12,19,202305,2023),('2023-05-13',202319,5,2023,13,19,202305,2023),('2023-05-14',202320,5,2023,14,20,202305,2023),('2023-05-15',202320,5,2023,15,20,202305,2023),('2023-05-16',202320,5,2023,16,20,202305,2023),('2023-05-17',202320,5,2023,17,20,202305,2023),('2023-05-18',202320,5,2023,18,20,202305,2023),('2023-05-19',202320,5,2023,19,20,202305,2023),('2023-05-20',202320,5,2023,20,20,202305,2023),('2023-05-21',202321,5,2023,21,21,202305,2023),('2023-05-22',202321,5,2023,22,21,202305,2023),('2023-05-23',202321,5,2023,23,21,202305,2023),('2023-05-24',202321,5,2023,24,21,202305,2023),('2023-05-25',202321,5,2023,25,21,202305,2023),('2023-05-26',202321,5,2023,26,21,202305,2023),('2023-05-27',202321,5,2023,27,21,202305,2023),('2023-05-28',202322,5,2023,28,22,202305,2023),('2023-05-29',202322,5,2023,29,22,202305,2023),('2023-05-30',202322,5,2023,30,22,202305,2023),('2023-05-31',202322,5,2023,31,22,202305,2023),('2023-06-01',202322,6,2023,1,22,202306,2023),('2023-06-02',202322,6,2023,2,22,202306,2023),('2023-06-03',202322,6,2023,3,22,202306,2023),('2023-06-04',202323,6,2023,4,23,202306,2023),('2023-06-05',202323,6,2023,5,23,202306,2023),('2023-06-06',202323,6,2023,6,23,202306,2023),('2023-06-07',202323,6,2023,7,23,202306,2023),('2023-06-08',202323,6,2023,8,23,202306,2023),('2023-06-09',202323,6,2023,9,23,202306,2023),('2023-06-10',202323,6,2023,10,23,202306,2023),('2023-06-11',202324,6,2023,11,24,202306,2023),('2023-06-12',202324,6,2023,12,24,202306,2023),('2023-06-13',202324,6,2023,13,24,202306,2023),('2023-06-14',202324,6,2023,14,24,202306,2023),('2023-06-15',202324,6,2023,15,24,202306,2023),('2023-06-16',202324,6,2023,16,24,202306,2023),('2023-06-17',202324,6,2023,17,24,202306,2023),('2023-06-18',202325,6,2023,18,25,202306,2023),('2023-06-19',202325,6,2023,19,25,202306,2023),('2023-06-20',202325,6,2023,20,25,202306,2023),('2023-06-21',202325,6,2023,21,25,202306,2023),('2023-06-22',202325,6,2023,22,25,202306,2023),('2023-06-23',202325,6,2023,23,25,202306,2023),('2023-06-24',202325,6,2023,24,25,202306,2023),('2023-06-25',202326,6,2023,25,26,202306,2023),('2023-06-26',202326,6,2023,26,26,202306,2023),('2023-06-27',202326,6,2023,27,26,202306,2023),('2023-06-28',202326,6,2023,28,26,202306,2023),('2023-06-29',202326,6,2023,29,26,202306,2023),('2023-06-30',202326,6,2023,30,26,202306,2023),('2023-07-01',202326,7,2023,1,26,202307,2023),('2023-07-02',202327,7,2023,2,27,202307,2023),('2023-07-03',202327,7,2023,3,27,202307,2023),('2023-07-04',202327,7,2023,4,27,202307,2023),('2023-07-05',202327,7,2023,5,27,202307,2023),('2023-07-06',202327,7,2023,6,27,202307,2023),('2023-07-07',202327,7,2023,7,27,202307,2023),('2023-07-08',202327,7,2023,8,27,202307,2023),('2023-07-09',202328,7,2023,9,28,202307,2023),('2023-07-10',202328,7,2023,10,28,202307,2023),('2023-07-11',202328,7,2023,11,28,202307,2023),('2023-07-12',202328,7,2023,12,28,202307,2023),('2023-07-13',202328,7,2023,13,28,202307,2023),('2023-07-14',202328,7,2023,14,28,202307,2023),('2023-07-15',202328,7,2023,15,28,202307,2023),('2023-07-16',202329,7,2023,16,29,202307,2023),('2023-07-17',202329,7,2023,17,29,202307,2023),('2023-07-18',202329,7,2023,18,29,202307,2023),('2023-07-19',202329,7,2023,19,29,202307,2023),('2023-07-20',202329,7,2023,20,29,202307,2023),('2023-07-21',202329,7,2023,21,29,202307,2023),('2023-07-22',202329,7,2023,22,29,202307,2023),('2023-07-23',202330,7,2023,23,30,202307,2023),('2023-07-24',202330,7,2023,24,30,202307,2023),('2023-07-25',202330,7,2023,25,30,202307,2023),('2023-07-26',202330,7,2023,26,30,202307,2023),('2023-07-27',202330,7,2023,27,30,202307,2023),('2023-07-28',202330,7,2023,28,30,202307,2023),('2023-07-29',202330,7,2023,29,30,202307,2023),('2023-07-30',202331,7,2023,30,31,202307,2023),('2023-07-31',202331,7,2023,31,31,202307,2023),('2023-08-01',202331,8,2023,1,31,202308,2023),('2023-08-02',202331,8,2023,2,31,202308,2023),('2023-08-03',202331,8,2023,3,31,202308,2023),('2023-08-04',202331,8,2023,4,31,202308,2023),('2023-08-05',202331,8,2023,5,31,202308,2023),('2023-08-06',202332,8,2023,6,32,202308,2023),('2023-08-07',202332,8,2023,7,32,202308,2023),('2023-08-08',202332,8,2023,8,32,202308,2023),('2023-08-09',202332,8,2023,9,32,202308,2023),('2023-08-10',202332,8,2023,10,32,202308,2023),('2023-08-11',202332,8,2023,11,32,202308,2023),('2023-08-12',202332,8,2023,12,32,202308,2023),('2023-08-13',202333,8,2023,13,33,202308,2023),('2023-08-14',202333,8,2023,14,33,202308,2023),('2023-08-15',202333,8,2023,15,33,202308,2023),('2023-08-16',202333,8,2023,16,33,202308,2023),('2023-08-17',202333,8,2023,17,33,202308,2023),('2023-08-18',202333,8,2023,18,33,202308,2023),('2023-08-19',202333,8,2023,19,33,202308,2023),('2023-08-20',202334,8,2023,20,34,202308,2023),('2023-08-21',202334,8,2023,21,34,202308,2023),('2023-08-22',202334,8,2023,22,34,202308,2023),('2023-08-23',202334,8,2023,23,34,202308,2023),('2023-08-24',202334,8,2023,24,34,202308,2023),('2023-08-25',202334,8,2023,25,34,202308,2023),('2023-08-26',202334,8,2023,26,34,202308,2023),('2023-08-27',202335,8,2023,27,35,202308,2023),('2023-08-28',202335,8,2023,28,35,202308,2023),('2023-08-29',202335,8,2023,29,35,202308,2023),('2023-08-30',202335,8,2023,30,35,202308,2023),('2023-08-31',202335,8,2023,31,35,202308,2023),('2023-09-01',202335,9,2023,1,35,202309,2023),('2023-09-02',202335,9,2023,2,35,202309,2023),('2023-09-03',202336,9,2023,3,36,202309,2023),('2023-09-04',202336,9,2023,4,36,202309,2023),('2023-09-05',202336,9,2023,5,36,202309,2023),('2023-09-06',202336,9,2023,6,36,202309,2023),('2023-09-07',202336,9,2023,7,36,202309,2023),('2023-09-08',202336,9,2023,8,36,202309,2023),('2023-09-09',202336,9,2023,9,36,202309,2023),('2023-09-10',202337,9,2023,10,37,202309,2023),('2023-09-11',202337,9,2023,11,37,202309,2023),('2023-09-12',202337,9,2023,12,37,202309,2023),('2023-09-13',202337,9,2023,13,37,202309,2023),('2023-09-14',202337,9,2023,14,37,202309,2023),('2023-09-15',202337,9,2023,15,37,202309,2023),('2023-09-16',202337,9,2023,16,37,202309,2023),('2023-09-17',202338,9,2023,17,38,202309,2023),('2023-09-18',202338,9,2023,18,38,202309,2023),('2023-09-19',202338,9,2023,19,38,202309,2023),('2023-09-20',202338,9,2023,20,38,202309,2023),('2023-09-21',202338,9,2023,21,38,202309,2023),('2023-09-22',202338,9,2023,22,38,202309,2023),('2023-09-23',202338,9,2023,23,38,202309,2023),('2023-09-24',202339,9,2023,24,39,202309,2023),('2023-09-25',202339,9,2023,25,39,202309,2023),('2023-09-26',202339,9,2023,26,39,202309,2023),('2023-09-27',202339,9,2023,27,39,202309,2023),('2023-09-28',202339,9,2023,28,39,202309,2023),('2023-09-29',202339,9,2023,29,39,202309,2023),('2023-09-30',202339,9,2023,30,39,202309,2023),('2023-10-01',202340,10,2023,1,40,202310,2023),('2023-10-02',202340,10,2023,2,40,202310,2023),('2023-10-03',202340,10,2023,3,40,202310,2023),('2023-10-04',202340,10,2023,4,40,202310,2023),('2023-10-05',202340,10,2023,5,40,202310,2023),('2023-10-06',202340,10,2023,6,40,202310,2023),('2023-10-07',202340,10,2023,7,40,202310,2023),('2023-10-08',202341,10,2023,8,41,202310,2023),('2023-10-09',202341,10,2023,9,41,202310,2023),('2023-10-10',202341,10,2023,10,41,202310,2023),('2023-10-11',202341,10,2023,11,41,202310,2023),('2023-10-12',202341,10,2023,12,41,202310,2023),('2023-10-13',202341,10,2023,13,41,202310,2023),('2023-10-14',202341,10,2023,14,41,202310,2023),('2023-10-15',202342,10,2023,15,42,202310,2023),('2023-10-16',202342,10,2023,16,42,202310,2023),('2023-10-17',202342,10,2023,17,42,202310,2023),('2023-10-18',202342,10,2023,18,42,202310,2023),('2023-10-19',202342,10,2023,19,42,202310,2023),('2023-10-20',202342,10,2023,20,42,202310,2023),('2023-10-21',202342,10,2023,21,42,202310,2023),('2023-10-22',202343,10,2023,22,43,202310,2023),('2023-10-23',202343,10,2023,23,43,202310,2023),('2023-10-24',202343,10,2023,24,43,202310,2023),('2023-10-25',202343,10,2023,25,43,202310,2023),('2023-10-26',202343,10,2023,26,43,202310,2023),('2023-10-27',202343,10,2023,27,43,202310,2023),('2023-10-28',202343,10,2023,28,43,202310,2023),('2023-10-29',202344,10,2023,29,44,202310,2023),('2023-10-30',202344,10,2023,30,44,202310,2023),('2023-10-31',202344,10,2023,31,44,202310,2023),('2023-11-01',202344,11,2023,1,44,202311,2023),('2023-11-02',202344,11,2023,2,44,202311,2023),('2023-11-03',202344,11,2023,3,44,202311,2023),('2023-11-04',202344,11,2023,4,44,202311,2023),('2023-11-05',202345,11,2023,5,45,202311,2023),('2023-11-06',202345,11,2023,6,45,202311,2023),('2023-11-07',202345,11,2023,7,45,202311,2023),('2023-11-08',202345,11,2023,8,45,202311,2023),('2023-11-09',202345,11,2023,9,45,202311,2023),('2023-11-10',202345,11,2023,10,45,202311,2023),('2023-11-11',202345,11,2023,11,45,202311,2023),('2023-11-12',202346,11,2023,12,46,202311,2023),('2023-11-13',202346,11,2023,13,46,202311,2023),('2023-11-14',202346,11,2023,14,46,202311,2023),('2023-11-15',202346,11,2023,15,46,202311,2023),('2023-11-16',202346,11,2023,16,46,202311,2023),('2023-11-17',202346,11,2023,17,46,202311,2023),('2023-11-18',202346,11,2023,18,46,202311,2023),('2023-11-19',202347,11,2023,19,47,202311,2023),('2023-11-20',202347,11,2023,20,47,202311,2023),('2023-11-21',202347,11,2023,21,47,202311,2023),('2023-11-22',202347,11,2023,22,47,202311,2023),('2023-11-23',202347,11,2023,23,47,202311,2023),('2023-11-24',202347,11,2023,24,47,202311,2023),('2023-11-25',202347,11,2023,25,47,202311,2023),('2023-11-26',202348,11,2023,26,48,202311,2023),('2023-11-27',202348,11,2023,27,48,202311,2023),('2023-11-28',202348,11,2023,28,48,202311,2023),('2023-11-29',202348,11,2023,29,48,202311,2023),('2023-11-30',202348,11,2023,30,48,202311,2023),('2023-12-01',202348,12,2023,1,48,202312,2024),('2023-12-02',202348,12,2023,2,48,202312,2024),('2023-12-03',202349,12,2023,3,49,202312,2024),('2023-12-04',202349,12,2023,4,49,202312,2024),('2023-12-05',202349,12,2023,5,49,202312,2024),('2023-12-06',202349,12,2023,6,49,202312,2024),('2023-12-07',202349,12,2023,7,49,202312,2024),('2023-12-08',202349,12,2023,8,49,202312,2024),('2023-12-09',202349,12,2023,9,49,202312,2024),('2023-12-10',202350,12,2023,10,50,202312,2024),('2023-12-11',202350,12,2023,11,50,202312,2024),('2023-12-12',202350,12,2023,12,50,202312,2024),('2023-12-13',202350,12,2023,13,50,202312,2024),('2023-12-14',202350,12,2023,14,50,202312,2024),('2023-12-15',202350,12,2023,15,50,202312,2024),('2023-12-16',202350,12,2023,16,50,202312,2024),('2023-12-17',202351,12,2023,17,51,202312,2024),('2023-12-18',202351,12,2023,18,51,202312,2024),('2023-12-19',202351,12,2023,19,51,202312,2024),('2023-12-20',202351,12,2023,20,51,202312,2024),('2023-12-21',202351,12,2023,21,51,202312,2024),('2023-12-22',202351,12,2023,22,51,202312,2024),('2023-12-23',202351,12,2023,23,51,202312,2024),('2023-12-24',202352,12,2023,24,52,202312,2024),('2023-12-25',202352,12,2023,25,52,202312,2024),('2023-12-26',202352,12,2023,26,52,202312,2024),('2023-12-27',202352,12,2023,27,52,202312,2024),('2023-12-28',202352,12,2023,28,52,202312,2024),('2023-12-29',202352,12,2023,29,52,202312,2024),('2023-12-30',202352,12,2023,30,52,202312,2024),('2023-12-31',202353,12,2023,31,53,202312,2024),('2024-01-01',202401,1,2024,1,1,202401,2024),('2024-01-02',202401,1,2024,2,1,202401,2024),('2024-01-03',202401,1,2024,3,1,202401,2024),('2024-01-04',202401,1,2024,4,1,202401,2024),('2024-01-05',202401,1,2024,5,1,202401,2024),('2024-01-06',202401,1,2024,6,1,202401,2024),('2024-01-07',202402,1,2024,7,2,202401,2024),('2024-01-08',202402,1,2024,8,2,202401,2024),('2024-01-09',202402,1,2024,9,2,202401,2024),('2024-01-10',202402,1,2024,10,2,202401,2024),('2024-01-11',202402,1,2024,11,2,202401,2024),('2024-01-12',202402,1,2024,12,2,202401,2024),('2024-01-13',202402,1,2024,13,2,202401,2024),('2024-01-14',202403,1,2024,14,3,202401,2024),('2024-01-15',202403,1,2024,15,3,202401,2024),('2024-01-16',202403,1,2024,16,3,202401,2024),('2024-01-17',202403,1,2024,17,3,202401,2024),('2024-01-18',202403,1,2024,18,3,202401,2024),('2024-01-19',202403,1,2024,19,3,202401,2024),('2024-01-20',202403,1,2024,20,3,202401,2024),('2024-01-21',202404,1,2024,21,4,202401,2024),('2024-01-22',202404,1,2024,22,4,202401,2024),('2024-01-23',202404,1,2024,23,4,202401,2024),('2024-01-24',202404,1,2024,24,4,202401,2024),('2024-01-25',202404,1,2024,25,4,202401,2024),('2024-01-26',202404,1,2024,26,4,202401,2024),('2024-01-27',202404,1,2024,27,4,202401,2024),('2024-01-28',202405,1,2024,28,5,202401,2024),('2024-01-29',202405,1,2024,29,5,202401,2024),('2024-01-30',202405,1,2024,30,5,202401,2024),('2024-01-31',202405,1,2024,31,5,202401,2024),('2024-02-01',202405,2,2024,1,5,202402,2024),('2024-02-02',202405,2,2024,2,5,202402,2024),('2024-02-03',202405,2,2024,3,5,202402,2024),('2024-02-04',202406,2,2024,4,6,202402,2024),('2024-02-05',202406,2,2024,5,6,202402,2024),('2024-02-06',202406,2,2024,6,6,202402,2024),('2024-02-07',202406,2,2024,7,6,202402,2024),('2024-02-08',202406,2,2024,8,6,202402,2024),('2024-02-09',202406,2,2024,9,6,202402,2024),('2024-02-10',202406,2,2024,10,6,202402,2024),('2024-02-11',202407,2,2024,11,7,202402,2024),('2024-02-12',202407,2,2024,12,7,202402,2024),('2024-02-13',202407,2,2024,13,7,202402,2024),('2024-02-14',202407,2,2024,14,7,202402,2024),('2024-02-15',202407,2,2024,15,7,202402,2024),('2024-02-16',202407,2,2024,16,7,202402,2024),('2024-02-17',202407,2,2024,17,7,202402,2024),('2024-02-18',202408,2,2024,18,8,202402,2024),('2024-02-19',202408,2,2024,19,8,202402,2024),('2024-02-20',202408,2,2024,20,8,202402,2024),('2024-02-21',202408,2,2024,21,8,202402,2024),('2024-02-22',202408,2,2024,22,8,202402,2024),('2024-02-23',202408,2,2024,23,8,202402,2024),('2024-02-24',202408,2,2024,24,8,202402,2024),('2024-02-25',202409,2,2024,25,9,202402,2024),('2024-02-26',202409,2,2024,26,9,202402,2024),('2024-02-27',202409,2,2024,27,9,202402,2024),('2024-02-28',202409,2,2024,28,9,202402,2024),('2024-02-29',202409,2,2024,29,9,202402,2024),('2024-03-01',202409,3,2024,1,9,202403,2024),('2024-03-02',202409,3,2024,2,9,202403,2024),('2024-03-03',202410,3,2024,3,10,202403,2024),('2024-03-04',202410,3,2024,4,10,202403,2024),('2024-03-05',202410,3,2024,5,10,202403,2024),('2024-03-06',202410,3,2024,6,10,202403,2024),('2024-03-07',202410,3,2024,7,10,202403,2024),('2024-03-08',202410,3,2024,8,10,202403,2024),('2024-03-09',202410,3,2024,9,10,202403,2024),('2024-03-10',202411,3,2024,10,11,202403,2024),('2024-03-11',202411,3,2024,11,11,202403,2024),('2024-03-12',202411,3,2024,12,11,202403,2024),('2024-03-13',202411,3,2024,13,11,202403,2024),('2024-03-14',202411,3,2024,14,11,202403,2024),('2024-03-15',202411,3,2024,15,11,202403,2024),('2024-03-16',202411,3,2024,16,11,202403,2024),('2024-03-17',202412,3,2024,17,12,202403,2024),('2024-03-18',202412,3,2024,18,12,202403,2024),('2024-03-19',202412,3,2024,19,12,202403,2024),('2024-03-20',202412,3,2024,20,12,202403,2024),('2024-03-21',202412,3,2024,21,12,202403,2024),('2024-03-22',202412,3,2024,22,12,202403,2024),('2024-03-23',202412,3,2024,23,12,202403,2024),('2024-03-24',202413,3,2024,24,13,202403,2024),('2024-03-25',202413,3,2024,25,13,202403,2024),('2024-03-26',202413,3,2024,26,13,202403,2024),('2024-03-27',202413,3,2024,27,13,202403,2024),('2024-03-28',202413,3,2024,28,13,202403,2024),('2024-03-29',202413,3,2024,29,13,202403,2024),('2024-03-30',202413,3,2024,30,13,202403,2024),('2024-03-31',202414,3,2024,31,14,202403,2024),('2024-04-01',202414,4,2024,1,14,202404,2024),('2024-04-02',202414,4,2024,2,14,202404,2024),('2024-04-03',202414,4,2024,3,14,202404,2024),('2024-04-04',202414,4,2024,4,14,202404,2024),('2024-04-05',202414,4,2024,5,14,202404,2024),('2024-04-06',202414,4,2024,6,14,202404,2024),('2024-04-07',202415,4,2024,7,15,202404,2024),('2024-04-08',202415,4,2024,8,15,202404,2024),('2024-04-09',202415,4,2024,9,15,202404,2024),('2024-04-10',202415,4,2024,10,15,202404,2024),('2024-04-11',202415,4,2024,11,15,202404,2024),('2024-04-12',202415,4,2024,12,15,202404,2024),('2024-04-13',202415,4,2024,13,15,202404,2024),('2024-04-14',202416,4,2024,14,16,202404,2024),('2024-04-15',202416,4,2024,15,16,202404,2024),('2024-04-16',202416,4,2024,16,16,202404,2024),('2024-04-17',202416,4,2024,17,16,202404,2024),('2024-04-18',202416,4,2024,18,16,202404,2024),('2024-04-19',202416,4,2024,19,16,202404,2024),('2024-04-20',202416,4,2024,20,16,202404,2024),('2024-04-21',202417,4,2024,21,17,202404,2024),('2024-04-22',202417,4,2024,22,17,202404,2024),('2024-04-23',202417,4,2024,23,17,202404,2024),('2024-04-24',202417,4,2024,24,17,202404,2024),('2024-04-25',202417,4,2024,25,17,202404,2024),('2024-04-26',202417,4,2024,26,17,202404,2024),('2024-04-27',202417,4,2024,27,17,202404,2024),('2024-04-28',202418,4,2024,28,18,202404,2024),('2024-04-29',202418,4,2024,29,18,202404,2024),('2024-04-30',202418,4,2024,30,18,202404,2024),('2024-05-01',202418,5,2024,1,18,202405,2024),('2024-05-02',202418,5,2024,2,18,202405,2024),('2024-05-03',202418,5,2024,3,18,202405,2024),('2024-05-04',202418,5,2024,4,18,202405,2024),('2024-05-05',202419,5,2024,5,19,202405,2024),('2024-05-06',202419,5,2024,6,19,202405,2024),('2024-05-07',202419,5,2024,7,19,202405,2024),('2024-05-08',202419,5,2024,8,19,202405,2024),('2024-05-09',202419,5,2024,9,19,202405,2024),('2024-05-10',202419,5,2024,10,19,202405,2024),('2024-05-11',202419,5,2024,11,19,202405,2024),('2024-05-12',202420,5,2024,12,20,202405,2024),('2024-05-13',202420,5,2024,13,20,202405,2024),('2024-05-14',202420,5,2024,14,20,202405,2024),('2024-05-15',202420,5,2024,15,20,202405,2024),('2024-05-16',202420,5,2024,16,20,202405,2024),('2024-05-17',202420,5,2024,17,20,202405,2024),('2024-05-18',202420,5,2024,18,20,202405,2024),('2024-05-19',202421,5,2024,19,21,202405,2024),('2024-05-20',202421,5,2024,20,21,202405,2024),('2024-05-21',202421,5,2024,21,21,202405,2024),('2024-05-22',202421,5,2024,22,21,202405,2024),('2024-05-23',202421,5,2024,23,21,202405,2024),('2024-05-24',202421,5,2024,24,21,202405,2024),('2024-05-25',202421,5,2024,25,21,202405,2024),('2024-05-26',202422,5,2024,26,22,202405,2024),('2024-05-27',202422,5,2024,27,22,202405,2024),('2024-05-28',202422,5,2024,28,22,202405,2024),('2024-05-29',202422,5,2024,29,22,202405,2024),('2024-05-30',202422,5,2024,30,22,202405,2024),('2024-05-31',202422,5,2024,31,22,202405,2024),('2024-06-01',202422,6,2024,1,22,202406,2024),('2024-06-02',202423,6,2024,2,23,202406,2024),('2024-06-03',202423,6,2024,3,23,202406,2024),('2024-06-04',202423,6,2024,4,23,202406,2024),('2024-06-05',202423,6,2024,5,23,202406,2024),('2024-06-06',202423,6,2024,6,23,202406,2024),('2024-06-07',202423,6,2024,7,23,202406,2024),('2024-06-08',202423,6,2024,8,23,202406,2024),('2024-06-09',202424,6,2024,9,24,202406,2024),('2024-06-10',202424,6,2024,10,24,202406,2024),('2024-06-11',202424,6,2024,11,24,202406,2024),('2024-06-12',202424,6,2024,12,24,202406,2024),('2024-06-13',202424,6,2024,13,24,202406,2024),('2024-06-14',202424,6,2024,14,24,202406,2024),('2024-06-15',202424,6,2024,15,24,202406,2024),('2024-06-16',202425,6,2024,16,25,202406,2024),('2024-06-17',202425,6,2024,17,25,202406,2024),('2024-06-18',202425,6,2024,18,25,202406,2024),('2024-06-19',202425,6,2024,19,25,202406,2024),('2024-06-20',202425,6,2024,20,25,202406,2024),('2024-06-21',202425,6,2024,21,25,202406,2024),('2024-06-22',202425,6,2024,22,25,202406,2024),('2024-06-23',202426,6,2024,23,26,202406,2024),('2024-06-24',202426,6,2024,24,26,202406,2024),('2024-06-25',202426,6,2024,25,26,202406,2024),('2024-06-26',202426,6,2024,26,26,202406,2024),('2024-06-27',202426,6,2024,27,26,202406,2024),('2024-06-28',202426,6,2024,28,26,202406,2024),('2024-06-29',202426,6,2024,29,26,202406,2024),('2024-06-30',202427,6,2024,30,27,202406,2024),('2024-07-01',202427,7,2024,1,27,202407,2024),('2024-07-02',202427,7,2024,2,27,202407,2024),('2024-07-03',202427,7,2024,3,27,202407,2024),('2024-07-04',202427,7,2024,4,27,202407,2024),('2024-07-05',202427,7,2024,5,27,202407,2024),('2024-07-06',202427,7,2024,6,27,202407,2024),('2024-07-07',202428,7,2024,7,28,202407,2024),('2024-07-08',202428,7,2024,8,28,202407,2024),('2024-07-09',202428,7,2024,9,28,202407,2024),('2024-07-10',202428,7,2024,10,28,202407,2024),('2024-07-11',202428,7,2024,11,28,202407,2024),('2024-07-12',202428,7,2024,12,28,202407,2024),('2024-07-13',202428,7,2024,13,28,202407,2024),('2024-07-14',202429,7,2024,14,29,202407,2024),('2024-07-15',202429,7,2024,15,29,202407,2024),('2024-07-16',202429,7,2024,16,29,202407,2024),('2024-07-17',202429,7,2024,17,29,202407,2024),('2024-07-18',202429,7,2024,18,29,202407,2024),('2024-07-19',202429,7,2024,19,29,202407,2024),('2024-07-20',202429,7,2024,20,29,202407,2024),('2024-07-21',202430,7,2024,21,30,202407,2024),('2024-07-22',202430,7,2024,22,30,202407,2024),('2024-07-23',202430,7,2024,23,30,202407,2024),('2024-07-24',202430,7,2024,24,30,202407,2024),('2024-07-25',202430,7,2024,25,30,202407,2024),('2024-07-26',202430,7,2024,26,30,202407,2024),('2024-07-27',202430,7,2024,27,30,202407,2024),('2024-07-28',202431,7,2024,28,31,202407,2024),('2024-07-29',202431,7,2024,29,31,202407,2024),('2024-07-30',202431,7,2024,30,31,202407,2024),('2024-07-31',202431,7,2024,31,31,202407,2024),('2024-08-01',202431,8,2024,1,31,202408,2024),('2024-08-02',202431,8,2024,2,31,202408,2024),('2024-08-03',202431,8,2024,3,31,202408,2024),('2024-08-04',202432,8,2024,4,32,202408,2024),('2024-08-05',202432,8,2024,5,32,202408,2024),('2024-08-06',202432,8,2024,6,32,202408,2024),('2024-08-07',202432,8,2024,7,32,202408,2024),('2024-08-08',202432,8,2024,8,32,202408,2024),('2024-08-09',202432,8,2024,9,32,202408,2024),('2024-08-10',202432,8,2024,10,32,202408,2024),('2024-08-11',202433,8,2024,11,33,202408,2024),('2024-08-12',202433,8,2024,12,33,202408,2024),('2024-08-13',202433,8,2024,13,33,202408,2024),('2024-08-14',202433,8,2024,14,33,202408,2024),('2024-08-15',202433,8,2024,15,33,202408,2024),('2024-08-16',202433,8,2024,16,33,202408,2024),('2024-08-17',202433,8,2024,17,33,202408,2024),('2024-08-18',202434,8,2024,18,34,202408,2024),('2024-08-19',202434,8,2024,19,34,202408,2024),('2024-08-20',202434,8,2024,20,34,202408,2024),('2024-08-21',202434,8,2024,21,34,202408,2024),('2024-08-22',202434,8,2024,22,34,202408,2024),('2024-08-23',202434,8,2024,23,34,202408,2024),('2024-08-24',202434,8,2024,24,34,202408,2024),('2024-08-25',202435,8,2024,25,35,202408,2024),('2024-08-26',202435,8,2024,26,35,202408,2024),('2024-08-27',202435,8,2024,27,35,202408,2024),('2024-08-28',202435,8,2024,28,35,202408,2024),('2024-08-29',202435,8,2024,29,35,202408,2024),('2024-08-30',202435,8,2024,30,35,202408,2024),('2024-08-31',202435,8,2024,31,35,202408,2024),('2024-09-01',202436,9,2024,1,36,202409,2024),('2024-09-02',202436,9,2024,2,36,202409,2024),('2024-09-03',202436,9,2024,3,36,202409,2024),('2024-09-04',202436,9,2024,4,36,202409,2024),('2024-09-05',202436,9,2024,5,36,202409,2024),('2024-09-06',202436,9,2024,6,36,202409,2024),('2024-09-07',202436,9,2024,7,36,202409,2024),('2024-09-08',202437,9,2024,8,37,202409,2024),('2024-09-09',202437,9,2024,9,37,202409,2024),('2024-09-10',202437,9,2024,10,37,202409,2024),('2024-09-11',202437,9,2024,11,37,202409,2024),('2024-09-12',202437,9,2024,12,37,202409,2024),('2024-09-13',202437,9,2024,13,37,202409,2024),('2024-09-14',202437,9,2024,14,37,202409,2024),('2024-09-15',202438,9,2024,15,38,202409,2024),('2024-09-16',202438,9,2024,16,38,202409,2024),('2024-09-17',202438,9,2024,17,38,202409,2024),('2024-09-18',202438,9,2024,18,38,202409,2024),('2024-09-19',202438,9,2024,19,38,202409,2024),('2024-09-20',202438,9,2024,20,38,202409,2024),('2024-09-21',202438,9,2024,21,38,202409,2024),('2024-09-22',202439,9,2024,22,39,202409,2024),('2024-09-23',202439,9,2024,23,39,202409,2024),('2024-09-24',202439,9,2024,24,39,202409,2024),('2024-09-25',202439,9,2024,25,39,202409,2024),('2024-09-26',202439,9,2024,26,39,202409,2024),('2024-09-27',202439,9,2024,27,39,202409,2024),('2024-09-28',202439,9,2024,28,39,202409,2024),('2024-09-29',202440,9,2024,29,40,202409,2024),('2024-09-30',202440,9,2024,30,40,202409,2024),('2024-10-01',202440,10,2024,1,40,202410,2024),('2024-10-02',202440,10,2024,2,40,202410,2024),('2024-10-03',202440,10,2024,3,40,202410,2024),('2024-10-04',202440,10,2024,4,40,202410,2024),('2024-10-05',202440,10,2024,5,40,202410,2024),('2024-10-06',202441,10,2024,6,41,202410,2024),('2024-10-07',202441,10,2024,7,41,202410,2024),('2024-10-08',202441,10,2024,8,41,202410,2024),('2024-10-09',202441,10,2024,9,41,202410,2024),('2024-10-10',202441,10,2024,10,41,202410,2024),('2024-10-11',202441,10,2024,11,41,202410,2024),('2024-10-12',202441,10,2024,12,41,202410,2024),('2024-10-13',202442,10,2024,13,42,202410,2024),('2024-10-14',202442,10,2024,14,42,202410,2024),('2024-10-15',202442,10,2024,15,42,202410,2024),('2024-10-16',202442,10,2024,16,42,202410,2024),('2024-10-17',202442,10,2024,17,42,202410,2024),('2024-10-18',202442,10,2024,18,42,202410,2024),('2024-10-19',202442,10,2024,19,42,202410,2024),('2024-10-20',202443,10,2024,20,43,202410,2024),('2024-10-21',202443,10,2024,21,43,202410,2024),('2024-10-22',202443,10,2024,22,43,202410,2024),('2024-10-23',202443,10,2024,23,43,202410,2024),('2024-10-24',202443,10,2024,24,43,202410,2024),('2024-10-25',202443,10,2024,25,43,202410,2024),('2024-10-26',202443,10,2024,26,43,202410,2024),('2024-10-27',202444,10,2024,27,44,202410,2024),('2024-10-28',202444,10,2024,28,44,202410,2024),('2024-10-29',202444,10,2024,29,44,202410,2024),('2024-10-30',202444,10,2024,30,44,202410,2024),('2024-10-31',202444,10,2024,31,44,202410,2024),('2024-11-01',202444,11,2024,1,44,202411,2024),('2024-11-02',202444,11,2024,2,44,202411,2024),('2024-11-03',202445,11,2024,3,45,202411,2024),('2024-11-04',202445,11,2024,4,45,202411,2024),('2024-11-05',202445,11,2024,5,45,202411,2024),('2024-11-06',202445,11,2024,6,45,202411,2024),('2024-11-07',202445,11,2024,7,45,202411,2024),('2024-11-08',202445,11,2024,8,45,202411,2024),('2024-11-09',202445,11,2024,9,45,202411,2024),('2024-11-10',202446,11,2024,10,46,202411,2024),('2024-11-11',202446,11,2024,11,46,202411,2024),('2024-11-12',202446,11,2024,12,46,202411,2024),('2024-11-13',202446,11,2024,13,46,202411,2024),('2024-11-14',202446,11,2024,14,46,202411,2024),('2024-11-15',202446,11,2024,15,46,202411,2024),('2024-11-16',202446,11,2024,16,46,202411,2024),('2024-11-17',202447,11,2024,17,47,202411,2024),('2024-11-18',202447,11,2024,18,47,202411,2024),('2024-11-19',202447,11,2024,19,47,202411,2024),('2024-11-20',202447,11,2024,20,47,202411,2024),('2024-11-21',202447,11,2024,21,47,202411,2024),('2024-11-22',202447,11,2024,22,47,202411,2024),('2024-11-23',202447,11,2024,23,47,202411,2024),('2024-11-24',202448,11,2024,24,48,202411,2024),('2024-11-25',202448,11,2024,25,48,202411,2024),('2024-11-26',202448,11,2024,26,48,202411,2024),('2024-11-27',202448,11,2024,27,48,202411,2024),('2024-11-28',202448,11,2024,28,48,202411,2024),('2024-11-29',202448,11,2024,29,48,202411,2024),('2024-11-30',202448,11,2024,30,48,202411,2024),('2024-12-01',202449,12,2024,1,49,202412,2025),('2024-12-02',202449,12,2024,2,49,202412,2025),('2024-12-03',202449,12,2024,3,49,202412,2025),('2024-12-04',202449,12,2024,4,49,202412,2025),('2024-12-05',202449,12,2024,5,49,202412,2025),('2024-12-06',202449,12,2024,6,49,202412,2025),('2024-12-07',202449,12,2024,7,49,202412,2025),('2024-12-08',202450,12,2024,8,50,202412,2025),('2024-12-09',202450,12,2024,9,50,202412,2025),('2024-12-10',202450,12,2024,10,50,202412,2025),('2024-12-11',202450,12,2024,11,50,202412,2025),('2024-12-12',202450,12,2024,12,50,202412,2025),('2024-12-13',202450,12,2024,13,50,202412,2025),('2024-12-14',202450,12,2024,14,50,202412,2025),('2024-12-15',202451,12,2024,15,51,202412,2025),('2024-12-16',202451,12,2024,16,51,202412,2025),('2024-12-17',202451,12,2024,17,51,202412,2025),('2024-12-18',202451,12,2024,18,51,202412,2025),('2024-12-19',202451,12,2024,19,51,202412,2025),('2024-12-20',202451,12,2024,20,51,202412,2025),('2024-12-21',202451,12,2024,21,51,202412,2025),('2024-12-22',202452,12,2024,22,52,202412,2025),('2024-12-23',202452,12,2024,23,52,202412,2025),('2024-12-24',202452,12,2024,24,52,202412,2025),('2024-12-25',202452,12,2024,25,52,202412,2025),('2024-12-26',202452,12,2024,26,52,202412,2025),('2024-12-27',202452,12,2024,27,52,202412,2025),('2024-12-28',202452,12,2024,28,52,202412,2025),('2024-12-29',202453,12,2024,29,1,202412,2025),('2024-12-30',202401,12,2024,30,1,202412,2025),('2024-12-31',202401,12,2024,31,1,202412,2025),('2025-01-01',202501,1,2025,1,1,202501,2025),('2025-01-02',202501,1,2025,2,1,202501,2025),('2025-01-03',202501,1,2025,3,1,202501,2025),('2025-01-04',202501,1,2025,4,1,202501,2025),('2025-01-05',202502,1,2025,5,2,202501,2025),('2025-01-06',202502,1,2025,6,2,202501,2025),('2025-01-07',202502,1,2025,7,2,202501,2025),('2025-01-08',202502,1,2025,8,2,202501,2025),('2025-01-09',202502,1,2025,9,2,202501,2025),('2025-01-10',202502,1,2025,10,2,202501,2025),('2025-01-11',202502,1,2025,11,2,202501,2025),('2025-01-12',202503,1,2025,12,3,202501,2025),('2025-01-13',202503,1,2025,13,3,202501,2025),('2025-01-14',202503,1,2025,14,3,202501,2025),('2025-01-15',202503,1,2025,15,3,202501,2025),('2025-01-16',202503,1,2025,16,3,202501,2025),('2025-01-17',202503,1,2025,17,3,202501,2025),('2025-01-18',202503,1,2025,18,3,202501,2025),('2025-01-19',202504,1,2025,19,4,202501,2025),('2025-01-20',202504,1,2025,20,4,202501,2025),('2025-01-21',202504,1,2025,21,4,202501,2025),('2025-01-22',202504,1,2025,22,4,202501,2025),('2025-01-23',202504,1,2025,23,4,202501,2025),('2025-01-24',202504,1,2025,24,4,202501,2025),('2025-01-25',202504,1,2025,25,4,202501,2025),('2025-01-26',202505,1,2025,26,5,202501,2025),('2025-01-27',202505,1,2025,27,5,202501,2025),('2025-01-28',202505,1,2025,28,5,202501,2025),('2025-01-29',202505,1,2025,29,5,202501,2025),('2025-01-30',202505,1,2025,30,5,202501,2025),('2025-01-31',202505,1,2025,31,5,202501,2025),('2025-02-01',202505,2,2025,1,5,202502,2025),('2025-02-02',202506,2,2025,2,6,202502,2025),('2025-02-03',202506,2,2025,3,6,202502,2025),('2025-02-04',202506,2,2025,4,6,202502,2025),('2025-02-05',202506,2,2025,5,6,202502,2025),('2025-02-06',202506,2,2025,6,6,202502,2025),('2025-02-07',202506,2,2025,7,6,202502,2025),('2025-02-08',202506,2,2025,8,6,202502,2025),('2025-02-09',202507,2,2025,9,7,202502,2025),('2025-02-10',202507,2,2025,10,7,202502,2025),('2025-02-11',202507,2,2025,11,7,202502,2025),('2025-02-12',202507,2,2025,12,7,202502,2025),('2025-02-13',202507,2,2025,13,7,202502,2025),('2025-02-14',202507,2,2025,14,7,202502,2025),('2025-02-15',202507,2,2025,15,7,202502,2025),('2025-02-16',202508,2,2025,16,8,202502,2025),('2025-02-17',202508,2,2025,17,8,202502,2025),('2025-02-18',202508,2,2025,18,8,202502,2025),('2025-02-19',202508,2,2025,19,8,202502,2025),('2025-02-20',202508,2,2025,20,8,202502,2025),('2025-02-21',202508,2,2025,21,8,202502,2025),('2025-02-22',202508,2,2025,22,8,202502,2025),('2025-02-23',202509,2,2025,23,9,202502,2025),('2025-02-24',202509,2,2025,24,9,202502,2025),('2025-02-25',202509,2,2025,25,9,202502,2025),('2025-02-26',202509,2,2025,26,9,202502,2025),('2025-02-27',202509,2,2025,27,9,202502,2025),('2025-02-28',202509,2,2025,28,9,202502,2025),('2025-03-01',202509,3,2025,1,9,202503,2025),('2025-03-02',202510,3,2025,2,10,202503,2025),('2025-03-03',202510,3,2025,3,10,202503,2025),('2025-03-04',202510,3,2025,4,10,202503,2025),('2025-03-05',202510,3,2025,5,10,202503,2025),('2025-03-06',202510,3,2025,6,10,202503,2025),('2025-03-07',202510,3,2025,7,10,202503,2025),('2025-03-08',202510,3,2025,8,10,202503,2025),('2025-03-09',202511,3,2025,9,11,202503,2025),('2025-03-10',202511,3,2025,10,11,202503,2025),('2025-03-11',202511,3,2025,11,11,202503,2025),('2025-03-12',202511,3,2025,12,11,202503,2025),('2025-03-13',202511,3,2025,13,11,202503,2025),('2025-03-14',202511,3,2025,14,11,202503,2025),('2025-03-15',202511,3,2025,15,11,202503,2025),('2025-03-16',202512,3,2025,16,12,202503,2025),('2025-03-17',202512,3,2025,17,12,202503,2025),('2025-03-18',202512,3,2025,18,12,202503,2025),('2025-03-19',202512,3,2025,19,12,202503,2025),('2025-03-20',202512,3,2025,20,12,202503,2025),('2025-03-21',202512,3,2025,21,12,202503,2025),('2025-03-22',202512,3,2025,22,12,202503,2025),('2025-03-23',202513,3,2025,23,13,202503,2025),('2025-03-24',202513,3,2025,24,13,202503,2025),('2025-03-25',202513,3,2025,25,13,202503,2025),('2025-03-26',202513,3,2025,26,13,202503,2025),('2025-03-27',202513,3,2025,27,13,202503,2025),('2025-03-28',202513,3,2025,28,13,202503,2025),('2025-03-29',202513,3,2025,29,13,202503,2025),('2025-03-30',202514,3,2025,30,14,202503,2025),('2025-03-31',202514,3,2025,31,14,202503,2025),('2025-04-01',202514,4,2025,1,14,202504,2025),('2025-04-02',202514,4,2025,2,14,202504,2025),('2025-04-03',202514,4,2025,3,14,202504,2025),('2025-04-04',202514,4,2025,4,14,202504,2025),('2025-04-05',202514,4,2025,5,14,202504,2025),('2025-04-06',202515,4,2025,6,15,202504,2025),('2025-04-07',202515,4,2025,7,15,202504,2025),('2025-04-08',202515,4,2025,8,15,202504,2025),('2025-04-09',202515,4,2025,9,15,202504,2025),('2025-04-10',202515,4,2025,10,15,202504,2025),('2025-04-11',202515,4,2025,11,15,202504,2025),('2025-04-12',202515,4,2025,12,15,202504,2025),('2025-04-13',202516,4,2025,13,16,202504,2025),('2025-04-14',202516,4,2025,14,16,202504,2025),('2025-04-15',202516,4,2025,15,16,202504,2025),('2025-04-16',202516,4,2025,16,16,202504,2025),('2025-04-17',202516,4,2025,17,16,202504,2025),('2025-04-18',202516,4,2025,18,16,202504,2025),('2025-04-19',202516,4,2025,19,16,202504,2025),('2025-04-20',202517,4,2025,20,17,202504,2025),('2025-04-21',202517,4,2025,21,17,202504,2025),('2025-04-22',202517,4,2025,22,17,202504,2025),('2025-04-23',202517,4,2025,23,17,202504,2025),('2025-04-24',202517,4,2025,24,17,202504,2025),('2025-04-25',202517,4,2025,25,17,202504,2025),('2025-04-26',202517,4,2025,26,17,202504,2025),('2025-04-27',202518,4,2025,27,18,202504,2025),('2025-04-28',202518,4,2025,28,18,202504,2025),('2025-04-29',202518,4,2025,29,18,202504,2025),('2025-04-30',202518,4,2025,30,18,202504,2025),('2025-05-01',202518,5,2025,1,18,202505,2025),('2025-05-02',202518,5,2025,2,18,202505,2025),('2025-05-03',202518,5,2025,3,18,202505,2025),('2025-05-04',202519,5,2025,4,19,202505,2025),('2025-05-05',202519,5,2025,5,19,202505,2025),('2025-05-06',202519,5,2025,6,19,202505,2025),('2025-05-07',202519,5,2025,7,19,202505,2025),('2025-05-08',202519,5,2025,8,19,202505,2025),('2025-05-09',202519,5,2025,9,19,202505,2025),('2025-05-10',202519,5,2025,10,19,202505,2025),('2025-05-11',202520,5,2025,11,20,202505,2025),('2025-05-12',202520,5,2025,12,20,202505,2025),('2025-05-13',202520,5,2025,13,20,202505,2025),('2025-05-14',202520,5,2025,14,20,202505,2025),('2025-05-15',202520,5,2025,15,20,202505,2025),('2025-05-16',202520,5,2025,16,20,202505,2025),('2025-05-17',202520,5,2025,17,20,202505,2025),('2025-05-18',202521,5,2025,18,21,202505,2025),('2025-05-19',202521,5,2025,19,21,202505,2025),('2025-05-20',202521,5,2025,20,21,202505,2025),('2025-05-21',202521,5,2025,21,21,202505,2025),('2025-05-22',202521,5,2025,22,21,202505,2025),('2025-05-23',202521,5,2025,23,21,202505,2025),('2025-05-24',202521,5,2025,24,21,202505,2025),('2025-05-25',202522,5,2025,25,22,202505,2025),('2025-05-26',202522,5,2025,26,22,202505,2025),('2025-05-27',202522,5,2025,27,22,202505,2025),('2025-05-28',202522,5,2025,28,22,202505,2025),('2025-05-29',202522,5,2025,29,22,202505,2025),('2025-05-30',202522,5,2025,30,22,202505,2025),('2025-05-31',202522,5,2025,31,22,202505,2025),('2025-06-01',202523,6,2025,1,23,202506,2025),('2025-06-02',202523,6,2025,2,23,202506,2025),('2025-06-03',202523,6,2025,3,23,202506,2025),('2025-06-04',202523,6,2025,4,23,202506,2025),('2025-06-05',202523,6,2025,5,23,202506,2025),('2025-06-06',202523,6,2025,6,23,202506,2025),('2025-06-07',202523,6,2025,7,23,202506,2025),('2025-06-08',202524,6,2025,8,24,202506,2025),('2025-06-09',202524,6,2025,9,24,202506,2025),('2025-06-10',202524,6,2025,10,24,202506,2025),('2025-06-11',202524,6,2025,11,24,202506,2025),('2025-06-12',202524,6,2025,12,24,202506,2025),('2025-06-13',202524,6,2025,13,24,202506,2025),('2025-06-14',202524,6,2025,14,24,202506,2025),('2025-06-15',202525,6,2025,15,25,202506,2025),('2025-06-16',202525,6,2025,16,25,202506,2025),('2025-06-17',202525,6,2025,17,25,202506,2025),('2025-06-18',202525,6,2025,18,25,202506,2025),('2025-06-19',202525,6,2025,19,25,202506,2025),('2025-06-20',202525,6,2025,20,25,202506,2025),('2025-06-21',202525,6,2025,21,25,202506,2025),('2025-06-22',202526,6,2025,22,26,202506,2025),('2025-06-23',202526,6,2025,23,26,202506,2025),('2025-06-24',202526,6,2025,24,26,202506,2025),('2025-06-25',202526,6,2025,25,26,202506,2025),('2025-06-26',202526,6,2025,26,26,202506,2025),('2025-06-27',202526,6,2025,27,26,202506,2025),('2025-06-28',202526,6,2025,28,26,202506,2025),('2025-06-29',202527,6,2025,29,27,202506,2025),('2025-06-30',202527,6,2025,30,27,202506,2025),('2025-07-01',202527,7,2025,1,27,202507,2025),('2025-07-02',202527,7,2025,2,27,202507,2025),('2025-07-03',202527,7,2025,3,27,202507,2025),('2025-07-04',202527,7,2025,4,27,202507,2025),('2025-07-05',202527,7,2025,5,27,202507,2025),('2025-07-06',202528,7,2025,6,28,202507,2025),('2025-07-07',202528,7,2025,7,28,202507,2025),('2025-07-08',202528,7,2025,8,28,202507,2025),('2025-07-09',202528,7,2025,9,28,202507,2025),('2025-07-10',202528,7,2025,10,28,202507,2025),('2025-07-11',202528,7,2025,11,28,202507,2025),('2025-07-12',202528,7,2025,12,28,202507,2025),('2025-07-13',202529,7,2025,13,29,202507,2025),('2025-07-14',202529,7,2025,14,29,202507,2025),('2025-07-15',202529,7,2025,15,29,202507,2025),('2025-07-16',202529,7,2025,16,29,202507,2025),('2025-07-17',202529,7,2025,17,29,202507,2025),('2025-07-18',202529,7,2025,18,29,202507,2025),('2025-07-19',202529,7,2025,19,29,202507,2025),('2025-07-20',202530,7,2025,20,30,202507,2025),('2025-07-21',202530,7,2025,21,30,202507,2025),('2025-07-22',202530,7,2025,22,30,202507,2025),('2025-07-23',202530,7,2025,23,30,202507,2025),('2025-07-24',202530,7,2025,24,30,202507,2025),('2025-07-25',202530,7,2025,25,30,202507,2025),('2025-07-26',202530,7,2025,26,30,202507,2025),('2025-07-27',202531,7,2025,27,31,202507,2025),('2025-07-28',202531,7,2025,28,31,202507,2025),('2025-07-29',202531,7,2025,29,31,202507,2025),('2025-07-30',202531,7,2025,30,31,202507,2025),('2025-07-31',202531,7,2025,31,31,202507,2025),('2025-08-01',202531,8,2025,1,31,202508,2025),('2025-08-02',202531,8,2025,2,31,202508,2025),('2025-08-03',202532,8,2025,3,32,202508,2025),('2025-08-04',202532,8,2025,4,32,202508,2025),('2025-08-05',202532,8,2025,5,32,202508,2025),('2025-08-06',202532,8,2025,6,32,202508,2025),('2025-08-07',202532,8,2025,7,32,202508,2025),('2025-08-08',202532,8,2025,8,32,202508,2025),('2025-08-09',202532,8,2025,9,32,202508,2025),('2025-08-10',202533,8,2025,10,33,202508,2025),('2025-08-11',202533,8,2025,11,33,202508,2025),('2025-08-12',202533,8,2025,12,33,202508,2025),('2025-08-13',202533,8,2025,13,33,202508,2025),('2025-08-14',202533,8,2025,14,33,202508,2025),('2025-08-15',202533,8,2025,15,33,202508,2025),('2025-08-16',202533,8,2025,16,33,202508,2025),('2025-08-17',202534,8,2025,17,34,202508,2025),('2025-08-18',202534,8,2025,18,34,202508,2025),('2025-08-19',202534,8,2025,19,34,202508,2025),('2025-08-20',202534,8,2025,20,34,202508,2025),('2025-08-21',202534,8,2025,21,34,202508,2025),('2025-08-22',202534,8,2025,22,34,202508,2025),('2025-08-23',202534,8,2025,23,34,202508,2025),('2025-08-24',202535,8,2025,24,35,202508,2025),('2025-08-25',202535,8,2025,25,35,202508,2025),('2025-08-26',202535,8,2025,26,35,202508,2025),('2025-08-27',202535,8,2025,27,35,202508,2025),('2025-08-28',202535,8,2025,28,35,202508,2025),('2025-08-29',202535,8,2025,29,35,202508,2025),('2025-08-30',202535,8,2025,30,35,202508,2025),('2025-08-31',202536,8,2025,31,36,202508,2025),('2025-09-01',202536,9,2025,1,36,202509,2025),('2025-09-02',202536,9,2025,2,36,202509,2025),('2025-09-03',202536,9,2025,3,36,202509,2025),('2025-09-04',202536,9,2025,4,36,202509,2025),('2025-09-05',202536,9,2025,5,36,202509,2025),('2025-09-06',202536,9,2025,6,36,202509,2025),('2025-09-07',202537,9,2025,7,37,202509,2025),('2025-09-08',202537,9,2025,8,37,202509,2025),('2025-09-09',202537,9,2025,9,37,202509,2025),('2025-09-10',202537,9,2025,10,37,202509,2025),('2025-09-11',202537,9,2025,11,37,202509,2025),('2025-09-12',202537,9,2025,12,37,202509,2025),('2025-09-13',202537,9,2025,13,37,202509,2025),('2025-09-14',202538,9,2025,14,38,202509,2025),('2025-09-15',202538,9,2025,15,38,202509,2025),('2025-09-16',202538,9,2025,16,38,202509,2025),('2025-09-17',202538,9,2025,17,38,202509,2025),('2025-09-18',202538,9,2025,18,38,202509,2025),('2025-09-19',202538,9,2025,19,38,202509,2025),('2025-09-20',202538,9,2025,20,38,202509,2025),('2025-09-21',202539,9,2025,21,39,202509,2025),('2025-09-22',202539,9,2025,22,39,202509,2025),('2025-09-23',202539,9,2025,23,39,202509,2025),('2025-09-24',202539,9,2025,24,39,202509,2025),('2025-09-25',202539,9,2025,25,39,202509,2025),('2025-09-26',202539,9,2025,26,39,202509,2025),('2025-09-27',202539,9,2025,27,39,202509,2025),('2025-09-28',202540,9,2025,28,40,202509,2025),('2025-09-29',202540,9,2025,29,40,202509,2025),('2025-09-30',202540,9,2025,30,40,202509,2025),('2025-10-01',202540,10,2025,1,40,202510,2025),('2025-10-02',202540,10,2025,2,40,202510,2025),('2025-10-03',202540,10,2025,3,40,202510,2025),('2025-10-04',202540,10,2025,4,40,202510,2025),('2025-10-05',202541,10,2025,5,41,202510,2025),('2025-10-06',202541,10,2025,6,41,202510,2025),('2025-10-07',202541,10,2025,7,41,202510,2025),('2025-10-08',202541,10,2025,8,41,202510,2025),('2025-10-09',202541,10,2025,9,41,202510,2025),('2025-10-10',202541,10,2025,10,41,202510,2025),('2025-10-11',202541,10,2025,11,41,202510,2025),('2025-10-12',202542,10,2025,12,42,202510,2025),('2025-10-13',202542,10,2025,13,42,202510,2025),('2025-10-14',202542,10,2025,14,42,202510,2025),('2025-10-15',202542,10,2025,15,42,202510,2025),('2025-10-16',202542,10,2025,16,42,202510,2025),('2025-10-17',202542,10,2025,17,42,202510,2025),('2025-10-18',202542,10,2025,18,42,202510,2025),('2025-10-19',202543,10,2025,19,43,202510,2025),('2025-10-20',202543,10,2025,20,43,202510,2025),('2025-10-21',202543,10,2025,21,43,202510,2025),('2025-10-22',202543,10,2025,22,43,202510,2025),('2025-10-23',202543,10,2025,23,43,202510,2025),('2025-10-24',202543,10,2025,24,43,202510,2025),('2025-10-25',202543,10,2025,25,43,202510,2025),('2025-10-26',202544,10,2025,26,44,202510,2025),('2025-10-27',202544,10,2025,27,44,202510,2025),('2025-10-28',202544,10,2025,28,44,202510,2025),('2025-10-29',202544,10,2025,29,44,202510,2025),('2025-10-30',202544,10,2025,30,44,202510,2025),('2025-10-31',202544,10,2025,31,44,202510,2025),('2025-11-01',202544,11,2025,1,44,202511,2025),('2025-11-02',202545,11,2025,2,45,202511,2025),('2025-11-03',202545,11,2025,3,45,202511,2025),('2025-11-04',202545,11,2025,4,45,202511,2025),('2025-11-05',202545,11,2025,5,45,202511,2025),('2025-11-06',202545,11,2025,6,45,202511,2025),('2025-11-07',202545,11,2025,7,45,202511,2025),('2025-11-08',202545,11,2025,8,45,202511,2025),('2025-11-09',202546,11,2025,9,46,202511,2025),('2025-11-10',202546,11,2025,10,46,202511,2025),('2025-11-11',202546,11,2025,11,46,202511,2025),('2025-11-12',202546,11,2025,12,46,202511,2025),('2025-11-13',202546,11,2025,13,46,202511,2025),('2025-11-14',202546,11,2025,14,46,202511,2025),('2025-11-15',202546,11,2025,15,46,202511,2025),('2025-11-16',202547,11,2025,16,47,202511,2025),('2025-11-17',202547,11,2025,17,47,202511,2025),('2025-11-18',202547,11,2025,18,47,202511,2025),('2025-11-19',202547,11,2025,19,47,202511,2025),('2025-11-20',202547,11,2025,20,47,202511,2025),('2025-11-21',202547,11,2025,21,47,202511,2025),('2025-11-22',202547,11,2025,22,47,202511,2025),('2025-11-23',202548,11,2025,23,48,202511,2025),('2025-11-24',202548,11,2025,24,48,202511,2025),('2025-11-25',202548,11,2025,25,48,202511,2025),('2025-11-26',202548,11,2025,26,48,202511,2025),('2025-11-27',202548,11,2025,27,48,202511,2025),('2025-11-28',202548,11,2025,28,48,202511,2025),('2025-11-29',202548,11,2025,29,48,202511,2025),('2025-11-30',202549,11,2025,30,49,202511,2025),('2025-12-01',202549,12,2025,1,49,202512,2026),('2025-12-02',202549,12,2025,2,49,202512,2026),('2025-12-03',202549,12,2025,3,49,202512,2026),('2025-12-04',202549,12,2025,4,49,202512,2026),('2025-12-05',202549,12,2025,5,49,202512,2026),('2025-12-06',202549,12,2025,6,49,202512,2026),('2025-12-07',202550,12,2025,7,50,202512,2026),('2025-12-08',202550,12,2025,8,50,202512,2026),('2025-12-09',202550,12,2025,9,50,202512,2026),('2025-12-10',202550,12,2025,10,50,202512,2026),('2025-12-11',202550,12,2025,11,50,202512,2026),('2025-12-12',202550,12,2025,12,50,202512,2026),('2025-12-13',202550,12,2025,13,50,202512,2026),('2025-12-14',202551,12,2025,14,51,202512,2026),('2025-12-15',202551,12,2025,15,51,202512,2026),('2025-12-16',202551,12,2025,16,51,202512,2026),('2025-12-17',202551,12,2025,17,51,202512,2026),('2025-12-18',202551,12,2025,18,51,202512,2026),('2025-12-19',202551,12,2025,19,51,202512,2026),('2025-12-20',202551,12,2025,20,51,202512,2026),('2025-12-21',202552,12,2025,21,52,202512,2026),('2025-12-22',202552,12,2025,22,52,202512,2026),('2025-12-23',202552,12,2025,23,52,202512,2026),('2025-12-24',202552,12,2025,24,52,202512,2026),('2025-12-25',202552,12,2025,25,52,202512,2026),('2025-12-26',202552,12,2025,26,52,202512,2026),('2025-12-27',202552,12,2025,27,52,202512,2026),('2025-12-28',202553,12,2025,28,53,202512,2026),('2025-12-29',202501,12,2025,29,53,202512,2026),('2025-12-30',202501,12,2025,30,53,202512,2026),('2025-12-31',202501,12,2025,31,53,202512,2026),('2026-01-01',202601,1,2026,1,53,202601,2026),('2026-01-02',202601,1,2026,2,53,202601,2026),('2026-01-03',202601,1,2026,3,53,202601,2026),('2026-01-04',202602,1,2026,4,1,202601,2026),('2026-01-05',202602,1,2026,5,1,202601,2026),('2026-01-06',202602,1,2026,6,1,202601,2026),('2026-01-07',202602,1,2026,7,1,202601,2026),('2026-01-08',202602,1,2026,8,1,202601,2026),('2026-01-09',202602,1,2026,9,1,202601,2026),('2026-01-10',202602,1,2026,10,1,202601,2026),('2026-01-11',202603,1,2026,11,2,202601,2026),('2026-01-12',202603,1,2026,12,2,202601,2026),('2026-01-13',202603,1,2026,13,2,202601,2026),('2026-01-14',202603,1,2026,14,2,202601,2026),('2026-01-15',202603,1,2026,15,2,202601,2026),('2026-01-16',202603,1,2026,16,2,202601,2026),('2026-01-17',202603,1,2026,17,2,202601,2026),('2026-01-18',202604,1,2026,18,3,202601,2026),('2026-01-19',202604,1,2026,19,3,202601,2026),('2026-01-20',202604,1,2026,20,3,202601,2026),('2026-01-21',202604,1,2026,21,3,202601,2026),('2026-01-22',202604,1,2026,22,3,202601,2026),('2026-01-23',202604,1,2026,23,3,202601,2026),('2026-01-24',202604,1,2026,24,3,202601,2026),('2026-01-25',202605,1,2026,25,4,202601,2026),('2026-01-26',202605,1,2026,26,4,202601,2026),('2026-01-27',202605,1,2026,27,4,202601,2026),('2026-01-28',202605,1,2026,28,4,202601,2026),('2026-01-29',202605,1,2026,29,4,202601,2026),('2026-01-30',202605,1,2026,30,4,202601,2026),('2026-01-31',202605,1,2026,31,4,202601,2026),('2026-02-01',202606,2,2026,1,5,202602,2026),('2026-02-02',202606,2,2026,2,5,202602,2026),('2026-02-03',202606,2,2026,3,5,202602,2026),('2026-02-04',202606,2,2026,4,5,202602,2026),('2026-02-05',202606,2,2026,5,5,202602,2026),('2026-02-06',202606,2,2026,6,5,202602,2026),('2026-02-07',202606,2,2026,7,5,202602,2026),('2026-02-08',202607,2,2026,8,6,202602,2026),('2026-02-09',202607,2,2026,9,6,202602,2026),('2026-02-10',202607,2,2026,10,6,202602,2026),('2026-02-11',202607,2,2026,11,6,202602,2026),('2026-02-12',202607,2,2026,12,6,202602,2026),('2026-02-13',202607,2,2026,13,6,202602,2026),('2026-02-14',202607,2,2026,14,6,202602,2026),('2026-02-15',202608,2,2026,15,7,202602,2026),('2026-02-16',202608,2,2026,16,7,202602,2026),('2026-02-17',202608,2,2026,17,7,202602,2026),('2026-02-18',202608,2,2026,18,7,202602,2026),('2026-02-19',202608,2,2026,19,7,202602,2026),('2026-02-20',202608,2,2026,20,7,202602,2026),('2026-02-21',202608,2,2026,21,7,202602,2026),('2026-02-22',202609,2,2026,22,8,202602,2026),('2026-02-23',202609,2,2026,23,8,202602,2026),('2026-02-24',202609,2,2026,24,8,202602,2026),('2026-02-25',202609,2,2026,25,8,202602,2026),('2026-02-26',202609,2,2026,26,8,202602,2026),('2026-02-27',202609,2,2026,27,8,202602,2026),('2026-02-28',202609,2,2026,28,8,202602,2026),('2026-03-01',202610,3,2026,1,9,202603,2026),('2026-03-02',202610,3,2026,2,9,202603,2026),('2026-03-03',202610,3,2026,3,9,202603,2026),('2026-03-04',202610,3,2026,4,9,202603,2026),('2026-03-05',202610,3,2026,5,9,202603,2026),('2026-03-06',202610,3,2026,6,9,202603,2026),('2026-03-07',202610,3,2026,7,9,202603,2026),('2026-03-08',202611,3,2026,8,10,202603,2026),('2026-03-09',202611,3,2026,9,10,202603,2026),('2026-03-10',202611,3,2026,10,10,202603,2026),('2026-03-11',202611,3,2026,11,10,202603,2026),('2026-03-12',202611,3,2026,12,10,202603,2026),('2026-03-13',202611,3,2026,13,10,202603,2026),('2026-03-14',202611,3,2026,14,10,202603,2026),('2026-03-15',202612,3,2026,15,11,202603,2026),('2026-03-16',202612,3,2026,16,11,202603,2026),('2026-03-17',202612,3,2026,17,11,202603,2026),('2026-03-18',202612,3,2026,18,11,202603,2026),('2026-03-19',202612,3,2026,19,11,202603,2026),('2026-03-20',202612,3,2026,20,11,202603,2026),('2026-03-21',202612,3,2026,21,11,202603,2026),('2026-03-22',202613,3,2026,22,12,202603,2026),('2026-03-23',202613,3,2026,23,12,202603,2026),('2026-03-24',202613,3,2026,24,12,202603,2026),('2026-03-25',202613,3,2026,25,12,202603,2026),('2026-03-26',202613,3,2026,26,12,202603,2026),('2026-03-27',202613,3,2026,27,12,202603,2026),('2026-03-28',202613,3,2026,28,12,202603,2026),('2026-03-29',202614,3,2026,29,13,202603,2026),('2026-03-30',202614,3,2026,30,13,202603,2026),('2026-03-31',202614,3,2026,31,13,202603,2026),('2026-04-01',202614,4,2026,1,13,202604,2026),('2026-04-02',202614,4,2026,2,13,202604,2026),('2026-04-03',202614,4,2026,3,13,202604,2026),('2026-04-04',202614,4,2026,4,13,202604,2026),('2026-04-05',202615,4,2026,5,14,202604,2026),('2026-04-06',202615,4,2026,6,14,202604,2026),('2026-04-07',202615,4,2026,7,14,202604,2026),('2026-04-08',202615,4,2026,8,14,202604,2026),('2026-04-09',202615,4,2026,9,14,202604,2026),('2026-04-10',202615,4,2026,10,14,202604,2026),('2026-04-11',202615,4,2026,11,14,202604,2026),('2026-04-12',202616,4,2026,12,15,202604,2026),('2026-04-13',202616,4,2026,13,15,202604,2026),('2026-04-14',202616,4,2026,14,15,202604,2026),('2026-04-15',202616,4,2026,15,15,202604,2026),('2026-04-16',202616,4,2026,16,15,202604,2026),('2026-04-17',202616,4,2026,17,15,202604,2026),('2026-04-18',202616,4,2026,18,15,202604,2026),('2026-04-19',202617,4,2026,19,16,202604,2026),('2026-04-20',202617,4,2026,20,16,202604,2026),('2026-04-21',202617,4,2026,21,16,202604,2026),('2026-04-22',202617,4,2026,22,16,202604,2026),('2026-04-23',202617,4,2026,23,16,202604,2026),('2026-04-24',202617,4,2026,24,16,202604,2026),('2026-04-25',202617,4,2026,25,16,202604,2026),('2026-04-26',202618,4,2026,26,17,202604,2026),('2026-04-27',202618,4,2026,27,17,202604,2026),('2026-04-28',202618,4,2026,28,17,202604,2026),('2026-04-29',202618,4,2026,29,17,202604,2026),('2026-04-30',202618,4,2026,30,17,202604,2026),('2026-05-01',202618,5,2026,1,17,202605,2026),('2026-05-02',202618,5,2026,2,17,202605,2026),('2026-05-03',202619,5,2026,3,18,202605,2026),('2026-05-04',202619,5,2026,4,18,202605,2026),('2026-05-05',202619,5,2026,5,18,202605,2026),('2026-05-06',202619,5,2026,6,18,202605,2026),('2026-05-07',202619,5,2026,7,18,202605,2026),('2026-05-08',202619,5,2026,8,18,202605,2026),('2026-05-09',202619,5,2026,9,18,202605,2026),('2026-05-10',202620,5,2026,10,19,202605,2026),('2026-05-11',202620,5,2026,11,19,202605,2026),('2026-05-12',202620,5,2026,12,19,202605,2026),('2026-05-13',202620,5,2026,13,19,202605,2026),('2026-05-14',202620,5,2026,14,19,202605,2026),('2026-05-15',202620,5,2026,15,19,202605,2026),('2026-05-16',202620,5,2026,16,19,202605,2026),('2026-05-17',202621,5,2026,17,20,202605,2026),('2026-05-18',202621,5,2026,18,20,202605,2026),('2026-05-19',202621,5,2026,19,20,202605,2026),('2026-05-20',202621,5,2026,20,20,202605,2026),('2026-05-21',202621,5,2026,21,20,202605,2026),('2026-05-22',202621,5,2026,22,20,202605,2026),('2026-05-23',202621,5,2026,23,20,202605,2026),('2026-05-24',202622,5,2026,24,21,202605,2026),('2026-05-25',202622,5,2026,25,21,202605,2026),('2026-05-26',202622,5,2026,26,21,202605,2026),('2026-05-27',202622,5,2026,27,21,202605,2026),('2026-05-28',202622,5,2026,28,21,202605,2026),('2026-05-29',202622,5,2026,29,21,202605,2026),('2026-05-30',202622,5,2026,30,21,202605,2026),('2026-05-31',202623,5,2026,31,22,202605,2026),('2026-06-01',202623,6,2026,1,22,202606,2026),('2026-06-02',202623,6,2026,2,22,202606,2026),('2026-06-03',202623,6,2026,3,22,202606,2026),('2026-06-04',202623,6,2026,4,22,202606,2026),('2026-06-05',202623,6,2026,5,22,202606,2026),('2026-06-06',202623,6,2026,6,22,202606,2026),('2026-06-07',202624,6,2026,7,23,202606,2026),('2026-06-08',202624,6,2026,8,23,202606,2026),('2026-06-09',202624,6,2026,9,23,202606,2026),('2026-06-10',202624,6,2026,10,23,202606,2026),('2026-06-11',202624,6,2026,11,23,202606,2026),('2026-06-12',202624,6,2026,12,23,202606,2026),('2026-06-13',202624,6,2026,13,23,202606,2026),('2026-06-14',202625,6,2026,14,24,202606,2026),('2026-06-15',202625,6,2026,15,24,202606,2026),('2026-06-16',202625,6,2026,16,24,202606,2026),('2026-06-17',202625,6,2026,17,24,202606,2026),('2026-06-18',202625,6,2026,18,24,202606,2026),('2026-06-19',202625,6,2026,19,24,202606,2026),('2026-06-20',202625,6,2026,20,24,202606,2026),('2026-06-21',202626,6,2026,21,25,202606,2026),('2026-06-22',202626,6,2026,22,25,202606,2026),('2026-06-23',202626,6,2026,23,25,202606,2026),('2026-06-24',202626,6,2026,24,25,202606,2026),('2026-06-25',202626,6,2026,25,25,202606,2026),('2026-06-26',202626,6,2026,26,25,202606,2026),('2026-06-27',202626,6,2026,27,25,202606,2026),('2026-06-28',202627,6,2026,28,26,202606,2026),('2026-06-29',202627,6,2026,29,26,202606,2026),('2026-06-30',202627,6,2026,30,26,202606,2026),('2026-07-01',202627,7,2026,1,26,202607,2026),('2026-07-02',202627,7,2026,2,26,202607,2026),('2026-07-03',202627,7,2026,3,26,202607,2026),('2026-07-04',202627,7,2026,4,26,202607,2026),('2026-07-05',202628,7,2026,5,27,202607,2026),('2026-07-06',202628,7,2026,6,27,202607,2026),('2026-07-07',202628,7,2026,7,27,202607,2026),('2026-07-08',202628,7,2026,8,27,202607,2026),('2026-07-09',202628,7,2026,9,27,202607,2026),('2026-07-10',202628,7,2026,10,27,202607,2026),('2026-07-11',202628,7,2026,11,27,202607,2026),('2026-07-12',202629,7,2026,12,28,202607,2026),('2026-07-13',202629,7,2026,13,28,202607,2026),('2026-07-14',202629,7,2026,14,28,202607,2026),('2026-07-15',202629,7,2026,15,28,202607,2026),('2026-07-16',202629,7,2026,16,28,202607,2026),('2026-07-17',202629,7,2026,17,28,202607,2026),('2026-07-18',202629,7,2026,18,28,202607,2026),('2026-07-19',202630,7,2026,19,29,202607,2026),('2026-07-20',202630,7,2026,20,29,202607,2026),('2026-07-21',202630,7,2026,21,29,202607,2026),('2026-07-22',202630,7,2026,22,29,202607,2026),('2026-07-23',202630,7,2026,23,29,202607,2026),('2026-07-24',202630,7,2026,24,29,202607,2026),('2026-07-25',202630,7,2026,25,29,202607,2026),('2026-07-26',202631,7,2026,26,30,202607,2026),('2026-07-27',202631,7,2026,27,30,202607,2026),('2026-07-28',202631,7,2026,28,30,202607,2026),('2026-07-29',202631,7,2026,29,30,202607,2026),('2026-07-30',202631,7,2026,30,30,202607,2026),('2026-07-31',202631,7,2026,31,30,202607,2026),('2026-08-01',202631,8,2026,1,30,202608,2026),('2026-08-02',202632,8,2026,2,31,202608,2026),('2026-08-03',202632,8,2026,3,31,202608,2026),('2026-08-04',202632,8,2026,4,31,202608,2026),('2026-08-05',202632,8,2026,5,31,202608,2026),('2026-08-06',202632,8,2026,6,31,202608,2026),('2026-08-07',202632,8,2026,7,31,202608,2026),('2026-08-08',202632,8,2026,8,31,202608,2026),('2026-08-09',202633,8,2026,9,32,202608,2026),('2026-08-10',202633,8,2026,10,32,202608,2026),('2026-08-11',202633,8,2026,11,32,202608,2026),('2026-08-12',202633,8,2026,12,32,202608,2026),('2026-08-13',202633,8,2026,13,32,202608,2026),('2026-08-14',202633,8,2026,14,32,202608,2026),('2026-08-15',202633,8,2026,15,32,202608,2026),('2026-08-16',202634,8,2026,16,33,202608,2026),('2026-08-17',202634,8,2026,17,33,202608,2026),('2026-08-18',202634,8,2026,18,33,202608,2026),('2026-08-19',202634,8,2026,19,33,202608,2026),('2026-08-20',202634,8,2026,20,33,202608,2026),('2026-08-21',202634,8,2026,21,33,202608,2026),('2026-08-22',202634,8,2026,22,33,202608,2026),('2026-08-23',202635,8,2026,23,34,202608,2026),('2026-08-24',202635,8,2026,24,34,202608,2026),('2026-08-25',202635,8,2026,25,34,202608,2026),('2026-08-26',202635,8,2026,26,34,202608,2026),('2026-08-27',202635,8,2026,27,34,202608,2026),('2026-08-28',202635,8,2026,28,34,202608,2026),('2026-08-29',202635,8,2026,29,34,202608,2026),('2026-08-30',202636,8,2026,30,35,202608,2026),('2026-08-31',202636,8,2026,31,35,202608,2026),('2026-09-01',202636,9,2026,1,35,202609,2026),('2026-09-02',202636,9,2026,2,35,202609,2026),('2026-09-03',202636,9,2026,3,35,202609,2026),('2026-09-04',202636,9,2026,4,35,202609,2026),('2026-09-05',202636,9,2026,5,35,202609,2026),('2026-09-06',202637,9,2026,6,36,202609,2026),('2026-09-07',202637,9,2026,7,36,202609,2026),('2026-09-08',202637,9,2026,8,36,202609,2026),('2026-09-09',202637,9,2026,9,36,202609,2026),('2026-09-10',202637,9,2026,10,36,202609,2026),('2026-09-11',202637,9,2026,11,36,202609,2026),('2026-09-12',202637,9,2026,12,36,202609,2026),('2026-09-13',202638,9,2026,13,37,202609,2026),('2026-09-14',202638,9,2026,14,37,202609,2026),('2026-09-15',202638,9,2026,15,37,202609,2026),('2026-09-16',202638,9,2026,16,37,202609,2026),('2026-09-17',202638,9,2026,17,37,202609,2026),('2026-09-18',202638,9,2026,18,37,202609,2026),('2026-09-19',202638,9,2026,19,37,202609,2026),('2026-09-20',202639,9,2026,20,38,202609,2026),('2026-09-21',202639,9,2026,21,38,202609,2026),('2026-09-22',202639,9,2026,22,38,202609,2026),('2026-09-23',202639,9,2026,23,38,202609,2026),('2026-09-24',202639,9,2026,24,38,202609,2026),('2026-09-25',202639,9,2026,25,38,202609,2026),('2026-09-26',202639,9,2026,26,38,202609,2026),('2026-09-27',202640,9,2026,27,39,202609,2026),('2026-09-28',202640,9,2026,28,39,202609,2026),('2026-09-29',202640,9,2026,29,39,202609,2026),('2026-09-30',202640,9,2026,30,39,202609,2026),('2026-10-01',202640,10,2026,1,39,202610,2026),('2026-10-02',202640,10,2026,2,39,202610,2026),('2026-10-03',202640,10,2026,3,39,202610,2026),('2026-10-04',202641,10,2026,4,40,202610,2026),('2026-10-05',202641,10,2026,5,40,202610,2026),('2026-10-06',202641,10,2026,6,40,202610,2026),('2026-10-07',202641,10,2026,7,40,202610,2026),('2026-10-08',202641,10,2026,8,40,202610,2026),('2026-10-09',202641,10,2026,9,40,202610,2026),('2026-10-10',202641,10,2026,10,40,202610,2026),('2026-10-11',202642,10,2026,11,41,202610,2026),('2026-10-12',202642,10,2026,12,41,202610,2026),('2026-10-13',202642,10,2026,13,41,202610,2026),('2026-10-14',202642,10,2026,14,41,202610,2026),('2026-10-15',202642,10,2026,15,41,202610,2026),('2026-10-16',202642,10,2026,16,41,202610,2026),('2026-10-17',202642,10,2026,17,41,202610,2026),('2026-10-18',202643,10,2026,18,42,202610,2026),('2026-10-19',202643,10,2026,19,42,202610,2026),('2026-10-20',202643,10,2026,20,42,202610,2026),('2026-10-21',202643,10,2026,21,42,202610,2026),('2026-10-22',202643,10,2026,22,42,202610,2026),('2026-10-23',202643,10,2026,23,42,202610,2026),('2026-10-24',202643,10,2026,24,42,202610,2026),('2026-10-25',202644,10,2026,25,43,202610,2026),('2026-10-26',202644,10,2026,26,43,202610,2026),('2026-10-27',202644,10,2026,27,43,202610,2026),('2026-10-28',202644,10,2026,28,43,202610,2026),('2026-10-29',202644,10,2026,29,43,202610,2026),('2026-10-30',202644,10,2026,30,43,202610,2026),('2026-10-31',202644,10,2026,31,43,202610,2026),('2026-11-01',202645,11,2026,1,44,202611,2026),('2026-11-02',202645,11,2026,2,44,202611,2026),('2026-11-03',202645,11,2026,3,44,202611,2026),('2026-11-04',202645,11,2026,4,44,202611,2026),('2026-11-05',202645,11,2026,5,44,202611,2026),('2026-11-06',202645,11,2026,6,44,202611,2026),('2026-11-07',202645,11,2026,7,44,202611,2026),('2026-11-08',202646,11,2026,8,45,202611,2026),('2026-11-09',202646,11,2026,9,45,202611,2026),('2026-11-10',202646,11,2026,10,45,202611,2026),('2026-11-11',202646,11,2026,11,45,202611,2026),('2026-11-12',202646,11,2026,12,45,202611,2026),('2026-11-13',202646,11,2026,13,45,202611,2026),('2026-11-14',202646,11,2026,14,45,202611,2026),('2026-11-15',202647,11,2026,15,46,202611,2026),('2026-11-16',202647,11,2026,16,46,202611,2026),('2026-11-17',202647,11,2026,17,46,202611,2026),('2026-11-18',202647,11,2026,18,46,202611,2026),('2026-11-19',202647,11,2026,19,46,202611,2026),('2026-11-20',202647,11,2026,20,46,202611,2026),('2026-11-21',202647,11,2026,21,46,202611,2026),('2026-11-22',202648,11,2026,22,47,202611,2026),('2026-11-23',202648,11,2026,23,47,202611,2026),('2026-11-24',202648,11,2026,24,47,202611,2026),('2026-11-25',202648,11,2026,25,47,202611,2026),('2026-11-26',202648,11,2026,26,47,202611,2026),('2026-11-27',202648,11,2026,27,47,202611,2026),('2026-11-28',202648,11,2026,28,47,202611,2026),('2026-11-29',202649,11,2026,29,48,202611,2026),('2026-11-30',202649,11,2026,30,48,202611,2026),('2026-12-01',202649,12,2026,1,48,202612,2027),('2026-12-02',202649,12,2026,2,48,202612,2027),('2026-12-03',202649,12,2026,3,48,202612,2027),('2026-12-04',202649,12,2026,4,48,202612,2027),('2026-12-05',202649,12,2026,5,48,202612,2027),('2026-12-06',202650,12,2026,6,49,202612,2027),('2026-12-07',202650,12,2026,7,49,202612,2027),('2026-12-08',202650,12,2026,8,49,202612,2027),('2026-12-09',202650,12,2026,9,49,202612,2027),('2026-12-10',202650,12,2026,10,49,202612,2027),('2026-12-11',202650,12,2026,11,49,202612,2027),('2026-12-12',202650,12,2026,12,49,202612,2027),('2026-12-13',202651,12,2026,13,50,202612,2027),('2026-12-14',202651,12,2026,14,50,202612,2027),('2026-12-15',202651,12,2026,15,50,202612,2027),('2026-12-16',202651,12,2026,16,50,202612,2027),('2026-12-17',202651,12,2026,17,50,202612,2027),('2026-12-18',202651,12,2026,18,50,202612,2027),('2026-12-19',202651,12,2026,19,50,202612,2027),('2026-12-20',202652,12,2026,20,51,202612,2027),('2026-12-21',202652,12,2026,21,51,202612,2027),('2026-12-22',202652,12,2026,22,51,202612,2027),('2026-12-23',202652,12,2026,23,51,202612,2027),('2026-12-24',202652,12,2026,24,51,202612,2027),('2026-12-25',202652,12,2026,25,51,202612,2027),('2026-12-26',202652,12,2026,26,51,202612,2027),('2026-12-27',202653,12,2026,27,52,202612,2027),('2026-12-28',202653,12,2026,28,52,202612,2027),('2026-12-29',202653,12,2026,29,52,202612,2027),('2026-12-30',202653,12,2026,30,52,202612,2027),('2026-12-31',202653,12,2026,31,52,202612,2027),('2027-01-01',202753,1,2027,1,52,202701,2027),('2027-01-02',202753,1,2027,2,52,202701,2027),('2027-01-03',202754,1,2027,3,1,202701,2027),('2027-01-04',202701,1,2027,4,1,202701,2027),('2027-01-05',202701,1,2027,5,1,202701,2027),('2027-01-06',202701,1,2027,6,1,202701,2027),('2027-01-07',202701,1,2027,7,1,202701,2027),('2027-01-08',202701,1,2027,8,1,202701,2027),('2027-01-09',202701,1,2027,9,1,202701,2027),('2027-01-10',202702,1,2027,10,2,202701,2027),('2027-01-11',202702,1,2027,11,2,202701,2027),('2027-01-12',202702,1,2027,12,2,202701,2027),('2027-01-13',202702,1,2027,13,2,202701,2027),('2027-01-14',202702,1,2027,14,2,202701,2027),('2027-01-15',202702,1,2027,15,2,202701,2027),('2027-01-16',202702,1,2027,16,2,202701,2027),('2027-01-17',202703,1,2027,17,3,202701,2027),('2027-01-18',202703,1,2027,18,3,202701,2027),('2027-01-19',202703,1,2027,19,3,202701,2027),('2027-01-20',202703,1,2027,20,3,202701,2027),('2027-01-21',202703,1,2027,21,3,202701,2027),('2027-01-22',202703,1,2027,22,3,202701,2027),('2027-01-23',202703,1,2027,23,3,202701,2027),('2027-01-24',202704,1,2027,24,4,202701,2027),('2027-01-25',202704,1,2027,25,4,202701,2027),('2027-01-26',202704,1,2027,26,4,202701,2027),('2027-01-27',202704,1,2027,27,4,202701,2027),('2027-01-28',202704,1,2027,28,4,202701,2027),('2027-01-29',202704,1,2027,29,4,202701,2027),('2027-01-30',202704,1,2027,30,4,202701,2027),('2027-01-31',202705,1,2027,31,5,202701,2027),('2027-02-01',202705,2,2027,1,5,202702,2027),('2027-02-02',202705,2,2027,2,5,202702,2027),('2027-02-03',202705,2,2027,3,5,202702,2027),('2027-02-04',202705,2,2027,4,5,202702,2027),('2027-02-05',202705,2,2027,5,5,202702,2027),('2027-02-06',202705,2,2027,6,5,202702,2027),('2027-02-07',202706,2,2027,7,6,202702,2027),('2027-02-08',202706,2,2027,8,6,202702,2027),('2027-02-09',202706,2,2027,9,6,202702,2027),('2027-02-10',202706,2,2027,10,6,202702,2027),('2027-02-11',202706,2,2027,11,6,202702,2027),('2027-02-12',202706,2,2027,12,6,202702,2027),('2027-02-13',202706,2,2027,13,6,202702,2027),('2027-02-14',202707,2,2027,14,7,202702,2027),('2027-02-15',202707,2,2027,15,7,202702,2027),('2027-02-16',202707,2,2027,16,7,202702,2027),('2027-02-17',202707,2,2027,17,7,202702,2027),('2027-02-18',202707,2,2027,18,7,202702,2027),('2027-02-19',202707,2,2027,19,7,202702,2027),('2027-02-20',202707,2,2027,20,7,202702,2027),('2027-02-21',202708,2,2027,21,8,202702,2027),('2027-02-22',202708,2,2027,22,8,202702,2027),('2027-02-23',202708,2,2027,23,8,202702,2027),('2027-02-24',202708,2,2027,24,8,202702,2027),('2027-02-25',202708,2,2027,25,8,202702,2027),('2027-02-26',202708,2,2027,26,8,202702,2027),('2027-02-27',202708,2,2027,27,8,202702,2027),('2027-02-28',202709,2,2027,28,9,202702,2027),('2027-03-01',202709,3,2027,1,9,202703,2027),('2027-03-02',202709,3,2027,2,9,202703,2027),('2027-03-03',202709,3,2027,3,9,202703,2027),('2027-03-04',202709,3,2027,4,9,202703,2027),('2027-03-05',202709,3,2027,5,9,202703,2027),('2027-03-06',202709,3,2027,6,9,202703,2027),('2027-03-07',202710,3,2027,7,10,202703,2027),('2027-03-08',202710,3,2027,8,10,202703,2027),('2027-03-09',202710,3,2027,9,10,202703,2027),('2027-03-10',202710,3,2027,10,10,202703,2027),('2027-03-11',202710,3,2027,11,10,202703,2027),('2027-03-12',202710,3,2027,12,10,202703,2027),('2027-03-13',202710,3,2027,13,10,202703,2027),('2027-03-14',202711,3,2027,14,11,202703,2027),('2027-03-15',202711,3,2027,15,11,202703,2027),('2027-03-16',202711,3,2027,16,11,202703,2027),('2027-03-17',202711,3,2027,17,11,202703,2027),('2027-03-18',202711,3,2027,18,11,202703,2027),('2027-03-19',202711,3,2027,19,11,202703,2027),('2027-03-20',202711,3,2027,20,11,202703,2027),('2027-03-21',202712,3,2027,21,12,202703,2027),('2027-03-22',202712,3,2027,22,12,202703,2027),('2027-03-23',202712,3,2027,23,12,202703,2027),('2027-03-24',202712,3,2027,24,12,202703,2027),('2027-03-25',202712,3,2027,25,12,202703,2027),('2027-03-26',202712,3,2027,26,12,202703,2027),('2027-03-27',202712,3,2027,27,12,202703,2027),('2027-03-28',202713,3,2027,28,13,202703,2027),('2027-03-29',202713,3,2027,29,13,202703,2027),('2027-03-30',202713,3,2027,30,13,202703,2027),('2027-03-31',202713,3,2027,31,13,202703,2027),('2027-04-01',202713,4,2027,1,13,202704,2027),('2027-04-02',202713,4,2027,2,13,202704,2027),('2027-04-03',202713,4,2027,3,13,202704,2027),('2027-04-04',202714,4,2027,4,14,202704,2027),('2027-04-05',202714,4,2027,5,14,202704,2027),('2027-04-06',202714,4,2027,6,14,202704,2027),('2027-04-07',202714,4,2027,7,14,202704,2027),('2027-04-08',202714,4,2027,8,14,202704,2027),('2027-04-09',202714,4,2027,9,14,202704,2027),('2027-04-10',202714,4,2027,10,14,202704,2027),('2027-04-11',202715,4,2027,11,15,202704,2027),('2027-04-12',202715,4,2027,12,15,202704,2027),('2027-04-13',202715,4,2027,13,15,202704,2027),('2027-04-14',202715,4,2027,14,15,202704,2027),('2027-04-15',202715,4,2027,15,15,202704,2027),('2027-04-16',202715,4,2027,16,15,202704,2027),('2027-04-17',202715,4,2027,17,15,202704,2027),('2027-04-18',202716,4,2027,18,16,202704,2027),('2027-04-19',202716,4,2027,19,16,202704,2027),('2027-04-20',202716,4,2027,20,16,202704,2027),('2027-04-21',202716,4,2027,21,16,202704,2027),('2027-04-22',202716,4,2027,22,16,202704,2027),('2027-04-23',202716,4,2027,23,16,202704,2027),('2027-04-24',202716,4,2027,24,16,202704,2027),('2027-04-25',202717,4,2027,25,17,202704,2027),('2027-04-26',202717,4,2027,26,17,202704,2027),('2027-04-27',202717,4,2027,27,17,202704,2027),('2027-04-28',202717,4,2027,28,17,202704,2027),('2027-04-29',202717,4,2027,29,17,202704,2027),('2027-04-30',202717,4,2027,30,17,202704,2027),('2027-05-01',202717,5,2027,1,17,202705,2027),('2027-05-02',202718,5,2027,2,18,202705,2027),('2027-05-03',202718,5,2027,3,18,202705,2027),('2027-05-04',202718,5,2027,4,18,202705,2027),('2027-05-05',202718,5,2027,5,18,202705,2027),('2027-05-06',202718,5,2027,6,18,202705,2027),('2027-05-07',202718,5,2027,7,18,202705,2027),('2027-05-08',202718,5,2027,8,18,202705,2027),('2027-05-09',202719,5,2027,9,19,202705,2027),('2027-05-10',202719,5,2027,10,19,202705,2027),('2027-05-11',202719,5,2027,11,19,202705,2027),('2027-05-12',202719,5,2027,12,19,202705,2027),('2027-05-13',202719,5,2027,13,19,202705,2027),('2027-05-14',202719,5,2027,14,19,202705,2027),('2027-05-15',202719,5,2027,15,19,202705,2027),('2027-05-16',202720,5,2027,16,20,202705,2027),('2027-05-17',202720,5,2027,17,20,202705,2027),('2027-05-18',202720,5,2027,18,20,202705,2027),('2027-05-19',202720,5,2027,19,20,202705,2027),('2027-05-20',202720,5,2027,20,20,202705,2027),('2027-05-21',202720,5,2027,21,20,202705,2027),('2027-05-22',202720,5,2027,22,20,202705,2027),('2027-05-23',202721,5,2027,23,21,202705,2027),('2027-05-24',202721,5,2027,24,21,202705,2027),('2027-05-25',202721,5,2027,25,21,202705,2027),('2027-05-26',202721,5,2027,26,21,202705,2027),('2027-05-27',202721,5,2027,27,21,202705,2027),('2027-05-28',202721,5,2027,28,21,202705,2027),('2027-05-29',202721,5,2027,29,21,202705,2027),('2027-05-30',202722,5,2027,30,22,202705,2027),('2027-05-31',202722,5,2027,31,22,202705,2027),('2027-06-01',202722,6,2027,1,22,202706,2027),('2027-06-02',202722,6,2027,2,22,202706,2027),('2027-06-03',202722,6,2027,3,22,202706,2027),('2027-06-04',202722,6,2027,4,22,202706,2027),('2027-06-05',202722,6,2027,5,22,202706,2027),('2027-06-06',202723,6,2027,6,23,202706,2027),('2027-06-07',202723,6,2027,7,23,202706,2027),('2027-06-08',202723,6,2027,8,23,202706,2027),('2027-06-09',202723,6,2027,9,23,202706,2027),('2027-06-10',202723,6,2027,10,23,202706,2027),('2027-06-11',202723,6,2027,11,23,202706,2027),('2027-06-12',202723,6,2027,12,23,202706,2027),('2027-06-13',202724,6,2027,13,24,202706,2027),('2027-06-14',202724,6,2027,14,24,202706,2027),('2027-06-15',202724,6,2027,15,24,202706,2027),('2027-06-16',202724,6,2027,16,24,202706,2027),('2027-06-17',202724,6,2027,17,24,202706,2027),('2027-06-18',202724,6,2027,18,24,202706,2027),('2027-06-19',202724,6,2027,19,24,202706,2027),('2027-06-20',202725,6,2027,20,25,202706,2027),('2027-06-21',202725,6,2027,21,25,202706,2027),('2027-06-22',202725,6,2027,22,25,202706,2027),('2027-06-23',202725,6,2027,23,25,202706,2027),('2027-06-24',202725,6,2027,24,25,202706,2027),('2027-06-25',202725,6,2027,25,25,202706,2027),('2027-06-26',202725,6,2027,26,25,202706,2027),('2027-06-27',202726,6,2027,27,26,202706,2027),('2027-06-28',202726,6,2027,28,26,202706,2027),('2027-06-29',202726,6,2027,29,26,202706,2027),('2027-06-30',202726,6,2027,30,26,202706,2027),('2027-07-01',202726,7,2027,1,26,202707,2027),('2027-07-02',202726,7,2027,2,26,202707,2027),('2027-07-03',202726,7,2027,3,26,202707,2027),('2027-07-04',202727,7,2027,4,27,202707,2027),('2027-07-05',202727,7,2027,5,27,202707,2027),('2027-07-06',202727,7,2027,6,27,202707,2027),('2027-07-07',202727,7,2027,7,27,202707,2027),('2027-07-08',202727,7,2027,8,27,202707,2027),('2027-07-09',202727,7,2027,9,27,202707,2027),('2027-07-10',202727,7,2027,10,27,202707,2027),('2027-07-11',202728,7,2027,11,28,202707,2027),('2027-07-12',202728,7,2027,12,28,202707,2027),('2027-07-13',202728,7,2027,13,28,202707,2027),('2027-07-14',202728,7,2027,14,28,202707,2027),('2027-07-15',202728,7,2027,15,28,202707,2027),('2027-07-16',202728,7,2027,16,28,202707,2027),('2027-07-17',202728,7,2027,17,28,202707,2027),('2027-07-18',202729,7,2027,18,29,202707,2027),('2027-07-19',202729,7,2027,19,29,202707,2027),('2027-07-20',202729,7,2027,20,29,202707,2027),('2027-07-21',202729,7,2027,21,29,202707,2027),('2027-07-22',202729,7,2027,22,29,202707,2027),('2027-07-23',202729,7,2027,23,29,202707,2027),('2027-07-24',202729,7,2027,24,29,202707,2027),('2027-07-25',202730,7,2027,25,30,202707,2027),('2027-07-26',202730,7,2027,26,30,202707,2027),('2027-07-27',202730,7,2027,27,30,202707,2027),('2027-07-28',202730,7,2027,28,30,202707,2027),('2027-07-29',202730,7,2027,29,30,202707,2027),('2027-07-30',202730,7,2027,30,30,202707,2027),('2027-07-31',202730,7,2027,31,30,202707,2027),('2027-08-01',202731,8,2027,1,31,202708,2027),('2027-08-02',202731,8,2027,2,31,202708,2027),('2027-08-03',202731,8,2027,3,31,202708,2027),('2027-08-04',202731,8,2027,4,31,202708,2027),('2027-08-05',202731,8,2027,5,31,202708,2027),('2027-08-06',202731,8,2027,6,31,202708,2027),('2027-08-07',202731,8,2027,7,31,202708,2027),('2027-08-08',202732,8,2027,8,32,202708,2027),('2027-08-09',202732,8,2027,9,32,202708,2027),('2027-08-10',202732,8,2027,10,32,202708,2027),('2027-08-11',202732,8,2027,11,32,202708,2027),('2027-08-12',202732,8,2027,12,32,202708,2027),('2027-08-13',202732,8,2027,13,32,202708,2027),('2027-08-14',202732,8,2027,14,32,202708,2027),('2027-08-15',202733,8,2027,15,33,202708,2027),('2027-08-16',202733,8,2027,16,33,202708,2027),('2027-08-17',202733,8,2027,17,33,202708,2027),('2027-08-18',202733,8,2027,18,33,202708,2027),('2027-08-19',202733,8,2027,19,33,202708,2027),('2027-08-20',202733,8,2027,20,33,202708,2027),('2027-08-21',202733,8,2027,21,33,202708,2027),('2027-08-22',202734,8,2027,22,34,202708,2027),('2027-08-23',202734,8,2027,23,34,202708,2027),('2027-08-24',202734,8,2027,24,34,202708,2027),('2027-08-25',202734,8,2027,25,34,202708,2027),('2027-08-26',202734,8,2027,26,34,202708,2027),('2027-08-27',202734,8,2027,27,34,202708,2027),('2027-08-28',202734,8,2027,28,34,202708,2027),('2027-08-29',202735,8,2027,29,35,202708,2027),('2027-08-30',202735,8,2027,30,35,202708,2027),('2027-08-31',202735,8,2027,31,35,202708,2027),('2027-09-01',202735,9,2027,1,35,202709,2027),('2027-09-02',202735,9,2027,2,35,202709,2027),('2027-09-03',202735,9,2027,3,35,202709,2027),('2027-09-04',202735,9,2027,4,35,202709,2027),('2027-09-05',202736,9,2027,5,36,202709,2027),('2027-09-06',202736,9,2027,6,36,202709,2027),('2027-09-07',202736,9,2027,7,36,202709,2027),('2027-09-08',202736,9,2027,8,36,202709,2027),('2027-09-09',202736,9,2027,9,36,202709,2027),('2027-09-10',202736,9,2027,10,36,202709,2027),('2027-09-11',202736,9,2027,11,36,202709,2027),('2027-09-12',202737,9,2027,12,37,202709,2027),('2027-09-13',202737,9,2027,13,37,202709,2027),('2027-09-14',202737,9,2027,14,37,202709,2027),('2027-09-15',202737,9,2027,15,37,202709,2027),('2027-09-16',202737,9,2027,16,37,202709,2027),('2027-09-17',202737,9,2027,17,37,202709,2027),('2027-09-18',202737,9,2027,18,37,202709,2027),('2027-09-19',202738,9,2027,19,38,202709,2027),('2027-09-20',202738,9,2027,20,38,202709,2027),('2027-09-21',202738,9,2027,21,38,202709,2027),('2027-09-22',202738,9,2027,22,38,202709,2027),('2027-09-23',202738,9,2027,23,38,202709,2027),('2027-09-24',202738,9,2027,24,38,202709,2027),('2027-09-25',202738,9,2027,25,38,202709,2027),('2027-09-26',202739,9,2027,26,39,202709,2027),('2027-09-27',202739,9,2027,27,39,202709,2027),('2027-09-28',202739,9,2027,28,39,202709,2027),('2027-09-29',202739,9,2027,29,39,202709,2027),('2027-09-30',202739,9,2027,30,39,202709,2027),('2027-10-01',202739,10,2027,1,39,202710,2027),('2027-10-02',202739,10,2027,2,39,202710,2027),('2027-10-03',202740,10,2027,3,40,202710,2027),('2027-10-04',202740,10,2027,4,40,202710,2027),('2027-10-05',202740,10,2027,5,40,202710,2027),('2027-10-06',202740,10,2027,6,40,202710,2027),('2027-10-07',202740,10,2027,7,40,202710,2027),('2027-10-08',202740,10,2027,8,40,202710,2027),('2027-10-09',202740,10,2027,9,40,202710,2027),('2027-10-10',202741,10,2027,10,41,202710,2027),('2027-10-11',202741,10,2027,11,41,202710,2027),('2027-10-12',202741,10,2027,12,41,202710,2027),('2027-10-13',202741,10,2027,13,41,202710,2027),('2027-10-14',202741,10,2027,14,41,202710,2027),('2027-10-15',202741,10,2027,15,41,202710,2027),('2027-10-16',202741,10,2027,16,41,202710,2027),('2027-10-17',202742,10,2027,17,42,202710,2027),('2027-10-18',202742,10,2027,18,42,202710,2027),('2027-10-19',202742,10,2027,19,42,202710,2027),('2027-10-20',202742,10,2027,20,42,202710,2027),('2027-10-21',202742,10,2027,21,42,202710,2027),('2027-10-22',202742,10,2027,22,42,202710,2027),('2027-10-23',202742,10,2027,23,42,202710,2027),('2027-10-24',202743,10,2027,24,43,202710,2027),('2027-10-25',202743,10,2027,25,43,202710,2027),('2027-10-26',202743,10,2027,26,43,202710,2027),('2027-10-27',202743,10,2027,27,43,202710,2027),('2027-10-28',202743,10,2027,28,43,202710,2027),('2027-10-29',202743,10,2027,29,43,202710,2027),('2027-10-30',202743,10,2027,30,43,202710,2027),('2027-10-31',202744,10,2027,31,44,202710,2027),('2027-11-01',202744,11,2027,1,44,202711,2027),('2027-11-02',202744,11,2027,2,44,202711,2027),('2027-11-03',202744,11,2027,3,44,202711,2027),('2027-11-04',202744,11,2027,4,44,202711,2027),('2027-11-05',202744,11,2027,5,44,202711,2027),('2027-11-06',202744,11,2027,6,44,202711,2027),('2027-11-07',202745,11,2027,7,45,202711,2027),('2027-11-08',202745,11,2027,8,45,202711,2027),('2027-11-09',202745,11,2027,9,45,202711,2027),('2027-11-10',202745,11,2027,10,45,202711,2027),('2027-11-11',202745,11,2027,11,45,202711,2027),('2027-11-12',202745,11,2027,12,45,202711,2027),('2027-11-13',202745,11,2027,13,45,202711,2027),('2027-11-14',202746,11,2027,14,46,202711,2027),('2027-11-15',202746,11,2027,15,46,202711,2027),('2027-11-16',202746,11,2027,16,46,202711,2027),('2027-11-17',202746,11,2027,17,46,202711,2027),('2027-11-18',202746,11,2027,18,46,202711,2027),('2027-11-19',202746,11,2027,19,46,202711,2027),('2027-11-20',202746,11,2027,20,46,202711,2027),('2027-11-21',202747,11,2027,21,47,202711,2027),('2027-11-22',202747,11,2027,22,47,202711,2027),('2027-11-23',202747,11,2027,23,47,202711,2027),('2027-11-24',202747,11,2027,24,47,202711,2027),('2027-11-25',202747,11,2027,25,47,202711,2027),('2027-11-26',202747,11,2027,26,47,202711,2027),('2027-11-27',202747,11,2027,27,47,202711,2027),('2027-11-28',202748,11,2027,28,48,202711,2027),('2027-11-29',202748,11,2027,29,48,202711,2027),('2027-11-30',202748,11,2027,30,48,202711,2027),('2027-12-01',202748,12,2027,1,48,202712,2028),('2027-12-02',202748,12,2027,2,48,202712,2028),('2027-12-03',202748,12,2027,3,48,202712,2028),('2027-12-04',202748,12,2027,4,48,202712,2028),('2027-12-05',202749,12,2027,5,49,202712,2028),('2027-12-06',202749,12,2027,6,49,202712,2028),('2027-12-07',202749,12,2027,7,49,202712,2028),('2027-12-08',202749,12,2027,8,49,202712,2028),('2027-12-09',202749,12,2027,9,49,202712,2028),('2027-12-10',202749,12,2027,10,49,202712,2028),('2027-12-11',202749,12,2027,11,49,202712,2028),('2027-12-12',202750,12,2027,12,50,202712,2028),('2027-12-13',202750,12,2027,13,50,202712,2028),('2027-12-14',202750,12,2027,14,50,202712,2028),('2027-12-15',202750,12,2027,15,50,202712,2028),('2027-12-16',202750,12,2027,16,50,202712,2028),('2027-12-17',202750,12,2027,17,50,202712,2028),('2027-12-18',202750,12,2027,18,50,202712,2028),('2027-12-19',202751,12,2027,19,51,202712,2028),('2027-12-20',202751,12,2027,20,51,202712,2028),('2027-12-21',202751,12,2027,21,51,202712,2028),('2027-12-22',202751,12,2027,22,51,202712,2028),('2027-12-23',202751,12,2027,23,51,202712,2028),('2027-12-24',202751,12,2027,24,51,202712,2028),('2027-12-25',202751,12,2027,25,51,202712,2028),('2027-12-26',202752,12,2027,26,52,202712,2028),('2027-12-27',202752,12,2027,27,52,202712,2028),('2027-12-28',202752,12,2027,28,52,202712,2028),('2027-12-29',202752,12,2027,29,52,202712,2028),('2027-12-30',202752,12,2027,30,52,202712,2028),('2027-12-31',202752,12,2027,31,52,202712,2028),('2028-01-01',202852,1,2028,1,52,202801,2028),('2028-01-02',202853,1,2028,2,1,202801,2028),('2028-01-03',202801,1,2028,3,1,202801,2028),('2028-01-04',202801,1,2028,4,1,202801,2028),('2028-01-05',202801,1,2028,5,1,202801,2028),('2028-01-06',202801,1,2028,6,1,202801,2028),('2028-01-07',202801,1,2028,7,1,202801,2028),('2028-01-08',202801,1,2028,8,1,202801,2028),('2028-01-09',202802,1,2028,9,2,202801,2028),('2028-01-10',202802,1,2028,10,2,202801,2028),('2028-01-11',202802,1,2028,11,2,202801,2028),('2028-01-12',202802,1,2028,12,2,202801,2028),('2028-01-13',202802,1,2028,13,2,202801,2028),('2028-01-14',202802,1,2028,14,2,202801,2028),('2028-01-15',202802,1,2028,15,2,202801,2028),('2028-01-16',202803,1,2028,16,3,202801,2028),('2028-01-17',202803,1,2028,17,3,202801,2028),('2028-01-18',202803,1,2028,18,3,202801,2028),('2028-01-19',202803,1,2028,19,3,202801,2028),('2028-01-20',202803,1,2028,20,3,202801,2028),('2028-01-21',202803,1,2028,21,3,202801,2028),('2028-01-22',202803,1,2028,22,3,202801,2028),('2028-01-23',202804,1,2028,23,4,202801,2028),('2028-01-24',202804,1,2028,24,4,202801,2028),('2028-01-25',202804,1,2028,25,4,202801,2028),('2028-01-26',202804,1,2028,26,4,202801,2028),('2028-01-27',202804,1,2028,27,4,202801,2028),('2028-01-28',202804,1,2028,28,4,202801,2028),('2028-01-29',202804,1,2028,29,4,202801,2028),('2028-01-30',202805,1,2028,30,5,202801,2028),('2028-01-31',202805,1,2028,31,5,202801,2028),('2028-02-01',202805,2,2028,1,5,202802,2028),('2028-02-02',202805,2,2028,2,5,202802,2028),('2028-02-03',202805,2,2028,3,5,202802,2028),('2028-02-04',202805,2,2028,4,5,202802,2028),('2028-02-05',202805,2,2028,5,5,202802,2028),('2028-02-06',202806,2,2028,6,6,202802,2028),('2028-02-07',202806,2,2028,7,6,202802,2028),('2028-02-08',202806,2,2028,8,6,202802,2028),('2028-02-09',202806,2,2028,9,6,202802,2028),('2028-02-10',202806,2,2028,10,6,202802,2028),('2028-02-11',202806,2,2028,11,6,202802,2028),('2028-02-12',202806,2,2028,12,6,202802,2028),('2028-02-13',202807,2,2028,13,7,202802,2028),('2028-02-14',202807,2,2028,14,7,202802,2028),('2028-02-15',202807,2,2028,15,7,202802,2028),('2028-02-16',202807,2,2028,16,7,202802,2028),('2028-02-17',202807,2,2028,17,7,202802,2028),('2028-02-18',202807,2,2028,18,7,202802,2028),('2028-02-19',202807,2,2028,19,7,202802,2028),('2028-02-20',202808,2,2028,20,8,202802,2028),('2028-02-21',202808,2,2028,21,8,202802,2028),('2028-02-22',202808,2,2028,22,8,202802,2028),('2028-02-23',202808,2,2028,23,8,202802,2028),('2028-02-24',202808,2,2028,24,8,202802,2028),('2028-02-25',202808,2,2028,25,8,202802,2028),('2028-02-26',202808,2,2028,26,8,202802,2028),('2028-02-27',202809,2,2028,27,9,202802,2028),('2028-02-28',202809,2,2028,28,9,202802,2028),('2028-02-29',202809,2,2028,29,9,202802,2028),('2028-03-01',202809,3,2028,1,9,202803,2028),('2028-03-02',202809,3,2028,2,9,202803,2028),('2028-03-03',202809,3,2028,3,9,202803,2028),('2028-03-04',202809,3,2028,4,9,202803,2028),('2028-03-05',202810,3,2028,5,10,202803,2028),('2028-03-06',202810,3,2028,6,10,202803,2028),('2028-03-07',202810,3,2028,7,10,202803,2028),('2028-03-08',202810,3,2028,8,10,202803,2028),('2028-03-09',202810,3,2028,9,10,202803,2028),('2028-03-10',202810,3,2028,10,10,202803,2028),('2028-03-11',202810,3,2028,11,10,202803,2028),('2028-03-12',202811,3,2028,12,11,202803,2028),('2028-03-13',202811,3,2028,13,11,202803,2028),('2028-03-14',202811,3,2028,14,11,202803,2028),('2028-03-15',202811,3,2028,15,11,202803,2028),('2028-03-16',202811,3,2028,16,11,202803,2028),('2028-03-17',202811,3,2028,17,11,202803,2028),('2028-03-18',202811,3,2028,18,11,202803,2028),('2028-03-19',202812,3,2028,19,12,202803,2028),('2028-03-20',202812,3,2028,20,12,202803,2028),('2028-03-21',202812,3,2028,21,12,202803,2028),('2028-03-22',202812,3,2028,22,12,202803,2028),('2028-03-23',202812,3,2028,23,12,202803,2028),('2028-03-24',202812,3,2028,24,12,202803,2028),('2028-03-25',202812,3,2028,25,12,202803,2028),('2028-03-26',202813,3,2028,26,13,202803,2028),('2028-03-27',202813,3,2028,27,13,202803,2028),('2028-03-28',202813,3,2028,28,13,202803,2028),('2028-03-29',202813,3,2028,29,13,202803,2028),('2028-03-30',202813,3,2028,30,13,202803,2028),('2028-03-31',202813,3,2028,31,13,202803,2028),('2028-04-01',202813,4,2028,1,13,202804,2028),('2028-04-02',202814,4,2028,2,14,202804,2028),('2028-04-03',202814,4,2028,3,14,202804,2028),('2028-04-04',202814,4,2028,4,14,202804,2028),('2028-04-05',202814,4,2028,5,14,202804,2028),('2028-04-06',202814,4,2028,6,14,202804,2028),('2028-04-07',202814,4,2028,7,14,202804,2028),('2028-04-08',202814,4,2028,8,14,202804,2028),('2028-04-09',202815,4,2028,9,15,202804,2028),('2028-04-10',202815,4,2028,10,15,202804,2028),('2028-04-11',202815,4,2028,11,15,202804,2028),('2028-04-12',202815,4,2028,12,15,202804,2028),('2028-04-13',202815,4,2028,13,15,202804,2028),('2028-04-14',202815,4,2028,14,15,202804,2028),('2028-04-15',202815,4,2028,15,15,202804,2028),('2028-04-16',202816,4,2028,16,16,202804,2028),('2028-04-17',202816,4,2028,17,16,202804,2028),('2028-04-18',202816,4,2028,18,16,202804,2028),('2028-04-19',202816,4,2028,19,16,202804,2028),('2028-04-20',202816,4,2028,20,16,202804,2028),('2028-04-21',202816,4,2028,21,16,202804,2028),('2028-04-22',202816,4,2028,22,16,202804,2028),('2028-04-23',202817,4,2028,23,17,202804,2028),('2028-04-24',202817,4,2028,24,17,202804,2028),('2028-04-25',202817,4,2028,25,17,202804,2028),('2028-04-26',202817,4,2028,26,17,202804,2028),('2028-04-27',202817,4,2028,27,17,202804,2028),('2028-04-28',202817,4,2028,28,17,202804,2028),('2028-04-29',202817,4,2028,29,17,202804,2028),('2028-04-30',202818,4,2028,30,18,202804,2028),('2028-05-01',202818,5,2028,1,18,202805,2028),('2028-05-02',202818,5,2028,2,18,202805,2028),('2028-05-03',202818,5,2028,3,18,202805,2028),('2028-05-04',202818,5,2028,4,18,202805,2028),('2028-05-05',202818,5,2028,5,18,202805,2028),('2028-05-06',202818,5,2028,6,18,202805,2028),('2028-05-07',202819,5,2028,7,19,202805,2028),('2028-05-08',202819,5,2028,8,19,202805,2028),('2028-05-09',202819,5,2028,9,19,202805,2028),('2028-05-10',202819,5,2028,10,19,202805,2028),('2028-05-11',202819,5,2028,11,19,202805,2028),('2028-05-12',202819,5,2028,12,19,202805,2028),('2028-05-13',202819,5,2028,13,19,202805,2028),('2028-05-14',202820,5,2028,14,20,202805,2028),('2028-05-15',202820,5,2028,15,20,202805,2028),('2028-05-16',202820,5,2028,16,20,202805,2028),('2028-05-17',202820,5,2028,17,20,202805,2028),('2028-05-18',202820,5,2028,18,20,202805,2028),('2028-05-19',202820,5,2028,19,20,202805,2028),('2028-05-20',202820,5,2028,20,20,202805,2028),('2028-05-21',202821,5,2028,21,21,202805,2028),('2028-05-22',202821,5,2028,22,21,202805,2028),('2028-05-23',202821,5,2028,23,21,202805,2028),('2028-05-24',202821,5,2028,24,21,202805,2028),('2028-05-25',202821,5,2028,25,21,202805,2028),('2028-05-26',202821,5,2028,26,21,202805,2028),('2028-05-27',202821,5,2028,27,21,202805,2028),('2028-05-28',202822,5,2028,28,22,202805,2028),('2028-05-29',202822,5,2028,29,22,202805,2028),('2028-05-30',202822,5,2028,30,22,202805,2028),('2028-05-31',202822,5,2028,31,22,202805,2028),('2028-06-01',202822,6,2028,1,22,202806,2028),('2028-06-02',202822,6,2028,2,22,202806,2028),('2028-06-03',202822,6,2028,3,22,202806,2028),('2028-06-04',202823,6,2028,4,23,202806,2028),('2028-06-05',202823,6,2028,5,23,202806,2028),('2028-06-06',202823,6,2028,6,23,202806,2028),('2028-06-07',202823,6,2028,7,23,202806,2028),('2028-06-08',202823,6,2028,8,23,202806,2028),('2028-06-09',202823,6,2028,9,23,202806,2028),('2028-06-10',202823,6,2028,10,23,202806,2028),('2028-06-11',202824,6,2028,11,24,202806,2028),('2028-06-12',202824,6,2028,12,24,202806,2028),('2028-06-13',202824,6,2028,13,24,202806,2028),('2028-06-14',202824,6,2028,14,24,202806,2028),('2028-06-15',202824,6,2028,15,24,202806,2028),('2028-06-16',202824,6,2028,16,24,202806,2028),('2028-06-17',202824,6,2028,17,24,202806,2028),('2028-06-18',202825,6,2028,18,25,202806,2028),('2028-06-19',202825,6,2028,19,25,202806,2028),('2028-06-20',202825,6,2028,20,25,202806,2028),('2028-06-21',202825,6,2028,21,25,202806,2028),('2028-06-22',202825,6,2028,22,25,202806,2028),('2028-06-23',202825,6,2028,23,25,202806,2028),('2028-06-24',202825,6,2028,24,25,202806,2028),('2028-06-25',202826,6,2028,25,26,202806,2028),('2028-06-26',202826,6,2028,26,26,202806,2028),('2028-06-27',202826,6,2028,27,26,202806,2028),('2028-06-28',202826,6,2028,28,26,202806,2028),('2028-06-29',202826,6,2028,29,26,202806,2028),('2028-06-30',202826,6,2028,30,26,202806,2028),('2028-07-01',202826,7,2028,1,26,202807,2028),('2028-07-02',202827,7,2028,2,27,202807,2028),('2028-07-03',202827,7,2028,3,27,202807,2028),('2028-07-04',202827,7,2028,4,27,202807,2028),('2028-07-05',202827,7,2028,5,27,202807,2028),('2028-07-06',202827,7,2028,6,27,202807,2028),('2028-07-07',202827,7,2028,7,27,202807,2028),('2028-07-08',202827,7,2028,8,27,202807,2028),('2028-07-09',202828,7,2028,9,28,202807,2028),('2028-07-10',202828,7,2028,10,28,202807,2028),('2028-07-11',202828,7,2028,11,28,202807,2028),('2028-07-12',202828,7,2028,12,28,202807,2028),('2028-07-13',202828,7,2028,13,28,202807,2028),('2028-07-14',202828,7,2028,14,28,202807,2028),('2028-07-15',202828,7,2028,15,28,202807,2028),('2028-07-16',202829,7,2028,16,29,202807,2028),('2028-07-17',202829,7,2028,17,29,202807,2028),('2028-07-18',202829,7,2028,18,29,202807,2028),('2028-07-19',202829,7,2028,19,29,202807,2028),('2028-07-20',202829,7,2028,20,29,202807,2028),('2028-07-21',202829,7,2028,21,29,202807,2028),('2028-07-22',202829,7,2028,22,29,202807,2028),('2028-07-23',202830,7,2028,23,30,202807,2028),('2028-07-24',202830,7,2028,24,30,202807,2028),('2028-07-25',202830,7,2028,25,30,202807,2028),('2028-07-26',202830,7,2028,26,30,202807,2028),('2028-07-27',202830,7,2028,27,30,202807,2028),('2028-07-28',202830,7,2028,28,30,202807,2028),('2028-07-29',202830,7,2028,29,30,202807,2028),('2028-07-30',202831,7,2028,30,31,202807,2028),('2028-07-31',202831,7,2028,31,31,202807,2028),('2028-08-01',202831,8,2028,1,31,202808,2028),('2028-08-02',202831,8,2028,2,31,202808,2028),('2028-08-03',202831,8,2028,3,31,202808,2028),('2028-08-04',202831,8,2028,4,31,202808,2028),('2028-08-05',202831,8,2028,5,31,202808,2028),('2028-08-06',202832,8,2028,6,32,202808,2028),('2028-08-07',202832,8,2028,7,32,202808,2028),('2028-08-08',202832,8,2028,8,32,202808,2028),('2028-08-09',202832,8,2028,9,32,202808,2028),('2028-08-10',202832,8,2028,10,32,202808,2028),('2028-08-11',202832,8,2028,11,32,202808,2028),('2028-08-12',202832,8,2028,12,32,202808,2028),('2028-08-13',202833,8,2028,13,33,202808,2028),('2028-08-14',202833,8,2028,14,33,202808,2028),('2028-08-15',202833,8,2028,15,33,202808,2028),('2028-08-16',202833,8,2028,16,33,202808,2028),('2028-08-17',202833,8,2028,17,33,202808,2028),('2028-08-18',202833,8,2028,18,33,202808,2028),('2028-08-19',202833,8,2028,19,33,202808,2028),('2028-08-20',202834,8,2028,20,34,202808,2028),('2028-08-21',202834,8,2028,21,34,202808,2028),('2028-08-22',202834,8,2028,22,34,202808,2028),('2028-08-23',202834,8,2028,23,34,202808,2028),('2028-08-24',202834,8,2028,24,34,202808,2028),('2028-08-25',202834,8,2028,25,34,202808,2028),('2028-08-26',202834,8,2028,26,34,202808,2028),('2028-08-27',202835,8,2028,27,35,202808,2028),('2028-08-28',202835,8,2028,28,35,202808,2028),('2028-08-29',202835,8,2028,29,35,202808,2028),('2028-08-30',202835,8,2028,30,35,202808,2028),('2028-08-31',202835,8,2028,31,35,202808,2028),('2028-09-01',202835,9,2028,1,35,202809,2028),('2028-09-02',202835,9,2028,2,35,202809,2028),('2028-09-03',202836,9,2028,3,36,202809,2028),('2028-09-04',202836,9,2028,4,36,202809,2028),('2028-09-05',202836,9,2028,5,36,202809,2028),('2028-09-06',202836,9,2028,6,36,202809,2028),('2028-09-07',202836,9,2028,7,36,202809,2028),('2028-09-08',202836,9,2028,8,36,202809,2028),('2028-09-09',202836,9,2028,9,36,202809,2028),('2028-09-10',202837,9,2028,10,37,202809,2028),('2028-09-11',202837,9,2028,11,37,202809,2028),('2028-09-12',202837,9,2028,12,37,202809,2028),('2028-09-13',202837,9,2028,13,37,202809,2028),('2028-09-14',202837,9,2028,14,37,202809,2028),('2028-09-15',202837,9,2028,15,37,202809,2028),('2028-09-16',202837,9,2028,16,37,202809,2028),('2028-09-17',202838,9,2028,17,38,202809,2028),('2028-09-18',202838,9,2028,18,38,202809,2028),('2028-09-19',202838,9,2028,19,38,202809,2028),('2028-09-20',202838,9,2028,20,38,202809,2028),('2028-09-21',202838,9,2028,21,38,202809,2028),('2028-09-22',202838,9,2028,22,38,202809,2028),('2028-09-23',202838,9,2028,23,38,202809,2028),('2028-09-24',202839,9,2028,24,39,202809,2028),('2028-09-25',202839,9,2028,25,39,202809,2028),('2028-09-26',202839,9,2028,26,39,202809,2028),('2028-09-27',202839,9,2028,27,39,202809,2028),('2028-09-28',202839,9,2028,28,39,202809,2028),('2028-09-29',202839,9,2028,29,39,202809,2028),('2028-09-30',202839,9,2028,30,39,202809,2028),('2028-10-01',202840,10,2028,1,40,202810,2028),('2028-10-02',202840,10,2028,2,40,202810,2028),('2028-10-03',202840,10,2028,3,40,202810,2028),('2028-10-04',202840,10,2028,4,40,202810,2028),('2028-10-05',202840,10,2028,5,40,202810,2028),('2028-10-06',202840,10,2028,6,40,202810,2028),('2028-10-07',202840,10,2028,7,40,202810,2028),('2028-10-08',202841,10,2028,8,41,202810,2028),('2028-10-09',202841,10,2028,9,41,202810,2028),('2028-10-10',202841,10,2028,10,41,202810,2028),('2028-10-11',202841,10,2028,11,41,202810,2028),('2028-10-12',202841,10,2028,12,41,202810,2028),('2028-10-13',202841,10,2028,13,41,202810,2028),('2028-10-14',202841,10,2028,14,41,202810,2028),('2028-10-15',202842,10,2028,15,42,202810,2028),('2028-10-16',202842,10,2028,16,42,202810,2028),('2028-10-17',202842,10,2028,17,42,202810,2028),('2028-10-18',202842,10,2028,18,42,202810,2028),('2028-10-19',202842,10,2028,19,42,202810,2028),('2028-10-20',202842,10,2028,20,42,202810,2028),('2028-10-21',202842,10,2028,21,42,202810,2028),('2028-10-22',202843,10,2028,22,43,202810,2028),('2028-10-23',202843,10,2028,23,43,202810,2028),('2028-10-24',202843,10,2028,24,43,202810,2028),('2028-10-25',202843,10,2028,25,43,202810,2028),('2028-10-26',202843,10,2028,26,43,202810,2028),('2028-10-27',202843,10,2028,27,43,202810,2028),('2028-10-28',202843,10,2028,28,43,202810,2028),('2028-10-29',202844,10,2028,29,44,202810,2028),('2028-10-30',202844,10,2028,30,44,202810,2028),('2028-10-31',202844,10,2028,31,44,202810,2028),('2028-11-01',202844,11,2028,1,44,202811,2028),('2028-11-02',202844,11,2028,2,44,202811,2028),('2028-11-03',202844,11,2028,3,44,202811,2028),('2028-11-04',202844,11,2028,4,44,202811,2028),('2028-11-05',202845,11,2028,5,45,202811,2028),('2028-11-06',202845,11,2028,6,45,202811,2028),('2028-11-07',202845,11,2028,7,45,202811,2028),('2028-11-08',202845,11,2028,8,45,202811,2028),('2028-11-09',202845,11,2028,9,45,202811,2028),('2028-11-10',202845,11,2028,10,45,202811,2028),('2028-11-11',202845,11,2028,11,45,202811,2028),('2028-11-12',202846,11,2028,12,46,202811,2028),('2028-11-13',202846,11,2028,13,46,202811,2028),('2028-11-14',202846,11,2028,14,46,202811,2028),('2028-11-15',202846,11,2028,15,46,202811,2028),('2028-11-16',202846,11,2028,16,46,202811,2028),('2028-11-17',202846,11,2028,17,46,202811,2028),('2028-11-18',202846,11,2028,18,46,202811,2028),('2028-11-19',202847,11,2028,19,47,202811,2028),('2028-11-20',202847,11,2028,20,47,202811,2028),('2028-11-21',202847,11,2028,21,47,202811,2028),('2028-11-22',202847,11,2028,22,47,202811,2028),('2028-11-23',202847,11,2028,23,47,202811,2028),('2028-11-24',202847,11,2028,24,47,202811,2028),('2028-11-25',202847,11,2028,25,47,202811,2028),('2028-11-26',202848,11,2028,26,48,202811,2028),('2028-11-27',202848,11,2028,27,48,202811,2028),('2028-11-28',202848,11,2028,28,48,202811,2028),('2028-11-29',202848,11,2028,29,48,202811,2028),('2028-11-30',202848,11,2028,30,48,202811,2028),('2028-12-01',202848,12,2028,1,48,202812,2029),('2028-12-02',202848,12,2028,2,48,202812,2029),('2028-12-03',202849,12,2028,3,49,202812,2029),('2028-12-04',202849,12,2028,4,49,202812,2029),('2028-12-05',202849,12,2028,5,49,202812,2029),('2028-12-06',202849,12,2028,6,49,202812,2029),('2028-12-07',202849,12,2028,7,49,202812,2029),('2028-12-08',202849,12,2028,8,49,202812,2029),('2028-12-09',202849,12,2028,9,49,202812,2029),('2028-12-10',202850,12,2028,10,50,202812,2029),('2028-12-11',202850,12,2028,11,50,202812,2029),('2028-12-12',202850,12,2028,12,50,202812,2029),('2028-12-13',202850,12,2028,13,50,202812,2029),('2028-12-14',202850,12,2028,14,50,202812,2029),('2028-12-15',202850,12,2028,15,50,202812,2029),('2028-12-16',202850,12,2028,16,50,202812,2029),('2028-12-17',202851,12,2028,17,51,202812,2029),('2028-12-18',202851,12,2028,18,51,202812,2029),('2028-12-19',202851,12,2028,19,51,202812,2029),('2028-12-20',202851,12,2028,20,51,202812,2029),('2028-12-21',202851,12,2028,21,51,202812,2029),('2028-12-22',202851,12,2028,22,51,202812,2029),('2028-12-23',202851,12,2028,23,51,202812,2029),('2028-12-24',202852,12,2028,24,52,202812,2029),('2028-12-25',202852,12,2028,25,52,202812,2029),('2028-12-26',202852,12,2028,26,52,202812,2029),('2028-12-27',202852,12,2028,27,52,202812,2029),('2028-12-28',202852,12,2028,28,52,202812,2029),('2028-12-29',202852,12,2028,29,52,202812,2029),('2028-12-30',202852,12,2028,30,52,202812,2029),('2028-12-31',202853,12,2028,31,1,202812,2029),('2029-01-01',202901,1,2029,1,1,202901,2029),('2029-01-02',202901,1,2029,2,1,202901,2029),('2029-01-03',202901,1,2029,3,1,202901,2029),('2029-01-04',202901,1,2029,4,1,202901,2029),('2029-01-05',202901,1,2029,5,1,202901,2029),('2029-01-06',202901,1,2029,6,1,202901,2029),('2029-01-07',202902,1,2029,7,2,202901,2029),('2029-01-08',202902,1,2029,8,2,202901,2029),('2029-01-09',202902,1,2029,9,2,202901,2029),('2029-01-10',202902,1,2029,10,2,202901,2029),('2029-01-11',202902,1,2029,11,2,202901,2029),('2029-01-12',202902,1,2029,12,2,202901,2029),('2029-01-13',202902,1,2029,13,2,202901,2029),('2029-01-14',202903,1,2029,14,3,202901,2029),('2029-01-15',202903,1,2029,15,3,202901,2029),('2029-01-16',202903,1,2029,16,3,202901,2029),('2029-01-17',202903,1,2029,17,3,202901,2029),('2029-01-18',202903,1,2029,18,3,202901,2029),('2029-01-19',202903,1,2029,19,3,202901,2029),('2029-01-20',202903,1,2029,20,3,202901,2029),('2029-01-21',202904,1,2029,21,4,202901,2029),('2029-01-22',202904,1,2029,22,4,202901,2029),('2029-01-23',202904,1,2029,23,4,202901,2029),('2029-01-24',202904,1,2029,24,4,202901,2029),('2029-01-25',202904,1,2029,25,4,202901,2029),('2029-01-26',202904,1,2029,26,4,202901,2029),('2029-01-27',202904,1,2029,27,4,202901,2029),('2029-01-28',202905,1,2029,28,5,202901,2029),('2029-01-29',202905,1,2029,29,5,202901,2029),('2029-01-30',202905,1,2029,30,5,202901,2029),('2029-01-31',202905,1,2029,31,5,202901,2029),('2029-02-01',202905,2,2029,1,5,202902,2029),('2029-02-02',202905,2,2029,2,5,202902,2029),('2029-02-03',202905,2,2029,3,5,202902,2029),('2029-02-04',202906,2,2029,4,6,202902,2029),('2029-02-05',202906,2,2029,5,6,202902,2029),('2029-02-06',202906,2,2029,6,6,202902,2029),('2029-02-07',202906,2,2029,7,6,202902,2029),('2029-02-08',202906,2,2029,8,6,202902,2029),('2029-02-09',202906,2,2029,9,6,202902,2029),('2029-02-10',202906,2,2029,10,6,202902,2029),('2029-02-11',202907,2,2029,11,7,202902,2029),('2029-02-12',202907,2,2029,12,7,202902,2029),('2029-02-13',202907,2,2029,13,7,202902,2029),('2029-02-14',202907,2,2029,14,7,202902,2029),('2029-02-15',202907,2,2029,15,7,202902,2029),('2029-02-16',202907,2,2029,16,7,202902,2029),('2029-02-17',202907,2,2029,17,7,202902,2029),('2029-02-18',202908,2,2029,18,8,202902,2029),('2029-02-19',202908,2,2029,19,8,202902,2029),('2029-02-20',202908,2,2029,20,8,202902,2029),('2029-02-21',202908,2,2029,21,8,202902,2029),('2029-02-22',202908,2,2029,22,8,202902,2029),('2029-02-23',202908,2,2029,23,8,202902,2029),('2029-02-24',202908,2,2029,24,8,202902,2029),('2029-02-25',202909,2,2029,25,9,202902,2029),('2029-02-26',202909,2,2029,26,9,202902,2029),('2029-02-27',202909,2,2029,27,9,202902,2029),('2029-02-28',202909,2,2029,28,9,202902,2029),('2029-03-01',202909,3,2029,1,9,202903,2029),('2029-03-02',202909,3,2029,2,9,202903,2029),('2029-03-03',202909,3,2029,3,9,202903,2029),('2029-03-04',202910,3,2029,4,10,202903,2029),('2029-03-05',202910,3,2029,5,10,202903,2029),('2029-03-06',202910,3,2029,6,10,202903,2029),('2029-03-07',202910,3,2029,7,10,202903,2029),('2029-03-08',202910,3,2029,8,10,202903,2029),('2029-03-09',202910,3,2029,9,10,202903,2029),('2029-03-10',202910,3,2029,10,10,202903,2029),('2029-03-11',202911,3,2029,11,11,202903,2029),('2029-03-12',202911,3,2029,12,11,202903,2029),('2029-03-13',202911,3,2029,13,11,202903,2029),('2029-03-14',202911,3,2029,14,11,202903,2029),('2029-03-15',202911,3,2029,15,11,202903,2029),('2029-03-16',202911,3,2029,16,11,202903,2029),('2029-03-17',202911,3,2029,17,11,202903,2029),('2029-03-18',202912,3,2029,18,12,202903,2029),('2029-03-19',202912,3,2029,19,12,202903,2029),('2029-03-20',202912,3,2029,20,12,202903,2029),('2029-03-21',202912,3,2029,21,12,202903,2029),('2029-03-22',202912,3,2029,22,12,202903,2029),('2029-03-23',202912,3,2029,23,12,202903,2029),('2029-03-24',202912,3,2029,24,12,202903,2029),('2029-03-25',202913,3,2029,25,13,202903,2029),('2029-03-26',202913,3,2029,26,13,202903,2029),('2029-03-27',202913,3,2029,27,13,202903,2029),('2029-03-28',202913,3,2029,28,13,202903,2029),('2029-03-29',202913,3,2029,29,13,202903,2029),('2029-03-30',202913,3,2029,30,13,202903,2029),('2029-03-31',202913,3,2029,31,13,202903,2029),('2029-04-01',202914,4,2029,1,14,202904,2029),('2029-04-02',202914,4,2029,2,14,202904,2029),('2029-04-03',202914,4,2029,3,14,202904,2029),('2029-04-04',202914,4,2029,4,14,202904,2029),('2029-04-05',202914,4,2029,5,14,202904,2029),('2029-04-06',202914,4,2029,6,14,202904,2029),('2029-04-07',202914,4,2029,7,14,202904,2029),('2029-04-08',202915,4,2029,8,15,202904,2029),('2029-04-09',202915,4,2029,9,15,202904,2029),('2029-04-10',202915,4,2029,10,15,202904,2029),('2029-04-11',202915,4,2029,11,15,202904,2029),('2029-04-12',202915,4,2029,12,15,202904,2029),('2029-04-13',202915,4,2029,13,15,202904,2029),('2029-04-14',202915,4,2029,14,15,202904,2029),('2029-04-15',202916,4,2029,15,16,202904,2029),('2029-04-16',202916,4,2029,16,16,202904,2029),('2029-04-17',202916,4,2029,17,16,202904,2029),('2029-04-18',202916,4,2029,18,16,202904,2029),('2029-04-19',202916,4,2029,19,16,202904,2029),('2029-04-20',202916,4,2029,20,16,202904,2029),('2029-04-21',202916,4,2029,21,16,202904,2029),('2029-04-22',202917,4,2029,22,17,202904,2029),('2029-04-23',202917,4,2029,23,17,202904,2029),('2029-04-24',202917,4,2029,24,17,202904,2029),('2029-04-25',202917,4,2029,25,17,202904,2029),('2029-04-26',202917,4,2029,26,17,202904,2029),('2029-04-27',202917,4,2029,27,17,202904,2029),('2029-04-28',202917,4,2029,28,17,202904,2029),('2029-04-29',202918,4,2029,29,18,202904,2029),('2029-04-30',202918,4,2029,30,18,202904,2029),('2029-05-01',202918,5,2029,1,18,202905,2029),('2029-05-02',202918,5,2029,2,18,202905,2029),('2029-05-03',202918,5,2029,3,18,202905,2029),('2029-05-04',202918,5,2029,4,18,202905,2029),('2029-05-05',202918,5,2029,5,18,202905,2029),('2029-05-06',202919,5,2029,6,19,202905,2029),('2029-05-07',202919,5,2029,7,19,202905,2029),('2029-05-08',202919,5,2029,8,19,202905,2029),('2029-05-09',202919,5,2029,9,19,202905,2029),('2029-05-10',202919,5,2029,10,19,202905,2029),('2029-05-11',202919,5,2029,11,19,202905,2029),('2029-05-12',202919,5,2029,12,19,202905,2029),('2029-05-13',202920,5,2029,13,20,202905,2029),('2029-05-14',202920,5,2029,14,20,202905,2029),('2029-05-15',202920,5,2029,15,20,202905,2029),('2029-05-16',202920,5,2029,16,20,202905,2029),('2029-05-17',202920,5,2029,17,20,202905,2029),('2029-05-18',202920,5,2029,18,20,202905,2029),('2029-05-19',202920,5,2029,19,20,202905,2029),('2029-05-20',202921,5,2029,20,21,202905,2029),('2029-05-21',202921,5,2029,21,21,202905,2029),('2029-05-22',202921,5,2029,22,21,202905,2029),('2029-05-23',202921,5,2029,23,21,202905,2029),('2029-05-24',202921,5,2029,24,21,202905,2029),('2029-05-25',202921,5,2029,25,21,202905,2029),('2029-05-26',202921,5,2029,26,21,202905,2029),('2029-05-27',202922,5,2029,27,22,202905,2029),('2029-05-28',202922,5,2029,28,22,202905,2029),('2029-05-29',202922,5,2029,29,22,202905,2029),('2029-05-30',202922,5,2029,30,22,202905,2029),('2029-05-31',202922,5,2029,31,22,202905,2029),('2029-06-01',202922,6,2029,1,22,202906,2029),('2029-06-02',202922,6,2029,2,22,202906,2029),('2029-06-03',202923,6,2029,3,23,202906,2029),('2029-06-04',202923,6,2029,4,23,202906,2029),('2029-06-05',202923,6,2029,5,23,202906,2029),('2029-06-06',202923,6,2029,6,23,202906,2029),('2029-06-07',202923,6,2029,7,23,202906,2029),('2029-06-08',202923,6,2029,8,23,202906,2029),('2029-06-09',202923,6,2029,9,23,202906,2029),('2029-06-10',202924,6,2029,10,24,202906,2029),('2029-06-11',202924,6,2029,11,24,202906,2029),('2029-06-12',202924,6,2029,12,24,202906,2029),('2029-06-13',202924,6,2029,13,24,202906,2029),('2029-06-14',202924,6,2029,14,24,202906,2029),('2029-06-15',202924,6,2029,15,24,202906,2029),('2029-06-16',202924,6,2029,16,24,202906,2029),('2029-06-17',202925,6,2029,17,25,202906,2029),('2029-06-18',202925,6,2029,18,25,202906,2029),('2029-06-19',202925,6,2029,19,25,202906,2029),('2029-06-20',202925,6,2029,20,25,202906,2029),('2029-06-21',202925,6,2029,21,25,202906,2029),('2029-06-22',202925,6,2029,22,25,202906,2029),('2029-06-23',202925,6,2029,23,25,202906,2029),('2029-06-24',202926,6,2029,24,26,202906,2029),('2029-06-25',202926,6,2029,25,26,202906,2029),('2029-06-26',202926,6,2029,26,26,202906,2029),('2029-06-27',202926,6,2029,27,26,202906,2029),('2029-06-28',202926,6,2029,28,26,202906,2029),('2029-06-29',202926,6,2029,29,26,202906,2029),('2029-06-30',202926,6,2029,30,26,202906,2029),('2029-07-01',202927,7,2029,1,27,202907,2029),('2029-07-02',202927,7,2029,2,27,202907,2029),('2029-07-03',202927,7,2029,3,27,202907,2029),('2029-07-04',202927,7,2029,4,27,202907,2029),('2029-07-05',202927,7,2029,5,27,202907,2029),('2029-07-06',202927,7,2029,6,27,202907,2029),('2029-07-07',202927,7,2029,7,27,202907,2029),('2029-07-08',202928,7,2029,8,28,202907,2029),('2029-07-09',202928,7,2029,9,28,202907,2029),('2029-07-10',202928,7,2029,10,28,202907,2029),('2029-07-11',202928,7,2029,11,28,202907,2029),('2029-07-12',202928,7,2029,12,28,202907,2029),('2029-07-13',202928,7,2029,13,28,202907,2029),('2029-07-14',202928,7,2029,14,28,202907,2029),('2029-07-15',202929,7,2029,15,29,202907,2029),('2029-07-16',202929,7,2029,16,29,202907,2029),('2029-07-17',202929,7,2029,17,29,202907,2029),('2029-07-18',202929,7,2029,18,29,202907,2029),('2029-07-19',202929,7,2029,19,29,202907,2029),('2029-07-20',202929,7,2029,20,29,202907,2029),('2029-07-21',202929,7,2029,21,29,202907,2029),('2029-07-22',202930,7,2029,22,30,202907,2029),('2029-07-23',202930,7,2029,23,30,202907,2029),('2029-07-24',202930,7,2029,24,30,202907,2029),('2029-07-25',202930,7,2029,25,30,202907,2029),('2029-07-26',202930,7,2029,26,30,202907,2029),('2029-07-27',202930,7,2029,27,30,202907,2029),('2029-07-28',202930,7,2029,28,30,202907,2029),('2029-07-29',202931,7,2029,29,31,202907,2029),('2029-07-30',202931,7,2029,30,31,202907,2029),('2029-07-31',202931,7,2029,31,31,202907,2029),('2029-08-01',202931,8,2029,1,31,202908,2029),('2029-08-02',202931,8,2029,2,31,202908,2029),('2029-08-03',202931,8,2029,3,31,202908,2029),('2029-08-04',202931,8,2029,4,31,202908,2029),('2029-08-05',202932,8,2029,5,32,202908,2029),('2029-08-06',202932,8,2029,6,32,202908,2029),('2029-08-07',202932,8,2029,7,32,202908,2029),('2029-08-08',202932,8,2029,8,32,202908,2029),('2029-08-09',202932,8,2029,9,32,202908,2029),('2029-08-10',202932,8,2029,10,32,202908,2029),('2029-08-11',202932,8,2029,11,32,202908,2029),('2029-08-12',202933,8,2029,12,33,202908,2029),('2029-08-13',202933,8,2029,13,33,202908,2029),('2029-08-14',202933,8,2029,14,33,202908,2029),('2029-08-15',202933,8,2029,15,33,202908,2029),('2029-08-16',202933,8,2029,16,33,202908,2029),('2029-08-17',202933,8,2029,17,33,202908,2029),('2029-08-18',202933,8,2029,18,33,202908,2029),('2029-08-19',202934,8,2029,19,34,202908,2029),('2029-08-20',202934,8,2029,20,34,202908,2029),('2029-08-21',202934,8,2029,21,34,202908,2029),('2029-08-22',202934,8,2029,22,34,202908,2029),('2029-08-23',202934,8,2029,23,34,202908,2029),('2029-08-24',202934,8,2029,24,34,202908,2029),('2029-08-25',202934,8,2029,25,34,202908,2029),('2029-08-26',202935,8,2029,26,35,202908,2029),('2029-08-27',202935,8,2029,27,35,202908,2029),('2029-08-28',202935,8,2029,28,35,202908,2029),('2029-08-29',202935,8,2029,29,35,202908,2029),('2029-08-30',202935,8,2029,30,35,202908,2029),('2029-08-31',202935,8,2029,31,35,202908,2029),('2029-09-01',202935,9,2029,1,35,202909,2029),('2029-09-02',202936,9,2029,2,36,202909,2029),('2029-09-03',202936,9,2029,3,36,202909,2029),('2029-09-04',202936,9,2029,4,36,202909,2029),('2029-09-05',202936,9,2029,5,36,202909,2029),('2029-09-06',202936,9,2029,6,36,202909,2029),('2029-09-07',202936,9,2029,7,36,202909,2029),('2029-09-08',202936,9,2029,8,36,202909,2029),('2029-09-09',202937,9,2029,9,37,202909,2029),('2029-09-10',202937,9,2029,10,37,202909,2029),('2029-09-11',202937,9,2029,11,37,202909,2029),('2029-09-12',202937,9,2029,12,37,202909,2029),('2029-09-13',202937,9,2029,13,37,202909,2029),('2029-09-14',202937,9,2029,14,37,202909,2029),('2029-09-15',202937,9,2029,15,37,202909,2029),('2029-09-16',202938,9,2029,16,38,202909,2029),('2029-09-17',202938,9,2029,17,38,202909,2029),('2029-09-18',202938,9,2029,18,38,202909,2029),('2029-09-19',202938,9,2029,19,38,202909,2029),('2029-09-20',202938,9,2029,20,38,202909,2029),('2029-09-21',202938,9,2029,21,38,202909,2029),('2029-09-22',202938,9,2029,22,38,202909,2029),('2029-09-23',202939,9,2029,23,39,202909,2029),('2029-09-24',202939,9,2029,24,39,202909,2029),('2029-09-25',202939,9,2029,25,39,202909,2029),('2029-09-26',202939,9,2029,26,39,202909,2029),('2029-09-27',202939,9,2029,27,39,202909,2029),('2029-09-28',202939,9,2029,28,39,202909,2029),('2029-09-29',202939,9,2029,29,39,202909,2029),('2029-09-30',202940,9,2029,30,40,202909,2029),('2029-10-01',202940,10,2029,1,40,202910,2029),('2029-10-02',202940,10,2029,2,40,202910,2029),('2029-10-03',202940,10,2029,3,40,202910,2029),('2029-10-04',202940,10,2029,4,40,202910,2029),('2029-10-05',202940,10,2029,5,40,202910,2029),('2029-10-06',202940,10,2029,6,40,202910,2029),('2029-10-07',202941,10,2029,7,41,202910,2029),('2029-10-08',202941,10,2029,8,41,202910,2029),('2029-10-09',202941,10,2029,9,41,202910,2029),('2029-10-10',202941,10,2029,10,41,202910,2029),('2029-10-11',202941,10,2029,11,41,202910,2029),('2029-10-12',202941,10,2029,12,41,202910,2029),('2029-10-13',202941,10,2029,13,41,202910,2029),('2029-10-14',202942,10,2029,14,42,202910,2029),('2029-10-15',202942,10,2029,15,42,202910,2029),('2029-10-16',202942,10,2029,16,42,202910,2029),('2029-10-17',202942,10,2029,17,42,202910,2029),('2029-10-18',202942,10,2029,18,42,202910,2029),('2029-10-19',202942,10,2029,19,42,202910,2029),('2029-10-20',202942,10,2029,20,42,202910,2029),('2029-10-21',202943,10,2029,21,43,202910,2029),('2029-10-22',202943,10,2029,22,43,202910,2029),('2029-10-23',202943,10,2029,23,43,202910,2029),('2029-10-24',202943,10,2029,24,43,202910,2029),('2029-10-25',202943,10,2029,25,43,202910,2029),('2029-10-26',202943,10,2029,26,43,202910,2029),('2029-10-27',202943,10,2029,27,43,202910,2029),('2029-10-28',202944,10,2029,28,44,202910,2029),('2029-10-29',202944,10,2029,29,44,202910,2029),('2029-10-30',202944,10,2029,30,44,202910,2029),('2029-10-31',202944,10,2029,31,44,202910,2029),('2029-11-01',202944,11,2029,1,44,202911,2029),('2029-11-02',202944,11,2029,2,44,202911,2029),('2029-11-03',202944,11,2029,3,44,202911,2029),('2029-11-04',202945,11,2029,4,45,202911,2029),('2029-11-05',202945,11,2029,5,45,202911,2029),('2029-11-06',202945,11,2029,6,45,202911,2029),('2029-11-07',202945,11,2029,7,45,202911,2029),('2029-11-08',202945,11,2029,8,45,202911,2029),('2029-11-09',202945,11,2029,9,45,202911,2029),('2029-11-10',202945,11,2029,10,45,202911,2029),('2029-11-11',202946,11,2029,11,46,202911,2029),('2029-11-12',202946,11,2029,12,46,202911,2029),('2029-11-13',202946,11,2029,13,46,202911,2029),('2029-11-14',202946,11,2029,14,46,202911,2029),('2029-11-15',202946,11,2029,15,46,202911,2029),('2029-11-16',202946,11,2029,16,46,202911,2029),('2029-11-17',202946,11,2029,17,46,202911,2029),('2029-11-18',202947,11,2029,18,47,202911,2029),('2029-11-19',202947,11,2029,19,47,202911,2029),('2029-11-20',202947,11,2029,20,47,202911,2029),('2029-11-21',202947,11,2029,21,47,202911,2029),('2029-11-22',202947,11,2029,22,47,202911,2029),('2029-11-23',202947,11,2029,23,47,202911,2029),('2029-11-24',202947,11,2029,24,47,202911,2029),('2029-11-25',202948,11,2029,25,48,202911,2029),('2029-11-26',202948,11,2029,26,48,202911,2029),('2029-11-27',202948,11,2029,27,48,202911,2029),('2029-11-28',202948,11,2029,28,48,202911,2029),('2029-11-29',202948,11,2029,29,48,202911,2029),('2029-11-30',202948,11,2029,30,48,202911,2029),('2029-12-01',202948,12,2029,1,48,202912,2030),('2029-12-02',202949,12,2029,2,49,202912,2030),('2029-12-03',202949,12,2029,3,49,202912,2030),('2029-12-04',202949,12,2029,4,49,202912,2030),('2029-12-05',202949,12,2029,5,49,202912,2030),('2029-12-06',202949,12,2029,6,49,202912,2030),('2029-12-07',202949,12,2029,7,49,202912,2030),('2029-12-08',202949,12,2029,8,49,202912,2030),('2029-12-09',202950,12,2029,9,50,202912,2030),('2029-12-10',202950,12,2029,10,50,202912,2030),('2029-12-11',202950,12,2029,11,50,202912,2030),('2029-12-12',202950,12,2029,12,50,202912,2030),('2029-12-13',202950,12,2029,13,50,202912,2030),('2029-12-14',202950,12,2029,14,50,202912,2030),('2029-12-15',202950,12,2029,15,50,202912,2030),('2029-12-16',202951,12,2029,16,51,202912,2030),('2029-12-17',202951,12,2029,17,51,202912,2030),('2029-12-18',202951,12,2029,18,51,202912,2030),('2029-12-19',202951,12,2029,19,51,202912,2030),('2029-12-20',202951,12,2029,20,51,202912,2030),('2029-12-21',202951,12,2029,21,51,202912,2030),('2029-12-22',202951,12,2029,22,51,202912,2030),('2029-12-23',202952,12,2029,23,52,202912,2030),('2029-12-24',202952,12,2029,24,52,202912,2030),('2029-12-25',202952,12,2029,25,52,202912,2030),('2029-12-26',202952,12,2029,26,52,202912,2030),('2029-12-27',202952,12,2029,27,52,202912,2030),('2029-12-28',202952,12,2029,28,52,202912,2030),('2029-12-29',202952,12,2029,29,52,202912,2030),('2029-12-30',202953,12,2029,30,1,202912,2030),('2029-12-31',202901,12,2029,31,1,202912,2030),('2030-01-01',203001,1,2030,1,1,203001,2030),('2030-01-02',203001,1,2030,2,1,203001,2030),('2030-01-03',203001,1,2030,3,1,203001,2030),('2030-01-04',203001,1,2030,4,1,203001,2030),('2030-01-05',203001,1,2030,5,1,203001,2030),('2030-01-06',203002,1,2030,6,2,203001,2030),('2030-01-07',203002,1,2030,7,2,203001,2030),('2030-01-08',203002,1,2030,8,2,203001,2030),('2030-01-09',203002,1,2030,9,2,203001,2030),('2030-01-10',203002,1,2030,10,2,203001,2030),('2030-01-11',203002,1,2030,11,2,203001,2030),('2030-01-12',203002,1,2030,12,2,203001,2030),('2030-01-13',203003,1,2030,13,3,203001,2030),('2030-01-14',203003,1,2030,14,3,203001,2030),('2030-01-15',203003,1,2030,15,3,203001,2030),('2030-01-16',203003,1,2030,16,3,203001,2030),('2030-01-17',203003,1,2030,17,3,203001,2030),('2030-01-18',203003,1,2030,18,3,203001,2030),('2030-01-19',203003,1,2030,19,3,203001,2030),('2030-01-20',203004,1,2030,20,4,203001,2030),('2030-01-21',203004,1,2030,21,4,203001,2030),('2030-01-22',203004,1,2030,22,4,203001,2030),('2030-01-23',203004,1,2030,23,4,203001,2030),('2030-01-24',203004,1,2030,24,4,203001,2030),('2030-01-25',203004,1,2030,25,4,203001,2030),('2030-01-26',203004,1,2030,26,4,203001,2030),('2030-01-27',203005,1,2030,27,5,203001,2030),('2030-01-28',203005,1,2030,28,5,203001,2030),('2030-01-29',203005,1,2030,29,5,203001,2030),('2030-01-30',203005,1,2030,30,5,203001,2030),('2030-01-31',203005,1,2030,31,5,203001,2030),('2030-02-01',203005,2,2030,1,5,203002,2030),('2030-02-02',203005,2,2030,2,5,203002,2030),('2030-02-03',203006,2,2030,3,6,203002,2030),('2030-02-04',203006,2,2030,4,6,203002,2030),('2030-02-05',203006,2,2030,5,6,203002,2030),('2030-02-06',203006,2,2030,6,6,203002,2030),('2030-02-07',203006,2,2030,7,6,203002,2030),('2030-02-08',203006,2,2030,8,6,203002,2030),('2030-02-09',203006,2,2030,9,6,203002,2030),('2030-02-10',203007,2,2030,10,7,203002,2030),('2030-02-11',203007,2,2030,11,7,203002,2030),('2030-02-12',203007,2,2030,12,7,203002,2030),('2030-02-13',203007,2,2030,13,7,203002,2030),('2030-02-14',203007,2,2030,14,7,203002,2030),('2030-02-15',203007,2,2030,15,7,203002,2030),('2030-02-16',203007,2,2030,16,7,203002,2030),('2030-02-17',203008,2,2030,17,8,203002,2030),('2030-02-18',203008,2,2030,18,8,203002,2030),('2030-02-19',203008,2,2030,19,8,203002,2030),('2030-02-20',203008,2,2030,20,8,203002,2030),('2030-02-21',203008,2,2030,21,8,203002,2030),('2030-02-22',203008,2,2030,22,8,203002,2030),('2030-02-23',203008,2,2030,23,8,203002,2030),('2030-02-24',203009,2,2030,24,9,203002,2030),('2030-02-25',203009,2,2030,25,9,203002,2030),('2030-02-26',203009,2,2030,26,9,203002,2030),('2030-02-27',203009,2,2030,27,9,203002,2030),('2030-02-28',203009,2,2030,28,9,203002,2030),('2030-03-01',203009,3,2030,1,9,203003,2030),('2030-03-02',203009,3,2030,2,9,203003,2030),('2030-03-03',203010,3,2030,3,10,203003,2030),('2030-03-04',203010,3,2030,4,10,203003,2030),('2030-03-05',203010,3,2030,5,10,203003,2030),('2030-03-06',203010,3,2030,6,10,203003,2030),('2030-03-07',203010,3,2030,7,10,203003,2030),('2030-03-08',203010,3,2030,8,10,203003,2030),('2030-03-09',203010,3,2030,9,10,203003,2030),('2030-03-10',203011,3,2030,10,11,203003,2030),('2030-03-11',203011,3,2030,11,11,203003,2030),('2030-03-12',203011,3,2030,12,11,203003,2030),('2030-03-13',203011,3,2030,13,11,203003,2030),('2030-03-14',203011,3,2030,14,11,203003,2030),('2030-03-15',203011,3,2030,15,11,203003,2030),('2030-03-16',203011,3,2030,16,11,203003,2030),('2030-03-17',203012,3,2030,17,12,203003,2030),('2030-03-18',203012,3,2030,18,12,203003,2030),('2030-03-19',203012,3,2030,19,12,203003,2030),('2030-03-20',203012,3,2030,20,12,203003,2030),('2030-03-21',203012,3,2030,21,12,203003,2030),('2030-03-22',203012,3,2030,22,12,203003,2030),('2030-03-23',203012,3,2030,23,12,203003,2030),('2030-03-24',203013,3,2030,24,13,203003,2030),('2030-03-25',203013,3,2030,25,13,203003,2030),('2030-03-26',203013,3,2030,26,13,203003,2030),('2030-03-27',203013,3,2030,27,13,203003,2030),('2030-03-28',203013,3,2030,28,13,203003,2030),('2030-03-29',203013,3,2030,29,13,203003,2030),('2030-03-30',203013,3,2030,30,13,203003,2030),('2030-03-31',203014,3,2030,31,14,203003,2030),('2030-04-01',203014,4,2030,1,14,203004,2030),('2030-04-02',203014,4,2030,2,14,203004,2030),('2030-04-03',203014,4,2030,3,14,203004,2030),('2030-04-04',203014,4,2030,4,14,203004,2030),('2030-04-05',203014,4,2030,5,14,203004,2030),('2030-04-06',203014,4,2030,6,14,203004,2030),('2030-04-07',203015,4,2030,7,15,203004,2030),('2030-04-08',203015,4,2030,8,15,203004,2030),('2030-04-09',203015,4,2030,9,15,203004,2030),('2030-04-10',203015,4,2030,10,15,203004,2030),('2030-04-11',203015,4,2030,11,15,203004,2030),('2030-04-12',203015,4,2030,12,15,203004,2030),('2030-04-13',203015,4,2030,13,15,203004,2030),('2030-04-14',203016,4,2030,14,16,203004,2030),('2030-04-15',203016,4,2030,15,16,203004,2030),('2030-04-16',203016,4,2030,16,16,203004,2030),('2030-04-17',203016,4,2030,17,16,203004,2030),('2030-04-18',203016,4,2030,18,16,203004,2030),('2030-04-19',203016,4,2030,19,16,203004,2030),('2030-04-20',203016,4,2030,20,16,203004,2030),('2030-04-21',203017,4,2030,21,17,203004,2030),('2030-04-22',203017,4,2030,22,17,203004,2030),('2030-04-23',203017,4,2030,23,17,203004,2030),('2030-04-24',203017,4,2030,24,17,203004,2030),('2030-04-25',203017,4,2030,25,17,203004,2030),('2030-04-26',203017,4,2030,26,17,203004,2030),('2030-04-27',203017,4,2030,27,17,203004,2030),('2030-04-28',203018,4,2030,28,18,203004,2030),('2030-04-29',203018,4,2030,29,18,203004,2030),('2030-04-30',203018,4,2030,30,18,203004,2030),('2030-05-01',203018,5,2030,1,18,203005,2030),('2030-05-02',203018,5,2030,2,18,203005,2030),('2030-05-03',203018,5,2030,3,18,203005,2030),('2030-05-04',203018,5,2030,4,18,203005,2030),('2030-05-05',203019,5,2030,5,19,203005,2030),('2030-05-06',203019,5,2030,6,19,203005,2030),('2030-05-07',203019,5,2030,7,19,203005,2030),('2030-05-08',203019,5,2030,8,19,203005,2030),('2030-05-09',203019,5,2030,9,19,203005,2030),('2030-05-10',203019,5,2030,10,19,203005,2030),('2030-05-11',203019,5,2030,11,19,203005,2030),('2030-05-12',203020,5,2030,12,20,203005,2030),('2030-05-13',203020,5,2030,13,20,203005,2030),('2030-05-14',203020,5,2030,14,20,203005,2030),('2030-05-15',203020,5,2030,15,20,203005,2030),('2030-05-16',203020,5,2030,16,20,203005,2030),('2030-05-17',203020,5,2030,17,20,203005,2030),('2030-05-18',203020,5,2030,18,20,203005,2030),('2030-05-19',203021,5,2030,19,21,203005,2030),('2030-05-20',203021,5,2030,20,21,203005,2030),('2030-05-21',203021,5,2030,21,21,203005,2030),('2030-05-22',203021,5,2030,22,21,203005,2030),('2030-05-23',203021,5,2030,23,21,203005,2030),('2030-05-24',203021,5,2030,24,21,203005,2030),('2030-05-25',203021,5,2030,25,21,203005,2030),('2030-05-26',203022,5,2030,26,22,203005,2030),('2030-05-27',203022,5,2030,27,22,203005,2030),('2030-05-28',203022,5,2030,28,22,203005,2030),('2030-05-29',203022,5,2030,29,22,203005,2030),('2030-05-30',203022,5,2030,30,22,203005,2030),('2030-05-31',203022,5,2030,31,22,203005,2030),('2030-06-01',203022,6,2030,1,22,203006,2030),('2030-06-02',203023,6,2030,2,23,203006,2030),('2030-06-03',203023,6,2030,3,23,203006,2030),('2030-06-04',203023,6,2030,4,23,203006,2030),('2030-06-05',203023,6,2030,5,23,203006,2030),('2030-06-06',203023,6,2030,6,23,203006,2030),('2030-06-07',203023,6,2030,7,23,203006,2030),('2030-06-08',203023,6,2030,8,23,203006,2030),('2030-06-09',203024,6,2030,9,24,203006,2030),('2030-06-10',203024,6,2030,10,24,203006,2030),('2030-06-11',203024,6,2030,11,24,203006,2030),('2030-06-12',203024,6,2030,12,24,203006,2030),('2030-06-13',203024,6,2030,13,24,203006,2030),('2030-06-14',203024,6,2030,14,24,203006,2030),('2030-06-15',203024,6,2030,15,24,203006,2030),('2030-06-16',203025,6,2030,16,25,203006,2030),('2030-06-17',203025,6,2030,17,25,203006,2030),('2030-06-18',203025,6,2030,18,25,203006,2030),('2030-06-19',203025,6,2030,19,25,203006,2030),('2030-06-20',203025,6,2030,20,25,203006,2030),('2030-06-21',203025,6,2030,21,25,203006,2030),('2030-06-22',203025,6,2030,22,25,203006,2030),('2030-06-23',203026,6,2030,23,26,203006,2030),('2030-06-24',203026,6,2030,24,26,203006,2030),('2030-06-25',203026,6,2030,25,26,203006,2030),('2030-06-26',203026,6,2030,26,26,203006,2030),('2030-06-27',203026,6,2030,27,26,203006,2030),('2030-06-28',203026,6,2030,28,26,203006,2030),('2030-06-29',203026,6,2030,29,26,203006,2030),('2030-06-30',203027,6,2030,30,27,203006,2030),('2030-07-01',203027,7,2030,1,27,203007,2030),('2030-07-02',203027,7,2030,2,27,203007,2030),('2030-07-03',203027,7,2030,3,27,203007,2030),('2030-07-04',203027,7,2030,4,27,203007,2030),('2030-07-05',203027,7,2030,5,27,203007,2030),('2030-07-06',203027,7,2030,6,27,203007,2030),('2030-07-07',203028,7,2030,7,28,203007,2030),('2030-07-08',203028,7,2030,8,28,203007,2030),('2030-07-09',203028,7,2030,9,28,203007,2030),('2030-07-10',203028,7,2030,10,28,203007,2030),('2030-07-11',203028,7,2030,11,28,203007,2030),('2030-07-12',203028,7,2030,12,28,203007,2030),('2030-07-13',203028,7,2030,13,28,203007,2030),('2030-07-14',203029,7,2030,14,29,203007,2030),('2030-07-15',203029,7,2030,15,29,203007,2030),('2030-07-16',203029,7,2030,16,29,203007,2030),('2030-07-17',203029,7,2030,17,29,203007,2030),('2030-07-18',203029,7,2030,18,29,203007,2030),('2030-07-19',203029,7,2030,19,29,203007,2030),('2030-07-20',203029,7,2030,20,29,203007,2030),('2030-07-21',203030,7,2030,21,30,203007,2030),('2030-07-22',203030,7,2030,22,30,203007,2030),('2030-07-23',203030,7,2030,23,30,203007,2030),('2030-07-24',203030,7,2030,24,30,203007,2030),('2030-07-25',203030,7,2030,25,30,203007,2030),('2030-07-26',203030,7,2030,26,30,203007,2030),('2030-07-27',203030,7,2030,27,30,203007,2030),('2030-07-28',203031,7,2030,28,31,203007,2030),('2030-07-29',203031,7,2030,29,31,203007,2030),('2030-07-30',203031,7,2030,30,31,203007,2030),('2030-07-31',203031,7,2030,31,31,203007,2030),('2030-08-01',203031,8,2030,1,31,203008,2030),('2030-08-02',203031,8,2030,2,31,203008,2030),('2030-08-03',203031,8,2030,3,31,203008,2030),('2030-08-04',203032,8,2030,4,32,203008,2030),('2030-08-05',203032,8,2030,5,32,203008,2030),('2030-08-06',203032,8,2030,6,32,203008,2030),('2030-08-07',203032,8,2030,7,32,203008,2030),('2030-08-08',203032,8,2030,8,32,203008,2030),('2030-08-09',203032,8,2030,9,32,203008,2030),('2030-08-10',203032,8,2030,10,32,203008,2030),('2030-08-11',203033,8,2030,11,33,203008,2030),('2030-08-12',203033,8,2030,12,33,203008,2030),('2030-08-13',203033,8,2030,13,33,203008,2030),('2030-08-14',203033,8,2030,14,33,203008,2030),('2030-08-15',203033,8,2030,15,33,203008,2030),('2030-08-16',203033,8,2030,16,33,203008,2030),('2030-08-17',203033,8,2030,17,33,203008,2030),('2030-08-18',203034,8,2030,18,34,203008,2030),('2030-08-19',203034,8,2030,19,34,203008,2030),('2030-08-20',203034,8,2030,20,34,203008,2030),('2030-08-21',203034,8,2030,21,34,203008,2030),('2030-08-22',203034,8,2030,22,34,203008,2030),('2030-08-23',203034,8,2030,23,34,203008,2030),('2030-08-24',203034,8,2030,24,34,203008,2030),('2030-08-25',203035,8,2030,25,35,203008,2030),('2030-08-26',203035,8,2030,26,35,203008,2030),('2030-08-27',203035,8,2030,27,35,203008,2030),('2030-08-28',203035,8,2030,28,35,203008,2030),('2030-08-29',203035,8,2030,29,35,203008,2030),('2030-08-30',203035,8,2030,30,35,203008,2030),('2030-08-31',203035,8,2030,31,35,203008,2030),('2030-09-01',203036,9,2030,1,36,203009,2030),('2030-09-02',203036,9,2030,2,36,203009,2030),('2030-09-03',203036,9,2030,3,36,203009,2030),('2030-09-04',203036,9,2030,4,36,203009,2030),('2030-09-05',203036,9,2030,5,36,203009,2030),('2030-09-06',203036,9,2030,6,36,203009,2030),('2030-09-07',203036,9,2030,7,36,203009,2030),('2030-09-08',203037,9,2030,8,37,203009,2030),('2030-09-09',203037,9,2030,9,37,203009,2030),('2030-09-10',203037,9,2030,10,37,203009,2030),('2030-09-11',203037,9,2030,11,37,203009,2030),('2030-09-12',203037,9,2030,12,37,203009,2030),('2030-09-13',203037,9,2030,13,37,203009,2030),('2030-09-14',203037,9,2030,14,37,203009,2030),('2030-09-15',203038,9,2030,15,38,203009,2030),('2030-09-16',203038,9,2030,16,38,203009,2030),('2030-09-17',203038,9,2030,17,38,203009,2030),('2030-09-18',203038,9,2030,18,38,203009,2030),('2030-09-19',203038,9,2030,19,38,203009,2030),('2030-09-20',203038,9,2030,20,38,203009,2030),('2030-09-21',203038,9,2030,21,38,203009,2030),('2030-09-22',203039,9,2030,22,39,203009,2030),('2030-09-23',203039,9,2030,23,39,203009,2030),('2030-09-24',203039,9,2030,24,39,203009,2030),('2030-09-25',203039,9,2030,25,39,203009,2030),('2030-09-26',203039,9,2030,26,39,203009,2030),('2030-09-27',203039,9,2030,27,39,203009,2030),('2030-09-28',203039,9,2030,28,39,203009,2030),('2030-09-29',203040,9,2030,29,40,203009,2030),('2030-09-30',203040,9,2030,30,40,203009,2030),('2030-10-01',203040,10,2030,1,40,203010,2030),('2030-10-02',203040,10,2030,2,40,203010,2030),('2030-10-03',203040,10,2030,3,40,203010,2030),('2030-10-04',203040,10,2030,4,40,203010,2030),('2030-10-05',203040,10,2030,5,40,203010,2030),('2030-10-06',203041,10,2030,6,41,203010,2030),('2030-10-07',203041,10,2030,7,41,203010,2030),('2030-10-08',203041,10,2030,8,41,203010,2030),('2030-10-09',203041,10,2030,9,41,203010,2030),('2030-10-10',203041,10,2030,10,41,203010,2030),('2030-10-11',203041,10,2030,11,41,203010,2030),('2030-10-12',203041,10,2030,12,41,203010,2030),('2030-10-13',203042,10,2030,13,42,203010,2030),('2030-10-14',203042,10,2030,14,42,203010,2030),('2030-10-15',203042,10,2030,15,42,203010,2030),('2030-10-16',203042,10,2030,16,42,203010,2030),('2030-10-17',203042,10,2030,17,42,203010,2030),('2030-10-18',203042,10,2030,18,42,203010,2030),('2030-10-19',203042,10,2030,19,42,203010,2030),('2030-10-20',203043,10,2030,20,43,203010,2030),('2030-10-21',203043,10,2030,21,43,203010,2030),('2030-10-22',203043,10,2030,22,43,203010,2030),('2030-10-23',203043,10,2030,23,43,203010,2030),('2030-10-24',203043,10,2030,24,43,203010,2030),('2030-10-25',203043,10,2030,25,43,203010,2030),('2030-10-26',203043,10,2030,26,43,203010,2030),('2030-10-27',203044,10,2030,27,44,203010,2030),('2030-10-28',203044,10,2030,28,44,203010,2030),('2030-10-29',203044,10,2030,29,44,203010,2030),('2030-10-30',203044,10,2030,30,44,203010,2030),('2030-10-31',203044,10,2030,31,44,203010,2030),('2030-11-01',203044,11,2030,1,44,203011,2030),('2030-11-02',203044,11,2030,2,44,203011,2030),('2030-11-03',203045,11,2030,3,45,203011,2030),('2030-11-04',203045,11,2030,4,45,203011,2030),('2030-11-05',203045,11,2030,5,45,203011,2030),('2030-11-06',203045,11,2030,6,45,203011,2030),('2030-11-07',203045,11,2030,7,45,203011,2030),('2030-11-08',203045,11,2030,8,45,203011,2030),('2030-11-09',203045,11,2030,9,45,203011,2030),('2030-11-10',203046,11,2030,10,46,203011,2030),('2030-11-11',203046,11,2030,11,46,203011,2030),('2030-11-12',203046,11,2030,12,46,203011,2030),('2030-11-13',203046,11,2030,13,46,203011,2030),('2030-11-14',203046,11,2030,14,46,203011,2030),('2030-11-15',203046,11,2030,15,46,203011,2030),('2030-11-16',203046,11,2030,16,46,203011,2030),('2030-11-17',203047,11,2030,17,47,203011,2030),('2030-11-18',203047,11,2030,18,47,203011,2030),('2030-11-19',203047,11,2030,19,47,203011,2030),('2030-11-20',203047,11,2030,20,47,203011,2030),('2030-11-21',203047,11,2030,21,47,203011,2030),('2030-11-22',203047,11,2030,22,47,203011,2030),('2030-11-23',203047,11,2030,23,47,203011,2030),('2030-11-24',203048,11,2030,24,48,203011,2030),('2030-11-25',203048,11,2030,25,48,203011,2030),('2030-11-26',203048,11,2030,26,48,203011,2030),('2030-11-27',203048,11,2030,27,48,203011,2030),('2030-11-28',203048,11,2030,28,48,203011,2030),('2030-11-29',203048,11,2030,29,48,203011,2030),('2030-11-30',203048,11,2030,30,48,203011,2030),('2030-12-01',203049,12,2030,1,49,203012,2031),('2030-12-02',203049,12,2030,2,49,203012,2031),('2030-12-03',203049,12,2030,3,49,203012,2031),('2030-12-04',203049,12,2030,4,49,203012,2031),('2030-12-05',203049,12,2030,5,49,203012,2031),('2030-12-06',203049,12,2030,6,49,203012,2031),('2030-12-07',203049,12,2030,7,49,203012,2031),('2030-12-08',203050,12,2030,8,50,203012,2031),('2030-12-09',203050,12,2030,9,50,203012,2031),('2030-12-10',203050,12,2030,10,50,203012,2031),('2030-12-11',203050,12,2030,11,50,203012,2031),('2030-12-12',203050,12,2030,12,50,203012,2031),('2030-12-13',203050,12,2030,13,50,203012,2031),('2030-12-14',203050,12,2030,14,50,203012,2031),('2030-12-15',203051,12,2030,15,51,203012,2031),('2030-12-16',203051,12,2030,16,51,203012,2031),('2030-12-17',203051,12,2030,17,51,203012,2031),('2030-12-18',203051,12,2030,18,51,203012,2031),('2030-12-19',203051,12,2030,19,51,203012,2031),('2030-12-20',203051,12,2030,20,51,203012,2031),('2030-12-21',203051,12,2030,21,51,203012,2031),('2030-12-22',203052,12,2030,22,52,203012,2031),('2030-12-23',203052,12,2030,23,52,203012,2031),('2030-12-24',203052,12,2030,24,52,203012,2031),('2030-12-25',203052,12,2030,25,52,203012,2031),('2030-12-26',203052,12,2030,26,52,203012,2031),('2030-12-27',203052,12,2030,27,52,203012,2031),('2030-12-28',203052,12,2030,28,52,203012,2031),('2030-12-29',203053,12,2030,29,1,203012,2031),('2030-12-30',203001,12,2030,30,1,203012,2031),('2030-12-31',203001,12,2030,31,1,203012,2031),('2031-01-01',203101,1,2031,1,1,203101,2031),('2031-01-02',203101,1,2031,2,1,203101,2031),('2031-01-03',203101,1,2031,3,1,203101,2031),('2031-01-04',203101,1,2031,4,1,203101,2031),('2031-01-05',203102,1,2031,5,2,203101,2031),('2031-01-06',203102,1,2031,6,2,203101,2031),('2031-01-07',203102,1,2031,7,2,203101,2031),('2031-01-08',203102,1,2031,8,2,203101,2031),('2031-01-09',203102,1,2031,9,2,203101,2031),('2031-01-10',203102,1,2031,10,2,203101,2031),('2031-01-11',203102,1,2031,11,2,203101,2031),('2031-01-12',203103,1,2031,12,3,203101,2031),('2031-01-13',203103,1,2031,13,3,203101,2031),('2031-01-14',203103,1,2031,14,3,203101,2031),('2031-01-15',203103,1,2031,15,3,203101,2031),('2031-01-16',203103,1,2031,16,3,203101,2031),('2031-01-17',203103,1,2031,17,3,203101,2031),('2031-01-18',203103,1,2031,18,3,203101,2031),('2031-01-19',203104,1,2031,19,4,203101,2031),('2031-01-20',203104,1,2031,20,4,203101,2031),('2031-01-21',203104,1,2031,21,4,203101,2031),('2031-01-22',203104,1,2031,22,4,203101,2031),('2031-01-23',203104,1,2031,23,4,203101,2031),('2031-01-24',203104,1,2031,24,4,203101,2031),('2031-01-25',203104,1,2031,25,4,203101,2031),('2031-01-26',203105,1,2031,26,5,203101,2031),('2031-01-27',203105,1,2031,27,5,203101,2031),('2031-01-28',203105,1,2031,28,5,203101,2031),('2031-01-29',203105,1,2031,29,5,203101,2031),('2031-01-30',203105,1,2031,30,5,203101,2031),('2031-01-31',203105,1,2031,31,5,203101,2031),('2031-02-01',203105,2,2031,1,5,203102,2031),('2031-02-02',203106,2,2031,2,6,203102,2031),('2031-02-03',203106,2,2031,3,6,203102,2031),('2031-02-04',203106,2,2031,4,6,203102,2031),('2031-02-05',203106,2,2031,5,6,203102,2031),('2031-02-06',203106,2,2031,6,6,203102,2031),('2031-02-07',203106,2,2031,7,6,203102,2031),('2031-02-08',203106,2,2031,8,6,203102,2031),('2031-02-09',203107,2,2031,9,7,203102,2031),('2031-02-10',203107,2,2031,10,7,203102,2031),('2031-02-11',203107,2,2031,11,7,203102,2031),('2031-02-12',203107,2,2031,12,7,203102,2031),('2031-02-13',203107,2,2031,13,7,203102,2031),('2031-02-14',203107,2,2031,14,7,203102,2031),('2031-02-15',203107,2,2031,15,7,203102,2031),('2031-02-16',203108,2,2031,16,8,203102,2031),('2031-02-17',203108,2,2031,17,8,203102,2031),('2031-02-18',203108,2,2031,18,8,203102,2031),('2031-02-19',203108,2,2031,19,8,203102,2031),('2031-02-20',203108,2,2031,20,8,203102,2031),('2031-02-21',203108,2,2031,21,8,203102,2031),('2031-02-22',203108,2,2031,22,8,203102,2031),('2031-02-23',203109,2,2031,23,9,203102,2031),('2031-02-24',203109,2,2031,24,9,203102,2031),('2031-02-25',203109,2,2031,25,9,203102,2031),('2031-02-26',203109,2,2031,26,9,203102,2031),('2031-02-27',203109,2,2031,27,9,203102,2031),('2031-02-28',203109,2,2031,28,9,203102,2031),('2031-03-01',203109,3,2031,1,9,203103,2031),('2031-03-02',203110,3,2031,2,10,203103,2031),('2031-03-03',203110,3,2031,3,10,203103,2031),('2031-03-04',203110,3,2031,4,10,203103,2031),('2031-03-05',203110,3,2031,5,10,203103,2031),('2031-03-06',203110,3,2031,6,10,203103,2031),('2031-03-07',203110,3,2031,7,10,203103,2031),('2031-03-08',203110,3,2031,8,10,203103,2031),('2031-03-09',203111,3,2031,9,11,203103,2031),('2031-03-10',203111,3,2031,10,11,203103,2031),('2031-03-11',203111,3,2031,11,11,203103,2031),('2031-03-12',203111,3,2031,12,11,203103,2031),('2031-03-13',203111,3,2031,13,11,203103,2031),('2031-03-14',203111,3,2031,14,11,203103,2031),('2031-03-15',203111,3,2031,15,11,203103,2031),('2031-03-16',203112,3,2031,16,12,203103,2031),('2031-03-17',203112,3,2031,17,12,203103,2031),('2031-03-18',203112,3,2031,18,12,203103,2031),('2031-03-19',203112,3,2031,19,12,203103,2031),('2031-03-20',203112,3,2031,20,12,203103,2031),('2031-03-21',203112,3,2031,21,12,203103,2031),('2031-03-22',203112,3,2031,22,12,203103,2031),('2031-03-23',203113,3,2031,23,13,203103,2031),('2031-03-24',203113,3,2031,24,13,203103,2031),('2031-03-25',203113,3,2031,25,13,203103,2031),('2031-03-26',203113,3,2031,26,13,203103,2031),('2031-03-27',203113,3,2031,27,13,203103,2031),('2031-03-28',203113,3,2031,28,13,203103,2031),('2031-03-29',203113,3,2031,29,13,203103,2031),('2031-03-30',203114,3,2031,30,14,203103,2031),('2031-03-31',203114,3,2031,31,14,203103,2031),('2031-04-01',203114,4,2031,1,14,203104,2031),('2031-04-02',203114,4,2031,2,14,203104,2031),('2031-04-03',203114,4,2031,3,14,203104,2031),('2031-04-04',203114,4,2031,4,14,203104,2031),('2031-04-05',203114,4,2031,5,14,203104,2031),('2031-04-06',203115,4,2031,6,15,203104,2031),('2031-04-07',203115,4,2031,7,15,203104,2031),('2031-04-08',203115,4,2031,8,15,203104,2031),('2031-04-09',203115,4,2031,9,15,203104,2031),('2031-04-10',203115,4,2031,10,15,203104,2031),('2031-04-11',203115,4,2031,11,15,203104,2031),('2031-04-12',203115,4,2031,12,15,203104,2031),('2031-04-13',203116,4,2031,13,16,203104,2031),('2031-04-14',203116,4,2031,14,16,203104,2031),('2031-04-15',203116,4,2031,15,16,203104,2031),('2031-04-16',203116,4,2031,16,16,203104,2031),('2031-04-17',203116,4,2031,17,16,203104,2031),('2031-04-18',203116,4,2031,18,16,203104,2031),('2031-04-19',203116,4,2031,19,16,203104,2031),('2031-04-20',203117,4,2031,20,17,203104,2031),('2031-04-21',203117,4,2031,21,17,203104,2031),('2031-04-22',203117,4,2031,22,17,203104,2031),('2031-04-23',203117,4,2031,23,17,203104,2031),('2031-04-24',203117,4,2031,24,17,203104,2031),('2031-04-25',203117,4,2031,25,17,203104,2031),('2031-04-26',203117,4,2031,26,17,203104,2031),('2031-04-27',203118,4,2031,27,18,203104,2031),('2031-04-28',203118,4,2031,28,18,203104,2031),('2031-04-29',203118,4,2031,29,18,203104,2031),('2031-04-30',203118,4,2031,30,18,203104,2031),('2031-05-01',203118,5,2031,1,18,203105,2031),('2031-05-02',203118,5,2031,2,18,203105,2031),('2031-05-03',203118,5,2031,3,18,203105,2031),('2031-05-04',203119,5,2031,4,19,203105,2031),('2031-05-05',203119,5,2031,5,19,203105,2031),('2031-05-06',203119,5,2031,6,19,203105,2031),('2031-05-07',203119,5,2031,7,19,203105,2031),('2031-05-08',203119,5,2031,8,19,203105,2031),('2031-05-09',203119,5,2031,9,19,203105,2031),('2031-05-10',203119,5,2031,10,19,203105,2031),('2031-05-11',203120,5,2031,11,20,203105,2031),('2031-05-12',203120,5,2031,12,20,203105,2031),('2031-05-13',203120,5,2031,13,20,203105,2031),('2031-05-14',203120,5,2031,14,20,203105,2031),('2031-05-15',203120,5,2031,15,20,203105,2031),('2031-05-16',203120,5,2031,16,20,203105,2031),('2031-05-17',203120,5,2031,17,20,203105,2031),('2031-05-18',203121,5,2031,18,21,203105,2031),('2031-05-19',203121,5,2031,19,21,203105,2031),('2031-05-20',203121,5,2031,20,21,203105,2031),('2031-05-21',203121,5,2031,21,21,203105,2031),('2031-05-22',203121,5,2031,22,21,203105,2031),('2031-05-23',203121,5,2031,23,21,203105,2031),('2031-05-24',203121,5,2031,24,21,203105,2031),('2031-05-25',203122,5,2031,25,22,203105,2031),('2031-05-26',203122,5,2031,26,22,203105,2031),('2031-05-27',203122,5,2031,27,22,203105,2031),('2031-05-28',203122,5,2031,28,22,203105,2031),('2031-05-29',203122,5,2031,29,22,203105,2031),('2031-05-30',203122,5,2031,30,22,203105,2031),('2031-05-31',203122,5,2031,31,22,203105,2031),('2031-06-01',203123,6,2031,1,23,203106,2031),('2031-06-02',203123,6,2031,2,23,203106,2031),('2031-06-03',203123,6,2031,3,23,203106,2031),('2031-06-04',203123,6,2031,4,23,203106,2031),('2031-06-05',203123,6,2031,5,23,203106,2031),('2031-06-06',203123,6,2031,6,23,203106,2031),('2031-06-07',203123,6,2031,7,23,203106,2031),('2031-06-08',203124,6,2031,8,24,203106,2031),('2031-06-09',203124,6,2031,9,24,203106,2031),('2031-06-10',203124,6,2031,10,24,203106,2031),('2031-06-11',203124,6,2031,11,24,203106,2031),('2031-06-12',203124,6,2031,12,24,203106,2031),('2031-06-13',203124,6,2031,13,24,203106,2031),('2031-06-14',203124,6,2031,14,24,203106,2031),('2031-06-15',203125,6,2031,15,25,203106,2031),('2031-06-16',203125,6,2031,16,25,203106,2031),('2031-06-17',203125,6,2031,17,25,203106,2031),('2031-06-18',203125,6,2031,18,25,203106,2031),('2031-06-19',203125,6,2031,19,25,203106,2031),('2031-06-20',203125,6,2031,20,25,203106,2031),('2031-06-21',203125,6,2031,21,25,203106,2031),('2031-06-22',203126,6,2031,22,26,203106,2031),('2031-06-23',203126,6,2031,23,26,203106,2031),('2031-06-24',203126,6,2031,24,26,203106,2031),('2031-06-25',203126,6,2031,25,26,203106,2031),('2031-06-26',203126,6,2031,26,26,203106,2031),('2031-06-27',203126,6,2031,27,26,203106,2031),('2031-06-28',203126,6,2031,28,26,203106,2031),('2031-06-29',203127,6,2031,29,27,203106,2031),('2031-06-30',203127,6,2031,30,27,203106,2031),('2031-07-01',203127,7,2031,1,27,203107,2031),('2031-07-02',203127,7,2031,2,27,203107,2031),('2031-07-03',203127,7,2031,3,27,203107,2031),('2031-07-04',203127,7,2031,4,27,203107,2031),('2031-07-05',203127,7,2031,5,27,203107,2031),('2031-07-06',203128,7,2031,6,28,203107,2031),('2031-07-07',203128,7,2031,7,28,203107,2031),('2031-07-08',203128,7,2031,8,28,203107,2031),('2031-07-09',203128,7,2031,9,28,203107,2031),('2031-07-10',203128,7,2031,10,28,203107,2031),('2031-07-11',203128,7,2031,11,28,203107,2031),('2031-07-12',203128,7,2031,12,28,203107,2031),('2031-07-13',203129,7,2031,13,29,203107,2031),('2031-07-14',203129,7,2031,14,29,203107,2031),('2031-07-15',203129,7,2031,15,29,203107,2031),('2031-07-16',203129,7,2031,16,29,203107,2031),('2031-07-17',203129,7,2031,17,29,203107,2031),('2031-07-18',203129,7,2031,18,29,203107,2031),('2031-07-19',203129,7,2031,19,29,203107,2031),('2031-07-20',203130,7,2031,20,30,203107,2031),('2031-07-21',203130,7,2031,21,30,203107,2031),('2031-07-22',203130,7,2031,22,30,203107,2031),('2031-07-23',203130,7,2031,23,30,203107,2031),('2031-07-24',203130,7,2031,24,30,203107,2031),('2031-07-25',203130,7,2031,25,30,203107,2031),('2031-07-26',203130,7,2031,26,30,203107,2031),('2031-07-27',203131,7,2031,27,31,203107,2031),('2031-07-28',203131,7,2031,28,31,203107,2031),('2031-07-29',203131,7,2031,29,31,203107,2031),('2031-07-30',203131,7,2031,30,31,203107,2031),('2031-07-31',203131,7,2031,31,31,203107,2031),('2031-08-01',203131,8,2031,1,31,203108,2031),('2031-08-02',203131,8,2031,2,31,203108,2031),('2031-08-03',203132,8,2031,3,32,203108,2031),('2031-08-04',203132,8,2031,4,32,203108,2031),('2031-08-05',203132,8,2031,5,32,203108,2031),('2031-08-06',203132,8,2031,6,32,203108,2031),('2031-08-07',203132,8,2031,7,32,203108,2031),('2031-08-08',203132,8,2031,8,32,203108,2031),('2031-08-09',203132,8,2031,9,32,203108,2031),('2031-08-10',203133,8,2031,10,33,203108,2031),('2031-08-11',203133,8,2031,11,33,203108,2031),('2031-08-12',203133,8,2031,12,33,203108,2031),('2031-08-13',203133,8,2031,13,33,203108,2031),('2031-08-14',203133,8,2031,14,33,203108,2031),('2031-08-15',203133,8,2031,15,33,203108,2031),('2031-08-16',203133,8,2031,16,33,203108,2031),('2031-08-17',203134,8,2031,17,34,203108,2031),('2031-08-18',203134,8,2031,18,34,203108,2031),('2031-08-19',203134,8,2031,19,34,203108,2031),('2031-08-20',203134,8,2031,20,34,203108,2031),('2031-08-21',203134,8,2031,21,34,203108,2031),('2031-08-22',203134,8,2031,22,34,203108,2031),('2031-08-23',203134,8,2031,23,34,203108,2031),('2031-08-24',203135,8,2031,24,35,203108,2031),('2031-08-25',203135,8,2031,25,35,203108,2031),('2031-08-26',203135,8,2031,26,35,203108,2031),('2031-08-27',203135,8,2031,27,35,203108,2031),('2031-08-28',203135,8,2031,28,35,203108,2031),('2031-08-29',203135,8,2031,29,35,203108,2031),('2031-08-30',203135,8,2031,30,35,203108,2031),('2031-08-31',203136,8,2031,31,36,203108,2031),('2031-09-01',203136,9,2031,1,36,203109,2031),('2031-09-02',203136,9,2031,2,36,203109,2031),('2031-09-03',203136,9,2031,3,36,203109,2031),('2031-09-04',203136,9,2031,4,36,203109,2031),('2031-09-05',203136,9,2031,5,36,203109,2031),('2031-09-06',203136,9,2031,6,36,203109,2031),('2031-09-07',203137,9,2031,7,37,203109,2031),('2031-09-08',203137,9,2031,8,37,203109,2031),('2031-09-09',203137,9,2031,9,37,203109,2031),('2031-09-10',203137,9,2031,10,37,203109,2031),('2031-09-11',203137,9,2031,11,37,203109,2031),('2031-09-12',203137,9,2031,12,37,203109,2031),('2031-09-13',203137,9,2031,13,37,203109,2031),('2031-09-14',203138,9,2031,14,38,203109,2031),('2031-09-15',203138,9,2031,15,38,203109,2031),('2031-09-16',203138,9,2031,16,38,203109,2031),('2031-09-17',203138,9,2031,17,38,203109,2031),('2031-09-18',203138,9,2031,18,38,203109,2031),('2031-09-19',203138,9,2031,19,38,203109,2031),('2031-09-20',203138,9,2031,20,38,203109,2031),('2031-09-21',203139,9,2031,21,39,203109,2031),('2031-09-22',203139,9,2031,22,39,203109,2031),('2031-09-23',203139,9,2031,23,39,203109,2031),('2031-09-24',203139,9,2031,24,39,203109,2031),('2031-09-25',203139,9,2031,25,39,203109,2031),('2031-09-26',203139,9,2031,26,39,203109,2031),('2031-09-27',203139,9,2031,27,39,203109,2031),('2031-09-28',203140,9,2031,28,40,203109,2031),('2031-09-29',203140,9,2031,29,40,203109,2031),('2031-09-30',203140,9,2031,30,40,203109,2031),('2031-10-01',203140,10,2031,1,40,203110,2031),('2031-10-02',203140,10,2031,2,40,203110,2031),('2031-10-03',203140,10,2031,3,40,203110,2031),('2031-10-04',203140,10,2031,4,40,203110,2031),('2031-10-05',203141,10,2031,5,41,203110,2031),('2031-10-06',203141,10,2031,6,41,203110,2031),('2031-10-07',203141,10,2031,7,41,203110,2031),('2031-10-08',203141,10,2031,8,41,203110,2031),('2031-10-09',203141,10,2031,9,41,203110,2031),('2031-10-10',203141,10,2031,10,41,203110,2031),('2031-10-11',203141,10,2031,11,41,203110,2031),('2031-10-12',203142,10,2031,12,42,203110,2031),('2031-10-13',203142,10,2031,13,42,203110,2031),('2031-10-14',203142,10,2031,14,42,203110,2031),('2031-10-15',203142,10,2031,15,42,203110,2031),('2031-10-16',203142,10,2031,16,42,203110,2031),('2031-10-17',203142,10,2031,17,42,203110,2031),('2031-10-18',203142,10,2031,18,42,203110,2031),('2031-10-19',203143,10,2031,19,43,203110,2031),('2031-10-20',203143,10,2031,20,43,203110,2031),('2031-10-21',203143,10,2031,21,43,203110,2031),('2031-10-22',203143,10,2031,22,43,203110,2031),('2031-10-23',203143,10,2031,23,43,203110,2031),('2031-10-24',203143,10,2031,24,43,203110,2031),('2031-10-25',203143,10,2031,25,43,203110,2031),('2031-10-26',203144,10,2031,26,44,203110,2031),('2031-10-27',203144,10,2031,27,44,203110,2031),('2031-10-28',203144,10,2031,28,44,203110,2031),('2031-10-29',203144,10,2031,29,44,203110,2031),('2031-10-30',203144,10,2031,30,44,203110,2031),('2031-10-31',203144,10,2031,31,44,203110,2031),('2031-11-01',203144,11,2031,1,44,203111,2031),('2031-11-02',203145,11,2031,2,45,203111,2031),('2031-11-03',203145,11,2031,3,45,203111,2031),('2031-11-04',203145,11,2031,4,45,203111,2031),('2031-11-05',203145,11,2031,5,45,203111,2031),('2031-11-06',203145,11,2031,6,45,203111,2031),('2031-11-07',203145,11,2031,7,45,203111,2031),('2031-11-08',203145,11,2031,8,45,203111,2031),('2031-11-09',203146,11,2031,9,46,203111,2031),('2031-11-10',203146,11,2031,10,46,203111,2031),('2031-11-11',203146,11,2031,11,46,203111,2031),('2031-11-12',203146,11,2031,12,46,203111,2031),('2031-11-13',203146,11,2031,13,46,203111,2031),('2031-11-14',203146,11,2031,14,46,203111,2031),('2031-11-15',203146,11,2031,15,46,203111,2031),('2031-11-16',203147,11,2031,16,47,203111,2031),('2031-11-17',203147,11,2031,17,47,203111,2031),('2031-11-18',203147,11,2031,18,47,203111,2031),('2031-11-19',203147,11,2031,19,47,203111,2031),('2031-11-20',203147,11,2031,20,47,203111,2031),('2031-11-21',203147,11,2031,21,47,203111,2031),('2031-11-22',203147,11,2031,22,47,203111,2031),('2031-11-23',203148,11,2031,23,48,203111,2031),('2031-11-24',203148,11,2031,24,48,203111,2031),('2031-11-25',203148,11,2031,25,48,203111,2031),('2031-11-26',203148,11,2031,26,48,203111,2031),('2031-11-27',203148,11,2031,27,48,203111,2031),('2031-11-28',203148,11,2031,28,48,203111,2031),('2031-11-29',203148,11,2031,29,48,203111,2031),('2031-11-30',203149,11,2031,30,49,203111,2031),('2031-12-01',203149,12,2031,1,49,203112,2032),('2031-12-02',203149,12,2031,2,49,203112,2032),('2031-12-03',203149,12,2031,3,49,203112,2032),('2031-12-04',203149,12,2031,4,49,203112,2032),('2031-12-05',203149,12,2031,5,49,203112,2032),('2031-12-06',203149,12,2031,6,49,203112,2032),('2031-12-07',203150,12,2031,7,50,203112,2032),('2031-12-08',203150,12,2031,8,50,203112,2032),('2031-12-09',203150,12,2031,9,50,203112,2032),('2031-12-10',203150,12,2031,10,50,203112,2032),('2031-12-11',203150,12,2031,11,50,203112,2032),('2031-12-12',203150,12,2031,12,50,203112,2032),('2031-12-13',203150,12,2031,13,50,203112,2032),('2031-12-14',203151,12,2031,14,51,203112,2032),('2031-12-15',203151,12,2031,15,51,203112,2032),('2031-12-16',203151,12,2031,16,51,203112,2032),('2031-12-17',203151,12,2031,17,51,203112,2032),('2031-12-18',203151,12,2031,18,51,203112,2032),('2031-12-19',203151,12,2031,19,51,203112,2032),('2031-12-20',203151,12,2031,20,51,203112,2032),('2031-12-21',203152,12,2031,21,52,203112,2032),('2031-12-22',203152,12,2031,22,52,203112,2032),('2031-12-23',203152,12,2031,23,52,203112,2032),('2031-12-24',203152,12,2031,24,52,203112,2032),('2031-12-25',203152,12,2031,25,52,203112,2032),('2031-12-26',203152,12,2031,26,52,203112,2032),('2031-12-27',203152,12,2031,27,52,203112,2032),('2031-12-28',203153,12,2031,28,53,203112,2032),('2031-12-29',203101,12,2031,29,53,203112,2032),('2031-12-30',203101,12,2031,30,53,203112,2032),('2031-12-31',203101,12,2031,31,53,203112,2032),('2032-01-01',203201,1,2032,1,53,203201,2032),('2032-01-02',203201,1,2032,2,53,203201,2032),('2032-01-03',203201,1,2032,3,53,203201,2032),('2032-01-04',203202,1,2032,4,1,203201,2032),('2032-01-05',203202,1,2032,5,1,203201,2032),('2032-01-06',203202,1,2032,6,1,203201,2032),('2032-01-07',203202,1,2032,7,1,203201,2032),('2032-01-08',203202,1,2032,8,1,203201,2032),('2032-01-09',203202,1,2032,9,1,203201,2032),('2032-01-10',203202,1,2032,10,1,203201,2032),('2032-01-11',203203,1,2032,11,2,203201,2032),('2032-01-12',203203,1,2032,12,2,203201,2032),('2032-01-13',203203,1,2032,13,2,203201,2032),('2032-01-14',203203,1,2032,14,2,203201,2032),('2032-01-15',203203,1,2032,15,2,203201,2032),('2032-01-16',203203,1,2032,16,2,203201,2032),('2032-01-17',203203,1,2032,17,2,203201,2032),('2032-01-18',203204,1,2032,18,3,203201,2032),('2032-01-19',203204,1,2032,19,3,203201,2032),('2032-01-20',203204,1,2032,20,3,203201,2032),('2032-01-21',203204,1,2032,21,3,203201,2032),('2032-01-22',203204,1,2032,22,3,203201,2032),('2032-01-23',203204,1,2032,23,3,203201,2032),('2032-01-24',203204,1,2032,24,3,203201,2032),('2032-01-25',203205,1,2032,25,4,203201,2032),('2032-01-26',203205,1,2032,26,4,203201,2032),('2032-01-27',203205,1,2032,27,4,203201,2032),('2032-01-28',203205,1,2032,28,4,203201,2032),('2032-01-29',203205,1,2032,29,4,203201,2032),('2032-01-30',203205,1,2032,30,4,203201,2032),('2032-01-31',203205,1,2032,31,4,203201,2032),('2032-02-01',203206,2,2032,1,5,203202,2032),('2032-02-02',203206,2,2032,2,5,203202,2032),('2032-02-03',203206,2,2032,3,5,203202,2032),('2032-02-04',203206,2,2032,4,5,203202,2032),('2032-02-05',203206,2,2032,5,5,203202,2032),('2032-02-06',203206,2,2032,6,5,203202,2032),('2032-02-07',203206,2,2032,7,5,203202,2032),('2032-02-08',203207,2,2032,8,6,203202,2032),('2032-02-09',203207,2,2032,9,6,203202,2032),('2032-02-10',203207,2,2032,10,6,203202,2032),('2032-02-11',203207,2,2032,11,6,203202,2032),('2032-02-12',203207,2,2032,12,6,203202,2032),('2032-02-13',203207,2,2032,13,6,203202,2032),('2032-02-14',203207,2,2032,14,6,203202,2032),('2032-02-15',203208,2,2032,15,7,203202,2032),('2032-02-16',203208,2,2032,16,7,203202,2032),('2032-02-17',203208,2,2032,17,7,203202,2032),('2032-02-18',203208,2,2032,18,7,203202,2032),('2032-02-19',203208,2,2032,19,7,203202,2032),('2032-02-20',203208,2,2032,20,7,203202,2032),('2032-02-21',203208,2,2032,21,7,203202,2032),('2032-02-22',203209,2,2032,22,8,203202,2032),('2032-02-23',203209,2,2032,23,8,203202,2032),('2032-02-24',203209,2,2032,24,8,203202,2032),('2032-02-25',203209,2,2032,25,8,203202,2032),('2032-02-26',203209,2,2032,26,8,203202,2032),('2032-02-27',203209,2,2032,27,8,203202,2032),('2032-02-28',203209,2,2032,28,8,203202,2032),('2032-02-29',203210,2,2032,29,9,203202,2032),('2032-03-01',203210,3,2032,1,9,203203,2032),('2032-03-02',203210,3,2032,2,9,203203,2032),('2032-03-03',203210,3,2032,3,9,203203,2032),('2032-03-04',203210,3,2032,4,9,203203,2032),('2032-03-05',203210,3,2032,5,9,203203,2032),('2032-03-06',203210,3,2032,6,9,203203,2032),('2032-03-07',203211,3,2032,7,10,203203,2032),('2032-03-08',203211,3,2032,8,10,203203,2032),('2032-03-09',203211,3,2032,9,10,203203,2032),('2032-03-10',203211,3,2032,10,10,203203,2032),('2032-03-11',203211,3,2032,11,10,203203,2032),('2032-03-12',203211,3,2032,12,10,203203,2032),('2032-03-13',203211,3,2032,13,10,203203,2032),('2032-03-14',203212,3,2032,14,11,203203,2032),('2032-03-15',203212,3,2032,15,11,203203,2032),('2032-03-16',203212,3,2032,16,11,203203,2032),('2032-03-17',203212,3,2032,17,11,203203,2032),('2032-03-18',203212,3,2032,18,11,203203,2032),('2032-03-19',203212,3,2032,19,11,203203,2032),('2032-03-20',203212,3,2032,20,11,203203,2032),('2032-03-21',203213,3,2032,21,12,203203,2032),('2032-03-22',203213,3,2032,22,12,203203,2032),('2032-03-23',203213,3,2032,23,12,203203,2032),('2032-03-24',203213,3,2032,24,12,203203,2032),('2032-03-25',203213,3,2032,25,12,203203,2032),('2032-03-26',203213,3,2032,26,12,203203,2032),('2032-03-27',203213,3,2032,27,12,203203,2032),('2032-03-28',203214,3,2032,28,13,203203,2032),('2032-03-29',203214,3,2032,29,13,203203,2032),('2032-03-30',203214,3,2032,30,13,203203,2032),('2032-03-31',203214,3,2032,31,13,203203,2032),('2032-04-01',203214,4,2032,1,13,203204,2032),('2032-04-02',203214,4,2032,2,13,203204,2032),('2032-04-03',203214,4,2032,3,13,203204,2032),('2032-04-04',203215,4,2032,4,14,203204,2032),('2032-04-05',203215,4,2032,5,14,203204,2032),('2032-04-06',203215,4,2032,6,14,203204,2032),('2032-04-07',203215,4,2032,7,14,203204,2032),('2032-04-08',203215,4,2032,8,14,203204,2032),('2032-04-09',203215,4,2032,9,14,203204,2032),('2032-04-10',203215,4,2032,10,14,203204,2032),('2032-04-11',203216,4,2032,11,15,203204,2032),('2032-04-12',203216,4,2032,12,15,203204,2032),('2032-04-13',203216,4,2032,13,15,203204,2032),('2032-04-14',203216,4,2032,14,15,203204,2032),('2032-04-15',203216,4,2032,15,15,203204,2032),('2032-04-16',203216,4,2032,16,15,203204,2032),('2032-04-17',203216,4,2032,17,15,203204,2032),('2032-04-18',203217,4,2032,18,16,203204,2032),('2032-04-19',203217,4,2032,19,16,203204,2032),('2032-04-20',203217,4,2032,20,16,203204,2032),('2032-04-21',203217,4,2032,21,16,203204,2032),('2032-04-22',203217,4,2032,22,16,203204,2032),('2032-04-23',203217,4,2032,23,16,203204,2032),('2032-04-24',203217,4,2032,24,16,203204,2032),('2032-04-25',203218,4,2032,25,17,203204,2032),('2032-04-26',203218,4,2032,26,17,203204,2032),('2032-04-27',203218,4,2032,27,17,203204,2032),('2032-04-28',203218,4,2032,28,17,203204,2032),('2032-04-29',203218,4,2032,29,17,203204,2032),('2032-04-30',203218,4,2032,30,17,203204,2032),('2032-05-01',203218,5,2032,1,17,203205,2032),('2032-05-02',203219,5,2032,2,18,203205,2032),('2032-05-03',203219,5,2032,3,18,203205,2032),('2032-05-04',203219,5,2032,4,18,203205,2032),('2032-05-05',203219,5,2032,5,18,203205,2032),('2032-05-06',203219,5,2032,6,18,203205,2032),('2032-05-07',203219,5,2032,7,18,203205,2032),('2032-05-08',203219,5,2032,8,18,203205,2032),('2032-05-09',203220,5,2032,9,19,203205,2032),('2032-05-10',203220,5,2032,10,19,203205,2032),('2032-05-11',203220,5,2032,11,19,203205,2032),('2032-05-12',203220,5,2032,12,19,203205,2032),('2032-05-13',203220,5,2032,13,19,203205,2032),('2032-05-14',203220,5,2032,14,19,203205,2032),('2032-05-15',203220,5,2032,15,19,203205,2032),('2032-05-16',203221,5,2032,16,20,203205,2032),('2032-05-17',203221,5,2032,17,20,203205,2032),('2032-05-18',203221,5,2032,18,20,203205,2032),('2032-05-19',203221,5,2032,19,20,203205,2032),('2032-05-20',203221,5,2032,20,20,203205,2032),('2032-05-21',203221,5,2032,21,20,203205,2032),('2032-05-22',203221,5,2032,22,20,203205,2032),('2032-05-23',203222,5,2032,23,21,203205,2032),('2032-05-24',203222,5,2032,24,21,203205,2032),('2032-05-25',203222,5,2032,25,21,203205,2032),('2032-05-26',203222,5,2032,26,21,203205,2032),('2032-05-27',203222,5,2032,27,21,203205,2032),('2032-05-28',203222,5,2032,28,21,203205,2032),('2032-05-29',203222,5,2032,29,21,203205,2032),('2032-05-30',203223,5,2032,30,22,203205,2032),('2032-05-31',203223,5,2032,31,22,203205,2032),('2032-06-01',203223,6,2032,1,22,203206,2032),('2032-06-02',203223,6,2032,2,22,203206,2032),('2032-06-03',203223,6,2032,3,22,203206,2032),('2032-06-04',203223,6,2032,4,22,203206,2032),('2032-06-05',203223,6,2032,5,22,203206,2032),('2032-06-06',203224,6,2032,6,23,203206,2032),('2032-06-07',203224,6,2032,7,23,203206,2032),('2032-06-08',203224,6,2032,8,23,203206,2032),('2032-06-09',203224,6,2032,9,23,203206,2032),('2032-06-10',203224,6,2032,10,23,203206,2032),('2032-06-11',203224,6,2032,11,23,203206,2032),('2032-06-12',203224,6,2032,12,23,203206,2032),('2032-06-13',203225,6,2032,13,24,203206,2032),('2032-06-14',203225,6,2032,14,24,203206,2032),('2032-06-15',203225,6,2032,15,24,203206,2032),('2032-06-16',203225,6,2032,16,24,203206,2032),('2032-06-17',203225,6,2032,17,24,203206,2032),('2032-06-18',203225,6,2032,18,24,203206,2032),('2032-06-19',203225,6,2032,19,24,203206,2032),('2032-06-20',203226,6,2032,20,25,203206,2032),('2032-06-21',203226,6,2032,21,25,203206,2032),('2032-06-22',203226,6,2032,22,25,203206,2032),('2032-06-23',203226,6,2032,23,25,203206,2032),('2032-06-24',203226,6,2032,24,25,203206,2032),('2032-06-25',203226,6,2032,25,25,203206,2032),('2032-06-26',203226,6,2032,26,25,203206,2032),('2032-06-27',203227,6,2032,27,26,203206,2032),('2032-06-28',203227,6,2032,28,26,203206,2032),('2032-06-29',203227,6,2032,29,26,203206,2032),('2032-06-30',203227,6,2032,30,26,203206,2032),('2032-07-01',203227,7,2032,1,26,203207,2032),('2032-07-02',203227,7,2032,2,26,203207,2032),('2032-07-03',203227,7,2032,3,26,203207,2032),('2032-07-04',203228,7,2032,4,27,203207,2032),('2032-07-05',203228,7,2032,5,27,203207,2032),('2032-07-06',203228,7,2032,6,27,203207,2032),('2032-07-07',203228,7,2032,7,27,203207,2032),('2032-07-08',203228,7,2032,8,27,203207,2032),('2032-07-09',203228,7,2032,9,27,203207,2032),('2032-07-10',203228,7,2032,10,27,203207,2032),('2032-07-11',203229,7,2032,11,28,203207,2032),('2032-07-12',203229,7,2032,12,28,203207,2032),('2032-07-13',203229,7,2032,13,28,203207,2032),('2032-07-14',203229,7,2032,14,28,203207,2032),('2032-07-15',203229,7,2032,15,28,203207,2032),('2032-07-16',203229,7,2032,16,28,203207,2032),('2032-07-17',203229,7,2032,17,28,203207,2032),('2032-07-18',203230,7,2032,18,29,203207,2032),('2032-07-19',203230,7,2032,19,29,203207,2032),('2032-07-20',203230,7,2032,20,29,203207,2032),('2032-07-21',203230,7,2032,21,29,203207,2032),('2032-07-22',203230,7,2032,22,29,203207,2032),('2032-07-23',203230,7,2032,23,29,203207,2032),('2032-07-24',203230,7,2032,24,29,203207,2032),('2032-07-25',203231,7,2032,25,30,203207,2032),('2032-07-26',203231,7,2032,26,30,203207,2032),('2032-07-27',203231,7,2032,27,30,203207,2032),('2032-07-28',203231,7,2032,28,30,203207,2032),('2032-07-29',203231,7,2032,29,30,203207,2032),('2032-07-30',203231,7,2032,30,30,203207,2032),('2032-07-31',203231,7,2032,31,30,203207,2032),('2032-08-01',203232,8,2032,1,31,203208,2032),('2032-08-02',203232,8,2032,2,31,203208,2032),('2032-08-03',203232,8,2032,3,31,203208,2032),('2032-08-04',203232,8,2032,4,31,203208,2032),('2032-08-05',203232,8,2032,5,31,203208,2032),('2032-08-06',203232,8,2032,6,31,203208,2032),('2032-08-07',203232,8,2032,7,31,203208,2032),('2032-08-08',203233,8,2032,8,32,203208,2032),('2032-08-09',203233,8,2032,9,32,203208,2032),('2032-08-10',203233,8,2032,10,32,203208,2032),('2032-08-11',203233,8,2032,11,32,203208,2032),('2032-08-12',203233,8,2032,12,32,203208,2032),('2032-08-13',203233,8,2032,13,32,203208,2032),('2032-08-14',203233,8,2032,14,32,203208,2032),('2032-08-15',203234,8,2032,15,33,203208,2032),('2032-08-16',203234,8,2032,16,33,203208,2032),('2032-08-17',203234,8,2032,17,33,203208,2032),('2032-08-18',203234,8,2032,18,33,203208,2032),('2032-08-19',203234,8,2032,19,33,203208,2032),('2032-08-20',203234,8,2032,20,33,203208,2032),('2032-08-21',203234,8,2032,21,33,203208,2032),('2032-08-22',203235,8,2032,22,34,203208,2032),('2032-08-23',203235,8,2032,23,34,203208,2032),('2032-08-24',203235,8,2032,24,34,203208,2032),('2032-08-25',203235,8,2032,25,34,203208,2032),('2032-08-26',203235,8,2032,26,34,203208,2032),('2032-08-27',203235,8,2032,27,34,203208,2032),('2032-08-28',203235,8,2032,28,34,203208,2032),('2032-08-29',203236,8,2032,29,35,203208,2032),('2032-08-30',203236,8,2032,30,35,203208,2032),('2032-08-31',203236,8,2032,31,35,203208,2032),('2032-09-01',203236,9,2032,1,35,203209,2032),('2032-09-02',203236,9,2032,2,35,203209,2032),('2032-09-03',203236,9,2032,3,35,203209,2032),('2032-09-04',203236,9,2032,4,35,203209,2032),('2032-09-05',203237,9,2032,5,36,203209,2032),('2032-09-06',203237,9,2032,6,36,203209,2032),('2032-09-07',203237,9,2032,7,36,203209,2032),('2032-09-08',203237,9,2032,8,36,203209,2032),('2032-09-09',203237,9,2032,9,36,203209,2032),('2032-09-10',203237,9,2032,10,36,203209,2032),('2032-09-11',203237,9,2032,11,36,203209,2032),('2032-09-12',203238,9,2032,12,37,203209,2032),('2032-09-13',203238,9,2032,13,37,203209,2032),('2032-09-14',203238,9,2032,14,37,203209,2032),('2032-09-15',203238,9,2032,15,37,203209,2032),('2032-09-16',203238,9,2032,16,37,203209,2032),('2032-09-17',203238,9,2032,17,37,203209,2032),('2032-09-18',203238,9,2032,18,37,203209,2032),('2032-09-19',203239,9,2032,19,38,203209,2032),('2032-09-20',203239,9,2032,20,38,203209,2032),('2032-09-21',203239,9,2032,21,38,203209,2032),('2032-09-22',203239,9,2032,22,38,203209,2032),('2032-09-23',203239,9,2032,23,38,203209,2032),('2032-09-24',203239,9,2032,24,38,203209,2032),('2032-09-25',203239,9,2032,25,38,203209,2032),('2032-09-26',203240,9,2032,26,39,203209,2032),('2032-09-27',203240,9,2032,27,39,203209,2032),('2032-09-28',203240,9,2032,28,39,203209,2032),('2032-09-29',203240,9,2032,29,39,203209,2032),('2032-09-30',203240,9,2032,30,39,203209,2032),('2032-10-01',203240,10,2032,1,39,203210,2032),('2032-10-02',203240,10,2032,2,39,203210,2032),('2032-10-03',203241,10,2032,3,40,203210,2032),('2032-10-04',203241,10,2032,4,40,203210,2032),('2032-10-05',203241,10,2032,5,40,203210,2032),('2032-10-06',203241,10,2032,6,40,203210,2032),('2032-10-07',203241,10,2032,7,40,203210,2032),('2032-10-08',203241,10,2032,8,40,203210,2032),('2032-10-09',203241,10,2032,9,40,203210,2032),('2032-10-10',203242,10,2032,10,41,203210,2032),('2032-10-11',203242,10,2032,11,41,203210,2032),('2032-10-12',203242,10,2032,12,41,203210,2032),('2032-10-13',203242,10,2032,13,41,203210,2032),('2032-10-14',203242,10,2032,14,41,203210,2032),('2032-10-15',203242,10,2032,15,41,203210,2032),('2032-10-16',203242,10,2032,16,41,203210,2032),('2032-10-17',203243,10,2032,17,42,203210,2032),('2032-10-18',203243,10,2032,18,42,203210,2032),('2032-10-19',203243,10,2032,19,42,203210,2032),('2032-10-20',203243,10,2032,20,42,203210,2032),('2032-10-21',203243,10,2032,21,42,203210,2032),('2032-10-22',203243,10,2032,22,42,203210,2032),('2032-10-23',203243,10,2032,23,42,203210,2032),('2032-10-24',203244,10,2032,24,43,203210,2032),('2032-10-25',203244,10,2032,25,43,203210,2032),('2032-10-26',203244,10,2032,26,43,203210,2032),('2032-10-27',203244,10,2032,27,43,203210,2032),('2032-10-28',203244,10,2032,28,43,203210,2032),('2032-10-29',203244,10,2032,29,43,203210,2032),('2032-10-30',203244,10,2032,30,43,203210,2032),('2032-10-31',203245,10,2032,31,44,203210,2032),('2032-11-01',203245,11,2032,1,44,203211,2032),('2032-11-02',203245,11,2032,2,44,203211,2032),('2032-11-03',203245,11,2032,3,44,203211,2032),('2032-11-04',203245,11,2032,4,44,203211,2032),('2032-11-05',203245,11,2032,5,44,203211,2032),('2032-11-06',203245,11,2032,6,44,203211,2032),('2032-11-07',203246,11,2032,7,45,203211,2032),('2032-11-08',203246,11,2032,8,45,203211,2032),('2032-11-09',203246,11,2032,9,45,203211,2032),('2032-11-10',203246,11,2032,10,45,203211,2032),('2032-11-11',203246,11,2032,11,45,203211,2032),('2032-11-12',203246,11,2032,12,45,203211,2032),('2032-11-13',203246,11,2032,13,45,203211,2032),('2032-11-14',203247,11,2032,14,46,203211,2032),('2032-11-15',203247,11,2032,15,46,203211,2032),('2032-11-16',203247,11,2032,16,46,203211,2032),('2032-11-17',203247,11,2032,17,46,203211,2032),('2032-11-18',203247,11,2032,18,46,203211,2032),('2032-11-19',203247,11,2032,19,46,203211,2032),('2032-11-20',203247,11,2032,20,46,203211,2032),('2032-11-21',203248,11,2032,21,47,203211,2032),('2032-11-22',203248,11,2032,22,47,203211,2032),('2032-11-23',203248,11,2032,23,47,203211,2032),('2032-11-24',203248,11,2032,24,47,203211,2032),('2032-11-25',203248,11,2032,25,47,203211,2032),('2032-11-26',203248,11,2032,26,47,203211,2032),('2032-11-27',203248,11,2032,27,47,203211,2032),('2032-11-28',203249,11,2032,28,48,203211,2032),('2032-11-29',203249,11,2032,29,48,203211,2032),('2032-11-30',203249,11,2032,30,48,203211,2032),('2032-12-01',203249,12,2032,1,48,203212,2033),('2032-12-02',203249,12,2032,2,48,203212,2033),('2032-12-03',203249,12,2032,3,48,203212,2033),('2032-12-04',203249,12,2032,4,48,203212,2033),('2032-12-05',203250,12,2032,5,49,203212,2033),('2032-12-06',203250,12,2032,6,49,203212,2033),('2032-12-07',203250,12,2032,7,49,203212,2033),('2032-12-08',203250,12,2032,8,49,203212,2033),('2032-12-09',203250,12,2032,9,49,203212,2033),('2032-12-10',203250,12,2032,10,49,203212,2033),('2032-12-11',203250,12,2032,11,49,203212,2033),('2032-12-12',203251,12,2032,12,50,203212,2033),('2032-12-13',203251,12,2032,13,50,203212,2033),('2032-12-14',203251,12,2032,14,50,203212,2033),('2032-12-15',203251,12,2032,15,50,203212,2033),('2032-12-16',203251,12,2032,16,50,203212,2033),('2032-12-17',203251,12,2032,17,50,203212,2033),('2032-12-18',203251,12,2032,18,50,203212,2033),('2032-12-19',203252,12,2032,19,51,203212,2033),('2032-12-20',203252,12,2032,20,51,203212,2033),('2032-12-21',203252,12,2032,21,51,203212,2033),('2032-12-22',203252,12,2032,22,51,203212,2033),('2032-12-23',203252,12,2032,23,51,203212,2033),('2032-12-24',203252,12,2032,24,51,203212,2033),('2032-12-25',203252,12,2032,25,51,203212,2033),('2032-12-26',203253,12,2032,26,52,203212,2033),('2032-12-27',203253,12,2032,27,52,203212,2033),('2032-12-28',203253,12,2032,28,52,203212,2033),('2032-12-29',203253,12,2032,29,52,203212,2033),('2032-12-30',203253,12,2032,30,52,203212,2033),('2032-12-31',203253,12,2032,31,52,203212,2033),('2033-01-01',203353,1,2033,1,52,203301,2033),('2033-01-02',203354,1,2033,2,1,203301,2033),('2033-01-03',203301,1,2033,3,1,203301,2033),('2033-01-04',203301,1,2033,4,1,203301,2033),('2033-01-05',203301,1,2033,5,1,203301,2033),('2033-01-06',203301,1,2033,6,1,203301,2033),('2033-01-07',203301,1,2033,7,1,203301,2033),('2033-01-08',203301,1,2033,8,1,203301,2033),('2033-01-09',203302,1,2033,9,2,203301,2033),('2033-01-10',203302,1,2033,10,2,203301,2033),('2033-01-11',203302,1,2033,11,2,203301,2033),('2033-01-12',203302,1,2033,12,2,203301,2033),('2033-01-13',203302,1,2033,13,2,203301,2033),('2033-01-14',203302,1,2033,14,2,203301,2033),('2033-01-15',203302,1,2033,15,2,203301,2033),('2033-01-16',203303,1,2033,16,3,203301,2033),('2033-01-17',203303,1,2033,17,3,203301,2033),('2033-01-18',203303,1,2033,18,3,203301,2033),('2033-01-19',203303,1,2033,19,3,203301,2033),('2033-01-20',203303,1,2033,20,3,203301,2033),('2033-01-21',203303,1,2033,21,3,203301,2033),('2033-01-22',203303,1,2033,22,3,203301,2033),('2033-01-23',203304,1,2033,23,4,203301,2033),('2033-01-24',203304,1,2033,24,4,203301,2033),('2033-01-25',203304,1,2033,25,4,203301,2033),('2033-01-26',203304,1,2033,26,4,203301,2033),('2033-01-27',203304,1,2033,27,4,203301,2033),('2033-01-28',203304,1,2033,28,4,203301,2033),('2033-01-29',203304,1,2033,29,4,203301,2033),('2033-01-30',203305,1,2033,30,5,203301,2033),('2033-01-31',203305,1,2033,31,5,203301,2033),('2033-02-01',203305,2,2033,1,5,203302,2033),('2033-02-02',203305,2,2033,2,5,203302,2033),('2033-02-03',203305,2,2033,3,5,203302,2033),('2033-02-04',203305,2,2033,4,5,203302,2033),('2033-02-05',203305,2,2033,5,5,203302,2033),('2033-02-06',203306,2,2033,6,6,203302,2033),('2033-02-07',203306,2,2033,7,6,203302,2033),('2033-02-08',203306,2,2033,8,6,203302,2033),('2033-02-09',203306,2,2033,9,6,203302,2033),('2033-02-10',203306,2,2033,10,6,203302,2033),('2033-02-11',203306,2,2033,11,6,203302,2033),('2033-02-12',203306,2,2033,12,6,203302,2033),('2033-02-13',203307,2,2033,13,7,203302,2033),('2033-02-14',203307,2,2033,14,7,203302,2033),('2033-02-15',203307,2,2033,15,7,203302,2033),('2033-02-16',203307,2,2033,16,7,203302,2033),('2033-02-17',203307,2,2033,17,7,203302,2033),('2033-02-18',203307,2,2033,18,7,203302,2033),('2033-02-19',203307,2,2033,19,7,203302,2033),('2033-02-20',203308,2,2033,20,8,203302,2033),('2033-02-21',203308,2,2033,21,8,203302,2033),('2033-02-22',203308,2,2033,22,8,203302,2033),('2033-02-23',203308,2,2033,23,8,203302,2033),('2033-02-24',203308,2,2033,24,8,203302,2033),('2033-02-25',203308,2,2033,25,8,203302,2033),('2033-02-26',203308,2,2033,26,8,203302,2033),('2033-02-27',203309,2,2033,27,9,203302,2033),('2033-02-28',203309,2,2033,28,9,203302,2033),('2033-03-01',203309,3,2033,1,9,203303,2033),('2033-03-02',203309,3,2033,2,9,203303,2033),('2033-03-03',203309,3,2033,3,9,203303,2033),('2033-03-04',203309,3,2033,4,9,203303,2033),('2033-03-05',203309,3,2033,5,9,203303,2033),('2033-03-06',203310,3,2033,6,10,203303,2033),('2033-03-07',203310,3,2033,7,10,203303,2033),('2033-03-08',203310,3,2033,8,10,203303,2033),('2033-03-09',203310,3,2033,9,10,203303,2033),('2033-03-10',203310,3,2033,10,10,203303,2033),('2033-03-11',203310,3,2033,11,10,203303,2033),('2033-03-12',203310,3,2033,12,10,203303,2033),('2033-03-13',203311,3,2033,13,11,203303,2033),('2033-03-14',203311,3,2033,14,11,203303,2033),('2033-03-15',203311,3,2033,15,11,203303,2033),('2033-03-16',203311,3,2033,16,11,203303,2033),('2033-03-17',203311,3,2033,17,11,203303,2033),('2033-03-18',203311,3,2033,18,11,203303,2033),('2033-03-19',203311,3,2033,19,11,203303,2033),('2033-03-20',203312,3,2033,20,12,203303,2033),('2033-03-21',203312,3,2033,21,12,203303,2033),('2033-03-22',203312,3,2033,22,12,203303,2033),('2033-03-23',203312,3,2033,23,12,203303,2033),('2033-03-24',203312,3,2033,24,12,203303,2033),('2033-03-25',203312,3,2033,25,12,203303,2033),('2033-03-26',203312,3,2033,26,12,203303,2033),('2033-03-27',203313,3,2033,27,13,203303,2033),('2033-03-28',203313,3,2033,28,13,203303,2033),('2033-03-29',203313,3,2033,29,13,203303,2033),('2033-03-30',203313,3,2033,30,13,203303,2033),('2033-03-31',203313,3,2033,31,13,203303,2033),('2033-04-01',203313,4,2033,1,13,203304,2033),('2033-04-02',203313,4,2033,2,13,203304,2033),('2033-04-03',203314,4,2033,3,14,203304,2033),('2033-04-04',203314,4,2033,4,14,203304,2033),('2033-04-05',203314,4,2033,5,14,203304,2033),('2033-04-06',203314,4,2033,6,14,203304,2033),('2033-04-07',203314,4,2033,7,14,203304,2033),('2033-04-08',203314,4,2033,8,14,203304,2033),('2033-04-09',203314,4,2033,9,14,203304,2033),('2033-04-10',203315,4,2033,10,15,203304,2033),('2033-04-11',203315,4,2033,11,15,203304,2033),('2033-04-12',203315,4,2033,12,15,203304,2033),('2033-04-13',203315,4,2033,13,15,203304,2033),('2033-04-14',203315,4,2033,14,15,203304,2033),('2033-04-15',203315,4,2033,15,15,203304,2033),('2033-04-16',203315,4,2033,16,15,203304,2033),('2033-04-17',203316,4,2033,17,16,203304,2033),('2033-04-18',203316,4,2033,18,16,203304,2033),('2033-04-19',203316,4,2033,19,16,203304,2033),('2033-04-20',203316,4,2033,20,16,203304,2033),('2033-04-21',203316,4,2033,21,16,203304,2033),('2033-04-22',203316,4,2033,22,16,203304,2033),('2033-04-23',203316,4,2033,23,16,203304,2033),('2033-04-24',203317,4,2033,24,17,203304,2033),('2033-04-25',203317,4,2033,25,17,203304,2033),('2033-04-26',203317,4,2033,26,17,203304,2033),('2033-04-27',203317,4,2033,27,17,203304,2033),('2033-04-28',203317,4,2033,28,17,203304,2033),('2033-04-29',203317,4,2033,29,17,203304,2033),('2033-04-30',203317,4,2033,30,17,203304,2033),('2033-05-01',203318,5,2033,1,18,203305,2033),('2033-05-02',203318,5,2033,2,18,203305,2033),('2033-05-03',203318,5,2033,3,18,203305,2033),('2033-05-04',203318,5,2033,4,18,203305,2033),('2033-05-05',203318,5,2033,5,18,203305,2033),('2033-05-06',203318,5,2033,6,18,203305,2033),('2033-05-07',203318,5,2033,7,18,203305,2033),('2033-05-08',203319,5,2033,8,19,203305,2033),('2033-05-09',203319,5,2033,9,19,203305,2033),('2033-05-10',203319,5,2033,10,19,203305,2033),('2033-05-11',203319,5,2033,11,19,203305,2033),('2033-05-12',203319,5,2033,12,19,203305,2033),('2033-05-13',203319,5,2033,13,19,203305,2033),('2033-05-14',203319,5,2033,14,19,203305,2033),('2033-05-15',203320,5,2033,15,20,203305,2033),('2033-05-16',203320,5,2033,16,20,203305,2033),('2033-05-17',203320,5,2033,17,20,203305,2033),('2033-05-18',203320,5,2033,18,20,203305,2033),('2033-05-19',203320,5,2033,19,20,203305,2033),('2033-05-20',203320,5,2033,20,20,203305,2033),('2033-05-21',203320,5,2033,21,20,203305,2033),('2033-05-22',203321,5,2033,22,21,203305,2033),('2033-05-23',203321,5,2033,23,21,203305,2033),('2033-05-24',203321,5,2033,24,21,203305,2033),('2033-05-25',203321,5,2033,25,21,203305,2033),('2033-05-26',203321,5,2033,26,21,203305,2033),('2033-05-27',203321,5,2033,27,21,203305,2033),('2033-05-28',203321,5,2033,28,21,203305,2033),('2033-05-29',203322,5,2033,29,22,203305,2033),('2033-05-30',203322,5,2033,30,22,203305,2033),('2033-05-31',203322,5,2033,31,22,203305,2033),('2033-06-01',203322,6,2033,1,22,203306,2033),('2033-06-02',203322,6,2033,2,22,203306,2033),('2033-06-03',203322,6,2033,3,22,203306,2033),('2033-06-04',203322,6,2033,4,22,203306,2033),('2033-06-05',203323,6,2033,5,23,203306,2033),('2033-06-06',203323,6,2033,6,23,203306,2033),('2033-06-07',203323,6,2033,7,23,203306,2033),('2033-06-08',203323,6,2033,8,23,203306,2033),('2033-06-09',203323,6,2033,9,23,203306,2033),('2033-06-10',203323,6,2033,10,23,203306,2033),('2033-06-11',203323,6,2033,11,23,203306,2033),('2033-06-12',203324,6,2033,12,24,203306,2033),('2033-06-13',203324,6,2033,13,24,203306,2033),('2033-06-14',203324,6,2033,14,24,203306,2033),('2033-06-15',203324,6,2033,15,24,203306,2033),('2033-06-16',203324,6,2033,16,24,203306,2033),('2033-06-17',203324,6,2033,17,24,203306,2033),('2033-06-18',203324,6,2033,18,24,203306,2033),('2033-06-19',203325,6,2033,19,25,203306,2033),('2033-06-20',203325,6,2033,20,25,203306,2033),('2033-06-21',203325,6,2033,21,25,203306,2033),('2033-06-22',203325,6,2033,22,25,203306,2033),('2033-06-23',203325,6,2033,23,25,203306,2033),('2033-06-24',203325,6,2033,24,25,203306,2033),('2033-06-25',203325,6,2033,25,25,203306,2033),('2033-06-26',203326,6,2033,26,26,203306,2033),('2033-06-27',203326,6,2033,27,26,203306,2033),('2033-06-28',203326,6,2033,28,26,203306,2033),('2033-06-29',203326,6,2033,29,26,203306,2033),('2033-06-30',203326,6,2033,30,26,203306,2033),('2033-07-01',203326,7,2033,1,26,203307,2033),('2033-07-02',203326,7,2033,2,26,203307,2033),('2033-07-03',203327,7,2033,3,27,203307,2033),('2033-07-04',203327,7,2033,4,27,203307,2033),('2033-07-05',203327,7,2033,5,27,203307,2033),('2033-07-06',203327,7,2033,6,27,203307,2033),('2033-07-07',203327,7,2033,7,27,203307,2033),('2033-07-08',203327,7,2033,8,27,203307,2033),('2033-07-09',203327,7,2033,9,27,203307,2033),('2033-07-10',203328,7,2033,10,28,203307,2033),('2033-07-11',203328,7,2033,11,28,203307,2033),('2033-07-12',203328,7,2033,12,28,203307,2033),('2033-07-13',203328,7,2033,13,28,203307,2033),('2033-07-14',203328,7,2033,14,28,203307,2033),('2033-07-15',203328,7,2033,15,28,203307,2033),('2033-07-16',203328,7,2033,16,28,203307,2033),('2033-07-17',203329,7,2033,17,29,203307,2033),('2033-07-18',203329,7,2033,18,29,203307,2033),('2033-07-19',203329,7,2033,19,29,203307,2033),('2033-07-20',203329,7,2033,20,29,203307,2033),('2033-07-21',203329,7,2033,21,29,203307,2033),('2033-07-22',203329,7,2033,22,29,203307,2033),('2033-07-23',203329,7,2033,23,29,203307,2033),('2033-07-24',203330,7,2033,24,30,203307,2033),('2033-07-25',203330,7,2033,25,30,203307,2033),('2033-07-26',203330,7,2033,26,30,203307,2033),('2033-07-27',203330,7,2033,27,30,203307,2033),('2033-07-28',203330,7,2033,28,30,203307,2033),('2033-07-29',203330,7,2033,29,30,203307,2033),('2033-07-30',203330,7,2033,30,30,203307,2033),('2033-07-31',203331,7,2033,31,31,203307,2033),('2033-08-01',203331,8,2033,1,31,203308,2033),('2033-08-02',203331,8,2033,2,31,203308,2033),('2033-08-03',203331,8,2033,3,31,203308,2033),('2033-08-04',203331,8,2033,4,31,203308,2033),('2033-08-05',203331,8,2033,5,31,203308,2033),('2033-08-06',203331,8,2033,6,31,203308,2033),('2033-08-07',203332,8,2033,7,32,203308,2033),('2033-08-08',203332,8,2033,8,32,203308,2033),('2033-08-09',203332,8,2033,9,32,203308,2033),('2033-08-10',203332,8,2033,10,32,203308,2033),('2033-08-11',203332,8,2033,11,32,203308,2033),('2033-08-12',203332,8,2033,12,32,203308,2033),('2033-08-13',203332,8,2033,13,32,203308,2033),('2033-08-14',203333,8,2033,14,33,203308,2033),('2033-08-15',203333,8,2033,15,33,203308,2033),('2033-08-16',203333,8,2033,16,33,203308,2033),('2033-08-17',203333,8,2033,17,33,203308,2033),('2033-08-18',203333,8,2033,18,33,203308,2033),('2033-08-19',203333,8,2033,19,33,203308,2033),('2033-08-20',203333,8,2033,20,33,203308,2033),('2033-08-21',203334,8,2033,21,34,203308,2033),('2033-08-22',203334,8,2033,22,34,203308,2033),('2033-08-23',203334,8,2033,23,34,203308,2033),('2033-08-24',203334,8,2033,24,34,203308,2033),('2033-08-25',203334,8,2033,25,34,203308,2033),('2033-08-26',203334,8,2033,26,34,203308,2033),('2033-08-27',203334,8,2033,27,34,203308,2033),('2033-08-28',203335,8,2033,28,35,203308,2033),('2033-08-29',203335,8,2033,29,35,203308,2033),('2033-08-30',203335,8,2033,30,35,203308,2033),('2033-08-31',203335,8,2033,31,35,203308,2033),('2033-09-01',203335,9,2033,1,35,203309,2033),('2033-09-02',203335,9,2033,2,35,203309,2033),('2033-09-03',203335,9,2033,3,35,203309,2033),('2033-09-04',203336,9,2033,4,36,203309,2033),('2033-09-05',203336,9,2033,5,36,203309,2033),('2033-09-06',203336,9,2033,6,36,203309,2033),('2033-09-07',203336,9,2033,7,36,203309,2033),('2033-09-08',203336,9,2033,8,36,203309,2033),('2033-09-09',203336,9,2033,9,36,203309,2033),('2033-09-10',203336,9,2033,10,36,203309,2033),('2033-09-11',203337,9,2033,11,37,203309,2033),('2033-09-12',203337,9,2033,12,37,203309,2033),('2033-09-13',203337,9,2033,13,37,203309,2033),('2033-09-14',203337,9,2033,14,37,203309,2033),('2033-09-15',203337,9,2033,15,37,203309,2033),('2033-09-16',203337,9,2033,16,37,203309,2033),('2033-09-17',203337,9,2033,17,37,203309,2033),('2033-09-18',203338,9,2033,18,38,203309,2033),('2033-09-19',203338,9,2033,19,38,203309,2033),('2033-09-20',203338,9,2033,20,38,203309,2033),('2033-09-21',203338,9,2033,21,38,203309,2033),('2033-09-22',203338,9,2033,22,38,203309,2033),('2033-09-23',203338,9,2033,23,38,203309,2033),('2033-09-24',203338,9,2033,24,38,203309,2033),('2033-09-25',203339,9,2033,25,39,203309,2033),('2033-09-26',203339,9,2033,26,39,203309,2033),('2033-09-27',203339,9,2033,27,39,203309,2033),('2033-09-28',203339,9,2033,28,39,203309,2033),('2033-09-29',203339,9,2033,29,39,203309,2033),('2033-09-30',203339,9,2033,30,39,203309,2033),('2033-10-01',203339,10,2033,1,39,203310,2033),('2033-10-02',203340,10,2033,2,40,203310,2033),('2033-10-03',203340,10,2033,3,40,203310,2033),('2033-10-04',203340,10,2033,4,40,203310,2033),('2033-10-05',203340,10,2033,5,40,203310,2033),('2033-10-06',203340,10,2033,6,40,203310,2033),('2033-10-07',203340,10,2033,7,40,203310,2033),('2033-10-08',203340,10,2033,8,40,203310,2033),('2033-10-09',203341,10,2033,9,41,203310,2033),('2033-10-10',203341,10,2033,10,41,203310,2033),('2033-10-11',203341,10,2033,11,41,203310,2033),('2033-10-12',203341,10,2033,12,41,203310,2033),('2033-10-13',203341,10,2033,13,41,203310,2033),('2033-10-14',203341,10,2033,14,41,203310,2033),('2033-10-15',203341,10,2033,15,41,203310,2033),('2033-10-16',203342,10,2033,16,42,203310,2033),('2033-10-17',203342,10,2033,17,42,203310,2033),('2033-10-18',203342,10,2033,18,42,203310,2033),('2033-10-19',203342,10,2033,19,42,203310,2033),('2033-10-20',203342,10,2033,20,42,203310,2033),('2033-10-21',203342,10,2033,21,42,203310,2033),('2033-10-22',203342,10,2033,22,42,203310,2033),('2033-10-23',203343,10,2033,23,43,203310,2033),('2033-10-24',203343,10,2033,24,43,203310,2033),('2033-10-25',203343,10,2033,25,43,203310,2033),('2033-10-26',203343,10,2033,26,43,203310,2033),('2033-10-27',203343,10,2033,27,43,203310,2033),('2033-10-28',203343,10,2033,28,43,203310,2033),('2033-10-29',203343,10,2033,29,43,203310,2033),('2033-10-30',203344,10,2033,30,44,203310,2033),('2033-10-31',203344,10,2033,31,44,203310,2033),('2033-11-01',203344,11,2033,1,44,203311,2033),('2033-11-02',203344,11,2033,2,44,203311,2033),('2033-11-03',203344,11,2033,3,44,203311,2033),('2033-11-04',203344,11,2033,4,44,203311,2033),('2033-11-05',203344,11,2033,5,44,203311,2033),('2033-11-06',203345,11,2033,6,45,203311,2033),('2033-11-07',203345,11,2033,7,45,203311,2033),('2033-11-08',203345,11,2033,8,45,203311,2033),('2033-11-09',203345,11,2033,9,45,203311,2033),('2033-11-10',203345,11,2033,10,45,203311,2033),('2033-11-11',203345,11,2033,11,45,203311,2033),('2033-11-12',203345,11,2033,12,45,203311,2033),('2033-11-13',203346,11,2033,13,46,203311,2033),('2033-11-14',203346,11,2033,14,46,203311,2033),('2033-11-15',203346,11,2033,15,46,203311,2033),('2033-11-16',203346,11,2033,16,46,203311,2033),('2033-11-17',203346,11,2033,17,46,203311,2033),('2033-11-18',203346,11,2033,18,46,203311,2033),('2033-11-19',203346,11,2033,19,46,203311,2033),('2033-11-20',203347,11,2033,20,47,203311,2033),('2033-11-21',203347,11,2033,21,47,203311,2033),('2033-11-22',203347,11,2033,22,47,203311,2033),('2033-11-23',203347,11,2033,23,47,203311,2033),('2033-11-24',203347,11,2033,24,47,203311,2033),('2033-11-25',203347,11,2033,25,47,203311,2033),('2033-11-26',203347,11,2033,26,47,203311,2033),('2033-11-27',203348,11,2033,27,48,203311,2033),('2033-11-28',203348,11,2033,28,48,203311,2033),('2033-11-29',203348,11,2033,29,48,203311,2033),('2033-11-30',203348,11,2033,30,48,203311,2033),('2033-12-01',203348,12,2033,1,48,203312,2034),('2033-12-02',203348,12,2033,2,48,203312,2034),('2033-12-03',203348,12,2033,3,48,203312,2034),('2033-12-04',203349,12,2033,4,49,203312,2034),('2033-12-05',203349,12,2033,5,49,203312,2034),('2033-12-06',203349,12,2033,6,49,203312,2034),('2033-12-07',203349,12,2033,7,49,203312,2034),('2033-12-08',203349,12,2033,8,49,203312,2034),('2033-12-09',203349,12,2033,9,49,203312,2034),('2033-12-10',203349,12,2033,10,49,203312,2034),('2033-12-11',203350,12,2033,11,50,203312,2034),('2033-12-12',203350,12,2033,12,50,203312,2034),('2033-12-13',203350,12,2033,13,50,203312,2034),('2033-12-14',203350,12,2033,14,50,203312,2034),('2033-12-15',203350,12,2033,15,50,203312,2034),('2033-12-16',203350,12,2033,16,50,203312,2034),('2033-12-17',203350,12,2033,17,50,203312,2034),('2033-12-18',203351,12,2033,18,51,203312,2034),('2033-12-19',203351,12,2033,19,51,203312,2034),('2033-12-20',203351,12,2033,20,51,203312,2034),('2033-12-21',203351,12,2033,21,51,203312,2034),('2033-12-22',203351,12,2033,22,51,203312,2034),('2033-12-23',203351,12,2033,23,51,203312,2034),('2033-12-24',203351,12,2033,24,51,203312,2034),('2033-12-25',203352,12,2033,25,52,203312,2034),('2033-12-26',203352,12,2033,26,52,203312,2034),('2033-12-27',203352,12,2033,27,52,203312,2034),('2033-12-28',203352,12,2033,28,52,203312,2034),('2033-12-29',203352,12,2033,29,52,203312,2034),('2033-12-30',203352,12,2033,30,52,203312,2034),('2033-12-31',203352,12,2033,31,52,203312,2034),('2034-01-01',203453,1,2034,1,1,203401,2034),('2034-01-02',203401,1,2034,2,1,203401,2034),('2034-01-03',203401,1,2034,3,1,203401,2034),('2034-01-04',203401,1,2034,4,1,203401,2034),('2034-01-05',203401,1,2034,5,1,203401,2034),('2034-01-06',203401,1,2034,6,1,203401,2034),('2034-01-07',203401,1,2034,7,1,203401,2034),('2034-01-08',203402,1,2034,8,2,203401,2034),('2034-01-09',203402,1,2034,9,2,203401,2034),('2034-01-10',203402,1,2034,10,2,203401,2034),('2034-01-11',203402,1,2034,11,2,203401,2034),('2034-01-12',203402,1,2034,12,2,203401,2034),('2034-01-13',203402,1,2034,13,2,203401,2034),('2034-01-14',203402,1,2034,14,2,203401,2034),('2034-01-15',203403,1,2034,15,3,203401,2034),('2034-01-16',203403,1,2034,16,3,203401,2034),('2034-01-17',203403,1,2034,17,3,203401,2034),('2034-01-18',203403,1,2034,18,3,203401,2034),('2034-01-19',203403,1,2034,19,3,203401,2034),('2034-01-20',203403,1,2034,20,3,203401,2034),('2034-01-21',203403,1,2034,21,3,203401,2034),('2034-01-22',203404,1,2034,22,4,203401,2034),('2034-01-23',203404,1,2034,23,4,203401,2034),('2034-01-24',203404,1,2034,24,4,203401,2034),('2034-01-25',203404,1,2034,25,4,203401,2034),('2034-01-26',203404,1,2034,26,4,203401,2034),('2034-01-27',203404,1,2034,27,4,203401,2034),('2034-01-28',203404,1,2034,28,4,203401,2034),('2034-01-29',203405,1,2034,29,5,203401,2034),('2034-01-30',203405,1,2034,30,5,203401,2034),('2034-01-31',203405,1,2034,31,5,203401,2034),('2034-02-01',203405,2,2034,1,5,203402,2034),('2034-02-02',203405,2,2034,2,5,203402,2034),('2034-02-03',203405,2,2034,3,5,203402,2034),('2034-02-04',203405,2,2034,4,5,203402,2034),('2034-02-05',203406,2,2034,5,6,203402,2034),('2034-02-06',203406,2,2034,6,6,203402,2034),('2034-02-07',203406,2,2034,7,6,203402,2034),('2034-02-08',203406,2,2034,8,6,203402,2034),('2034-02-09',203406,2,2034,9,6,203402,2034),('2034-02-10',203406,2,2034,10,6,203402,2034),('2034-02-11',203406,2,2034,11,6,203402,2034),('2034-02-12',203407,2,2034,12,7,203402,2034),('2034-02-13',203407,2,2034,13,7,203402,2034),('2034-02-14',203407,2,2034,14,7,203402,2034),('2034-02-15',203407,2,2034,15,7,203402,2034),('2034-02-16',203407,2,2034,16,7,203402,2034),('2034-02-17',203407,2,2034,17,7,203402,2034),('2034-02-18',203407,2,2034,18,7,203402,2034),('2034-02-19',203408,2,2034,19,8,203402,2034),('2034-02-20',203408,2,2034,20,8,203402,2034),('2034-02-21',203408,2,2034,21,8,203402,2034),('2034-02-22',203408,2,2034,22,8,203402,2034),('2034-02-23',203408,2,2034,23,8,203402,2034),('2034-02-24',203408,2,2034,24,8,203402,2034),('2034-02-25',203408,2,2034,25,8,203402,2034),('2034-02-26',203409,2,2034,26,9,203402,2034),('2034-02-27',203409,2,2034,27,9,203402,2034),('2034-02-28',203409,2,2034,28,9,203402,2034),('2034-03-01',203409,3,2034,1,9,203403,2034),('2034-03-02',203409,3,2034,2,9,203403,2034),('2034-03-03',203409,3,2034,3,9,203403,2034),('2034-03-04',203409,3,2034,4,9,203403,2034),('2034-03-05',203410,3,2034,5,10,203403,2034),('2034-03-06',203410,3,2034,6,10,203403,2034),('2034-03-07',203410,3,2034,7,10,203403,2034),('2034-03-08',203410,3,2034,8,10,203403,2034),('2034-03-09',203410,3,2034,9,10,203403,2034),('2034-03-10',203410,3,2034,10,10,203403,2034),('2034-03-11',203410,3,2034,11,10,203403,2034),('2034-03-12',203411,3,2034,12,11,203403,2034),('2034-03-13',203411,3,2034,13,11,203403,2034),('2034-03-14',203411,3,2034,14,11,203403,2034),('2034-03-15',203411,3,2034,15,11,203403,2034),('2034-03-16',203411,3,2034,16,11,203403,2034),('2034-03-17',203411,3,2034,17,11,203403,2034),('2034-03-18',203411,3,2034,18,11,203403,2034),('2034-03-19',203412,3,2034,19,12,203403,2034),('2034-03-20',203412,3,2034,20,12,203403,2034),('2034-03-21',203412,3,2034,21,12,203403,2034),('2034-03-22',203412,3,2034,22,12,203403,2034),('2034-03-23',203412,3,2034,23,12,203403,2034),('2034-03-24',203412,3,2034,24,12,203403,2034),('2034-03-25',203412,3,2034,25,12,203403,2034),('2034-03-26',203413,3,2034,26,13,203403,2034),('2034-03-27',203413,3,2034,27,13,203403,2034),('2034-03-28',203413,3,2034,28,13,203403,2034),('2034-03-29',203413,3,2034,29,13,203403,2034),('2034-03-30',203413,3,2034,30,13,203403,2034),('2034-03-31',203413,3,2034,31,13,203403,2034),('2034-04-01',203413,4,2034,1,13,203404,2034),('2034-04-02',203414,4,2034,2,14,203404,2034),('2034-04-03',203414,4,2034,3,14,203404,2034),('2034-04-04',203414,4,2034,4,14,203404,2034),('2034-04-05',203414,4,2034,5,14,203404,2034),('2034-04-06',203414,4,2034,6,14,203404,2034),('2034-04-07',203414,4,2034,7,14,203404,2034),('2034-04-08',203414,4,2034,8,14,203404,2034),('2034-04-09',203415,4,2034,9,15,203404,2034),('2034-04-10',203415,4,2034,10,15,203404,2034),('2034-04-11',203415,4,2034,11,15,203404,2034),('2034-04-12',203415,4,2034,12,15,203404,2034),('2034-04-13',203415,4,2034,13,15,203404,2034),('2034-04-14',203415,4,2034,14,15,203404,2034),('2034-04-15',203415,4,2034,15,15,203404,2034),('2034-04-16',203416,4,2034,16,16,203404,2034),('2034-04-17',203416,4,2034,17,16,203404,2034),('2034-04-18',203416,4,2034,18,16,203404,2034),('2034-04-19',203416,4,2034,19,16,203404,2034),('2034-04-20',203416,4,2034,20,16,203404,2034),('2034-04-21',203416,4,2034,21,16,203404,2034),('2034-04-22',203416,4,2034,22,16,203404,2034),('2034-04-23',203417,4,2034,23,17,203404,2034),('2034-04-24',203417,4,2034,24,17,203404,2034),('2034-04-25',203417,4,2034,25,17,203404,2034),('2034-04-26',203417,4,2034,26,17,203404,2034),('2034-04-27',203417,4,2034,27,17,203404,2034),('2034-04-28',203417,4,2034,28,17,203404,2034),('2034-04-29',203417,4,2034,29,17,203404,2034),('2034-04-30',203418,4,2034,30,18,203404,2034),('2034-05-01',203418,5,2034,1,18,203405,2034),('2034-05-02',203418,5,2034,2,18,203405,2034),('2034-05-03',203418,5,2034,3,18,203405,2034),('2034-05-04',203418,5,2034,4,18,203405,2034),('2034-05-05',203418,5,2034,5,18,203405,2034),('2034-05-06',203418,5,2034,6,18,203405,2034),('2034-05-07',203419,5,2034,7,19,203405,2034),('2034-05-08',203419,5,2034,8,19,203405,2034),('2034-05-09',203419,5,2034,9,19,203405,2034),('2034-05-10',203419,5,2034,10,19,203405,2034),('2034-05-11',203419,5,2034,11,19,203405,2034),('2034-05-12',203419,5,2034,12,19,203405,2034),('2034-05-13',203419,5,2034,13,19,203405,2034),('2034-05-14',203420,5,2034,14,20,203405,2034),('2034-05-15',203420,5,2034,15,20,203405,2034),('2034-05-16',203420,5,2034,16,20,203405,2034),('2034-05-17',203420,5,2034,17,20,203405,2034),('2034-05-18',203420,5,2034,18,20,203405,2034),('2034-05-19',203420,5,2034,19,20,203405,2034),('2034-05-20',203420,5,2034,20,20,203405,2034),('2034-05-21',203421,5,2034,21,21,203405,2034),('2034-05-22',203421,5,2034,22,21,203405,2034),('2034-05-23',203421,5,2034,23,21,203405,2034),('2034-05-24',203421,5,2034,24,21,203405,2034),('2034-05-25',203421,5,2034,25,21,203405,2034),('2034-05-26',203421,5,2034,26,21,203405,2034),('2034-05-27',203421,5,2034,27,21,203405,2034),('2034-05-28',203422,5,2034,28,22,203405,2034),('2034-05-29',203422,5,2034,29,22,203405,2034),('2034-05-30',203422,5,2034,30,22,203405,2034),('2034-05-31',203422,5,2034,31,22,203405,2034),('2034-06-01',203422,6,2034,1,22,203406,2034),('2034-06-02',203422,6,2034,2,22,203406,2034),('2034-06-03',203422,6,2034,3,22,203406,2034),('2034-06-04',203423,6,2034,4,23,203406,2034),('2034-06-05',203423,6,2034,5,23,203406,2034),('2034-06-06',203423,6,2034,6,23,203406,2034),('2034-06-07',203423,6,2034,7,23,203406,2034),('2034-06-08',203423,6,2034,8,23,203406,2034),('2034-06-09',203423,6,2034,9,23,203406,2034),('2034-06-10',203423,6,2034,10,23,203406,2034),('2034-06-11',203424,6,2034,11,24,203406,2034),('2034-06-12',203424,6,2034,12,24,203406,2034),('2034-06-13',203424,6,2034,13,24,203406,2034),('2034-06-14',203424,6,2034,14,24,203406,2034),('2034-06-15',203424,6,2034,15,24,203406,2034),('2034-06-16',203424,6,2034,16,24,203406,2034),('2034-06-17',203424,6,2034,17,24,203406,2034),('2034-06-18',203425,6,2034,18,25,203406,2034),('2034-06-19',203425,6,2034,19,25,203406,2034),('2034-06-20',203425,6,2034,20,25,203406,2034),('2034-06-21',203425,6,2034,21,25,203406,2034),('2034-06-22',203425,6,2034,22,25,203406,2034),('2034-06-23',203425,6,2034,23,25,203406,2034),('2034-06-24',203425,6,2034,24,25,203406,2034),('2034-06-25',203426,6,2034,25,26,203406,2034),('2034-06-26',203426,6,2034,26,26,203406,2034),('2034-06-27',203426,6,2034,27,26,203406,2034),('2034-06-28',203426,6,2034,28,26,203406,2034),('2034-06-29',203426,6,2034,29,26,203406,2034),('2034-06-30',203426,6,2034,30,26,203406,2034),('2034-07-01',203426,7,2034,1,26,203407,2034),('2034-07-02',203427,7,2034,2,27,203407,2034),('2034-07-03',203427,7,2034,3,27,203407,2034),('2034-07-04',203427,7,2034,4,27,203407,2034),('2034-07-05',203427,7,2034,5,27,203407,2034),('2034-07-06',203427,7,2034,6,27,203407,2034),('2034-07-07',203427,7,2034,7,27,203407,2034),('2034-07-08',203427,7,2034,8,27,203407,2034),('2034-07-09',203428,7,2034,9,28,203407,2034),('2034-07-10',203428,7,2034,10,28,203407,2034),('2034-07-11',203428,7,2034,11,28,203407,2034),('2034-07-12',203428,7,2034,12,28,203407,2034),('2034-07-13',203428,7,2034,13,28,203407,2034),('2034-07-14',203428,7,2034,14,28,203407,2034),('2034-07-15',203428,7,2034,15,28,203407,2034),('2034-07-16',203429,7,2034,16,29,203407,2034),('2034-07-17',203429,7,2034,17,29,203407,2034),('2034-07-18',203429,7,2034,18,29,203407,2034),('2034-07-19',203429,7,2034,19,29,203407,2034),('2034-07-20',203429,7,2034,20,29,203407,2034),('2034-07-21',203429,7,2034,21,29,203407,2034),('2034-07-22',203429,7,2034,22,29,203407,2034),('2034-07-23',203430,7,2034,23,30,203407,2034),('2034-07-24',203430,7,2034,24,30,203407,2034),('2034-07-25',203430,7,2034,25,30,203407,2034),('2034-07-26',203430,7,2034,26,30,203407,2034),('2034-07-27',203430,7,2034,27,30,203407,2034),('2034-07-28',203430,7,2034,28,30,203407,2034),('2034-07-29',203430,7,2034,29,30,203407,2034),('2034-07-30',203431,7,2034,30,31,203407,2034),('2034-07-31',203431,7,2034,31,31,203407,2034),('2034-08-01',203431,8,2034,1,31,203408,2034),('2034-08-02',203431,8,2034,2,31,203408,2034),('2034-08-03',203431,8,2034,3,31,203408,2034),('2034-08-04',203431,8,2034,4,31,203408,2034),('2034-08-05',203431,8,2034,5,31,203408,2034),('2034-08-06',203432,8,2034,6,32,203408,2034),('2034-08-07',203432,8,2034,7,32,203408,2034),('2034-08-08',203432,8,2034,8,32,203408,2034),('2034-08-09',203432,8,2034,9,32,203408,2034),('2034-08-10',203432,8,2034,10,32,203408,2034),('2034-08-11',203432,8,2034,11,32,203408,2034),('2034-08-12',203432,8,2034,12,32,203408,2034),('2034-08-13',203433,8,2034,13,33,203408,2034),('2034-08-14',203433,8,2034,14,33,203408,2034),('2034-08-15',203433,8,2034,15,33,203408,2034),('2034-08-16',203433,8,2034,16,33,203408,2034),('2034-08-17',203433,8,2034,17,33,203408,2034),('2034-08-18',203433,8,2034,18,33,203408,2034),('2034-08-19',203433,8,2034,19,33,203408,2034),('2034-08-20',203434,8,2034,20,34,203408,2034),('2034-08-21',203434,8,2034,21,34,203408,2034),('2034-08-22',203434,8,2034,22,34,203408,2034),('2034-08-23',203434,8,2034,23,34,203408,2034),('2034-08-24',203434,8,2034,24,34,203408,2034),('2034-08-25',203434,8,2034,25,34,203408,2034),('2034-08-26',203434,8,2034,26,34,203408,2034),('2034-08-27',203435,8,2034,27,35,203408,2034),('2034-08-28',203435,8,2034,28,35,203408,2034),('2034-08-29',203435,8,2034,29,35,203408,2034),('2034-08-30',203435,8,2034,30,35,203408,2034),('2034-08-31',203435,8,2034,31,35,203408,2034),('2034-09-01',203435,9,2034,1,35,203409,2034),('2034-09-02',203435,9,2034,2,35,203409,2034),('2034-09-03',203436,9,2034,3,36,203409,2034),('2034-09-04',203436,9,2034,4,36,203409,2034),('2034-09-05',203436,9,2034,5,36,203409,2034),('2034-09-06',203436,9,2034,6,36,203409,2034),('2034-09-07',203436,9,2034,7,36,203409,2034),('2034-09-08',203436,9,2034,8,36,203409,2034),('2034-09-09',203436,9,2034,9,36,203409,2034),('2034-09-10',203437,9,2034,10,37,203409,2034),('2034-09-11',203437,9,2034,11,37,203409,2034),('2034-09-12',203437,9,2034,12,37,203409,2034),('2034-09-13',203437,9,2034,13,37,203409,2034),('2034-09-14',203437,9,2034,14,37,203409,2034),('2034-09-15',203437,9,2034,15,37,203409,2034),('2034-09-16',203437,9,2034,16,37,203409,2034),('2034-09-17',203438,9,2034,17,38,203409,2034),('2034-09-18',203438,9,2034,18,38,203409,2034),('2034-09-19',203438,9,2034,19,38,203409,2034),('2034-09-20',203438,9,2034,20,38,203409,2034),('2034-09-21',203438,9,2034,21,38,203409,2034),('2034-09-22',203438,9,2034,22,38,203409,2034),('2034-09-23',203438,9,2034,23,38,203409,2034),('2034-09-24',203439,9,2034,24,39,203409,2034),('2034-09-25',203439,9,2034,25,39,203409,2034),('2034-09-26',203439,9,2034,26,39,203409,2034),('2034-09-27',203439,9,2034,27,39,203409,2034),('2034-09-28',203439,9,2034,28,39,203409,2034),('2034-09-29',203439,9,2034,29,39,203409,2034),('2034-09-30',203439,9,2034,30,39,203409,2034),('2034-10-01',203440,10,2034,1,40,203410,2034),('2034-10-02',203440,10,2034,2,40,203410,2034),('2034-10-03',203440,10,2034,3,40,203410,2034),('2034-10-04',203440,10,2034,4,40,203410,2034),('2034-10-05',203440,10,2034,5,40,203410,2034),('2034-10-06',203440,10,2034,6,40,203410,2034),('2034-10-07',203440,10,2034,7,40,203410,2034),('2034-10-08',203441,10,2034,8,41,203410,2034),('2034-10-09',203441,10,2034,9,41,203410,2034),('2034-10-10',203441,10,2034,10,41,203410,2034),('2034-10-11',203441,10,2034,11,41,203410,2034),('2034-10-12',203441,10,2034,12,41,203410,2034),('2034-10-13',203441,10,2034,13,41,203410,2034),('2034-10-14',203441,10,2034,14,41,203410,2034),('2034-10-15',203442,10,2034,15,42,203410,2034),('2034-10-16',203442,10,2034,16,42,203410,2034),('2034-10-17',203442,10,2034,17,42,203410,2034),('2034-10-18',203442,10,2034,18,42,203410,2034),('2034-10-19',203442,10,2034,19,42,203410,2034),('2034-10-20',203442,10,2034,20,42,203410,2034),('2034-10-21',203442,10,2034,21,42,203410,2034),('2034-10-22',203443,10,2034,22,43,203410,2034),('2034-10-23',203443,10,2034,23,43,203410,2034),('2034-10-24',203443,10,2034,24,43,203410,2034),('2034-10-25',203443,10,2034,25,43,203410,2034),('2034-10-26',203443,10,2034,26,43,203410,2034),('2034-10-27',203443,10,2034,27,43,203410,2034),('2034-10-28',203443,10,2034,28,43,203410,2034),('2034-10-29',203444,10,2034,29,44,203410,2034),('2034-10-30',203444,10,2034,30,44,203410,2034),('2034-10-31',203444,10,2034,31,44,203410,2034),('2034-11-01',203444,11,2034,1,44,203411,2034),('2034-11-02',203444,11,2034,2,44,203411,2034),('2034-11-03',203444,11,2034,3,44,203411,2034),('2034-11-04',203444,11,2034,4,44,203411,2034),('2034-11-05',203445,11,2034,5,45,203411,2034),('2034-11-06',203445,11,2034,6,45,203411,2034),('2034-11-07',203445,11,2034,7,45,203411,2034),('2034-11-08',203445,11,2034,8,45,203411,2034),('2034-11-09',203445,11,2034,9,45,203411,2034),('2034-11-10',203445,11,2034,10,45,203411,2034),('2034-11-11',203445,11,2034,11,45,203411,2034),('2034-11-12',203446,11,2034,12,46,203411,2034),('2034-11-13',203446,11,2034,13,46,203411,2034),('2034-11-14',203446,11,2034,14,46,203411,2034),('2034-11-15',203446,11,2034,15,46,203411,2034),('2034-11-16',203446,11,2034,16,46,203411,2034),('2034-11-17',203446,11,2034,17,46,203411,2034),('2034-11-18',203446,11,2034,18,46,203411,2034),('2034-11-19',203447,11,2034,19,47,203411,2034),('2034-11-20',203447,11,2034,20,47,203411,2034),('2034-11-21',203447,11,2034,21,47,203411,2034),('2034-11-22',203447,11,2034,22,47,203411,2034),('2034-11-23',203447,11,2034,23,47,203411,2034),('2034-11-24',203447,11,2034,24,47,203411,2034),('2034-11-25',203447,11,2034,25,47,203411,2034),('2034-11-26',203448,11,2034,26,48,203411,2034),('2034-11-27',203448,11,2034,27,48,203411,2034),('2034-11-28',203448,11,2034,28,48,203411,2034),('2034-11-29',203448,11,2034,29,48,203411,2034),('2034-11-30',203448,11,2034,30,48,203411,2034),('2034-12-01',203448,12,2034,1,48,203412,2035),('2034-12-02',203448,12,2034,2,48,203412,2035),('2034-12-03',203449,12,2034,3,49,203412,2035),('2034-12-04',203449,12,2034,4,49,203412,2035),('2034-12-05',203449,12,2034,5,49,203412,2035),('2034-12-06',203449,12,2034,6,49,203412,2035),('2034-12-07',203449,12,2034,7,49,203412,2035),('2034-12-08',203449,12,2034,8,49,203412,2035),('2034-12-09',203449,12,2034,9,49,203412,2035),('2034-12-10',203450,12,2034,10,50,203412,2035),('2034-12-11',203450,12,2034,11,50,203412,2035),('2034-12-12',203450,12,2034,12,50,203412,2035),('2034-12-13',203450,12,2034,13,50,203412,2035),('2034-12-14',203450,12,2034,14,50,203412,2035),('2034-12-15',203450,12,2034,15,50,203412,2035),('2034-12-16',203450,12,2034,16,50,203412,2035),('2034-12-17',203451,12,2034,17,51,203412,2035),('2034-12-18',203451,12,2034,18,51,203412,2035),('2034-12-19',203451,12,2034,19,51,203412,2035),('2034-12-20',203451,12,2034,20,51,203412,2035),('2034-12-21',203451,12,2034,21,51,203412,2035),('2034-12-22',203451,12,2034,22,51,203412,2035),('2034-12-23',203451,12,2034,23,51,203412,2035),('2034-12-24',203452,12,2034,24,52,203412,2035),('2034-12-25',203452,12,2034,25,52,203412,2035),('2034-12-26',203452,12,2034,26,52,203412,2035),('2034-12-27',203452,12,2034,27,52,203412,2035),('2034-12-28',203452,12,2034,28,52,203412,2035),('2034-12-29',203452,12,2034,29,52,203412,2035),('2034-12-30',203452,12,2034,30,52,203412,2035),('2034-12-31',203453,12,2034,31,1,203412,2035),('2035-01-01',203501,1,2035,1,1,203501,2035),('2035-01-02',203501,1,2035,2,1,203501,2035),('2035-01-03',203501,1,2035,3,1,203501,2035),('2035-01-04',203501,1,2035,4,1,203501,2035),('2035-01-05',203501,1,2035,5,1,203501,2035),('2035-01-06',203501,1,2035,6,1,203501,2035),('2035-01-07',203502,1,2035,7,2,203501,2035),('2035-01-08',203502,1,2035,8,2,203501,2035),('2035-01-09',203502,1,2035,9,2,203501,2035),('2035-01-10',203502,1,2035,10,2,203501,2035),('2035-01-11',203502,1,2035,11,2,203501,2035),('2035-01-12',203502,1,2035,12,2,203501,2035),('2035-01-13',203502,1,2035,13,2,203501,2035),('2035-01-14',203503,1,2035,14,3,203501,2035),('2035-01-15',203503,1,2035,15,3,203501,2035),('2035-01-16',203503,1,2035,16,3,203501,2035),('2035-01-17',203503,1,2035,17,3,203501,2035),('2035-01-18',203503,1,2035,18,3,203501,2035),('2035-01-19',203503,1,2035,19,3,203501,2035),('2035-01-20',203503,1,2035,20,3,203501,2035),('2035-01-21',203504,1,2035,21,4,203501,2035),('2035-01-22',203504,1,2035,22,4,203501,2035),('2035-01-23',203504,1,2035,23,4,203501,2035),('2035-01-24',203504,1,2035,24,4,203501,2035),('2035-01-25',203504,1,2035,25,4,203501,2035),('2035-01-26',203504,1,2035,26,4,203501,2035),('2035-01-27',203504,1,2035,27,4,203501,2035),('2035-01-28',203505,1,2035,28,5,203501,2035),('2035-01-29',203505,1,2035,29,5,203501,2035),('2035-01-30',203505,1,2035,30,5,203501,2035),('2035-01-31',203505,1,2035,31,5,203501,2035),('2035-02-01',203505,2,2035,1,5,203502,2035),('2035-02-02',203505,2,2035,2,5,203502,2035),('2035-02-03',203505,2,2035,3,5,203502,2035),('2035-02-04',203506,2,2035,4,6,203502,2035),('2035-02-05',203506,2,2035,5,6,203502,2035),('2035-02-06',203506,2,2035,6,6,203502,2035),('2035-02-07',203506,2,2035,7,6,203502,2035),('2035-02-08',203506,2,2035,8,6,203502,2035),('2035-02-09',203506,2,2035,9,6,203502,2035),('2035-02-10',203506,2,2035,10,6,203502,2035),('2035-02-11',203507,2,2035,11,7,203502,2035),('2035-02-12',203507,2,2035,12,7,203502,2035),('2035-02-13',203507,2,2035,13,7,203502,2035),('2035-02-14',203507,2,2035,14,7,203502,2035),('2035-02-15',203507,2,2035,15,7,203502,2035),('2035-02-16',203507,2,2035,16,7,203502,2035),('2035-02-17',203507,2,2035,17,7,203502,2035),('2035-02-18',203508,2,2035,18,8,203502,2035),('2035-02-19',203508,2,2035,19,8,203502,2035),('2035-02-20',203508,2,2035,20,8,203502,2035),('2035-02-21',203508,2,2035,21,8,203502,2035),('2035-02-22',203508,2,2035,22,8,203502,2035),('2035-02-23',203508,2,2035,23,8,203502,2035),('2035-02-24',203508,2,2035,24,8,203502,2035),('2035-02-25',203509,2,2035,25,9,203502,2035),('2035-02-26',203509,2,2035,26,9,203502,2035),('2035-02-27',203509,2,2035,27,9,203502,2035),('2035-02-28',203509,2,2035,28,9,203502,2035),('2035-03-01',203509,3,2035,1,9,203503,2035),('2035-03-02',203509,3,2035,2,9,203503,2035),('2035-03-03',203509,3,2035,3,9,203503,2035),('2035-03-04',203510,3,2035,4,10,203503,2035),('2035-03-05',203510,3,2035,5,10,203503,2035),('2035-03-06',203510,3,2035,6,10,203503,2035),('2035-03-07',203510,3,2035,7,10,203503,2035),('2035-03-08',203510,3,2035,8,10,203503,2035),('2035-03-09',203510,3,2035,9,10,203503,2035),('2035-03-10',203510,3,2035,10,10,203503,2035),('2035-03-11',203511,3,2035,11,11,203503,2035),('2035-03-12',203511,3,2035,12,11,203503,2035),('2035-03-13',203511,3,2035,13,11,203503,2035),('2035-03-14',203511,3,2035,14,11,203503,2035),('2035-03-15',203511,3,2035,15,11,203503,2035),('2035-03-16',203511,3,2035,16,11,203503,2035),('2035-03-17',203511,3,2035,17,11,203503,2035),('2035-03-18',203512,3,2035,18,12,203503,2035),('2035-03-19',203512,3,2035,19,12,203503,2035),('2035-03-20',203512,3,2035,20,12,203503,2035),('2035-03-21',203512,3,2035,21,12,203503,2035),('2035-03-22',203512,3,2035,22,12,203503,2035),('2035-03-23',203512,3,2035,23,12,203503,2035),('2035-03-24',203512,3,2035,24,12,203503,2035),('2035-03-25',203513,3,2035,25,13,203503,2035),('2035-03-26',203513,3,2035,26,13,203503,2035),('2035-03-27',203513,3,2035,27,13,203503,2035),('2035-03-28',203513,3,2035,28,13,203503,2035),('2035-03-29',203513,3,2035,29,13,203503,2035),('2035-03-30',203513,3,2035,30,13,203503,2035),('2035-03-31',203513,3,2035,31,13,203503,2035),('2035-04-01',203514,4,2035,1,14,203504,2035),('2035-04-02',203514,4,2035,2,14,203504,2035),('2035-04-03',203514,4,2035,3,14,203504,2035),('2035-04-04',203514,4,2035,4,14,203504,2035),('2035-04-05',203514,4,2035,5,14,203504,2035),('2035-04-06',203514,4,2035,6,14,203504,2035),('2035-04-07',203514,4,2035,7,14,203504,2035),('2035-04-08',203515,4,2035,8,15,203504,2035),('2035-04-09',203515,4,2035,9,15,203504,2035),('2035-04-10',203515,4,2035,10,15,203504,2035),('2035-04-11',203515,4,2035,11,15,203504,2035),('2035-04-12',203515,4,2035,12,15,203504,2035),('2035-04-13',203515,4,2035,13,15,203504,2035),('2035-04-14',203515,4,2035,14,15,203504,2035),('2035-04-15',203516,4,2035,15,16,203504,2035),('2035-04-16',203516,4,2035,16,16,203504,2035),('2035-04-17',203516,4,2035,17,16,203504,2035),('2035-04-18',203516,4,2035,18,16,203504,2035),('2035-04-19',203516,4,2035,19,16,203504,2035),('2035-04-20',203516,4,2035,20,16,203504,2035),('2035-04-21',203516,4,2035,21,16,203504,2035),('2035-04-22',203517,4,2035,22,17,203504,2035),('2035-04-23',203517,4,2035,23,17,203504,2035),('2035-04-24',203517,4,2035,24,17,203504,2035),('2035-04-25',203517,4,2035,25,17,203504,2035),('2035-04-26',203517,4,2035,26,17,203504,2035),('2035-04-27',203517,4,2035,27,17,203504,2035),('2035-04-28',203517,4,2035,28,17,203504,2035),('2035-04-29',203518,4,2035,29,18,203504,2035),('2035-04-30',203518,4,2035,30,18,203504,2035),('2035-05-01',203518,5,2035,1,18,203505,2035),('2035-05-02',203518,5,2035,2,18,203505,2035),('2035-05-03',203518,5,2035,3,18,203505,2035),('2035-05-04',203518,5,2035,4,18,203505,2035),('2035-05-05',203518,5,2035,5,18,203505,2035),('2035-05-06',203519,5,2035,6,19,203505,2035),('2035-05-07',203519,5,2035,7,19,203505,2035),('2035-05-08',203519,5,2035,8,19,203505,2035),('2035-05-09',203519,5,2035,9,19,203505,2035),('2035-05-10',203519,5,2035,10,19,203505,2035),('2035-05-11',203519,5,2035,11,19,203505,2035),('2035-05-12',203519,5,2035,12,19,203505,2035),('2035-05-13',203520,5,2035,13,20,203505,2035),('2035-05-14',203520,5,2035,14,20,203505,2035),('2035-05-15',203520,5,2035,15,20,203505,2035),('2035-05-16',203520,5,2035,16,20,203505,2035),('2035-05-17',203520,5,2035,17,20,203505,2035),('2035-05-18',203520,5,2035,18,20,203505,2035),('2035-05-19',203520,5,2035,19,20,203505,2035),('2035-05-20',203521,5,2035,20,21,203505,2035),('2035-05-21',203521,5,2035,21,21,203505,2035),('2035-05-22',203521,5,2035,22,21,203505,2035),('2035-05-23',203521,5,2035,23,21,203505,2035),('2035-05-24',203521,5,2035,24,21,203505,2035),('2035-05-25',203521,5,2035,25,21,203505,2035),('2035-05-26',203521,5,2035,26,21,203505,2035),('2035-05-27',203522,5,2035,27,22,203505,2035),('2035-05-28',203522,5,2035,28,22,203505,2035),('2035-05-29',203522,5,2035,29,22,203505,2035),('2035-05-30',203522,5,2035,30,22,203505,2035),('2035-05-31',203522,5,2035,31,22,203505,2035),('2035-06-01',203522,6,2035,1,22,203506,2035),('2035-06-02',203522,6,2035,2,22,203506,2035),('2035-06-03',203523,6,2035,3,23,203506,2035),('2035-06-04',203523,6,2035,4,23,203506,2035),('2035-06-05',203523,6,2035,5,23,203506,2035),('2035-06-06',203523,6,2035,6,23,203506,2035),('2035-06-07',203523,6,2035,7,23,203506,2035),('2035-06-08',203523,6,2035,8,23,203506,2035),('2035-06-09',203523,6,2035,9,23,203506,2035),('2035-06-10',203524,6,2035,10,24,203506,2035),('2035-06-11',203524,6,2035,11,24,203506,2035),('2035-06-12',203524,6,2035,12,24,203506,2035),('2035-06-13',203524,6,2035,13,24,203506,2035),('2035-06-14',203524,6,2035,14,24,203506,2035),('2035-06-15',203524,6,2035,15,24,203506,2035),('2035-06-16',203524,6,2035,16,24,203506,2035),('2035-06-17',203525,6,2035,17,25,203506,2035),('2035-06-18',203525,6,2035,18,25,203506,2035),('2035-06-19',203525,6,2035,19,25,203506,2035),('2035-06-20',203525,6,2035,20,25,203506,2035),('2035-06-21',203525,6,2035,21,25,203506,2035),('2035-06-22',203525,6,2035,22,25,203506,2035),('2035-06-23',203525,6,2035,23,25,203506,2035),('2035-06-24',203526,6,2035,24,26,203506,2035),('2035-06-25',203526,6,2035,25,26,203506,2035),('2035-06-26',203526,6,2035,26,26,203506,2035),('2035-06-27',203526,6,2035,27,26,203506,2035),('2035-06-28',203526,6,2035,28,26,203506,2035),('2035-06-29',203526,6,2035,29,26,203506,2035),('2035-06-30',203526,6,2035,30,26,203506,2035),('2035-07-01',203527,7,2035,1,27,203507,2035),('2035-07-02',203527,7,2035,2,27,203507,2035),('2035-07-03',203527,7,2035,3,27,203507,2035),('2035-07-04',203527,7,2035,4,27,203507,2035),('2035-07-05',203527,7,2035,5,27,203507,2035),('2035-07-06',203527,7,2035,6,27,203507,2035),('2035-07-07',203527,7,2035,7,27,203507,2035),('2035-07-08',203528,7,2035,8,28,203507,2035),('2035-07-09',203528,7,2035,9,28,203507,2035),('2035-07-10',203528,7,2035,10,28,203507,2035),('2035-07-11',203528,7,2035,11,28,203507,2035),('2035-07-12',203528,7,2035,12,28,203507,2035),('2035-07-13',203528,7,2035,13,28,203507,2035),('2035-07-14',203528,7,2035,14,28,203507,2035),('2035-07-15',203529,7,2035,15,29,203507,2035),('2035-07-16',203529,7,2035,16,29,203507,2035),('2035-07-17',203529,7,2035,17,29,203507,2035),('2035-07-18',203529,7,2035,18,29,203507,2035),('2035-07-19',203529,7,2035,19,29,203507,2035),('2035-07-20',203529,7,2035,20,29,203507,2035),('2035-07-21',203529,7,2035,21,29,203507,2035),('2035-07-22',203530,7,2035,22,30,203507,2035),('2035-07-23',203530,7,2035,23,30,203507,2035),('2035-07-24',203530,7,2035,24,30,203507,2035),('2035-07-25',203530,7,2035,25,30,203507,2035),('2035-07-26',203530,7,2035,26,30,203507,2035),('2035-07-27',203530,7,2035,27,30,203507,2035),('2035-07-28',203530,7,2035,28,30,203507,2035),('2035-07-29',203531,7,2035,29,31,203507,2035),('2035-07-30',203531,7,2035,30,31,203507,2035),('2035-07-31',203531,7,2035,31,31,203507,2035),('2035-08-01',203531,8,2035,1,31,203508,2035),('2035-08-02',203531,8,2035,2,31,203508,2035),('2035-08-03',203531,8,2035,3,31,203508,2035),('2035-08-04',203531,8,2035,4,31,203508,2035),('2035-08-05',203532,8,2035,5,32,203508,2035),('2035-08-06',203532,8,2035,6,32,203508,2035),('2035-08-07',203532,8,2035,7,32,203508,2035),('2035-08-08',203532,8,2035,8,32,203508,2035),('2035-08-09',203532,8,2035,9,32,203508,2035),('2035-08-10',203532,8,2035,10,32,203508,2035),('2035-08-11',203532,8,2035,11,32,203508,2035),('2035-08-12',203533,8,2035,12,33,203508,2035),('2035-08-13',203533,8,2035,13,33,203508,2035),('2035-08-14',203533,8,2035,14,33,203508,2035),('2035-08-15',203533,8,2035,15,33,203508,2035),('2035-08-16',203533,8,2035,16,33,203508,2035),('2035-08-17',203533,8,2035,17,33,203508,2035),('2035-08-18',203533,8,2035,18,33,203508,2035),('2035-08-19',203534,8,2035,19,34,203508,2035),('2035-08-20',203534,8,2035,20,34,203508,2035),('2035-08-21',203534,8,2035,21,34,203508,2035),('2035-08-22',203534,8,2035,22,34,203508,2035),('2035-08-23',203534,8,2035,23,34,203508,2035),('2035-08-24',203534,8,2035,24,34,203508,2035),('2035-08-25',203534,8,2035,25,34,203508,2035),('2035-08-26',203535,8,2035,26,35,203508,2035),('2035-08-27',203535,8,2035,27,35,203508,2035),('2035-08-28',203535,8,2035,28,35,203508,2035),('2035-08-29',203535,8,2035,29,35,203508,2035),('2035-08-30',203535,8,2035,30,35,203508,2035),('2035-08-31',203535,8,2035,31,35,203508,2035),('2035-09-01',203535,9,2035,1,35,203509,2035),('2035-09-02',203536,9,2035,2,36,203509,2035),('2035-09-03',203536,9,2035,3,36,203509,2035),('2035-09-04',203536,9,2035,4,36,203509,2035),('2035-09-05',203536,9,2035,5,36,203509,2035),('2035-09-06',203536,9,2035,6,36,203509,2035),('2035-09-07',203536,9,2035,7,36,203509,2035),('2035-09-08',203536,9,2035,8,36,203509,2035),('2035-09-09',203537,9,2035,9,37,203509,2035),('2035-09-10',203537,9,2035,10,37,203509,2035),('2035-09-11',203537,9,2035,11,37,203509,2035),('2035-09-12',203537,9,2035,12,37,203509,2035),('2035-09-13',203537,9,2035,13,37,203509,2035),('2035-09-14',203537,9,2035,14,37,203509,2035),('2035-09-15',203537,9,2035,15,37,203509,2035),('2035-09-16',203538,9,2035,16,38,203509,2035),('2035-09-17',203538,9,2035,17,38,203509,2035),('2035-09-18',203538,9,2035,18,38,203509,2035),('2035-09-19',203538,9,2035,19,38,203509,2035),('2035-09-20',203538,9,2035,20,38,203509,2035),('2035-09-21',203538,9,2035,21,38,203509,2035),('2035-09-22',203538,9,2035,22,38,203509,2035),('2035-09-23',203539,9,2035,23,39,203509,2035),('2035-09-24',203539,9,2035,24,39,203509,2035),('2035-09-25',203539,9,2035,25,39,203509,2035),('2035-09-26',203539,9,2035,26,39,203509,2035),('2035-09-27',203539,9,2035,27,39,203509,2035),('2035-09-28',203539,9,2035,28,39,203509,2035),('2035-09-29',203539,9,2035,29,39,203509,2035),('2035-09-30',203540,9,2035,30,40,203509,2035),('2035-10-01',203540,10,2035,1,40,203510,2035),('2035-10-02',203540,10,2035,2,40,203510,2035),('2035-10-03',203540,10,2035,3,40,203510,2035),('2035-10-04',203540,10,2035,4,40,203510,2035),('2035-10-05',203540,10,2035,5,40,203510,2035),('2035-10-06',203540,10,2035,6,40,203510,2035),('2035-10-07',203541,10,2035,7,41,203510,2035),('2035-10-08',203541,10,2035,8,41,203510,2035),('2035-10-09',203541,10,2035,9,41,203510,2035),('2035-10-10',203541,10,2035,10,41,203510,2035),('2035-10-11',203541,10,2035,11,41,203510,2035),('2035-10-12',203541,10,2035,12,41,203510,2035),('2035-10-13',203541,10,2035,13,41,203510,2035),('2035-10-14',203542,10,2035,14,42,203510,2035),('2035-10-15',203542,10,2035,15,42,203510,2035),('2035-10-16',203542,10,2035,16,42,203510,2035),('2035-10-17',203542,10,2035,17,42,203510,2035),('2035-10-18',203542,10,2035,18,42,203510,2035),('2035-10-19',203542,10,2035,19,42,203510,2035),('2035-10-20',203542,10,2035,20,42,203510,2035),('2035-10-21',203543,10,2035,21,43,203510,2035),('2035-10-22',203543,10,2035,22,43,203510,2035),('2035-10-23',203543,10,2035,23,43,203510,2035),('2035-10-24',203543,10,2035,24,43,203510,2035),('2035-10-25',203543,10,2035,25,43,203510,2035),('2035-10-26',203543,10,2035,26,43,203510,2035),('2035-10-27',203543,10,2035,27,43,203510,2035),('2035-10-28',203544,10,2035,28,44,203510,2035),('2035-10-29',203544,10,2035,29,44,203510,2035),('2035-10-30',203544,10,2035,30,44,203510,2035),('2035-10-31',203544,10,2035,31,44,203510,2035),('2035-11-01',203544,11,2035,1,44,203511,2035),('2035-11-02',203544,11,2035,2,44,203511,2035),('2035-11-03',203544,11,2035,3,44,203511,2035),('2035-11-04',203545,11,2035,4,45,203511,2035),('2035-11-05',203545,11,2035,5,45,203511,2035),('2035-11-06',203545,11,2035,6,45,203511,2035),('2035-11-07',203545,11,2035,7,45,203511,2035),('2035-11-08',203545,11,2035,8,45,203511,2035),('2035-11-09',203545,11,2035,9,45,203511,2035),('2035-11-10',203545,11,2035,10,45,203511,2035),('2035-11-11',203546,11,2035,11,46,203511,2035),('2035-11-12',203546,11,2035,12,46,203511,2035),('2035-11-13',203546,11,2035,13,46,203511,2035),('2035-11-14',203546,11,2035,14,46,203511,2035),('2035-11-15',203546,11,2035,15,46,203511,2035),('2035-11-16',203546,11,2035,16,46,203511,2035),('2035-11-17',203546,11,2035,17,46,203511,2035),('2035-11-18',203547,11,2035,18,47,203511,2035),('2035-11-19',203547,11,2035,19,47,203511,2035),('2035-11-20',203547,11,2035,20,47,203511,2035),('2035-11-21',203547,11,2035,21,47,203511,2035),('2035-11-22',203547,11,2035,22,47,203511,2035),('2035-11-23',203547,11,2035,23,47,203511,2035),('2035-11-24',203547,11,2035,24,47,203511,2035),('2035-11-25',203548,11,2035,25,48,203511,2035),('2035-11-26',203548,11,2035,26,48,203511,2035),('2035-11-27',203548,11,2035,27,48,203511,2035),('2035-11-28',203548,11,2035,28,48,203511,2035),('2035-11-29',203548,11,2035,29,48,203511,2035),('2035-11-30',203548,11,2035,30,48,203511,2035),('2035-12-01',203548,12,2035,1,48,203512,2036),('2035-12-02',203549,12,2035,2,49,203512,2036),('2035-12-03',203549,12,2035,3,49,203512,2036),('2035-12-04',203549,12,2035,4,49,203512,2036),('2035-12-05',203549,12,2035,5,49,203512,2036),('2035-12-06',203549,12,2035,6,49,203512,2036),('2035-12-07',203549,12,2035,7,49,203512,2036),('2035-12-08',203549,12,2035,8,49,203512,2036),('2035-12-09',203550,12,2035,9,50,203512,2036),('2035-12-10',203550,12,2035,10,50,203512,2036),('2035-12-11',203550,12,2035,11,50,203512,2036),('2035-12-12',203550,12,2035,12,50,203512,2036),('2035-12-13',203550,12,2035,13,50,203512,2036),('2035-12-14',203550,12,2035,14,50,203512,2036),('2035-12-15',203550,12,2035,15,50,203512,2036),('2035-12-16',203551,12,2035,16,51,203512,2036),('2035-12-17',203551,12,2035,17,51,203512,2036),('2035-12-18',203551,12,2035,18,51,203512,2036),('2035-12-19',203551,12,2035,19,51,203512,2036),('2035-12-20',203551,12,2035,20,51,203512,2036),('2035-12-21',203551,12,2035,21,51,203512,2036),('2035-12-22',203551,12,2035,22,51,203512,2036),('2035-12-23',203552,12,2035,23,52,203512,2036),('2035-12-24',203552,12,2035,24,52,203512,2036),('2035-12-25',203552,12,2035,25,52,203512,2036),('2035-12-26',203552,12,2035,26,52,203512,2036),('2035-12-27',203552,12,2035,27,52,203512,2036),('2035-12-28',203552,12,2035,28,52,203512,2036),('2035-12-29',203552,12,2035,29,52,203512,2036),('2035-12-30',203553,12,2035,30,1,203512,2036),('2035-12-31',203501,12,2035,31,1,203512,2036),('2036-01-01',203601,1,2036,1,1,203601,2036),('2036-01-02',203601,1,2036,2,1,203601,2036),('2036-01-03',203601,1,2036,3,1,203601,2036),('2036-01-04',203601,1,2036,4,1,203601,2036),('2036-01-05',203601,1,2036,5,1,203601,2036),('2036-01-06',203602,1,2036,6,2,203601,2036),('2036-01-07',203602,1,2036,7,2,203601,2036),('2036-01-08',203602,1,2036,8,2,203601,2036),('2036-01-09',203602,1,2036,9,2,203601,2036),('2036-01-10',203602,1,2036,10,2,203601,2036),('2036-01-11',203602,1,2036,11,2,203601,2036),('2036-01-12',203602,1,2036,12,2,203601,2036),('2036-01-13',203603,1,2036,13,3,203601,2036),('2036-01-14',203603,1,2036,14,3,203601,2036),('2036-01-15',203603,1,2036,15,3,203601,2036),('2036-01-16',203603,1,2036,16,3,203601,2036),('2036-01-17',203603,1,2036,17,3,203601,2036),('2036-01-18',203603,1,2036,18,3,203601,2036),('2036-01-19',203603,1,2036,19,3,203601,2036),('2036-01-20',203604,1,2036,20,4,203601,2036),('2036-01-21',203604,1,2036,21,4,203601,2036),('2036-01-22',203604,1,2036,22,4,203601,2036),('2036-01-23',203604,1,2036,23,4,203601,2036),('2036-01-24',203604,1,2036,24,4,203601,2036),('2036-01-25',203604,1,2036,25,4,203601,2036),('2036-01-26',203604,1,2036,26,4,203601,2036),('2036-01-27',203605,1,2036,27,5,203601,2036),('2036-01-28',203605,1,2036,28,5,203601,2036),('2036-01-29',203605,1,2036,29,5,203601,2036),('2036-01-30',203605,1,2036,30,5,203601,2036),('2036-01-31',203605,1,2036,31,5,203601,2036),('2036-02-01',203605,2,2036,1,5,203602,2036),('2036-02-02',203605,2,2036,2,5,203602,2036),('2036-02-03',203606,2,2036,3,6,203602,2036),('2036-02-04',203606,2,2036,4,6,203602,2036),('2036-02-05',203606,2,2036,5,6,203602,2036),('2036-02-06',203606,2,2036,6,6,203602,2036),('2036-02-07',203606,2,2036,7,6,203602,2036),('2036-02-08',203606,2,2036,8,6,203602,2036),('2036-02-09',203606,2,2036,9,6,203602,2036),('2036-02-10',203607,2,2036,10,7,203602,2036),('2036-02-11',203607,2,2036,11,7,203602,2036),('2036-02-12',203607,2,2036,12,7,203602,2036),('2036-02-13',203607,2,2036,13,7,203602,2036),('2036-02-14',203607,2,2036,14,7,203602,2036),('2036-02-15',203607,2,2036,15,7,203602,2036),('2036-02-16',203607,2,2036,16,7,203602,2036),('2036-02-17',203608,2,2036,17,8,203602,2036),('2036-02-18',203608,2,2036,18,8,203602,2036),('2036-02-19',203608,2,2036,19,8,203602,2036),('2036-02-20',203608,2,2036,20,8,203602,2036),('2036-02-21',203608,2,2036,21,8,203602,2036),('2036-02-22',203608,2,2036,22,8,203602,2036),('2036-02-23',203608,2,2036,23,8,203602,2036),('2036-02-24',203609,2,2036,24,9,203602,2036),('2036-02-25',203609,2,2036,25,9,203602,2036),('2036-02-26',203609,2,2036,26,9,203602,2036),('2036-02-27',203609,2,2036,27,9,203602,2036),('2036-02-28',203609,2,2036,28,9,203602,2036),('2036-02-29',203609,2,2036,29,9,203602,2036),('2036-03-01',203609,3,2036,1,9,203603,2036),('2036-03-02',203610,3,2036,2,10,203603,2036),('2036-03-03',203610,3,2036,3,10,203603,2036),('2036-03-04',203610,3,2036,4,10,203603,2036),('2036-03-05',203610,3,2036,5,10,203603,2036),('2036-03-06',203610,3,2036,6,10,203603,2036),('2036-03-07',203610,3,2036,7,10,203603,2036),('2036-03-08',203610,3,2036,8,10,203603,2036),('2036-03-09',203611,3,2036,9,11,203603,2036),('2036-03-10',203611,3,2036,10,11,203603,2036),('2036-03-11',203611,3,2036,11,11,203603,2036),('2036-03-12',203611,3,2036,12,11,203603,2036),('2036-03-13',203611,3,2036,13,11,203603,2036),('2036-03-14',203611,3,2036,14,11,203603,2036),('2036-03-15',203611,3,2036,15,11,203603,2036),('2036-03-16',203612,3,2036,16,12,203603,2036),('2036-03-17',203612,3,2036,17,12,203603,2036),('2036-03-18',203612,3,2036,18,12,203603,2036),('2036-03-19',203612,3,2036,19,12,203603,2036),('2036-03-20',203612,3,2036,20,12,203603,2036),('2036-03-21',203612,3,2036,21,12,203603,2036),('2036-03-22',203612,3,2036,22,12,203603,2036),('2036-03-23',203613,3,2036,23,13,203603,2036),('2036-03-24',203613,3,2036,24,13,203603,2036),('2036-03-25',203613,3,2036,25,13,203603,2036),('2036-03-26',203613,3,2036,26,13,203603,2036),('2036-03-27',203613,3,2036,27,13,203603,2036),('2036-03-28',203613,3,2036,28,13,203603,2036),('2036-03-29',203613,3,2036,29,13,203603,2036),('2036-03-30',203614,3,2036,30,14,203603,2036),('2036-03-31',203614,3,2036,31,14,203603,2036),('2036-04-01',203614,4,2036,1,14,203604,2036),('2036-04-02',203614,4,2036,2,14,203604,2036),('2036-04-03',203614,4,2036,3,14,203604,2036),('2036-04-04',203614,4,2036,4,14,203604,2036),('2036-04-05',203614,4,2036,5,14,203604,2036),('2036-04-06',203615,4,2036,6,15,203604,2036),('2036-04-07',203615,4,2036,7,15,203604,2036),('2036-04-08',203615,4,2036,8,15,203604,2036),('2036-04-09',203615,4,2036,9,15,203604,2036),('2036-04-10',203615,4,2036,10,15,203604,2036),('2036-04-11',203615,4,2036,11,15,203604,2036),('2036-04-12',203615,4,2036,12,15,203604,2036),('2036-04-13',203616,4,2036,13,16,203604,2036),('2036-04-14',203616,4,2036,14,16,203604,2036),('2036-04-15',203616,4,2036,15,16,203604,2036),('2036-04-16',203616,4,2036,16,16,203604,2036),('2036-04-17',203616,4,2036,17,16,203604,2036),('2036-04-18',203616,4,2036,18,16,203604,2036),('2036-04-19',203616,4,2036,19,16,203604,2036),('2036-04-20',203617,4,2036,20,17,203604,2036),('2036-04-21',203617,4,2036,21,17,203604,2036),('2036-04-22',203617,4,2036,22,17,203604,2036),('2036-04-23',203617,4,2036,23,17,203604,2036),('2036-04-24',203617,4,2036,24,17,203604,2036),('2036-04-25',203617,4,2036,25,17,203604,2036),('2036-04-26',203617,4,2036,26,17,203604,2036),('2036-04-27',203618,4,2036,27,18,203604,2036),('2036-04-28',203618,4,2036,28,18,203604,2036),('2036-04-29',203618,4,2036,29,18,203604,2036),('2036-04-30',203618,4,2036,30,18,203604,2036),('2036-05-01',203618,5,2036,1,18,203605,2036),('2036-05-02',203618,5,2036,2,18,203605,2036),('2036-05-03',203618,5,2036,3,18,203605,2036),('2036-05-04',203619,5,2036,4,19,203605,2036),('2036-05-05',203619,5,2036,5,19,203605,2036),('2036-05-06',203619,5,2036,6,19,203605,2036),('2036-05-07',203619,5,2036,7,19,203605,2036),('2036-05-08',203619,5,2036,8,19,203605,2036),('2036-05-09',203619,5,2036,9,19,203605,2036),('2036-05-10',203619,5,2036,10,19,203605,2036),('2036-05-11',203620,5,2036,11,20,203605,2036),('2036-05-12',203620,5,2036,12,20,203605,2036),('2036-05-13',203620,5,2036,13,20,203605,2036),('2036-05-14',203620,5,2036,14,20,203605,2036),('2036-05-15',203620,5,2036,15,20,203605,2036),('2036-05-16',203620,5,2036,16,20,203605,2036),('2036-05-17',203620,5,2036,17,20,203605,2036),('2036-05-18',203621,5,2036,18,21,203605,2036),('2036-05-19',203621,5,2036,19,21,203605,2036),('2036-05-20',203621,5,2036,20,21,203605,2036),('2036-05-21',203621,5,2036,21,21,203605,2036),('2036-05-22',203621,5,2036,22,21,203605,2036),('2036-05-23',203621,5,2036,23,21,203605,2036),('2036-05-24',203621,5,2036,24,21,203605,2036),('2036-05-25',203622,5,2036,25,22,203605,2036),('2036-05-26',203622,5,2036,26,22,203605,2036),('2036-05-27',203622,5,2036,27,22,203605,2036),('2036-05-28',203622,5,2036,28,22,203605,2036),('2036-05-29',203622,5,2036,29,22,203605,2036),('2036-05-30',203622,5,2036,30,22,203605,2036),('2036-05-31',203622,5,2036,31,22,203605,2036),('2036-06-01',203623,6,2036,1,23,203606,2036),('2036-06-02',203623,6,2036,2,23,203606,2036),('2036-06-03',203623,6,2036,3,23,203606,2036),('2036-06-04',203623,6,2036,4,23,203606,2036),('2036-06-05',203623,6,2036,5,23,203606,2036),('2036-06-06',203623,6,2036,6,23,203606,2036),('2036-06-07',203623,6,2036,7,23,203606,2036),('2036-06-08',203624,6,2036,8,24,203606,2036),('2036-06-09',203624,6,2036,9,24,203606,2036),('2036-06-10',203624,6,2036,10,24,203606,2036),('2036-06-11',203624,6,2036,11,24,203606,2036),('2036-06-12',203624,6,2036,12,24,203606,2036),('2036-06-13',203624,6,2036,13,24,203606,2036),('2036-06-14',203624,6,2036,14,24,203606,2036),('2036-06-15',203625,6,2036,15,25,203606,2036),('2036-06-16',203625,6,2036,16,25,203606,2036),('2036-06-17',203625,6,2036,17,25,203606,2036),('2036-06-18',203625,6,2036,18,25,203606,2036),('2036-06-19',203625,6,2036,19,25,203606,2036),('2036-06-20',203625,6,2036,20,25,203606,2036),('2036-06-21',203625,6,2036,21,25,203606,2036),('2036-06-22',203626,6,2036,22,26,203606,2036),('2036-06-23',203626,6,2036,23,26,203606,2036),('2036-06-24',203626,6,2036,24,26,203606,2036),('2036-06-25',203626,6,2036,25,26,203606,2036),('2036-06-26',203626,6,2036,26,26,203606,2036),('2036-06-27',203626,6,2036,27,26,203606,2036),('2036-06-28',203626,6,2036,28,26,203606,2036),('2036-06-29',203627,6,2036,29,27,203606,2036),('2036-06-30',203627,6,2036,30,27,203606,2036),('2036-07-01',203627,7,2036,1,27,203607,2036),('2036-07-02',203627,7,2036,2,27,203607,2036),('2036-07-03',203627,7,2036,3,27,203607,2036),('2036-07-04',203627,7,2036,4,27,203607,2036),('2036-07-05',203627,7,2036,5,27,203607,2036),('2036-07-06',203628,7,2036,6,28,203607,2036),('2036-07-07',203628,7,2036,7,28,203607,2036),('2036-07-08',203628,7,2036,8,28,203607,2036),('2036-07-09',203628,7,2036,9,28,203607,2036),('2036-07-10',203628,7,2036,10,28,203607,2036),('2036-07-11',203628,7,2036,11,28,203607,2036),('2036-07-12',203628,7,2036,12,28,203607,2036),('2036-07-13',203629,7,2036,13,29,203607,2036),('2036-07-14',203629,7,2036,14,29,203607,2036),('2036-07-15',203629,7,2036,15,29,203607,2036),('2036-07-16',203629,7,2036,16,29,203607,2036),('2036-07-17',203629,7,2036,17,29,203607,2036),('2036-07-18',203629,7,2036,18,29,203607,2036),('2036-07-19',203629,7,2036,19,29,203607,2036),('2036-07-20',203630,7,2036,20,30,203607,2036),('2036-07-21',203630,7,2036,21,30,203607,2036),('2036-07-22',203630,7,2036,22,30,203607,2036),('2036-07-23',203630,7,2036,23,30,203607,2036),('2036-07-24',203630,7,2036,24,30,203607,2036),('2036-07-25',203630,7,2036,25,30,203607,2036),('2036-07-26',203630,7,2036,26,30,203607,2036),('2036-07-27',203631,7,2036,27,31,203607,2036),('2036-07-28',203631,7,2036,28,31,203607,2036),('2036-07-29',203631,7,2036,29,31,203607,2036),('2036-07-30',203631,7,2036,30,31,203607,2036),('2036-07-31',203631,7,2036,31,31,203607,2036),('2036-08-01',203631,8,2036,1,31,203608,2036),('2036-08-02',203631,8,2036,2,31,203608,2036),('2036-08-03',203632,8,2036,3,32,203608,2036),('2036-08-04',203632,8,2036,4,32,203608,2036),('2036-08-05',203632,8,2036,5,32,203608,2036),('2036-08-06',203632,8,2036,6,32,203608,2036),('2036-08-07',203632,8,2036,7,32,203608,2036),('2036-08-08',203632,8,2036,8,32,203608,2036),('2036-08-09',203632,8,2036,9,32,203608,2036),('2036-08-10',203633,8,2036,10,33,203608,2036),('2036-08-11',203633,8,2036,11,33,203608,2036),('2036-08-12',203633,8,2036,12,33,203608,2036),('2036-08-13',203633,8,2036,13,33,203608,2036),('2036-08-14',203633,8,2036,14,33,203608,2036),('2036-08-15',203633,8,2036,15,33,203608,2036),('2036-08-16',203633,8,2036,16,33,203608,2036),('2036-08-17',203634,8,2036,17,34,203608,2036),('2036-08-18',203634,8,2036,18,34,203608,2036),('2036-08-19',203634,8,2036,19,34,203608,2036),('2036-08-20',203634,8,2036,20,34,203608,2036),('2036-08-21',203634,8,2036,21,34,203608,2036),('2036-08-22',203634,8,2036,22,34,203608,2036),('2036-08-23',203634,8,2036,23,34,203608,2036),('2036-08-24',203635,8,2036,24,35,203608,2036),('2036-08-25',203635,8,2036,25,35,203608,2036),('2036-08-26',203635,8,2036,26,35,203608,2036),('2036-08-27',203635,8,2036,27,35,203608,2036),('2036-08-28',203635,8,2036,28,35,203608,2036),('2036-08-29',203635,8,2036,29,35,203608,2036),('2036-08-30',203635,8,2036,30,35,203608,2036),('2036-08-31',203636,8,2036,31,36,203608,2036),('2036-09-01',203636,9,2036,1,36,203609,2036),('2036-09-02',203636,9,2036,2,36,203609,2036),('2036-09-03',203636,9,2036,3,36,203609,2036),('2036-09-04',203636,9,2036,4,36,203609,2036),('2036-09-05',203636,9,2036,5,36,203609,2036),('2036-09-06',203636,9,2036,6,36,203609,2036),('2036-09-07',203637,9,2036,7,37,203609,2036),('2036-09-08',203637,9,2036,8,37,203609,2036),('2036-09-09',203637,9,2036,9,37,203609,2036),('2036-09-10',203637,9,2036,10,37,203609,2036),('2036-09-11',203637,9,2036,11,37,203609,2036),('2036-09-12',203637,9,2036,12,37,203609,2036),('2036-09-13',203637,9,2036,13,37,203609,2036),('2036-09-14',203638,9,2036,14,38,203609,2036),('2036-09-15',203638,9,2036,15,38,203609,2036),('2036-09-16',203638,9,2036,16,38,203609,2036),('2036-09-17',203638,9,2036,17,38,203609,2036),('2036-09-18',203638,9,2036,18,38,203609,2036),('2036-09-19',203638,9,2036,19,38,203609,2036),('2036-09-20',203638,9,2036,20,38,203609,2036),('2036-09-21',203639,9,2036,21,39,203609,2036),('2036-09-22',203639,9,2036,22,39,203609,2036),('2036-09-23',203639,9,2036,23,39,203609,2036),('2036-09-24',203639,9,2036,24,39,203609,2036),('2036-09-25',203639,9,2036,25,39,203609,2036),('2036-09-26',203639,9,2036,26,39,203609,2036),('2036-09-27',203639,9,2036,27,39,203609,2036),('2036-09-28',203640,9,2036,28,40,203609,2036),('2036-09-29',203640,9,2036,29,40,203609,2036),('2036-09-30',203640,9,2036,30,40,203609,2036),('2036-10-01',203640,10,2036,1,40,203610,2036),('2036-10-02',203640,10,2036,2,40,203610,2036),('2036-10-03',203640,10,2036,3,40,203610,2036),('2036-10-04',203640,10,2036,4,40,203610,2036),('2036-10-05',203641,10,2036,5,41,203610,2036),('2036-10-06',203641,10,2036,6,41,203610,2036),('2036-10-07',203641,10,2036,7,41,203610,2036),('2036-10-08',203641,10,2036,8,41,203610,2036),('2036-10-09',203641,10,2036,9,41,203610,2036),('2036-10-10',203641,10,2036,10,41,203610,2036),('2036-10-11',203641,10,2036,11,41,203610,2036),('2036-10-12',203642,10,2036,12,42,203610,2036),('2036-10-13',203642,10,2036,13,42,203610,2036),('2036-10-14',203642,10,2036,14,42,203610,2036),('2036-10-15',203642,10,2036,15,42,203610,2036),('2036-10-16',203642,10,2036,16,42,203610,2036),('2036-10-17',203642,10,2036,17,42,203610,2036),('2036-10-18',203642,10,2036,18,42,203610,2036),('2036-10-19',203643,10,2036,19,43,203610,2036),('2036-10-20',203643,10,2036,20,43,203610,2036),('2036-10-21',203643,10,2036,21,43,203610,2036),('2036-10-22',203643,10,2036,22,43,203610,2036),('2036-10-23',203643,10,2036,23,43,203610,2036),('2036-10-24',203643,10,2036,24,43,203610,2036),('2036-10-25',203643,10,2036,25,43,203610,2036),('2036-10-26',203644,10,2036,26,44,203610,2036),('2036-10-27',203644,10,2036,27,44,203610,2036),('2036-10-28',203644,10,2036,28,44,203610,2036),('2036-10-29',203644,10,2036,29,44,203610,2036),('2036-10-30',203644,10,2036,30,44,203610,2036),('2036-10-31',203644,10,2036,31,44,203610,2036),('2036-11-01',203644,11,2036,1,44,203611,2036),('2036-11-02',203645,11,2036,2,45,203611,2036),('2036-11-03',203645,11,2036,3,45,203611,2036),('2036-11-04',203645,11,2036,4,45,203611,2036),('2036-11-05',203645,11,2036,5,45,203611,2036),('2036-11-06',203645,11,2036,6,45,203611,2036),('2036-11-07',203645,11,2036,7,45,203611,2036),('2036-11-08',203645,11,2036,8,45,203611,2036),('2036-11-09',203646,11,2036,9,46,203611,2036),('2036-11-10',203646,11,2036,10,46,203611,2036),('2036-11-11',203646,11,2036,11,46,203611,2036),('2036-11-12',203646,11,2036,12,46,203611,2036),('2036-11-13',203646,11,2036,13,46,203611,2036),('2036-11-14',203646,11,2036,14,46,203611,2036),('2036-11-15',203646,11,2036,15,46,203611,2036),('2036-11-16',203647,11,2036,16,47,203611,2036),('2036-11-17',203647,11,2036,17,47,203611,2036),('2036-11-18',203647,11,2036,18,47,203611,2036),('2036-11-19',203647,11,2036,19,47,203611,2036),('2036-11-20',203647,11,2036,20,47,203611,2036),('2036-11-21',203647,11,2036,21,47,203611,2036),('2036-11-22',203647,11,2036,22,47,203611,2036),('2036-11-23',203648,11,2036,23,48,203611,2036),('2036-11-24',203648,11,2036,24,48,203611,2036),('2036-11-25',203648,11,2036,25,48,203611,2036),('2036-11-26',203648,11,2036,26,48,203611,2036),('2036-11-27',203648,11,2036,27,48,203611,2036),('2036-11-28',203648,11,2036,28,48,203611,2036),('2036-11-29',203648,11,2036,29,48,203611,2036),('2036-11-30',203649,11,2036,30,49,203611,2036),('2036-12-01',203649,12,2036,1,49,203612,2037),('2036-12-02',203649,12,2036,2,49,203612,2037),('2036-12-03',203649,12,2036,3,49,203612,2037),('2036-12-04',203649,12,2036,4,49,203612,2037),('2036-12-05',203649,12,2036,5,49,203612,2037),('2036-12-06',203649,12,2036,6,49,203612,2037),('2036-12-07',203650,12,2036,7,50,203612,2037),('2036-12-08',203650,12,2036,8,50,203612,2037),('2036-12-09',203650,12,2036,9,50,203612,2037),('2036-12-10',203650,12,2036,10,50,203612,2037),('2036-12-11',203650,12,2036,11,50,203612,2037),('2036-12-12',203650,12,2036,12,50,203612,2037),('2036-12-13',203650,12,2036,13,50,203612,2037),('2036-12-14',203651,12,2036,14,51,203612,2037),('2036-12-15',203651,12,2036,15,51,203612,2037),('2036-12-16',203651,12,2036,16,51,203612,2037),('2036-12-17',203651,12,2036,17,51,203612,2037),('2036-12-18',203651,12,2036,18,51,203612,2037),('2036-12-19',203651,12,2036,19,51,203612,2037),('2036-12-20',203651,12,2036,20,51,203612,2037),('2036-12-21',203652,12,2036,21,52,203612,2037),('2036-12-22',203652,12,2036,22,52,203612,2037),('2036-12-23',203652,12,2036,23,52,203612,2037),('2036-12-24',203652,12,2036,24,52,203612,2037),('2036-12-25',203652,12,2036,25,52,203612,2037),('2036-12-26',203652,12,2036,26,52,203612,2037),('2036-12-27',203652,12,2036,27,52,203612,2037),('2036-12-28',203653,12,2036,28,53,203612,2037),('2036-12-29',203601,12,2036,29,53,203612,2037),('2036-12-30',203601,12,2036,30,53,203612,2037); -/*!40000 ALTER TABLE `time` ENABLE KEYS */; -UNLOCK TABLES; - -- -- Dumping data for table `volumeConfig` -- diff --git a/db/export-data.sh b/db/export-data.sh index 1df4db030..59edf6ebc 100755 --- a/db/export-data.sh +++ b/db/export-data.sh @@ -65,7 +65,6 @@ TABLES=( sample state ticketUpdateAction - time volumeConfig workCenter companyI18n From f9778c02b78b53db627c8a7e5118acb3259d8be4 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 14 Aug 2023 12:53:56 +0200 Subject: [PATCH 262/311] refs #5483 DB Dockerfile: STAMP removed, not needed anymore --- db/Dockerfile | 1 - db/PASTE_COMMENT_REMINDER | 4 ---- db/docker.js | 6 +----- 3 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 db/PASTE_COMMENT_REMINDER diff --git a/db/Dockerfile b/db/Dockerfile index 448b8b03a..8eeed35e5 100644 --- a/db/Dockerfile +++ b/db/Dockerfile @@ -31,7 +31,6 @@ RUN sed -i -e 's/@mockDate/'"$MOCKDATE"'/g' mockDate.sql \ && gosu mysql docker-structure.sh COPY changes ./changes COPY dump/fixtures.sql ./ -ARG STAMP=unknown RUN gosu mysql docker-fixtures.sh RUN echo "[INFO] -> Import finished" \ diff --git a/db/PASTE_COMMENT_REMINDER b/db/PASTE_COMMENT_REMINDER deleted file mode 100644 index f4468157f..000000000 --- a/db/PASTE_COMMENT_REMINDER +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Hay una versión en salix que machacará toda esta función/procedimiento avisa - * a ___ de los cambios que quieres hacer. - */ \ No newline at end of file diff --git a/db/docker.js b/db/docker.js index 05217d659..ae49c3337 100644 --- a/db/docker.js +++ b/db/docker.js @@ -22,12 +22,8 @@ module.exports = class Docker { * @param {String} networkName Name of the container network */ async run(ci, networkName = 'jenkins') { - let d = new Date(); - let pad = v => v < 10 ? '0' + v : v; - let stamp = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`; - log('Building container image...'); - await this.execP(`docker build --build-arg STAMP=${stamp} -t salix-db ./db`); + await this.execP(`docker build -t salix-db ./db`); log('Image built.'); let dockerArgs; From 868fbbfc2e0d873962ebe43afdf4883ff0961dcb Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 16 Aug 2023 08:04:32 +0200 Subject: [PATCH 263/311] cau #103812 hotFix(supplier): beforeSave name --- modules/supplier/back/models/supplier.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index f359d0580..96042c9a0 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -142,12 +142,12 @@ module.exports = Self => { const changes = ctx.data || ctx.instance; const orgData = ctx.currentInstance; - const socialName = changes.name || orgData.name; + const name = changes.name || orgData.name; const hasChanges = orgData && changes; - const socialNameChanged = hasChanges - && orgData.socialName != socialName; + const nameChanged = hasChanges + && orgData.name != name; - if ((socialNameChanged) && !isAlpha(socialName)) + if ((nameChanged) && !isAlpha(name)) throw new UserError('The social name has an invalid format'); }); }; From 518d5111e49f8422605e07ffd651a88ffb44a97f Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 17 Aug 2023 08:42:04 +0200 Subject: [PATCH 264/311] refs #6127 hotFix(ticketRefund): get ticketFk front ticketService --- modules/ticket/back/methods/sale/refund.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index a8191610a..12f240ae2 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -67,8 +67,12 @@ module.exports = Self => { const sales = await models.Sale.find(salesFilter, myOptions); const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))]; + let [firstTicketId] = ticketsIds; + if (!firstTicketId) { + [ticketServices] = await models.TicketService.find({where: {id: {inq: servicesIds}}}, myOptions); + firstTicketId = ticketServices.ticketFk; + } const now = Date.vnNew(); - const [firstTicketId] = ticketsIds; const refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions); From 4fb6d91e54d10e1a646e977d52c05a9da5c08449 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 17 Aug 2023 09:31:09 +0200 Subject: [PATCH 265/311] refs #6126 feat: add changeLog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f3570932..fb4ccc91b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2334.01] - 2023-08-24 ### Added +- (General -> Errores) Botón para enviar cau con los datos del error + ### Changed From 0f7f996e3ac58ea56595c5a66f4352f3fb074692 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 17 Aug 2023 09:34:53 +0200 Subject: [PATCH 266/311] refs #6126 feat(deploy): init 2336 version --- CHANGELOG.md | 13 +++++++------ db/changes/233601/.gitkeep | 0 package.json | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 db/changes/233601/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index fb4ccc91b..2b3c43005 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,17 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2334.01] - 2023-08-24 +## [2336.01] - 2023-09-07 ### Added -- (General -> Errores) Botón para enviar cau con los datos del error - ### Changed ### Fixed +## [2334.01] - 2023-08-24 + +### Added +- (General -> Errores) Botón para enviar cau con los datos del error + + ## [2332.01] - 2023-08-10 ### Added @@ -46,9 +50,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Clientes -> Razón social) Permite crear clientes con la misma razón social según el país -### Fixed - - ## [2328.01] - 2023-07-13 ### Added diff --git a/db/changes/233601/.gitkeep b/db/changes/233601/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/package.json b/package.json index 2aa37379e..dd833a8ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.34.01", + "version": "23.36.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 6b630722782ae9d12ff5c6329633bd49092f4247 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 18 Aug 2023 11:52:04 +0200 Subject: [PATCH 267/311] refs #6041 hotfix agricola --- print/templates/reports/entry-order/sql/supplier.sql | 2 +- print/templates/reports/invoiceIn/invoiceIn.html | 1 + print/templates/reports/invoiceIn/sql/invoice.sql | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/print/templates/reports/entry-order/sql/supplier.sql b/print/templates/reports/entry-order/sql/supplier.sql index 11a2bc602..81ed7e883 100644 --- a/print/templates/reports/entry-order/sql/supplier.sql +++ b/print/templates/reports/entry-order/sql/supplier.sql @@ -8,4 +8,4 @@ SELECT FROM supplier s JOIN entry e ON e.supplierFk = s.id LEFT JOIN province p ON p.id = s.provinceFk -WHERE e.id = ? \ No newline at end of file +WHERE e.id = ? diff --git a/print/templates/reports/invoiceIn/invoiceIn.html b/print/templates/reports/invoiceIn/invoiceIn.html index 8f072947f..a86fd42b0 100644 --- a/print/templates/reports/invoiceIn/invoiceIn.html +++ b/print/templates/reports/invoiceIn/invoiceIn.html @@ -32,6 +32,7 @@

{{invoice.name}}

{{invoice.postalAddress}}
{{invoice.postcodeCity}}
+
{{invoice.postCode}}, {{invoice.city}}, ({{invoice.province}})
{{$t('fiscalId')}}: {{invoice.nif}}
{{$t('phone')}}: {{invoice.phone}}
diff --git a/print/templates/reports/invoiceIn/sql/invoice.sql b/print/templates/reports/invoiceIn/sql/invoice.sql index dae979011..82eeebce0 100644 --- a/print/templates/reports/invoiceIn/sql/invoice.sql +++ b/print/templates/reports/invoiceIn/sql/invoice.sql @@ -4,6 +4,9 @@ SELECT i.issued, s.name, s.street AS postalAddress, + s.city, + s.postCode, + pr.name province, s.nif, s.phone, p.name payMethod @@ -11,4 +14,5 @@ SELECT JOIN supplier s ON s.id = i.supplierFk JOIN company c ON c.id = i.companyFk JOIN payMethod p ON p.id = s.payMethodFk + LEFT JOIN province pr ON pr.id = s.provinceFk WHERE i.id = ? From 86def6e2120dfe474ee51319811f797c582f46b1 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 21 Aug 2023 08:47:28 +0200 Subject: [PATCH 268/311] refs #5995 Changed query getExternalCmrs --- modules/route/back/methods/route/getExternalCmrs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/route/back/methods/route/getExternalCmrs.js b/modules/route/back/methods/route/getExternalCmrs.js index 5b08cf34a..7b3772c9e 100644 --- a/modules/route/back/methods/route/getExternalCmrs.js +++ b/modules/route/back/methods/route/getExternalCmrs.js @@ -95,7 +95,7 @@ module.exports = Self => { t.id ticketFk, co.country, t.clientFk, - sub.id hasCmrDms, + IF(sub.id, TRUE, FALSE) hasCmrDms, DATE(t.shipped) shipped FROM ticket t JOIN ticketState ts ON ts.ticketFk = t.id From 36623c1cae948bfd88c456aea6459a35166b240a Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 21 Aug 2023 13:48:51 +0200 Subject: [PATCH 269/311] refs #5941 fix(sendToSupport): fix email from --- back/methods/osticket/sendToSupport.js | 2 ++ print/core/smtp.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js index 320691e23..a9fcf28a9 100644 --- a/back/methods/osticket/sendToSupport.js +++ b/back/methods/osticket/sendToSupport.js @@ -33,6 +33,7 @@ module.exports = Self => { await Self.app.models.EmailUser.findById(ctx.req.accessToken.userId, {fields: ['email']}); let html = `Motivo:
${reason}
`; + html += `Usuario:
${ctx.req.accessToken.userId} ${emailUser.email}
`; for (const data in additionalData) html += `${data}:
${tryParse(additionalData[data])}
`; @@ -40,6 +41,7 @@ module.exports = Self => { const subjectReason = JSON.parse(additionalData?.httpRequest)?.data?.error; smtp.send({ to: config.app.reportEmail, + from: emailUser.email, replyTo: emailUser.email, subject: '[Support-Salix] ' + diff --git a/print/core/smtp.js b/print/core/smtp.js index 8c07e7eca..01d66b6f0 100644 --- a/print/core/smtp.js +++ b/print/core/smtp.js @@ -9,7 +9,7 @@ module.exports = { }, async send(options) { - options.from = `${config.app.senderName} <${config.app.senderEmail}>`; + options.from = options.from ?? `${config.app.senderName} <${config.app.senderEmail}>`; const env = process.env.NODE_ENV; const canSend = env === 'production' || !env || options.force; @@ -19,8 +19,10 @@ module.exports = { return Promise.resolve(true); } - if (!env) + if (!env) { options.to = config.app.senderEmail; + options.from = `${config.app.senderName} <${config.app.senderEmail}>`; + } let res; let error; From 14d4de0e1f4d4ac35bddb828d14c9d038f17979d Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 21 Aug 2023 14:48:05 +0200 Subject: [PATCH 270/311] refs #5941 fix(sendToSupport): add as a collaborator --- back/methods/osticket/sendToSupport.js | 4 +--- print/core/smtp.js | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js index a9fcf28a9..5b9ebb4e3 100644 --- a/back/methods/osticket/sendToSupport.js +++ b/back/methods/osticket/sendToSupport.js @@ -40,9 +40,7 @@ module.exports = Self => { const subjectReason = JSON.parse(additionalData?.httpRequest)?.data?.error; smtp.send({ - to: config.app.reportEmail, - from: emailUser.email, - replyTo: emailUser.email, + to: `${config.app.reportEmail}, ${emailUser.email}`, subject: '[Support-Salix] ' + additionalData?.frontPath + ' ' + diff --git a/print/core/smtp.js b/print/core/smtp.js index 01d66b6f0..8c07e7eca 100644 --- a/print/core/smtp.js +++ b/print/core/smtp.js @@ -9,7 +9,7 @@ module.exports = { }, async send(options) { - options.from = options.from ?? `${config.app.senderName} <${config.app.senderEmail}>`; + options.from = `${config.app.senderName} <${config.app.senderEmail}>`; const env = process.env.NODE_ENV; const canSend = env === 'production' || !env || options.force; @@ -19,10 +19,8 @@ module.exports = { return Promise.resolve(true); } - if (!env) { + if (!env) options.to = config.app.senderEmail; - options.from = `${config.app.senderName} <${config.app.senderEmail}>`; - } let res; let error; From a26652045c46efa6303c48f6db8c3c63b1454a6c Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 22 Aug 2023 10:17:46 +0200 Subject: [PATCH 271/311] refs #5712 hotFix(docuware): tickets. hotFix(catalog): search_panel --- back/methods/docuware/checkFile.js | 7 +++---- back/methods/docuware/deliveryNoteEmail.js | 2 +- back/methods/docuware/specs/checkFile.spec.js | 16 +++------------- back/methods/docuware/upload.js | 2 +- .../order/front/catalog-search-panel/index.js | 4 ---- modules/order/front/catalog/index.js | 2 +- modules/order/front/catalog/index.spec.js | 4 ++-- .../back/methods/ticket/docuwareDownload.js | 10 +++++++++- modules/ticket/back/models/ticket-methods.js | 1 + modules/ticket/front/descriptor-menu/index.js | 7 ++++--- 10 files changed, 25 insertions(+), 30 deletions(-) diff --git a/back/methods/docuware/checkFile.js b/back/methods/docuware/checkFile.js index 19224057c..76789649f 100644 --- a/back/methods/docuware/checkFile.js +++ b/back/methods/docuware/checkFile.js @@ -71,11 +71,10 @@ module.exports = Self => { } try { - const response = await Self.get(fileCabinet, filter); - const [documents] = response.Items; - if (!documents) return false; + const [response] = await Self.get(fileCabinet, filter); + if (!response) return false; - return {id: documents.Id}; + return {id: response['Document ID']}; } catch (error) { return false; } diff --git a/back/methods/docuware/deliveryNoteEmail.js b/back/methods/docuware/deliveryNoteEmail.js index 1557a3a87..a654eb262 100644 --- a/back/methods/docuware/deliveryNoteEmail.js +++ b/back/methods/docuware/deliveryNoteEmail.js @@ -65,7 +65,7 @@ module.exports = Self => { const email = new Email('delivery-note', params); - const docuwareFile = await models.Docuware.download(ctx, id, 'deliveryNote'); + const docuwareFile = await models.Docuware.download(id, 'deliveryNote'); return email.send({ overrideAttachments: true, diff --git a/back/methods/docuware/specs/checkFile.spec.js b/back/methods/docuware/specs/checkFile.spec.js index 8460bb561..c60809e85 100644 --- a/back/methods/docuware/specs/checkFile.spec.js +++ b/back/methods/docuware/specs/checkFile.spec.js @@ -16,19 +16,9 @@ describe('docuware download()', () => { it('should return the document data', async() => { const docuwareId = 1; - const response = { - Items: [ - { - Id: docuwareId, - Fields: [ - { - FieldName: 'ESTADO', - Item: 'Firmado' - } - ] - } - ] - }; + const response = [{ + 'Document ID': docuwareId + }]; spyOn(docuwareModel, 'get').and.returnValue((new Promise(resolve => resolve(response)))); const result = await models.Docuware.checkFile(ticketId, fileCabinetName, null, true); diff --git a/back/methods/docuware/upload.js b/back/methods/docuware/upload.js index 096301e56..7055bf8d5 100644 --- a/back/methods/docuware/upload.js +++ b/back/methods/docuware/upload.js @@ -111,7 +111,7 @@ module.exports = Self => { throw new UserError('Action not allowed on the test environment'); // delete old - const docuwareFile = await models.Docuware.checkFile(ctx, id, fileCabinet, false); + const docuwareFile = await models.Docuware.checkFile(id, fileCabinet, false); if (docuwareFile) { const deleteJson = { 'Field': [{'FieldName': 'ESTADO', 'Item': 'Pendiente eliminar', 'ItemElementName': 'String'}] diff --git a/modules/order/front/catalog-search-panel/index.js b/modules/order/front/catalog-search-panel/index.js index 21c0c50fa..b84243ca7 100644 --- a/modules/order/front/catalog-search-panel/index.js +++ b/modules/order/front/catalog-search-panel/index.js @@ -25,10 +25,6 @@ class Controller extends SearchPanel { this.filter.values.push({}); setTimeout(() => this.parentPopover.relocate()); } - - changeTag() { - - } } ngModule.vnComponent('vnOrderCatalogSearchPanel', { diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index c0777ebc9..f25c4a35e 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -236,7 +236,7 @@ class Controller extends Section { tagGroups: this.tagGroups, }; - return model.applyFilter({where: newFilter}, newParams); + return model.addFilter({where: newFilter}, newParams); } openPanel(event) { diff --git a/modules/order/front/catalog/index.spec.js b/modules/order/front/catalog/index.spec.js index 03d7c41ba..ef96e1ed0 100644 --- a/modules/order/front/catalog/index.spec.js +++ b/modules/order/front/catalog/index.spec.js @@ -191,14 +191,14 @@ describe('Order', () => { describe('applyFilters()', () => { it(`should call model applyFilter() method with a new filter`, () => { - jest.spyOn(controller.$.model, 'applyFilter'); + jest.spyOn(controller.$.model, 'addFilter'); controller._categoryId = 2; controller._typeId = 4; controller.applyFilters(); - expect(controller.$.model.applyFilter).toHaveBeenCalledWith( + expect(controller.$.model.addFilter).toHaveBeenCalledWith( {where: {categoryFk: 2, typeFk: 4}}, {orderFk: 4, orderBy: controller.getOrderBy(), tagGroups: []}); }); diff --git a/modules/ticket/back/methods/ticket/docuwareDownload.js b/modules/ticket/back/methods/ticket/docuwareDownload.js index e9b74b1a9..7084bbdd4 100644 --- a/modules/ticket/back/methods/ticket/docuwareDownload.js +++ b/modules/ticket/back/methods/ticket/docuwareDownload.js @@ -32,6 +32,14 @@ module.exports = Self => { }); Self.docuwareDownload = async id => { + const models = Self.app.models; + const docuwareInfo = await models.Docuware.findOne({ + where: { + code: 'deliveryNote', + action: 'find' + } + }); + const filter = { condition: [ { @@ -50,6 +58,6 @@ module.exports = Self => { } ] }; - return Self.app.models.Docuware.download(id, 'deliveryNote', filter); + return models.Docuware.download(id, 'deliveryNote', filter); }; }; diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index c37337253..14cb104be 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -42,4 +42,5 @@ module.exports = function(Self) { require('../methods/ticket/expeditionPalletLabel')(Self); require('../methods/ticket/saveSign')(Self); require('../methods/ticket/invoiceTickets')(Self); + require('../methods/ticket/docuwareDownload')(Self); }; diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 360d93564..d1f39fd19 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -3,10 +3,11 @@ import Section from 'salix/components/section'; import './style.scss'; class Controller extends Section { - constructor($element, $, vnReport, vnEmail) { + constructor($element, $, vnReport, vnEmail, vnFile) { super($element, $); this.vnReport = vnReport; this.vnEmail = vnEmail; + this.vnFile = vnFile; } get ticketId() { @@ -322,7 +323,7 @@ class Controller extends Section { } docuwareDownload() { - this.vnFile.download(`api/Ticket/${this.ticket.id}/docuwareDownload`); + this.vnFile.download(`api/Tickets/${this.ticket.id}/docuwareDownload`); } setTicketWeight(weight) { @@ -335,7 +336,7 @@ class Controller extends Section { } } -Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail']; +Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail', 'vnFile']; ngModule.vnComponent('vnTicketDescriptorMenu', { template: require('./index.html'), From cb8ed437d99acc7ca361dfc6ad8bb52ede9f2b00 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 22 Aug 2023 13:21:17 +0200 Subject: [PATCH 272/311] refs #6140 fix: el valor de ttl ya no es undefined --- front/core/services/token.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/core/services/token.js b/front/core/services/token.js index c16cc3c4f..426fe2b73 100644 --- a/front/core/services/token.js +++ b/front/core/services/token.js @@ -60,7 +60,7 @@ export default class Token { if (!this.token) return; const created = storage.getItem('vnTokenCreated'); this.created = created && new Date(created); - this.renewPeriod = storage.getItem('vnTokenRenewPeriod'); + this.ttl = storage.getItem('vnTokenTtl'); } setStorage(storage, token, created, ttl) { From 5a5e3ebddb40382eef2cd6c117312adddd77ad15 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 22 Aug 2023 13:39:57 +0200 Subject: [PATCH 273/311] refs #5712 hotFix(catalog): undo last fix search_panel --- modules/order/front/catalog/index.js | 2 +- modules/order/front/catalog/index.spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index f25c4a35e..c0777ebc9 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -236,7 +236,7 @@ class Controller extends Section { tagGroups: this.tagGroups, }; - return model.addFilter({where: newFilter}, newParams); + return model.applyFilter({where: newFilter}, newParams); } openPanel(event) { diff --git a/modules/order/front/catalog/index.spec.js b/modules/order/front/catalog/index.spec.js index ef96e1ed0..03d7c41ba 100644 --- a/modules/order/front/catalog/index.spec.js +++ b/modules/order/front/catalog/index.spec.js @@ -191,14 +191,14 @@ describe('Order', () => { describe('applyFilters()', () => { it(`should call model applyFilter() method with a new filter`, () => { - jest.spyOn(controller.$.model, 'addFilter'); + jest.spyOn(controller.$.model, 'applyFilter'); controller._categoryId = 2; controller._typeId = 4; controller.applyFilters(); - expect(controller.$.model.addFilter).toHaveBeenCalledWith( + expect(controller.$.model.applyFilter).toHaveBeenCalledWith( {where: {categoryFk: 2, typeFk: 4}}, {orderFk: 4, orderBy: controller.getOrderBy(), tagGroups: []}); }); From 4657bf4e433c9292d2604321d2f0dab865073cce Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 22 Aug 2023 14:58:26 +0200 Subject: [PATCH 274/311] refs #6143 refactor: ibanValidation with countryCode param --- loopback/util/validateIban.js | 3 ++- modules/client/back/models/client.js | 8 +++----- modules/supplier/back/models/supplier-account.js | 9 +++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/loopback/util/validateIban.js b/loopback/util/validateIban.js index 3ca09ef95..ed3e00426 100644 --- a/loopback/util/validateIban.js +++ b/loopback/util/validateIban.js @@ -1,6 +1,7 @@ -module.exports = function(iban) { +module.exports = function(iban, countryCode) { if (iban == null) return true; if (typeof iban != 'string') return false; + if (countryCode?.toLowerCase() != 'es') return true; iban = iban.toUpperCase(); iban = trim(iban); diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 129924b78..bdf2f91b5 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -90,16 +90,14 @@ module.exports = Self => { }); async function ibanNeedsValidation(err, done) { + const bankEntity = await Self.app.models.BankEntity.findById(this.bankEntityFk); const filter = { fields: ['code'], - where: {id: this.countryFk} + where: {id: bankEntity.countryFk} }; const country = await Self.app.models.Country.findOne(filter); - const code = country ? country.code.toLowerCase() : null; - if (code != 'es') - return done(); - if (!validateIban(this.iban)) + if (!validateIban(this.iban, country?.code)) err(); done(); } diff --git a/modules/supplier/back/models/supplier-account.js b/modules/supplier/back/models/supplier-account.js index 51da113ec..7a9e14421 100644 --- a/modules/supplier/back/models/supplier-account.js +++ b/modules/supplier/back/models/supplier-account.js @@ -7,18 +7,15 @@ module.exports = Self => { }); async function ibanValidation(err, done) { - const supplier = await Self.app.models.Supplier.findById(this.supplierFk); + const bankEntity = await Self.app.models.BankEntity.findById(this.bankEntityFk); const filter = { fields: ['code'], - where: {id: supplier.countryFk} + where: {id: bankEntity.countryFk} }; const country = await Self.app.models.Country.findOne(filter); - const code = country ? country.code.toLowerCase() : null; - if (code != 'es') - return done(); - if (!validateIban(this.iban)) + if (!validateIban(this.iban, country?.code)) err(); done(); } From 7349d4496f8ed79ec44a5f3f56bb922d18be3298 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 23 Aug 2023 07:34:01 +0200 Subject: [PATCH 275/311] refs #5351 hotFix(worker_sip): use worker.id not worker.userFk --- modules/worker/front/pbx/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/front/pbx/index.js b/modules/worker/front/pbx/index.js index d37f6f7d8..3b6443d3c 100644 --- a/modules/worker/front/pbx/index.js +++ b/modules/worker/front/pbx/index.js @@ -5,7 +5,7 @@ class Controller extends Section { onSubmit() { const sip = this.worker.sip; const params = { - userFk: this.worker.userFk, + userFk: this.worker.id, extension: sip.extension }; this.$.watcher.check(); From 8454d208e16c7be5999d3fe5b55102bdea881ac7 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 23 Aug 2023 12:02:52 +0200 Subject: [PATCH 276/311] hotFix(route_tickets): orderBy nickname --- modules/route/front/tickets/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index ea6755cca..46b62c5ba 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -58,7 +58,7 @@ Street City PC - Client + Client Warehouse Packages @@ -100,9 +100,9 @@ {{::ticket.street}} - From dad792cb76269af581c0664b518a4af2bf9a08c4 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 24 Aug 2023 07:40:37 +0200 Subject: [PATCH 277/311] refs #5244 move changes sql --- db/changes/{232601 => 233601}/00-aclWorker.sql | 0 db/changes/{232601 => 233601}/00-department.sql | 0 front/core/components/worker-autocomplete/index.js | 2 +- front/core/lib/event-emitter.js | 1 + modules/worker/back/methods/worker/search.js | 4 ++-- 5 files changed, 4 insertions(+), 3 deletions(-) rename db/changes/{232601 => 233601}/00-aclWorker.sql (100%) rename db/changes/{232601 => 233601}/00-department.sql (100%) diff --git a/db/changes/232601/00-aclWorker.sql b/db/changes/233601/00-aclWorker.sql similarity index 100% rename from db/changes/232601/00-aclWorker.sql rename to db/changes/233601/00-aclWorker.sql diff --git a/db/changes/232601/00-department.sql b/db/changes/233601/00-department.sql similarity index 100% rename from db/changes/232601/00-department.sql rename to db/changes/233601/00-department.sql diff --git a/front/core/components/worker-autocomplete/index.js b/front/core/components/worker-autocomplete/index.js index 24cc02797..70ca69e6e 100755 --- a/front/core/components/worker-autocomplete/index.js +++ b/front/core/components/worker-autocomplete/index.js @@ -16,7 +16,7 @@ export default class WorkerAutocomplete extends Autocomplete { } Object.assign(this, { label: 'Worker', - url: url, + url, searchFunction: function({$search}) { return {and: [ {'active': {neq: false}}, diff --git a/front/core/lib/event-emitter.js b/front/core/lib/event-emitter.js index 0e0ce1872..83e361253 100644 --- a/front/core/lib/event-emitter.js +++ b/front/core/lib/event-emitter.js @@ -83,3 +83,4 @@ export default class EventEmitter { } } } +EventEmitter.$inject = ['$element', '$scope']; diff --git a/modules/worker/back/methods/worker/search.js b/modules/worker/back/methods/worker/search.js index 50fe71235..cd0a466ea 100644 --- a/modules/worker/back/methods/worker/search.js +++ b/modules/worker/back/methods/worker/search.js @@ -3,11 +3,11 @@ const mergeFilters = require('vn-loopback/util/filter').mergeFilters; module.exports = Self => { Self.remoteMethodCtx('search', { - description: 'Returns an array of search from an specified worker', + description: 'Returns an array of search results for a specified worker', accepts: [{ arg: 'filter', type: 'object', - description: 'Filter defining where and paginated data', + description: 'Filter to define conditions and paginate the data.', required: true }, { From 470f511b3048b8bedebc18085afd148f73038668 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 24 Aug 2023 08:05:27 +0200 Subject: [PATCH 278/311] refs #5881 createRolAndGrantAcl --- db/changes/233601/00-createClaimReader.sql | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 db/changes/233601/00-createClaimReader.sql diff --git a/db/changes/233601/00-createClaimReader.sql b/db/changes/233601/00-createClaimReader.sql new file mode 100644 index 000000000..10ab03d29 --- /dev/null +++ b/db/changes/233601/00-createClaimReader.sql @@ -0,0 +1,33 @@ +INSERT INTO `account`.`role` (`id`, `name`, `description`, `hasLogin`) + VALUES (122, 'claimViewer','Trabajadores que consulta las reclamaciones ',1); + +INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) + VALUES (35, 122); +INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) + VALUES (18, 122); +INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) + VALUES (41, 122); +INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) + VALUES (57, 122); + +DELETE FROM `salix`.`ACL` + WHERE `model`= 'claim' + AND `property` = 'filter'; +DELETE FROM `salix`.`ACL` + WHERE `model`= 'claim' + AND `property` = 'find'; +DELETE FROM `salix`.`ACL` + WHERE `model`= 'claim' + AND `property` = 'findById'; +DELETE FROM `salix`.`ACL` + WHERE `model`= 'claim' + AND `property` = 'getSummary'; + +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) + VALUES ('Claim','filter','READ','ALLOW','ROLE','claimViewer'); +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) + VALUES ('Claim','find','READ','ALLOW','ROLE','claimViewer'); +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) + VALUES ('Claim','findById','READ','ALLOW','ROLE','claimViewer'); +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) + VALUES ('Claim','getSummary','READ','ALLOW','ROLE','claimViewer'); From beeebbdf9c7522e7f9eaf1519001e815780ba313 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 24 Aug 2023 09:33:58 +0200 Subject: [PATCH 279/311] =?UTF-8?q?refs=20#6013=20refactor:=20siempre=20se?= =?UTF-8?q?=20crea=20una=20tranacci=C3=B3n=20para=20cada=20dia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../back/methods/worker-time-control/sendMail.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/worker/back/methods/worker-time-control/sendMail.js b/modules/worker/back/methods/worker-time-control/sendMail.js index 4988d1f46..66fb7cc23 100644 --- a/modules/worker/back/methods/worker-time-control/sendMail.js +++ b/modules/worker/back/methods/worker-time-control/sendMail.js @@ -180,10 +180,8 @@ module.exports = Self => { const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions); for (let day of days[index]) { - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; try { workerFk = day.workerFk; if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null @@ -368,10 +366,7 @@ module.exports = Self => { previousReceiver = day.receiver; } - if (tx) { - await tx.commit(); - delete myOptions.transaction; - } + if (tx) await tx.commit(); } catch (e) { const stmts = []; let stmt; @@ -394,7 +389,6 @@ module.exports = Self => { previousReceiver = day.receiver; if (tx) await tx.rollback(); - delete myOptions.transaction; continue; } From bda39374178e10aac5f3c0413629b707e228709d Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 24 Aug 2023 10:01:07 +0200 Subject: [PATCH 280/311] refs #5216 path replaced and test created --- .../expedition-state/addExpeditionState.js | 23 +++--- .../specs/addExpeditionState.spec.js | 75 +++++++++++++++++++ 2 files changed, 88 insertions(+), 10 deletions(-) create mode 100644 modules/ticket/back/methods/expedition-state/specs/addExpeditionState.spec.js diff --git a/modules/ticket/back/methods/expedition-state/addExpeditionState.js b/modules/ticket/back/methods/expedition-state/addExpeditionState.js index 16b7a4c75..cc70cbb8d 100644 --- a/modules/ticket/back/methods/expedition-state/addExpeditionState.js +++ b/modules/ticket/back/methods/expedition-state/addExpeditionState.js @@ -5,10 +5,7 @@ module.exports = Self => { accepts: [ { arg: 'expeditions', - type: [{ - expeditionFk: 'number', - stateCode: 'string', - }], + type: ['object'], required: true, description: 'Array of objects containing expeditionFk and stateCode' } @@ -18,7 +15,7 @@ module.exports = Self => { root: true }, http: { - path: `/addState`, + path: `/addExpeditionState`, verb: 'post' } }); @@ -44,11 +41,18 @@ module.exports = Self => { where: {code: expedition.stateCode} } ); - - if (!expeditionStateType.id) - throw new Error(`The state code '${expedition.stateCode}' does not exist.`); + if (!expeditionStateType) + throw new Error(`The state code: ${expedition.stateCode} does not exist.`); const typeFk = expeditionStateType.id; + + const existsExpedition = await models.Expedition.findOne({ + fields: ['id'], + where: {id: expedition.expeditionFk} + }); + if (!existsExpedition) + throw new Error(`The expedition with id: ${expedition.expeditionFk} does not exist.`); + const newExpeditionState = models.ExpeditionState.create({ expeditionFk: expedition.expeditionFk, typeFk, @@ -59,10 +63,9 @@ module.exports = Self => { await Promise.all(promises); if (tx) await tx.commit(); - return true; } catch (e) { if (tx) await tx.rollback(); - return false; + throw e; } }; }; diff --git a/modules/ticket/back/methods/expedition-state/specs/addExpeditionState.spec.js b/modules/ticket/back/methods/expedition-state/specs/addExpeditionState.spec.js new file mode 100644 index 000000000..c9c40ccd9 --- /dev/null +++ b/modules/ticket/back/methods/expedition-state/specs/addExpeditionState.spec.js @@ -0,0 +1,75 @@ +const models = require('vn-loopback/server/server').models; + +describe('expeditionState addExpeditionState()', () => { + it('should update the expedition states', async() => { + const tx = await models.ExpeditionState.beginTransaction({}); + + try { + const options = {transaction: tx}; + const payload = [ + { + expeditionFk: 5, + stateCode: 'ON DELIVERY' + }, + ]; + + await models.ExpeditionState.addExpeditionState(payload, options); + + const expeditionState = await models.ExpeditionState.findOne({ + where: {id: 5} + }); + + expect(expeditionState.typeFk).toEqual(1); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should throw an error an error when an stateCode does not exist', async() => { + const tx = await models.ExpeditionState.beginTransaction({}); + let error; + + try { + const options = {transaction: tx}; + const payload = [ + { + expeditionFk: 2, + stateCode: 'DUMMY' + } + ]; + await models.ExpeditionState.addExpeditionState(payload, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toContain('The state code: DUMMY does not exist.'); + }); + + it('should throw an error when expeditionFk does not exist', async() => { + const tx = await models.ExpeditionState.beginTransaction({}); + let error; + try { + const options = {transaction: tx}; + const payload = [ + { + expeditionFk: 50, + stateCode: 'LOST' + } + ]; + + await models.ExpeditionState.addExpeditionState(payload, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toContain('The expedition with id: 50 does not exist.'); + }); +}); From 3694fcbbfb6c24d17538b0323efa764764e35c77 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 24 Aug 2023 10:04:32 +0200 Subject: [PATCH 281/311] refs #5881 fixCreateRol --- db/changes/233601/00-createClaimReader.sql | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/db/changes/233601/00-createClaimReader.sql b/db/changes/233601/00-createClaimReader.sql index 10ab03d29..b1accf329 100644 --- a/db/changes/233601/00-createClaimReader.sql +++ b/db/changes/233601/00-createClaimReader.sql @@ -1,33 +1,33 @@ INSERT INTO `account`.`role` (`id`, `name`, `description`, `hasLogin`) - VALUES (122, 'claimViewer','Trabajadores que consulta las reclamaciones ',1); + VALUES ('claimViewer','Trabajadores que consulta las reclamaciones ',1); INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) - VALUES (35, 122); -INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) - VALUES (18, 122); -INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) - VALUES (41, 122); -INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) - VALUES (57, 122); + SELECT `r`.`id`, `r2`.`id` + FROM `account`.`role` `r` + JOIN `account`.`role` `r2` ON `r2`.`name` = 'claimViewer' + WHERE `r`.`name` IN ( + 'salesPerson', + 'buyer', + 'deliveryBoss', + 'handmadeBoss' + ) DELETE FROM `salix`.`ACL` WHERE `model`= 'claim' - AND `property` = 'filter'; -DELETE FROM `salix`.`ACL` - WHERE `model`= 'claim' - AND `property` = 'find'; -DELETE FROM `salix`.`ACL` - WHERE `model`= 'claim' - AND `property` = 'findById'; -DELETE FROM `salix`.`ACL` - WHERE `model`= 'claim' - AND `property` = 'getSummary'; + AND `property` IN ( + 'filter', + 'find', + 'findById', + 'getSummary' + ); INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) - VALUES ('Claim','filter','READ','ALLOW','ROLE','claimViewer'); -INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) - VALUES ('Claim','find','READ','ALLOW','ROLE','claimViewer'); -INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) - VALUES ('Claim','findById','READ','ALLOW','ROLE','claimViewer'); -INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) - VALUES ('Claim','getSummary','READ','ALLOW','ROLE','claimViewer'); + SELECT 'Claim',`property`,'READ','ALLOW','ROLE','claimViewer' + FROM `salix`.`ACL` + WHERE `property` IN ( + 'filter', + 'find', + 'findById', + 'getSummary' + ) + GROUP BY `property`; From b5b7770f3f19cbea1d63d5806cd790bfeeb48ede Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 24 Aug 2023 10:41:28 +0200 Subject: [PATCH 282/311] refs #6146 fixes: muestra la agencia de la ruta --- .../back/methods/route/getSuggestedTickets.js | 19 +++++++++++++++++-- modules/route/front/ticket-popup/index.html | 12 ++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/modules/route/back/methods/route/getSuggestedTickets.js b/modules/route/back/methods/route/getSuggestedTickets.js index c1a9c7cae..e1b90d359 100644 --- a/modules/route/back/methods/route/getSuggestedTickets.js +++ b/modules/route/back/methods/route/getSuggestedTickets.js @@ -24,7 +24,14 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const route = await Self.app.models.Route.findById(id, null, myOptions); + const route = await Self.app.models.Route.findById(id, { + include: { + relation: 'agencyMode', + scope: { + fields: ['name'] + } + } + }, myOptions); const zoneAgencyModes = await Self.app.models.ZoneAgencyMode.find({ where: { @@ -35,11 +42,13 @@ module.exports = Self => { const zoneIds = []; for (let zoneAgencyMode of zoneAgencyModes) zoneIds.push(zoneAgencyMode.zoneFk); + const minDate = new Date(route.created); minDate.setHours(0, 0, 0, 0); const maxDate = new Date(route.created); maxDate.setHours(23, 59, 59, 59); + let tickets = await Self.app.models.Ticket.find({ where: { zoneFk: {inq: zoneIds}, @@ -80,6 +89,12 @@ module.exports = Self => { ] }, myOptions); - return tickets; + return tickets.map(ticket => { + const simpleTicket = ticket.toJSON(); + return { + ...simpleTicket, + agencyName: route.agencyMode().name + }; + }); }; }; diff --git a/modules/route/front/ticket-popup/index.html b/modules/route/front/ticket-popup/index.html index 99e3364b8..5046d5e43 100644 --- a/modules/route/front/ticket-popup/index.html +++ b/modules/route/front/ticket-popup/index.html @@ -19,17 +19,17 @@ - Ticket Client Province - + - Population - + Population + PC Address @@ -39,7 +39,7 @@ - @@ -62,7 +62,7 @@ From c5006b6be685b23a96f1917f215f2c812385e03b Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 24 Aug 2023 11:31:12 +0200 Subject: [PATCH 283/311] refs #5881 insertAcl --- db/changes/233601/00-createClaimReader.sql | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/db/changes/233601/00-createClaimReader.sql b/db/changes/233601/00-createClaimReader.sql index b1accf329..666bf232e 100644 --- a/db/changes/233601/00-createClaimReader.sql +++ b/db/changes/233601/00-createClaimReader.sql @@ -22,12 +22,11 @@ DELETE FROM `salix`.`ACL` ); INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) - SELECT 'Claim',`property`,'READ','ALLOW','ROLE','claimViewer' - FROM `salix`.`ACL` - WHERE `property` IN ( - 'filter', - 'find', - 'findById', - 'getSummary' - ) - GROUP BY `property`; + VALUES ('Claim','filter','READ','ALLOW','ROLE','claimViewer'); +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) + VALUES ('Claim','find','READ','ALLOW','ROLE','claimViewer'); +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) + VALUES ('Claim','findById','READ','ALLOW','ROLE','claimViewer'); +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) + VALUES ('Claim','getSummary','READ','ALLOW','ROLE','claimViewer'); + From 4c1d9cd7679242392237b511efd5171ee892c346 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 24 Aug 2023 11:32:20 +0200 Subject: [PATCH 284/311] hotFix(priceDifference): import UserError --- modules/ticket/back/methods/ticket/priceDifference.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js index 495e9e1aa..7dc85bd3d 100644 --- a/modules/ticket/back/methods/ticket/priceDifference.js +++ b/modules/ticket/back/methods/ticket/priceDifference.js @@ -1,3 +1,5 @@ +const UserError = require('vn-loopback/util/user-error'); + module.exports = Self => { Self.remoteMethodCtx('priceDifference', { description: 'Returns sales with price difference if the ticket is editable', From 386de69bceb91c9fc6adeea666cf2b842fd31c96 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 24 Aug 2023 12:47:10 +0200 Subject: [PATCH 285/311] refs #5216 fix error handling --- .../00-addExpeditionState.sql | 0 .../expedition-state/addExpeditionState.js | 25 ++++++++----------- .../specs/addExpeditionState.spec.js | 6 ++--- 3 files changed, 13 insertions(+), 18 deletions(-) rename db/changes/{233201 => 233601}/00-addExpeditionState.sql (100%) diff --git a/db/changes/233201/00-addExpeditionState.sql b/db/changes/233601/00-addExpeditionState.sql similarity index 100% rename from db/changes/233201/00-addExpeditionState.sql rename to db/changes/233601/00-addExpeditionState.sql diff --git a/modules/ticket/back/methods/expedition-state/addExpeditionState.js b/modules/ticket/back/methods/expedition-state/addExpeditionState.js index cc70cbb8d..e82d279b0 100644 --- a/modules/ticket/back/methods/expedition-state/addExpeditionState.js +++ b/modules/ticket/back/methods/expedition-state/addExpeditionState.js @@ -1,3 +1,5 @@ +const UserError = require('vn-loopback/util/user-error'); + module.exports = Self => { Self.remoteMethod('addExpeditionState', { description: 'Update an expedition state', @@ -31,8 +33,7 @@ module.exports = Self => { tx = await Self.beginTransaction({}); myOptions.transaction = tx; } - - const promises = []; + let expeditionId; try { for (const expedition of expeditions) { const expeditionStateType = await models.ExpeditionStateType.findOne( @@ -42,30 +43,24 @@ module.exports = Self => { } ); if (!expeditionStateType) - throw new Error(`The state code: ${expedition.stateCode} does not exist.`); + throw new UserError(`Invalid state code: ${expedition.stateCode}.`); const typeFk = expeditionStateType.id; + expeditionId = expedition.expeditionFk; - const existsExpedition = await models.Expedition.findOne({ - fields: ['id'], - where: {id: expedition.expeditionFk} - }); - if (!existsExpedition) - throw new Error(`The expedition with id: ${expedition.expeditionFk} does not exist.`); - - const newExpeditionState = models.ExpeditionState.create({ + await models.ExpeditionState.create({ expeditionFk: expedition.expeditionFk, typeFk, }); - promises.push(newExpeditionState); } - await Promise.all(promises); - if (tx) await tx.commit(); } catch (e) { if (tx) await tx.rollback(); - throw e; + if (e instanceof UserError) + throw e; + + throw new UserError(`Invalid expedition id: ${expeditionId}.`); } }; }; diff --git a/modules/ticket/back/methods/expedition-state/specs/addExpeditionState.spec.js b/modules/ticket/back/methods/expedition-state/specs/addExpeditionState.spec.js index c9c40ccd9..819a43a60 100644 --- a/modules/ticket/back/methods/expedition-state/specs/addExpeditionState.spec.js +++ b/modules/ticket/back/methods/expedition-state/specs/addExpeditionState.spec.js @@ -8,7 +8,7 @@ describe('expeditionState addExpeditionState()', () => { const options = {transaction: tx}; const payload = [ { - expeditionFk: 5, + expeditionFk: 8, stateCode: 'ON DELIVERY' }, ]; @@ -47,7 +47,7 @@ describe('expeditionState addExpeditionState()', () => { await tx.rollback(); } - expect(error.message).toContain('The state code: DUMMY does not exist.'); + expect(error.message).toContain('Invalid state code: DUMMY.'); }); it('should throw an error when expeditionFk does not exist', async() => { @@ -70,6 +70,6 @@ describe('expeditionState addExpeditionState()', () => { await tx.rollback(); } - expect(error.message).toContain('The expedition with id: 50 does not exist.'); + expect(error.message).toContain('Invalid expedition id: 50.'); }); }); From 7e0865e4b7feb0d1fe7f20b5e726c07c14cdeddd Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 25 Aug 2023 08:01:11 +0200 Subject: [PATCH 286/311] refs #5941 feat(sendToSupport): don't show the button if it doesn't have token --- front/core/components/snackbar/snackbar.js | 2 +- front/core/components/support-dialog/index.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/front/core/components/snackbar/snackbar.js b/front/core/components/snackbar/snackbar.js index 7f4583188..b380c47c3 100644 --- a/front/core/components/snackbar/snackbar.js +++ b/front/core/components/snackbar/snackbar.js @@ -27,7 +27,7 @@ export default class Controller extends Component { setTimeout(() => element.classList.add('shown'), 30); shape.element = element; - if (data.additionalData) { + if (data.additionalData && this.vnToken.token) { this.additionalData = data.additionalData; let supportButton = document.createElement('i'); supportButton.setAttribute('class', 'material-icons clickable'); diff --git a/front/core/components/support-dialog/index.js b/front/core/components/support-dialog/index.js index eaaab047f..d15c14b4a 100644 --- a/front/core/components/support-dialog/index.js +++ b/front/core/components/support-dialog/index.js @@ -7,12 +7,15 @@ export default class Controller extends Dialog { } responseHandler(response) { + if (response !== 'accept') + return super.responseHandler(response); + this.$http.post('Ostickets/send-to-support', { reason: this.reason, additionalData: this.additionalData }) - .then(() => super.responseHandler(response)) - .then(() => this.vnApp.showSuccess(this.$t('Email sended!'))); + .then(() => super.responseHandler(response)) + .then(() => this.vnApp.showSuccess(this.$t('Email sended!'))); } } From f54a23922904e7afba8b5b69aff839769de337ff Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 25 Aug 2023 09:46:53 +0200 Subject: [PATCH 287/311] fixes #6143 fixes: this.bankEntityFk no existe --- loopback/util/specs/validateIban.spec.js | 44 ++++++++++++++----- modules/client/back/models/client.js | 3 ++ .../supplier/back/models/supplier-account.js | 3 ++ 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/loopback/util/specs/validateIban.spec.js b/loopback/util/specs/validateIban.spec.js index a5d08d4c4..dd096c1b5 100644 --- a/loopback/util/specs/validateIban.spec.js +++ b/loopback/util/specs/validateIban.spec.js @@ -1,21 +1,45 @@ const validateIban = require('../validateIban'); describe('IBAN validation', () => { - it('should return false for non-IBAN input', () => { - let isValid = validateIban('Pepinillos'); + it('should return false for invalid Spanish IBAN format', () => { + let isValid = validateIban('ES00 9999 0000 9999 0000 9999', 'ES'); expect(isValid).toBeFalsy(); }); - it('should return false for invalid spanish IBAN input', () => { - let isValid = validateIban('ES00 9999 0000 9999 0000 9999'); - - expect(isValid).toBeFalsy(); - }); - - it('should return true for valid spanish IBAN', () => { - let isValid = validateIban('ES91 2100 0418 4502 0005 1332'); + it('should return true for valid Spanish IBAN', () => { + let isValid = validateIban('ES91 2100 0418 4502 0005 1332', 'ES'); expect(isValid).toBeTruthy(); }); + + it('should return false for invalid Spanish IBAN with incorrect length', () => { + let isValid = validateIban('ES91210004184502000513', 'ES'); + + expect(isValid).toBeFalsy(); + }); + + it('should return false for invalid Spanish IBAN with incorrect module97 result', () => { + let isValid = validateIban('ES9121000418450200051331', 'ES'); + + expect(isValid).toBeFalsy(); + }); + + it('should return true for a non-Spanish countryCode', () => { + let isValid = validateIban('DE89370400440532013000', 'AT'); + + expect(isValid).toBeTruthy(); + }); + + it('should return true for null IBAN', () => { + let isValid = validateIban(null, 'ES'); + + expect(isValid).toBeTruthy(); + }); + + it('should return false for non-string IBAN', () => { + let isValid = validateIban(12345, 'ES'); + + expect(isValid).toBeFalsy(); + }); }); diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index bdf2f91b5..8e720484f 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -90,6 +90,9 @@ module.exports = Self => { }); async function ibanNeedsValidation(err, done) { + if (!this.bankEntityFk) + return done(); + const bankEntity = await Self.app.models.BankEntity.findById(this.bankEntityFk); const filter = { fields: ['code'], diff --git a/modules/supplier/back/models/supplier-account.js b/modules/supplier/back/models/supplier-account.js index 7a9e14421..691e72580 100644 --- a/modules/supplier/back/models/supplier-account.js +++ b/modules/supplier/back/models/supplier-account.js @@ -7,6 +7,9 @@ module.exports = Self => { }); async function ibanValidation(err, done) { + if (!this.bankEntityFk) + return done(); + const bankEntity = await Self.app.models.BankEntity.findById(this.bankEntityFk); const filter = { fields: ['code'], From ca28d2d78f662ae7b8da8c87d2a848d20f8ef115 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 25 Aug 2023 14:37:32 +0200 Subject: [PATCH 288/311] ref #5216 myOptions added --- .../back/methods/expedition-state/addExpeditionState.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/expedition-state/addExpeditionState.js b/modules/ticket/back/methods/expedition-state/addExpeditionState.js index e82d279b0..f1199f188 100644 --- a/modules/ticket/back/methods/expedition-state/addExpeditionState.js +++ b/modules/ticket/back/methods/expedition-state/addExpeditionState.js @@ -40,7 +40,7 @@ module.exports = Self => { { fields: ['id'], where: {code: expedition.stateCode} - } + }, myOptions ); if (!expeditionStateType) throw new UserError(`Invalid state code: ${expedition.stateCode}.`); @@ -51,7 +51,7 @@ module.exports = Self => { await models.ExpeditionState.create({ expeditionFk: expedition.expeditionFk, typeFk, - }); + }, myOptions); } if (tx) await tx.commit(); From de8aba289a39895354938c0dab594f5085ca09a1 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 28 Aug 2023 10:36:29 +0200 Subject: [PATCH 289/311] refs #5991 Deleted view currentWorkersStats --- db/export-structure.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/db/export-structure.sh b/db/export-structure.sh index a6888f2ac..0fb413a97 100755 --- a/db/export-structure.sh +++ b/db/export-structure.sh @@ -23,7 +23,6 @@ IGNORETABLES=( --ignore-table=bs.productionIndicators --ignore-table=bs.VentasPorCliente --ignore-table=bs.v_ventas - --ignore-table=postgresql.currentWorkersStats --ignore-table=vn.accounting__ --ignore-table=vn.agencyModeZone --ignore-table=vn.agencyProvince From 7848634bff0e605674d52927a44431474d071a58 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 28 Aug 2023 11:51:25 +0200 Subject: [PATCH 290/311] refs #5300 Deleted postgresql dependences --- db/export-data.sh | 7 ------- db/export-structure.sh | 1 - 2 files changed, 8 deletions(-) diff --git a/db/export-data.sh b/db/export-data.sh index 59edf6ebc..7d346b235 100755 --- a/db/export-data.sh +++ b/db/export-data.sh @@ -97,13 +97,6 @@ TABLES=( ) dump_tables ${TABLES[@]} -TABLES=( - postgresql - labour_agreement - media_type -) -dump_tables ${TABLES[@]} - TABLES=( sage TiposIva diff --git a/db/export-structure.sh b/db/export-structure.sh index 0fb413a97..4ecbfa7e8 100755 --- a/db/export-structure.sh +++ b/db/export-structure.sh @@ -7,7 +7,6 @@ SCHEMAS=( edi hedera pbx - postgresql sage salix stock From 4d802182f56528710d6e5044ad7331b846d3dbbd Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 28 Aug 2023 11:59:45 +0200 Subject: [PATCH 291/311] refs #5300 calendar_employee depend. (refs #5378) --- db/tests/vn/workerTimeControlCheck.spec.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/db/tests/vn/workerTimeControlCheck.spec.js b/db/tests/vn/workerTimeControlCheck.spec.js index 9140628e6..65f5db129 100644 --- a/db/tests/vn/workerTimeControlCheck.spec.js +++ b/db/tests/vn/workerTimeControlCheck.spec.js @@ -239,12 +239,6 @@ xdescribe('worker workerTimeControl_check()', () => { stmts.push('START TRANSACTION'); - stmt = new ParameterizedSQL(`INSERT INTO postgresql.calendar_employee(businessFk,calendar_state_id,date) - VALUES - (?,1,CURDATE())`, [ - workerId - ]); - stmts.push(stmt); stmt = new ParameterizedSQL(`INSERT INTO vn.workerTimeControl(userFk,timed,manual,direction) VALUES (?,TIMESTAMPADD(HOUR,-24,NOW()),0,"in"), From f38ff9ef9cffe2c6b352aab5b086a589a6d2fb90 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 28 Aug 2023 12:00:35 +0200 Subject: [PATCH 292/311] refs #5300 calendar_employee depend. (refs #5378) --- db/tests/vn/workerTimeControlCheck.spec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/db/tests/vn/workerTimeControlCheck.spec.js b/db/tests/vn/workerTimeControlCheck.spec.js index 65f5db129..0ca1429d4 100644 --- a/db/tests/vn/workerTimeControlCheck.spec.js +++ b/db/tests/vn/workerTimeControlCheck.spec.js @@ -54,7 +54,6 @@ xdescribe('worker workerTimeControl_check()', () => { }); it('should throw an error if the worker with a special category has not finished the 9h break', async() => { - // dayBreak to 9h in postgresql.professional_category const workerId = 1110; const tabletId = 1; let stmts = []; @@ -91,7 +90,6 @@ xdescribe('worker workerTimeControl_check()', () => { }); it('should check f the worker with a special category has finished the 9h break', async() => { - // dayBreak to 9h in postgresql.professional_category const workerId = 1110; const tabletId = 1; let stmts = []; From fea0db14e2b1d135a84d81ea33a43fa83a4dfc3e Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 30 Aug 2023 13:35:51 +0200 Subject: [PATCH 293/311] fixes #6169 invoiceIn con valores predeterminados --- modules/invoiceIn/front/basic-data/index.js | 27 ++++++++++++-------- modules/invoiceIn/front/create/index.js | 1 + modules/invoiceIn/front/create/index.spec.js | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/invoiceIn/front/basic-data/index.js b/modules/invoiceIn/front/basic-data/index.js index 8747fc4f2..246f1b16f 100644 --- a/modules/invoiceIn/front/basic-data/index.js +++ b/modules/invoiceIn/front/basic-data/index.js @@ -67,17 +67,22 @@ class Controller extends Section { } openCreateDialog() { - this.dms = { - reference: null, - warehouseId: null, - companyId: null, - dmsTypeId: null, - description: null, - hasFile: true, - hasFileAttached: true, - files: null - }; - this.$.dmsCreateDialog.show(); + const params = {filter: { + where: {code: 'invoiceIn'} + }}; + this.$http.get('DmsTypes/findOne', {params}).then(res => { + this.dms = { + reference: this.invoiceIn.supplierRef, + warehouseId: this.vnConfig.warehouseFk, + companyId: this.vnConfig.companyFk, + dmsTypeId: res.data.id, + description: this.invoiceIn.supplier.name, + hasFile: true, + hasFileAttached: true, + files: null + }; + this.$.dmsCreateDialog.show(); + }); } downloadFile(dmsId) { diff --git a/modules/invoiceIn/front/create/index.js b/modules/invoiceIn/front/create/index.js index 186f5d478..885d55359 100644 --- a/modules/invoiceIn/front/create/index.js +++ b/modules/invoiceIn/front/create/index.js @@ -6,6 +6,7 @@ class Controller extends Section { this.invoiceIn = {}; if (this.$params && this.$params.supplierFk) this.invoiceIn.supplierFk = this.$params.supplierFk; + this.invoiceIn.issued = Date.vnNew(); } get companyFk() { diff --git a/modules/invoiceIn/front/create/index.spec.js b/modules/invoiceIn/front/create/index.spec.js index 93109346c..1b6c903ce 100644 --- a/modules/invoiceIn/front/create/index.spec.js +++ b/modules/invoiceIn/front/create/index.spec.js @@ -26,7 +26,7 @@ describe('InvoiceIn', () => { controller.$onInit(); - expect(controller.invoiceIn).toEqual({}); + expect(controller.invoiceIn).toBeDefined(); }); it(`should define invoiceIn and it's supplierFk when received via params`, () => { From 30c863722cf5d40f28cd7dc6e8fa2c5adde3e4c4 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 30 Aug 2023 14:14:20 +0200 Subject: [PATCH 294/311] fixes #6169 no se necesita tests --- modules/invoiceIn/front/create/index.spec.js | 52 -------------------- 1 file changed, 52 deletions(-) delete mode 100644 modules/invoiceIn/front/create/index.spec.js diff --git a/modules/invoiceIn/front/create/index.spec.js b/modules/invoiceIn/front/create/index.spec.js deleted file mode 100644 index 1b6c903ce..000000000 --- a/modules/invoiceIn/front/create/index.spec.js +++ /dev/null @@ -1,52 +0,0 @@ -import './index.js'; -import watcher from 'core/mocks/watcher'; - -describe('InvoiceIn', () => { - describe('Component vnInvoiceInCreate', () => { - let controller; - let $element; - - beforeEach(ngModule('invoiceIn')); - - beforeEach(inject(($componentController, $rootScope) => { - const $scope = $rootScope.$new(); - $scope.watcher = watcher; - $element = angular.element(''); - controller = $componentController('vnInvoiceInCreate', {$element, $scope}); - controller.$params = {}; - })); - - afterEach(() => { - $element.remove(); - }); - - describe('onInit()', () => { - it(`should defined the controller's invoiceIn property`, () => { - expect(controller.invoiceIn).toBeUndefined(); - - controller.$onInit(); - - expect(controller.invoiceIn).toBeDefined(); - }); - - it(`should define invoiceIn and it's supplierFk when received via params`, () => { - controller.$params.supplierFk = 'supplierId'; - - controller.$onInit(); - - expect(controller.invoiceIn.supplierFk).toEqual('supplierId'); - }); - }); - - describe('onSubmit()', () => { - it(`should redirect to basic data by calling the $state.go function`, () => { - jest.spyOn(controller.$state, 'go'); - - controller.onSubmit(); - - expect(controller.$state.go).toHaveBeenCalledWith('invoiceIn.card.basicData', {id: 1234}); - }); - }); - }); -}); - From e498bba37b223dbf9b262bd7503bfd47e5f94871 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 31 Aug 2023 08:41:19 +0200 Subject: [PATCH 295/311] initial dump --- db/dump/dumpedFixtures.sql | 112 +- db/dump/structure.sql | 20878 ++++++++++++++++++----------------- 2 files changed, 10564 insertions(+), 10426 deletions(-) diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index be4828c2d..2e1511b59 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -1,8 +1,8 @@ USE `util`; --- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db1.static.verdnatura.es Database: util +-- Host: db2.static.verdnatura.es Database: util -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -22,7 +22,7 @@ USE `util`; LOCK TABLES `config` WRITE; /*!40000 ALTER TABLE `config` DISABLE KEYS */; -INSERT INTO `config` VALUES (1,'232401',0,'production',NULL,'2001-01-01 11:00:00',NULL,0); +INSERT INTO `config` VALUES (1,'233401',0,'production',NULL,'2001-01-01 11:00:00',NULL,0); /*!40000 ALTER TABLE `config` ENABLE KEYS */; UNLOCK TABLES; @@ -32,7 +32,7 @@ UNLOCK TABLES; LOCK TABLES `version` WRITE; /*!40000 ALTER TABLE `version` DISABLE KEYS */; -INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10649','4a8ae703b8ce8219887432ad1d1677a44e0cbdd8','2023-06-22 10:03:04','10654'); +INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10714','aeb89a7b54f62398ddbcf3a48c8d387f275fee47','2023-08-29 12:49:52','10716'); /*!40000 ALTER TABLE `version` ENABLE KEYS */; UNLOCK TABLES; @@ -42,7 +42,7 @@ UNLOCK TABLES; LOCK TABLES `versionLog` WRITE; /*!40000 ALTER TABLE `versionLog` DISABLE KEYS */; -INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL),('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL),('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL),('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL),('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL),('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL),('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL),('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL),('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL),('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL),('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL),('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL),('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL),('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL),('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL),('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL),('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL),('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL),('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL),('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL),('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL),('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL),('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL),('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL),('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL),('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL),('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL),('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL),('vn-database','10093','00-autoradioConfig.sql','jenkins@10.0.2.69','2022-05-03 09:16:47',NULL,NULL),('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL),('vn-database','10097','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL),('vn-database','10103','00-awbVolume.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10104','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10105','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL),('vn-database','10113','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10114','00-updateConfig.sql','jenkins@10.0.2.69','2022-04-27 13:37:25',NULL,NULL),('vn-database','10116','00-firstScript.sql','jenkins@10.0.2.69','2022-04-28 11:10:14',NULL,NULL),('vn-database','10118','00-firstScript.sql','jenkins@10.0.2.69','2022-04-29 08:10:15',NULL,NULL),('vn-database','10119','00-AfegirFKPart1.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10119','01-AfegirFkPart2.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10125','00-firstScript.sql','jenkins@10.0.2.68','2022-05-18 18:44:30',NULL,NULL),('vn-database','10127','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 11:04:46',NULL,NULL),('vn-database','10128','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 13:04:31',NULL,NULL),('vn-database','10129','00-firstScript.sql','jenkins@10.0.2.69','2022-05-03 08:21:01',NULL,NULL),('vn-database','10132','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10133','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 14:32:30',NULL,NULL),('vn-database','10134','00-firstScript.sql','jenkins@10.0.2.69','2022-05-06 07:45:25',NULL,NULL),('vn-database','10135','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10136','00-workerTimeControl.sql','jenkins@10.0.2.69','2022-05-09 13:51:12',NULL,NULL),('vn-database','10138','00-firstScript.sql','jenkins@10.0.2.69','2022-05-10 13:58:05',NULL,NULL),('vn-database','10139','00-firstScript.sql','jenkins@10.0.2.68','2022-05-16 14:32:37',NULL,NULL),('vn-database','10139','01-secondScript.sql','jenkins@10.0.2.68','2022-05-17 12:16:13',NULL,NULL),('vn-database','10141','00-firstScript.sql','jenkins@10.0.2.70','2022-05-12 08:27:31',NULL,NULL),('vn-database','10142','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10143','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10144','00-AfegirFKPArt1.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10144','00-firstScript.sql','jenkins@10.0.2.68','2022-05-13 09:44:25',NULL,NULL),('vn-database','10147','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10149','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10150','00-firstScript.sql','jenkins@10.0.2.68','2022-05-17 09:57:16',NULL,NULL),('vn-database','10152','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10153','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10154','00-compressionKk.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10157','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:35',NULL,NULL),('vn-database','10158','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10160','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:30:50',NULL,NULL),('vn-database','10163','00-firstScript.sql','jenkins@10.0.2.68','2022-05-23 08:17:14',NULL,NULL),('vn-database','10164','00-borrarSectorsDesus.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10165','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10166','00-firstScript.sql','jenkins@10.0.2.68','2022-05-24 16:11:21',NULL,NULL),('vn-database','10167','00-renameVnActiveContrat.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10168','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','00-createTableBankEntityConfig.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','02-addNotNullToBankEntityBic.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10171','00-volumeConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 14:11:11',NULL,NULL),('vn-database','10171','01-itemWeight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10171','02-agencymode.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10172','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10174','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10175','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10177','00-crearTablaSpecialLabels.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10178','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10179','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10183','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10184','00-firstScript.sql','jenkins@10.0.2.68','2022-06-03 08:05:34',NULL,NULL),('vn-database','10185','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 09:07:45',NULL,NULL),('vn-database','10186','00-desactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:31:23',NULL,NULL),('vn-database','10186','01-alter_Table_buy.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','02-alter_table_entryConfig.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','04-regularizar_Sticker_Inventario.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10186','09-reactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10187','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 12:37:31',NULL,NULL),('vn-database','10188','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 14:03:36',NULL,NULL),('vn-database','10189','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10191','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10193','00-delete.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:35',NULL,NULL),('vn-database','10193','01-botanicExport.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:43',NULL,NULL),('vn-database','10193','02-item.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-autonomy.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-turn.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','04-country.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10194','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10195','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10200','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10201','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10202','00-Remove_FK_to_ediGenus.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10203','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10204','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10205','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:21',NULL,NULL),('vn-database','10207','00-Alter_table_entry.sql','jenkins@10.0.2.69','2022-06-16 07:22:50',NULL,NULL),('vn-database','10207','01-Update_invoiceAmount.sql','jenkins@10.0.2.69','2022-06-16 07:23:00',NULL,NULL),('vn-database','10208','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10209','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 08:47:40',NULL,NULL),('vn-database','10210','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 17:39:17',1046,'Base de datos no seleccionada'),('vn-database','10211','01-firstScript.sql','jenkins@10.0.2.69','2022-06-17 07:11:27',NULL,NULL),('vn-database','10215','00-renameIsInventory.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10216','00-firstScript.sql','jenkins@10.0.2.69','2022-06-23 11:15:28',NULL,NULL),('vn-database','10216','01-batchIndex.sql','jenkins@10.0.2.70','2022-06-27 18:10:55',NULL,NULL),('vn-database','10219','00-AddCollectionFkOnPackingSite.sql','jenkins@10.0.2.70','2022-06-29 09:23:42',NULL,NULL),('vn-database','10219','01-AddFkToCollectionFk.sql','jenkins@10.0.2.70','2022-06-29 09:23:43',NULL,NULL),('vn-database','10220','00-createPersonalProtectionEquipment.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10222','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:12:40',NULL,NULL),('vn-database','10223','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:52',NULL,NULL),('vn-database','10224','00-cosetes.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-21 12:03:45',NULL,NULL),('vn-database','10229','00-firstScript.sql','jenkins@10.0.2.69','2022-07-01 11:59:34',NULL,NULL),('vn-database','10231','01-tablaEktConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:25:39',NULL,NULL),('vn-database','10233','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10235','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10236','00-firstScript.sql','jenkins@10.0.2.69','2022-07-05 12:11:40',NULL,NULL),('vn-database','10237','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10238','00-worker_mobileExtension.sql','jenkins@10.0.2.69','2022-07-14 09:14:09',NULL,NULL),('vn-database','10239','00-firstScript.sql','jenkins@10.0.2.69','2022-07-07 21:51:58',NULL,NULL),('vn-database','10241','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-29 08:14:01',NULL,NULL),('vn-database','10242','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10243','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10245','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10247','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10248','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-20 17:27:51',NULL,NULL),('vn-database','10250','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:40',NULL,NULL),('vn-database','10253','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:57',NULL,NULL),('vn-database','10254','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10256','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10258','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10259','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-02 08:54:56',NULL,NULL),('vn-database','10261','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-22 08:42:20',NULL,NULL),('vn-database','10262','00-createTablepackagingWithFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','01-alterTablePackagingConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','02-insertsInicials.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','03-createTablepackingWithoutFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10263','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10265','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10267','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10267','01-fixMerge.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10275','00-improvedGeneralLog.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 09:55:56',NULL,NULL),('vn-database','10277','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10278','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 17:51:41',NULL,NULL),('vn-database','10279','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10281','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10282','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10283','00-alterTable.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10284','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-04 16:59:08',NULL,NULL),('vn-database','10285','00-firstScript.sql','jenkins@swarm-worker3.static.verdnatura.es','2022-08-05 09:19:33',NULL,NULL),('vn-database','10287','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10288','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10289','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:36',NULL,NULL),('vn-database','10291','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-10 14:19:34',NULL,NULL),('vn-database','10293','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10297','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-16 12:43:36',NULL,NULL),('vn-database','10298','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-13 21:04:13',NULL,NULL),('vn-database','10299','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','00-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','01-drop.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','02-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','00-CreateTableEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','01-insertDataEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','02-alterTableEntry.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:22',NULL,NULL),('vn-database','10303','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:23',NULL,NULL),('vn-database','10304','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:48',NULL,NULL),('vn-database','10304','01-altertableticket.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:51',NULL,NULL),('vn-database','10305','00-ektAssign.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:24:52',NULL,NULL),('vn-database','10306','00-deliveryInformation.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:25',NULL,NULL),('vn-database','10307','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:26',NULL,NULL),('vn-database','10308','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:26:43',NULL,NULL),('vn-database','10309','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:54',NULL,NULL),('vn-database','10310','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10311','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:55',NULL,NULL),('vn-database','10312','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10313','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:27:21',NULL,NULL),('vn-database','10314','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:19',NULL,NULL),('vn-database','10315','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10317','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10318','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10319','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:41',NULL,NULL),('vn-database','10320','00-operator.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','01-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','02-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10321','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 11:11:12',NULL,NULL),('vn-database','10322','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-09 09:19:05',NULL,NULL),('vn-database','10326','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10328','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10329','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10330','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10332','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','00-collectionHotbed.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','01-saleGroupDetail.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10335','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10336','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10337','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10339','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-19 09:41:19',NULL,NULL),('vn-database','10340','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10341','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10342','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10343','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:35:30',NULL,NULL),('vn-database','10345','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10347','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10347','01-addVirtualField.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10349','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10350','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-30 10:11:56',NULL,NULL),('vn-database','10352','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10353','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10354','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10356','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','01-orderConfigFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','02-orderConfigDrop.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10357','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10359','00-improvedGeneralLog_collate.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10360','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10361','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 11:16:07',NULL,NULL),('vn-database','10362','00-dropUdfs.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-10 11:01:15',NULL,NULL),('vn-database','10363','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10365','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-13 19:30:46',NULL,NULL),('vn-database','10368','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10369','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-14 13:38:06',NULL,NULL),('vn-database','10370','00-deleteForeignKey.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:41',NULL,NULL),('vn-database','10370','01-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:47',NULL,NULL),('vn-database','10370','02-deleteTable.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','03-accion.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','04-inter.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10371','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10372','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10373','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-19 08:31:58',NULL,NULL),('vn-database','10378','00-rename_routeUserPercentage.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10379','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:16',NULL,NULL),('vn-database','10382','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10383','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10384','00-business_workcenterFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10385','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10386','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10387','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-16 14:05:33',NULL,NULL),('vn-database','10388','00-resizeUtilVerionLogCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10388','01-resizeUtilVersionCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10390','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:16',NULL,NULL),('vn-database','10391','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10394','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:24',NULL,NULL),('vn-database','10395','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10396','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 15:36:38',NULL,NULL),('vn-database','10397','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10399','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10400','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10402','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-21 14:11:31',NULL,NULL),('vn-database','10404','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10405','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:22',NULL,NULL),('vn-database','10407','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10408','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10409','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10412','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-30 12:45:44',NULL,NULL),('vn-database','10413','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10416','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10420','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:25',NULL,NULL),('vn-database','10421','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:26',NULL,NULL),('vn-database','10426','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:40',NULL,NULL),('vn-database','10428','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10431','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:22',NULL,NULL),('vn-database','10433','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10434','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10435','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-13 07:30:10',NULL,NULL),('vn-database','10436','00-createFkWorker.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:59',NULL,NULL),('vn-database','10436','01-addStateToWorkerProductivity.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','02-DeprecateVnSaleTrackingState.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','03-DeprecateColumnVnSaleTrackingActionFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','04-DropSchemaVnControl.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','05-RemoveFkWorkerProductivity.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-17 14:51:19',NULL,NULL),('vn-database','10439','00-fixRole.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:26',NULL,NULL),('vn-database','10440','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10444','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10445','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10448','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10450','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-27 08:28:04',NULL,NULL),('vn-database','10451','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-06 08:08:32',NULL,NULL),('vn-database','10452','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10453','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 14:04:37',NULL,NULL),('vn-database','10454','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10455','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10456','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:30',NULL,NULL),('vn-database','10457','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:33',NULL,NULL),('vn-database','10458','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10459','00-alterTableUtilConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','01-createFunctionCurdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','02-createFunctionMockTime.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','03-createFunctionMockTimeBase.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','04-createFunctionNow.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10460','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10461','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10463','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-03 12:59:26',NULL,NULL),('vn-database','10468','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10469','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10470','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10471','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10472','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10477','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:31',NULL,NULL),('vn-database','10478','00-dropBasket.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','01-orderConfigured.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:16',NULL,NULL),('vn-database','10478','02-configuredUpdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10478','99-privileges.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10480','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 15:09:26',NULL,NULL),('vn-database','10481','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 16:37:22',NULL,NULL),('vn-database','10482','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-21 10:00:28',NULL,NULL),('vn-database','10485','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10488','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10491','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10492','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10493','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10495','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:19',NULL,NULL),('vn-database','10498','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:38',NULL,NULL),('vn-database','10500','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 07:06:03',NULL,NULL),('vn-database','10501','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 10:52:24',NULL,NULL),('vn-database','10502','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10504','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10506','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10506','01-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','02-secondScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','03-thirdScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10507','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:35:23',NULL,NULL),('vn-database','10508','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:43',NULL,NULL),('vn-database','10510','00-dropBusinessFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','01-createTableProfessionalCategory.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','02-exportToNewTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','03-RecreateFK.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10510','04-kkPostgresqlTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10511','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10512','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:52',NULL,NULL),('vn-database','10513','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:56',NULL,NULL),('vn-database','10514','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10516','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10521','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 06:58:13',NULL,NULL),('vn-database','10522','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10523','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10525','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 12:42:50',NULL,NULL),('vn-database','10526','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:57',NULL,NULL),('vn-database','10528','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:00',NULL,NULL),('vn-database','10530','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-23 14:49:30',NULL,NULL),('vn-database','10531','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:47:10',NULL,NULL),('vn-database','10532','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:17:38',NULL,NULL),('vn-database','10533','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:04',NULL,NULL),('vn-database','10537','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-29 15:18:36',NULL,NULL),('vn-database','10538','00-createChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','01-createChronopostService.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','02-createChronopostExpedition.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','03-createChronopostSenderAddress.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','04-addgrantPrivilegies.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','05-updateChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 11:54:57',NULL,NULL),('vn-database','10539','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:07',NULL,NULL),('vn-database','10540','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10545','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-11 08:31:03',NULL,NULL),('vn-database','10546','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10547','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:21:58',NULL,NULL),('vn-database','10549','00-updateUpdateLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:29:22',NULL,NULL),('vn-database','10549','01-updateInsertLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:11',NULL,NULL),('vn-database','10549','02-updateDeleteLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:51',NULL,NULL),('vn-database','10549','03-deleteEmptyLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:31:34',NULL,NULL),('vn-database','10549','04-optimizeLogTables.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:33:58',NULL,NULL),('vn-database','10550','00-editorFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:42:33',NULL,NULL),('vn-database','10550','01-originFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10552','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-13 08:25:10',NULL,NULL),('vn-database','10554','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10557','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-17 07:45:56',NULL,NULL),('vn-database','10559','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-18 10:53:50',NULL,NULL),('vn-database','10560','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-17 09:19:31',NULL,NULL),('vn-database','10562','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10563','00-delivery_ticketFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 09:30:53',NULL,NULL),('vn-database','10566','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:08:41',NULL,NULL),('vn-database','10567','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:18:06',NULL,NULL),('vn-database','10568','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10569','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-24 09:14:35',NULL,NULL),('vn-database','10570','00-createSendingConfig.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','01-createSendingServiceWeekday.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','02-createSendingService.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','03-permisos.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10571','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10575','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-26 11:27:32',NULL,NULL),('vn-database','10577','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-27 14:00:12',NULL,NULL),('vn-database','10578','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10579','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-28 11:27:36',NULL,NULL),('vn-database','10580','00-itemTypeDropConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:18:52',NULL,NULL),('vn-database','10580','01-itemTypeAddConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:19:10',NULL,NULL),('vn-database','10581','00-itemTypeAutoIncrement.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 19:06:46',NULL,NULL),('vn-database','10582','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10583','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10584','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10585','00-ticketLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:20:10',NULL,NULL),('vn-database','10585','01-entryLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:21:12',NULL,NULL),('vn-database','10585','02-claimLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:36',NULL,NULL),('vn-database','10585','03-clientLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:54',NULL,NULL),('vn-database','10585','04-invoiceInLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:55',NULL,NULL),('vn-database','10585','05-itemLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:29:46',NULL,NULL),('vn-database','10585','06-routeLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:18',NULL,NULL),('vn-database','10585','07-shelvingLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','08-supplierLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','09-travelLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:41',NULL,NULL),('vn-database','10585','10-workerLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:42',NULL,NULL),('vn-database','10585','11-zoneLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:43',NULL,NULL),('vn-database','10585','12-userLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10585','13-roleLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10587','00-arcRead_addMinimum.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-16 13:13:15',NULL,NULL),('vn-database','10593','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10596','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10597','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10598','00-workerLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','01-supplierLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','02-workerTimeControlLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','03-workerClockLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10599','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10601','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-17 09:26:26',NULL,NULL),('vn-database','10602','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 08:52:15',NULL,NULL),('vn-database','10606','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 09:26:00',NULL,NULL),('vn-database','10608','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 12:36:31',NULL,NULL),('vn-database','10609','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 08:28:07',NULL,NULL),('vn-database','10610','00-updateCompanyId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:07',NULL,NULL),('vn-database','10610','01-updateSupplierId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:39',NULL,NULL),('vn-database','10610','02-invoiceOutCompany.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 09:49:55',NULL,NULL),('vn-database','10611','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-19 14:39:41',NULL,NULL),('vn-database','10613','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10614','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10615','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10617','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:41',NULL,NULL),('vn-database','10618','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 12:55:56',NULL,NULL),('vn-database','10619','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10624','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-30 19:01:10',NULL,NULL),('vn-database','10628','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10630','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-02 13:30:58',NULL,NULL),('vn-database','10631','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-05 08:37:25',NULL,NULL),('vn-database','10632','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10633','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10634','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-06 12:15:55',NULL,NULL),('vn-database','10637','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:19',NULL,NULL),('vn-database','10640','00-companyFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','00-updateCompany.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-07 14:22:13',1205,'Tiempo de espera de bloqueo excedido; intente rearrancar la transacción'),('vn-database','10640','01-companyFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','02-companyFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:47:04',NULL,NULL),('vn-database','10640','04-supplierFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:48:30',NULL,NULL),('vn-database','10640','05-supplierFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:53:17',NULL,NULL),('vn-database','10640','06-supplierFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 15:06:00',NULL,NULL),('vn-database','10643','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-09 15:04:35',NULL,NULL),('vn-database','10649','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-16 10:59:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL),('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL),('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL),('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL),('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL),('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL),('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL),('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL),('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL),('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL),('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL),('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL),('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL),('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL),('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL),('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL),('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL),('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL),('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL),('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL),('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL),('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL),('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL),('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL),('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL),('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL),('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL),('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL),('vn-database','10093','00-autoradioConfig.sql','jenkins@10.0.2.69','2022-05-03 09:16:47',NULL,NULL),('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL),('vn-database','10097','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL),('vn-database','10103','00-awbVolume.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10104','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10105','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL),('vn-database','10113','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10114','00-updateConfig.sql','jenkins@10.0.2.69','2022-04-27 13:37:25',NULL,NULL),('vn-database','10116','00-firstScript.sql','jenkins@10.0.2.69','2022-04-28 11:10:14',NULL,NULL),('vn-database','10118','00-firstScript.sql','jenkins@10.0.2.69','2022-04-29 08:10:15',NULL,NULL),('vn-database','10119','00-AfegirFKPart1.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10119','01-AfegirFkPart2.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10125','00-firstScript.sql','jenkins@10.0.2.68','2022-05-18 18:44:30',NULL,NULL),('vn-database','10127','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 11:04:46',NULL,NULL),('vn-database','10128','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 13:04:31',NULL,NULL),('vn-database','10129','00-firstScript.sql','jenkins@10.0.2.69','2022-05-03 08:21:01',NULL,NULL),('vn-database','10132','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10133','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 14:32:30',NULL,NULL),('vn-database','10134','00-firstScript.sql','jenkins@10.0.2.69','2022-05-06 07:45:25',NULL,NULL),('vn-database','10135','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10136','00-workerTimeControl.sql','jenkins@10.0.2.69','2022-05-09 13:51:12',NULL,NULL),('vn-database','10138','00-firstScript.sql','jenkins@10.0.2.69','2022-05-10 13:58:05',NULL,NULL),('vn-database','10139','00-firstScript.sql','jenkins@10.0.2.68','2022-05-16 14:32:37',NULL,NULL),('vn-database','10139','01-secondScript.sql','jenkins@10.0.2.68','2022-05-17 12:16:13',NULL,NULL),('vn-database','10141','00-firstScript.sql','jenkins@10.0.2.70','2022-05-12 08:27:31',NULL,NULL),('vn-database','10142','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10143','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10144','00-AfegirFKPArt1.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10144','00-firstScript.sql','jenkins@10.0.2.68','2022-05-13 09:44:25',NULL,NULL),('vn-database','10147','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10149','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10150','00-firstScript.sql','jenkins@10.0.2.68','2022-05-17 09:57:16',NULL,NULL),('vn-database','10152','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10153','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10154','00-compressionKk.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10157','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:35',NULL,NULL),('vn-database','10158','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10160','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:30:50',NULL,NULL),('vn-database','10163','00-firstScript.sql','jenkins@10.0.2.68','2022-05-23 08:17:14',NULL,NULL),('vn-database','10164','00-borrarSectorsDesus.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10165','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10166','00-firstScript.sql','jenkins@10.0.2.68','2022-05-24 16:11:21',NULL,NULL),('vn-database','10167','00-renameVnActiveContrat.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10168','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','00-createTableBankEntityConfig.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','02-addNotNullToBankEntityBic.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10171','00-volumeConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 14:11:11',NULL,NULL),('vn-database','10171','01-itemWeight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10171','02-agencymode.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10172','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10174','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10175','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10177','00-crearTablaSpecialLabels.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10178','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10179','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10183','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10184','00-firstScript.sql','jenkins@10.0.2.68','2022-06-03 08:05:34',NULL,NULL),('vn-database','10185','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 09:07:45',NULL,NULL),('vn-database','10186','00-desactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:31:23',NULL,NULL),('vn-database','10186','01-alter_Table_buy.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','02-alter_table_entryConfig.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','04-regularizar_Sticker_Inventario.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10186','09-reactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10187','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 12:37:31',NULL,NULL),('vn-database','10188','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 14:03:36',NULL,NULL),('vn-database','10189','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10191','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10193','00-delete.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:35',NULL,NULL),('vn-database','10193','01-botanicExport.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:43',NULL,NULL),('vn-database','10193','02-item.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-autonomy.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-turn.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','04-country.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10194','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10195','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10200','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10201','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10202','00-Remove_FK_to_ediGenus.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10203','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10204','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10205','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:21',NULL,NULL),('vn-database','10207','00-Alter_table_entry.sql','jenkins@10.0.2.69','2022-06-16 07:22:50',NULL,NULL),('vn-database','10207','01-Update_invoiceAmount.sql','jenkins@10.0.2.69','2022-06-16 07:23:00',NULL,NULL),('vn-database','10208','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10209','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 08:47:40',NULL,NULL),('vn-database','10210','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 17:39:17',1046,'Base de datos no seleccionada'),('vn-database','10211','01-firstScript.sql','jenkins@10.0.2.69','2022-06-17 07:11:27',NULL,NULL),('vn-database','10215','00-renameIsInventory.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10216','00-firstScript.sql','jenkins@10.0.2.69','2022-06-23 11:15:28',NULL,NULL),('vn-database','10216','01-batchIndex.sql','jenkins@10.0.2.70','2022-06-27 18:10:55',NULL,NULL),('vn-database','10219','00-AddCollectionFkOnPackingSite.sql','jenkins@10.0.2.70','2022-06-29 09:23:42',NULL,NULL),('vn-database','10219','01-AddFkToCollectionFk.sql','jenkins@10.0.2.70','2022-06-29 09:23:43',NULL,NULL),('vn-database','10220','00-createPersonalProtectionEquipment.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10222','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:12:40',NULL,NULL),('vn-database','10223','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:52',NULL,NULL),('vn-database','10224','00-cosetes.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-21 12:03:45',NULL,NULL),('vn-database','10229','00-firstScript.sql','jenkins@10.0.2.69','2022-07-01 11:59:34',NULL,NULL),('vn-database','10231','01-tablaEktConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:25:39',NULL,NULL),('vn-database','10233','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10235','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10236','00-firstScript.sql','jenkins@10.0.2.69','2022-07-05 12:11:40',NULL,NULL),('vn-database','10237','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10238','00-worker_mobileExtension.sql','jenkins@10.0.2.69','2022-07-14 09:14:09',NULL,NULL),('vn-database','10239','00-firstScript.sql','jenkins@10.0.2.69','2022-07-07 21:51:58',NULL,NULL),('vn-database','10241','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-29 08:14:01',NULL,NULL),('vn-database','10242','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10243','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10245','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10247','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10248','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-20 17:27:51',NULL,NULL),('vn-database','10250','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:40',NULL,NULL),('vn-database','10253','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:57',NULL,NULL),('vn-database','10254','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10256','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10258','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10259','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-02 08:54:56',NULL,NULL),('vn-database','10261','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-22 08:42:20',NULL,NULL),('vn-database','10262','00-createTablepackagingWithFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','01-alterTablePackagingConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','02-insertsInicials.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','03-createTablepackingWithoutFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10263','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10265','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10267','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10267','01-fixMerge.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10275','00-improvedGeneralLog.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 09:55:56',NULL,NULL),('vn-database','10277','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10278','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 17:51:41',NULL,NULL),('vn-database','10279','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10281','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10282','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10283','00-alterTable.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10284','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-04 16:59:08',NULL,NULL),('vn-database','10285','00-firstScript.sql','jenkins@swarm-worker3.static.verdnatura.es','2022-08-05 09:19:33',NULL,NULL),('vn-database','10287','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10288','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10289','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:36',NULL,NULL),('vn-database','10291','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-10 14:19:34',NULL,NULL),('vn-database','10293','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10297','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-16 12:43:36',NULL,NULL),('vn-database','10298','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-13 21:04:13',NULL,NULL),('vn-database','10299','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','00-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','01-drop.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','02-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','00-CreateTableEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','01-insertDataEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','02-alterTableEntry.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:22',NULL,NULL),('vn-database','10303','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:23',NULL,NULL),('vn-database','10304','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:48',NULL,NULL),('vn-database','10304','01-altertableticket.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:51',NULL,NULL),('vn-database','10305','00-ektAssign.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:24:52',NULL,NULL),('vn-database','10306','00-deliveryInformation.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:25',NULL,NULL),('vn-database','10307','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:26',NULL,NULL),('vn-database','10308','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:26:43',NULL,NULL),('vn-database','10309','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:54',NULL,NULL),('vn-database','10310','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10311','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:55',NULL,NULL),('vn-database','10312','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10313','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:27:21',NULL,NULL),('vn-database','10314','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:19',NULL,NULL),('vn-database','10315','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10317','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10318','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10319','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:41',NULL,NULL),('vn-database','10320','00-operator.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','01-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','02-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10321','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 11:11:12',NULL,NULL),('vn-database','10322','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-09 09:19:05',NULL,NULL),('vn-database','10326','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10328','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10329','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10330','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10332','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','00-collectionHotbed.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','01-saleGroupDetail.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10335','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10336','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10337','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10339','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-19 09:41:19',NULL,NULL),('vn-database','10340','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10341','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10342','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10343','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:35:30',NULL,NULL),('vn-database','10345','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10347','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10347','01-addVirtualField.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10349','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10350','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-30 10:11:56',NULL,NULL),('vn-database','10352','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10353','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10354','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10356','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','01-orderConfigFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','02-orderConfigDrop.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10357','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10359','00-improvedGeneralLog_collate.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10360','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10361','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 11:16:07',NULL,NULL),('vn-database','10362','00-dropUdfs.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-10 11:01:15',NULL,NULL),('vn-database','10363','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10365','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-13 19:30:46',NULL,NULL),('vn-database','10368','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10369','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-14 13:38:06',NULL,NULL),('vn-database','10370','00-deleteForeignKey.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:41',NULL,NULL),('vn-database','10370','01-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:47',NULL,NULL),('vn-database','10370','02-deleteTable.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','03-accion.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','04-inter.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10371','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10372','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10373','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-19 08:31:58',NULL,NULL),('vn-database','10378','00-rename_routeUserPercentage.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10379','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:16',NULL,NULL),('vn-database','10382','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10383','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10384','00-business_workcenterFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10385','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10386','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10387','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-16 14:05:33',NULL,NULL),('vn-database','10388','00-resizeUtilVerionLogCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10388','01-resizeUtilVersionCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10390','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:16',NULL,NULL),('vn-database','10391','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10394','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:24',NULL,NULL),('vn-database','10395','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10396','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 15:36:38',NULL,NULL),('vn-database','10397','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10399','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10400','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10402','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-21 14:11:31',NULL,NULL),('vn-database','10404','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10405','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:22',NULL,NULL),('vn-database','10407','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10408','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10409','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10412','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-30 12:45:44',NULL,NULL),('vn-database','10413','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10416','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10420','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:25',NULL,NULL),('vn-database','10421','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:26',NULL,NULL),('vn-database','10426','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:40',NULL,NULL),('vn-database','10428','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10431','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:22',NULL,NULL),('vn-database','10433','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10434','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10435','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-13 07:30:10',NULL,NULL),('vn-database','10436','00-createFkWorker.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:59',NULL,NULL),('vn-database','10436','01-addStateToWorkerProductivity.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','02-DeprecateVnSaleTrackingState.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','03-DeprecateColumnVnSaleTrackingActionFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','04-DropSchemaVnControl.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','05-RemoveFkWorkerProductivity.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-17 14:51:19',NULL,NULL),('vn-database','10439','00-fixRole.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:26',NULL,NULL),('vn-database','10440','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10444','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10445','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10448','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10450','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-27 08:28:04',NULL,NULL),('vn-database','10451','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-06 08:08:32',NULL,NULL),('vn-database','10452','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10453','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 14:04:37',NULL,NULL),('vn-database','10454','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10455','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10456','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:30',NULL,NULL),('vn-database','10457','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:33',NULL,NULL),('vn-database','10458','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10459','00-alterTableUtilConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','01-createFunctionCurdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','02-createFunctionMockTime.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','03-createFunctionMockTimeBase.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','04-createFunctionNow.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10460','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10461','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10463','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-03 12:59:26',NULL,NULL),('vn-database','10468','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10469','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10470','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10471','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10472','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10477','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:31',NULL,NULL),('vn-database','10478','00-dropBasket.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','01-orderConfigured.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:16',NULL,NULL),('vn-database','10478','02-configuredUpdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10478','99-privileges.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10480','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 15:09:26',NULL,NULL),('vn-database','10481','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 16:37:22',NULL,NULL),('vn-database','10482','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-21 10:00:28',NULL,NULL),('vn-database','10485','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10488','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10491','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10492','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10493','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10495','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:19',NULL,NULL),('vn-database','10498','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:38',NULL,NULL),('vn-database','10500','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 07:06:03',NULL,NULL),('vn-database','10501','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 10:52:24',NULL,NULL),('vn-database','10502','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10504','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10506','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10506','01-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','02-secondScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','03-thirdScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10507','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:35:23',NULL,NULL),('vn-database','10508','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:43',NULL,NULL),('vn-database','10510','00-dropBusinessFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','01-createTableProfessionalCategory.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','02-exportToNewTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','03-RecreateFK.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10510','04-kkPostgresqlTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10511','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10512','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:52',NULL,NULL),('vn-database','10513','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:56',NULL,NULL),('vn-database','10514','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10516','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10521','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 06:58:13',NULL,NULL),('vn-database','10522','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10523','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10524','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:12',NULL,NULL),('vn-database','10524','01-rateEditorFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:12',NULL,NULL),('vn-database','10525','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 12:42:50',NULL,NULL),('vn-database','10526','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:57',NULL,NULL),('vn-database','10528','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:00',NULL,NULL),('vn-database','10530','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-23 14:49:30',NULL,NULL),('vn-database','10531','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:47:10',NULL,NULL),('vn-database','10532','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:17:38',NULL,NULL),('vn-database','10533','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:04',NULL,NULL),('vn-database','10537','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-29 15:18:36',NULL,NULL),('vn-database','10538','00-createChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','01-createChronopostService.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','02-createChronopostExpedition.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','03-createChronopostSenderAddress.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','04-addgrantPrivilegies.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','05-updateChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 11:54:57',NULL,NULL),('vn-database','10539','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:07',NULL,NULL),('vn-database','10540','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10545','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-11 08:31:03',NULL,NULL),('vn-database','10546','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10547','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:21:58',NULL,NULL),('vn-database','10549','00-updateUpdateLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:29:22',NULL,NULL),('vn-database','10549','01-updateInsertLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:11',NULL,NULL),('vn-database','10549','02-updateDeleteLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:51',NULL,NULL),('vn-database','10549','03-deleteEmptyLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:31:34',NULL,NULL),('vn-database','10549','04-optimizeLogTables.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:33:58',NULL,NULL),('vn-database','10550','00-editorFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:42:33',NULL,NULL),('vn-database','10550','01-originFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10552','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-13 08:25:10',NULL,NULL),('vn-database','10554','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10557','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-17 07:45:56',NULL,NULL),('vn-database','10559','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-18 10:53:50',NULL,NULL),('vn-database','10560','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-17 09:19:31',NULL,NULL),('vn-database','10562','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10563','00-delivery_ticketFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 09:30:53',NULL,NULL),('vn-database','10566','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:08:41',NULL,NULL),('vn-database','10567','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:18:06',NULL,NULL),('vn-database','10568','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10569','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-24 09:14:35',NULL,NULL),('vn-database','10570','00-createSendingConfig.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','01-createSendingServiceWeekday.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','02-createSendingService.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','03-permisos.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10571','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10573','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:23',NULL,NULL),('vn-database','10575','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-26 11:27:32',NULL,NULL),('vn-database','10577','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-27 14:00:12',NULL,NULL),('vn-database','10578','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10579','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-28 11:27:36',NULL,NULL),('vn-database','10580','00-itemTypeDropConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:18:52',NULL,NULL),('vn-database','10580','01-itemTypeAddConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:19:10',NULL,NULL),('vn-database','10581','00-itemTypeAutoIncrement.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 19:06:46',NULL,NULL),('vn-database','10582','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10583','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10584','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10585','00-ticketLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:20:10',NULL,NULL),('vn-database','10585','01-entryLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:21:12',NULL,NULL),('vn-database','10585','02-claimLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:36',NULL,NULL),('vn-database','10585','03-clientLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:54',NULL,NULL),('vn-database','10585','04-invoiceInLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:55',NULL,NULL),('vn-database','10585','05-itemLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:29:46',NULL,NULL),('vn-database','10585','06-routeLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:18',NULL,NULL),('vn-database','10585','07-shelvingLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','08-supplierLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','09-travelLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:41',NULL,NULL),('vn-database','10585','10-workerLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:42',NULL,NULL),('vn-database','10585','11-zoneLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:43',NULL,NULL),('vn-database','10585','12-userLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10585','13-roleLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10587','00-arcRead_addMinimum.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-16 13:13:15',NULL,NULL),('vn-database','10593','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10596','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10597','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10598','00-workerLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','01-supplierLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','02-workerTimeControlLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','03-workerClockLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10599','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10601','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-17 09:26:26',NULL,NULL),('vn-database','10602','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 08:52:15',NULL,NULL),('vn-database','10606','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 09:26:00',NULL,NULL),('vn-database','10608','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 12:36:31',NULL,NULL),('vn-database','10609','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 08:28:07',NULL,NULL),('vn-database','10610','00-updateCompanyId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:07',NULL,NULL),('vn-database','10610','01-updateSupplierId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:39',NULL,NULL),('vn-database','10610','02-invoiceOutCompany.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 09:49:55',NULL,NULL),('vn-database','10611','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-19 14:39:41',NULL,NULL),('vn-database','10613','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10614','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10615','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10616','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:18:55',NULL,NULL),('vn-database','10616','01-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:18:55',NULL,NULL),('vn-database','10617','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:41',NULL,NULL),('vn-database','10618','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 12:55:56',NULL,NULL),('vn-database','10619','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10620','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:20:53',NULL,NULL),('vn-database','10624','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-30 19:01:10',NULL,NULL),('vn-database','10626','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 13:32:32',NULL,NULL),('vn-database','10628','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10630','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-02 13:30:58',NULL,NULL),('vn-database','10631','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-05 08:37:25',NULL,NULL),('vn-database','10632','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10633','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10634','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-06 12:15:55',NULL,NULL),('vn-database','10637','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:19',NULL,NULL),('vn-database','10640','00-companyFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','00-updateCompany.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-07 14:22:13',1205,'Tiempo de espera de bloqueo excedido; intente rearrancar la transacción'),('vn-database','10640','01-companyFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','02-companyFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:47:04',NULL,NULL),('vn-database','10640','04-supplierFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:48:30',NULL,NULL),('vn-database','10640','05-supplierFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:53:17',NULL,NULL),('vn-database','10640','06-supplierFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 15:06:00',NULL,NULL),('vn-database','10642','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 14:04:13',NULL,NULL),('vn-database','10643','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-09 15:04:35',NULL,NULL),('vn-database','10644','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:18',NULL,NULL),('vn-database','10647','00-renombrarTabla.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 14:04:13',NULL,NULL),('vn-database','10648','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10649','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-16 10:59:06',NULL,NULL),('vn-database','10652','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 14:04:13',NULL,NULL),('vn-database','10653','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:20',NULL,NULL),('vn-database','10655','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:24',NULL,NULL),('vn-database','10656','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10658','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:27',NULL,NULL),('vn-database','10659','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10662','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:33',NULL,NULL),('vn-database','10663','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:34',NULL,NULL),('vn-database','10665','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-30 08:52:51',NULL,NULL),('vn-database','10666','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:34',NULL,NULL),('vn-database','10667','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10668','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10671','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-25 14:56:50',NULL,NULL),('vn-database','10675','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10676','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10679','00-tables.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10680','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-07-18 14:58:36',NULL,NULL),('vn-database','10682','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10690','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-07-27 10:52:26',NULL,NULL),('vn-database','10691','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-07-31 13:37:21',NULL,NULL),('vn-database','10692','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10693','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10694','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-02 09:50:53',NULL,NULL),('vn-database','10695','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-02 13:40:16',NULL,NULL),('vn-database','10696','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-03 16:54:57',NULL,NULL),('vn-database','10698','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-03 08:53:12',NULL,NULL),('vn-database','10699','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-03 15:24:30',NULL,NULL),('vn-database','10700','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-29 09:42:11',NULL,NULL),('vn-database','10702','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 12:50:46',NULL,NULL),('vn-database','10704','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-29 09:42:14',NULL,NULL),('vn-database','10705','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-16 14:16:05',NULL,NULL),('vn-database','10707','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-21 12:31:18',NULL,NULL),('vn-database','10714','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-28 13:01:45',NULL,NULL); /*!40000 ALTER TABLE `versionLog` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -54,11 +54,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-06-26 8:40:00 +-- Dump completed on 2023-08-30 15:53:14 USE `account`; --- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db1.static.verdnatura.es Database: account +-- Host: db2.static.verdnatura.es Database: account -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -78,7 +78,7 @@ USE `account`; LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; -INSERT INTO `role` VALUES (1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2023-06-08 16:47:57',NULL),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2023-06-02 20:33:28',NULL),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35',NULL),(13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 07:04:58','2021-06-30 13:29:30',NULL),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10',NULL),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27',NULL),(20,'manager','Gerencia',1,'2017-06-01 14:57:02','2022-07-29 07:36:15',NULL),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52',NULL),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12',NULL),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36',NULL),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27',NULL),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20',NULL),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34',NULL),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53',NULL),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42',NULL),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08',NULL),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53',NULL),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09',NULL),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41',NULL),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12',NULL),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26',NULL),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59',NULL),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16',NULL),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12',NULL),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23',NULL),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18',NULL),(48,'coolerBoss','Jefe de cámara',1,'2018-02-23 13:12:01','2023-03-13 08:49:43',NULL),(49,'production','Empleado de producción',1,'2018-02-26 15:28:23','2021-02-12 09:42:35',NULL),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12',NULL),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39',NULL),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57',NULL),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57',NULL),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17',NULL),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31',NULL),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02',NULL),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19',NULL),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45',NULL),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10',NULL),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01',NULL),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07',NULL),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05',NULL),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08',NULL),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26',NULL),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56',NULL),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23',NULL),(69,'coolerAssist','Asistente de cámara con permiso compras',1,'2020-02-05 12:36:09','2023-03-13 08:50:07',NULL),(70,'trainee','Alumno de prácticas',1,'2020-03-04 11:00:25','2020-03-04 11:00:25',NULL),(71,'checker','Rol de revisor con privilegios de itemPicker',1,'2020-10-02 10:50:07','2020-10-02 10:50:07',NULL),(72,'claimManager','Personal de reclamaciones',1,'2020-10-13 10:01:32','2020-10-26 07:29:46',NULL),(73,'financial','Departamento de finanzas',1,'2020-11-16 09:30:27','2020-11-16 09:30:27',NULL),(74,'userPhotos','Privilegios para subir fotos de usuario',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(75,'catalogPhotos','Privilegios para subir fotos del catálogo',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(76,'chat','Rol para utilizar el rocket chat',1,'2020-11-27 13:06:50','2020-12-17 07:49:41',NULL),(100,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2020-11-12 06:50:07',NULL),(101,'buyerBoss','Jefe del departamento de compras',1,'2021-06-16 09:53:17','2021-06-16 09:53:17',NULL),(102,'preservedBoss','Responsable preservado',1,'2021-09-14 13:45:37','2021-09-14 13:45:37',NULL),(103,'it','Departamento de informática',1,'2021-11-11 09:48:22','2021-11-11 09:48:22',NULL),(104,'itBoss','Jefe de departamento de informática',1,'2021-11-11 09:48:49','2021-11-11 09:48:49',NULL),(105,'grant','Adjudicar roles a usuarios',1,'2021-11-11 12:41:09','2021-11-11 12:41:09',NULL),(106,'ext','Usuarios externos de la Base de datos',1,'2021-11-23 14:51:16','2021-11-23 14:51:16',NULL),(107,'productionPlus','Creado para pepe por orden de Juanvi',1,'2022-02-08 06:47:10','2022-02-08 06:47:10',NULL),(108,'system','System user',1,'2022-05-16 08:09:51','2022-05-16 08:09:51',NULL),(109,'salesTeamBoss','Jefe de equipo de comerciales',1,'2022-06-14 13:45:56','2022-06-14 13:45:56',NULL),(110,'palletizer','Paletizadores',1,'2022-12-02 12:56:22','2022-12-02 12:56:30',NULL),(111,'entryEditor','Entry editor',1,'2023-01-13 11:21:55','2023-01-13 11:21:55',NULL),(112,'maintenance','Personal de mantenimiento',1,'2023-01-19 06:23:35','2023-01-19 06:23:35',NULL),(114,'maintenanceBos','Jefe de mantenimiento',1,'2023-01-19 06:31:16','2023-05-17 11:07:21',NULL),(115,'itManagement','TI management',1,'2023-03-29 07:27:55','2023-03-29 07:28:04',NULL),(119,'palletizerBoss','Jefe de paletizadores',1,'2023-06-07 11:51:54','2023-06-07 11:51:54',NULL),(120,'developerBoss','Jefe de proyecto de desarrollo',1,'2023-06-19 07:07:21','2023-06-19 07:07:21',21709),(121,'buyerSalesAssistant','Rol para compradores que también son responsables de ventas',1,'2023-06-23 14:48:19','2023-06-23 14:48:19',NULL); +INSERT INTO `role` VALUES (1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2023-06-08 16:47:57',NULL),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2023-06-02 20:33:28',NULL),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35',NULL),(13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 07:04:58','2021-06-30 13:29:30',NULL),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10',NULL),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27',NULL),(20,'manager','Gerencia',1,'2017-06-01 14:57:02','2022-07-29 07:36:15',NULL),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52',NULL),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12',NULL),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36',NULL),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27',NULL),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20',NULL),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34',NULL),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53',NULL),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42',NULL),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08',NULL),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53',NULL),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09',NULL),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41',NULL),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12',NULL),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26',NULL),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59',NULL),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16',NULL),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12',NULL),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23',NULL),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18',NULL),(48,'coolerBoss','Jefe de cámara',1,'2018-02-23 13:12:01','2023-03-13 08:49:43',NULL),(49,'production','Empleado de producción',1,'2018-02-26 15:28:23','2021-02-12 09:42:35',NULL),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12',NULL),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39',NULL),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57',NULL),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57',NULL),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17',NULL),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31',NULL),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02',NULL),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19',NULL),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45',NULL),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10',NULL),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01',NULL),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07',NULL),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05',NULL),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08',NULL),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26',NULL),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56',NULL),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23',NULL),(69,'coolerAssist','Asistente de cámara con permiso compras',1,'2020-02-05 12:36:09','2023-03-13 08:50:07',NULL),(70,'trainee','Alumno de prácticas',1,'2020-03-04 11:00:25','2020-03-04 11:00:25',NULL),(71,'checker','Rol de revisor con privilegios de itemPicker',1,'2020-10-02 10:50:07','2020-10-02 10:50:07',NULL),(72,'claimManager','Personal de reclamaciones',1,'2020-10-13 10:01:32','2020-10-26 07:29:46',NULL),(73,'financial','Departamento de finanzas',1,'2020-11-16 09:30:27','2020-11-16 09:30:27',NULL),(74,'userPhotos','Privilegios para subir fotos de usuario',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(75,'catalogPhotos','Privilegios para subir fotos del catálogo',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(76,'chat','Rol para utilizar el rocket chat',1,'2020-11-27 13:06:50','2020-12-17 07:49:41',NULL),(100,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2020-11-12 06:50:07',NULL),(101,'buyerBoss','Jefe del departamento de compras',1,'2021-06-16 09:53:17','2021-06-16 09:53:17',NULL),(102,'preservedBoss','Responsable preservado',1,'2021-09-14 13:45:37','2021-09-14 13:45:37',NULL),(103,'it','Departamento de informática',1,'2021-11-11 09:48:22','2021-11-11 09:48:22',NULL),(104,'itBoss','Jefe de departamento de informática',1,'2021-11-11 09:48:49','2021-11-11 09:48:49',NULL),(105,'grant','Adjudicar roles a usuarios',1,'2021-11-11 12:41:09','2021-11-11 12:41:09',NULL),(106,'ext','Usuarios externos de la Base de datos',1,'2021-11-23 14:51:16','2021-11-23 14:51:16',NULL),(107,'productionPlus','Creado para pepe por orden de Juanvi',1,'2022-02-08 06:47:10','2022-02-08 06:47:10',NULL),(108,'system','System user',1,'2022-05-16 08:09:51','2022-05-16 08:09:51',NULL),(109,'salesTeamBoss','Jefe de equipo de comerciales',1,'2022-06-14 13:45:56','2022-06-14 13:45:56',NULL),(110,'palletizer','Paletizadores',1,'2022-12-02 12:56:22','2022-12-02 12:56:30',NULL),(111,'entryEditor','Entry editor',1,'2023-01-13 11:21:55','2023-01-13 11:21:55',NULL),(112,'maintenance','Personal de mantenimiento',1,'2023-01-19 06:23:35','2023-01-19 06:23:35',NULL),(114,'maintenanceBos','Jefe de mantenimiento',1,'2023-01-19 06:31:16','2023-05-17 11:07:21',NULL),(115,'itManagement','TI management',1,'2023-03-29 07:27:55','2023-03-29 07:28:04',NULL),(119,'palletizerBoss','Jefe de paletizadores',1,'2023-06-07 11:51:54','2023-06-07 11:51:54',NULL),(120,'developerBoss','Jefe de proyecto de desarrollo',1,'2023-06-19 07:07:21','2023-06-19 07:07:21',21709),(121,'buyerSalesAssistant','Rol para compradores que también son responsables de ventas',1,'2023-06-23 14:48:19','2023-06-23 14:48:19',NULL),(122,'logisticAssistant','Jefe auxiliar de logística',1,'2023-06-26 07:21:15','2023-06-26 07:21:15',NULL); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -88,7 +88,7 @@ UNLOCK TABLES; LOCK TABLES `roleInherit` WRITE; /*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */; -INSERT INTO `roleInherit` VALUES (1,1,2,NULL),(2,1,3,NULL),(3,1,70,NULL),(4,2,11,NULL),(5,3,11,NULL),(6,5,1,NULL),(8,5,33,NULL),(10,11,6,NULL),(11,13,1,NULL),(12,15,35,NULL),(15,16,15,NULL),(16,17,20,NULL),(17,17,37,NULL),(18,17,39,NULL),(19,17,64,NULL),(20,18,1,NULL),(21,19,21,NULL),(22,20,13,NULL),(23,20,16,NULL),(24,20,65,NULL),(25,21,13,NULL),(26,21,18,NULL),(27,21,53,NULL),(28,22,13,NULL),(29,22,21,NULL),(30,30,5,NULL),(31,30,20,NULL),(32,30,22,NULL),(33,30,53,NULL),(34,30,64,NULL),(35,31,1,NULL),(36,32,1,NULL),(37,34,1,NULL),(38,34,13,NULL),(39,34,33,NULL),(40,35,1,NULL),(41,36,44,NULL),(42,36,47,NULL),(43,37,1,NULL),(44,38,37,NULL),(45,38,64,NULL),(46,39,5,NULL),(47,39,21,NULL),(48,39,57,NULL),(49,40,1,NULL),(50,40,49,NULL),(51,41,13,NULL),(52,41,35,NULL),(53,41,40,NULL),(54,42,35,NULL),(55,42,49,NULL),(56,43,13,NULL),(57,43,42,NULL),(58,44,1,NULL),(59,45,13,NULL),(60,45,44,NULL),(61,47,1,NULL),(62,48,13,NULL),(63,48,47,NULL),(64,49,36,NULL),(65,49,58,NULL),(66,50,13,NULL),(67,50,21,NULL),(68,50,35,NULL),(69,50,49,NULL),(70,50,57,NULL),(72,51,1,NULL),(73,52,13,NULL),(74,52,19,NULL),(76,52,51,NULL),(77,53,1,NULL),(78,54,1,NULL),(79,55,13,NULL),(80,55,54,NULL),(81,56,1,NULL),(82,57,13,NULL),(83,57,56,NULL),(84,58,1,NULL),(85,59,13,NULL),(87,60,5,NULL),(91,61,13,NULL),(92,61,36,NULL),(94,65,35,NULL),(97,67,5,NULL),(98,67,37,NULL),(99,69,35,NULL),(101,70,11,NULL),(102,71,1,NULL),(103,71,58,NULL),(105,72,18,NULL),(106,73,5,NULL),(107,73,64,NULL),(108,73,19,NULL),(109,59,50,NULL),(115,39,76,NULL),(117,65,76,NULL),(118,30,76,NULL),(124,5,76,NULL),(125,37,76,NULL),(126,38,76,NULL),(128,42,76,NULL),(129,35,76,NULL),(130,60,76,NULL),(131,21,76,NULL),(132,18,76,NULL),(133,50,76,NULL),(134,20,76,NULL),(135,41,76,NULL),(136,17,76,NULL),(137,52,76,NULL),(138,57,76,NULL),(139,37,74,NULL),(140,51,74,NULL),(141,51,75,NULL),(142,35,75,NULL),(143,15,49,NULL),(145,17,67,NULL),(146,38,13,NULL),(147,101,35,NULL),(148,101,13,NULL),(150,15,56,NULL),(152,69,47,NULL),(153,48,35,NULL),(154,102,1,NULL),(167,9,103,NULL),(168,66,9,NULL),(169,104,100,NULL),(172,103,76,NULL),(173,103,1,NULL),(174,103,44,NULL),(175,103,45,NULL),(176,103,11,NULL),(177,103,39,NULL),(178,103,17,NULL),(179,103,5,NULL),(180,103,67,NULL),(181,103,3,NULL),(182,103,34,NULL),(183,103,42,NULL),(184,103,43,NULL),(185,103,64,NULL),(186,103,35,NULL),(187,103,101,NULL),(188,103,75,NULL),(189,103,71,NULL),(190,103,72,NULL),(191,103,47,NULL),(192,103,69,NULL),(193,103,48,NULL),(194,103,2,NULL),(195,103,56,NULL),(196,103,57,NULL),(197,103,32,NULL),(198,103,73,NULL),(199,103,30,NULL),(200,103,31,NULL),(201,103,6,NULL),(202,103,40,NULL),(203,103,41,NULL),(204,103,37,NULL),(205,103,38,NULL),(206,103,53,NULL),(207,103,33,NULL),(210,103,54,NULL),(211,103,55,NULL),(212,103,15,NULL),(213,103,16,NULL),(215,103,51,NULL),(216,103,52,NULL),(218,103,65,NULL),(219,103,58,NULL),(220,103,59,NULL),(221,103,102,NULL),(222,103,49,NULL),(223,103,60,NULL),(224,103,50,NULL),(225,103,36,NULL),(226,103,61,NULL),(228,103,21,NULL),(229,103,19,NULL),(230,103,18,NULL),(231,103,13,NULL),(232,103,22,NULL),(233,103,70,NULL),(234,103,74,NULL),(237,66,103,NULL),(238,103,20,NULL),(239,106,11,NULL),(240,107,60,NULL),(241,21,72,NULL),(242,20,9,NULL),(245,57,33,NULL),(246,102,35,NULL),(247,108,1,NULL),(248,102,13,NULL),(249,109,18,NULL),(250,109,13,NULL),(251,51,21,NULL),(253,48,49,NULL),(254,110,1,NULL),(255,110,76,NULL),(256,48,69,NULL),(257,47,111,NULL),(258,43,111,NULL),(259,72,111,NULL),(260,35,111,NULL),(261,5,111,NULL),(262,112,1,NULL),(263,114,112,NULL),(264,51,35,NULL),(265,72,49,NULL),(266,101,18,NULL),(268,65,57,NULL),(269,65,59,NULL),(270,65,49,NULL),(271,65,18,NULL),(272,65,13,NULL),(273,60,35,NULL),(275,50,59,NULL),(276,60,49,NULL),(280,5,53,NULL),(281,5,18,NULL),(282,50,60,NULL),(283,5,21,NULL),(284,60,57,NULL),(285,58,76,NULL),(287,69,58,NULL),(288,115,66,NULL),(290,104,115,NULL),(291,115,103,NULL),(297,21,33,NULL),(298,49,54,NULL),(299,112,49,NULL),(300,114,13,NULL),(302,5,35,NULL),(303,69,49,NULL),(306,119,110,NULL),(307,1,76,NULL),(309,120,9,NULL),(310,120,66,NULL),(311,120,13,25508),(312,115,120,NULL),(314,43,18,NULL),(315,121,35,NULL),(316,121,21,NULL); +INSERT INTO `roleInherit` VALUES (1,1,2,NULL),(2,1,3,NULL),(3,1,70,NULL),(4,2,11,NULL),(5,3,11,NULL),(6,5,1,NULL),(8,5,33,NULL),(10,11,6,NULL),(11,13,1,NULL),(12,15,35,NULL),(16,17,20,NULL),(17,17,37,NULL),(18,17,39,NULL),(19,17,64,NULL),(20,18,1,NULL),(21,19,21,NULL),(22,20,13,NULL),(23,20,16,NULL),(24,20,65,NULL),(25,21,13,NULL),(26,21,18,NULL),(27,21,53,NULL),(28,22,13,NULL),(29,22,21,NULL),(30,30,5,NULL),(31,30,20,NULL),(32,30,22,NULL),(33,30,53,NULL),(34,30,64,NULL),(35,31,1,NULL),(36,32,1,NULL),(37,34,1,NULL),(38,34,13,NULL),(39,34,33,NULL),(40,35,1,NULL),(41,36,44,NULL),(42,36,47,NULL),(43,37,1,NULL),(44,38,37,NULL),(45,38,64,NULL),(46,39,5,NULL),(47,39,21,NULL),(48,39,57,NULL),(49,40,1,NULL),(50,40,49,NULL),(51,41,13,NULL),(52,41,35,NULL),(53,41,40,NULL),(54,42,35,NULL),(55,42,49,NULL),(56,43,13,NULL),(57,43,42,NULL),(58,44,1,NULL),(59,45,13,NULL),(60,45,44,NULL),(61,47,1,NULL),(62,48,13,NULL),(63,48,47,NULL),(64,49,36,NULL),(65,49,58,NULL),(66,50,13,NULL),(67,50,21,NULL),(68,50,35,NULL),(69,50,49,NULL),(70,50,57,NULL),(72,51,1,NULL),(73,52,13,NULL),(74,52,19,NULL),(76,52,51,NULL),(77,53,1,NULL),(78,54,1,NULL),(79,55,13,NULL),(80,55,54,NULL),(81,56,1,NULL),(82,57,13,NULL),(83,57,56,NULL),(84,58,1,NULL),(85,59,13,NULL),(87,60,5,NULL),(91,61,13,NULL),(92,61,36,NULL),(94,65,35,NULL),(97,67,5,NULL),(98,67,37,NULL),(99,69,35,NULL),(101,70,11,NULL),(102,71,1,NULL),(103,71,58,NULL),(105,72,18,NULL),(106,73,5,NULL),(107,73,64,NULL),(108,73,19,NULL),(109,59,50,NULL),(115,39,76,NULL),(117,65,76,NULL),(118,30,76,NULL),(124,5,76,NULL),(125,37,76,NULL),(126,38,76,NULL),(128,42,76,NULL),(129,35,76,NULL),(130,60,76,NULL),(131,21,76,NULL),(132,18,76,NULL),(133,50,76,NULL),(134,20,76,NULL),(135,41,76,NULL),(136,17,76,NULL),(137,52,76,NULL),(138,57,76,NULL),(139,37,74,NULL),(140,51,74,NULL),(141,51,75,NULL),(142,35,75,NULL),(143,15,49,NULL),(145,17,67,NULL),(146,38,13,NULL),(147,101,35,NULL),(148,101,13,NULL),(150,15,56,NULL),(152,69,47,NULL),(153,48,35,NULL),(154,102,1,NULL),(167,9,103,NULL),(168,66,9,NULL),(169,104,100,NULL),(172,103,76,NULL),(173,103,1,NULL),(174,103,44,NULL),(175,103,45,NULL),(176,103,11,NULL),(177,103,39,NULL),(178,103,17,NULL),(179,103,5,NULL),(180,103,67,NULL),(181,103,3,NULL),(182,103,34,NULL),(183,103,42,NULL),(184,103,43,NULL),(185,103,64,NULL),(186,103,35,NULL),(187,103,101,NULL),(188,103,75,NULL),(189,103,71,NULL),(190,103,72,NULL),(191,103,47,NULL),(192,103,69,NULL),(193,103,48,NULL),(194,103,2,NULL),(195,103,56,NULL),(196,103,57,NULL),(197,103,32,NULL),(198,103,73,NULL),(199,103,30,NULL),(200,103,31,NULL),(201,103,6,NULL),(202,103,40,NULL),(203,103,41,NULL),(204,103,37,NULL),(205,103,38,NULL),(206,103,53,NULL),(207,103,33,NULL),(210,103,54,NULL),(211,103,55,NULL),(212,103,15,NULL),(213,103,16,NULL),(215,103,51,NULL),(216,103,52,NULL),(218,103,65,NULL),(219,103,58,NULL),(220,103,59,NULL),(221,103,102,NULL),(222,103,49,NULL),(223,103,60,NULL),(224,103,50,NULL),(225,103,36,NULL),(226,103,61,NULL),(228,103,21,NULL),(229,103,19,NULL),(230,103,18,NULL),(231,103,13,NULL),(232,103,22,NULL),(233,103,70,NULL),(234,103,74,NULL),(237,66,103,NULL),(238,103,20,NULL),(239,106,11,NULL),(240,107,60,NULL),(241,21,72,NULL),(242,20,9,NULL),(245,57,33,NULL),(246,102,35,NULL),(247,108,1,NULL),(248,102,13,NULL),(249,109,18,NULL),(250,109,13,NULL),(251,51,21,NULL),(253,48,49,NULL),(254,110,1,NULL),(255,110,76,NULL),(256,48,69,NULL),(257,47,111,NULL),(258,43,111,NULL),(259,72,111,NULL),(260,35,111,NULL),(261,5,111,NULL),(262,112,1,NULL),(263,114,112,NULL),(264,51,35,NULL),(265,72,49,NULL),(266,101,18,NULL),(268,65,57,NULL),(269,65,59,NULL),(270,65,49,NULL),(271,65,18,NULL),(272,65,13,NULL),(273,60,35,NULL),(275,50,59,NULL),(276,60,49,NULL),(280,5,53,NULL),(281,5,18,NULL),(282,50,60,NULL),(283,5,21,NULL),(284,60,57,NULL),(285,58,76,NULL),(287,69,58,NULL),(288,115,66,NULL),(290,104,115,NULL),(291,115,103,NULL),(297,21,33,NULL),(298,49,54,NULL),(299,112,49,NULL),(300,114,13,NULL),(302,5,35,NULL),(303,69,49,NULL),(306,119,110,NULL),(307,1,76,NULL),(309,120,9,NULL),(310,120,66,NULL),(311,120,13,25508),(312,115,120,NULL),(314,43,18,NULL),(315,121,35,NULL),(316,121,21,NULL),(317,122,15,NULL),(318,16,122,NULL),(319,37,49,NULL),(320,37,18,NULL); /*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */; UNLOCK TABLES; @@ -98,7 +98,7 @@ UNLOCK TABLES; LOCK TABLES `roleRole` WRITE; /*!40000 ALTER TABLE `roleRole` DISABLE KEYS */; -INSERT INTO `roleRole` VALUES (276665,1,1),(276666,1,2),(276667,1,3),(276671,1,6),(276670,1,11),(276668,1,70),(276669,1,76),(276672,2,2),(276674,2,6),(276673,2,11),(276675,3,3),(276677,3,6),(276676,3,11),(276679,5,1),(276692,5,2),(276691,5,3),(276678,5,5),(276698,5,6),(276694,5,11),(276689,5,13),(276680,5,18),(276681,5,21),(276682,5,33),(276683,5,35),(276697,5,36),(276700,5,44),(276699,5,47),(276693,5,49),(276684,5,53),(276696,5,54),(276695,5,58),(276690,5,70),(276688,5,72),(276687,5,75),(276685,5,76),(276686,5,111),(276701,6,6),(276704,9,1),(276705,9,2),(276706,9,3),(276707,9,5),(276708,9,6),(276702,9,9),(276709,9,11),(276710,9,13),(276711,9,15),(276712,9,16),(276713,9,17),(276714,9,18),(276715,9,19),(276716,9,20),(276717,9,21),(276718,9,22),(276719,9,30),(276720,9,31),(276721,9,32),(276722,9,33),(276723,9,34),(276724,9,35),(276725,9,36),(276726,9,37),(276727,9,38),(276728,9,39),(276729,9,40),(276730,9,41),(276731,9,42),(276732,9,43),(276733,9,44),(276734,9,45),(276735,9,47),(276736,9,48),(276737,9,49),(276738,9,50),(276739,9,51),(276740,9,52),(276741,9,53),(276742,9,54),(276743,9,55),(276744,9,56),(276745,9,57),(276746,9,58),(276747,9,59),(276748,9,60),(276749,9,61),(276750,9,64),(276751,9,65),(276752,9,67),(276753,9,69),(276754,9,70),(276755,9,71),(276756,9,72),(276757,9,73),(276758,9,74),(276759,9,75),(276760,9,76),(276761,9,101),(276762,9,102),(276703,9,103),(276763,9,111),(276765,11,6),(276764,11,11),(276767,13,1),(276768,13,2),(276769,13,3),(276773,13,6),(276772,13,11),(276766,13,13),(276770,13,70),(276771,13,76),(276780,15,1),(276789,15,2),(276788,15,3),(276791,15,6),(276790,15,11),(276774,15,15),(276775,15,35),(276782,15,36),(276786,15,44),(276785,15,47),(276776,15,49),(276783,15,54),(276777,15,56),(276784,15,58),(276787,15,70),(276779,15,75),(276778,15,76),(276781,15,111),(276799,16,1),(276808,16,2),(276807,16,3),(276810,16,6),(276809,16,11),(276793,16,15),(276792,16,16),(276794,16,35),(276801,16,36),(276805,16,44),(276804,16,47),(276795,16,49),(276802,16,54),(276796,16,56),(276803,16,58),(276806,16,70),(276798,16,75),(276797,16,76),(276800,16,111),(276819,17,1),(276829,17,2),(276828,17,3),(276824,17,5),(276854,17,6),(276823,17,9),(276853,17,11),(276822,17,13),(276834,17,15),(276821,17,16),(276811,17,17),(276833,17,18),(276852,17,19),(276812,17,20),(276825,17,21),(276851,17,22),(276850,17,30),(276849,17,31),(276848,17,32),(276836,17,33),(276847,17,34),(276832,17,35),(276846,17,36),(276813,17,37),(276845,17,38),(276814,17,39),(276844,17,40),(276843,17,41),(276842,17,42),(276841,17,43),(276855,17,44),(276856,17,45),(276857,17,47),(276858,17,48),(276831,17,49),(276859,17,50),(276860,17,51),(276861,17,52),(276837,17,53),(276862,17,54),(276863,17,55),(276840,17,56),(276826,17,57),(276864,17,58),(276830,17,59),(276865,17,60),(276866,17,61),(276815,17,64),(276820,17,65),(276816,17,67),(276867,17,69),(276827,17,70),(276868,17,71),(276839,17,72),(276869,17,73),(276818,17,74),(276870,17,75),(276817,17,76),(276871,17,101),(276872,17,102),(276835,17,103),(276838,17,111),(276874,18,1),(276877,18,2),(276876,18,3),(276880,18,6),(276879,18,11),(276873,18,18),(276878,18,70),(276875,18,76),(276891,19,1),(276897,19,2),(276896,19,3),(276901,19,6),(276900,19,11),(276883,19,13),(276884,19,18),(276881,19,19),(276882,19,21),(276885,19,33),(276894,19,36),(276899,19,44),(276898,19,47),(276890,19,49),(276886,19,53),(276893,19,54),(276892,19,58),(276895,19,70),(276887,19,72),(276888,19,76),(276889,19,111),(276911,20,1),(276923,20,2),(276922,20,3),(276921,20,5),(276920,20,6),(276903,20,9),(276919,20,11),(276904,20,13),(276910,20,15),(276905,20,16),(276918,20,17),(276909,20,18),(276917,20,19),(276902,20,20),(276916,20,21),(276924,20,22),(276925,20,30),(276926,20,31),(276927,20,32),(276928,20,33),(276929,20,34),(276908,20,35),(276930,20,36),(276931,20,37),(276932,20,38),(276933,20,39),(276934,20,40),(276935,20,41),(276936,20,42),(276937,20,43),(276938,20,44),(276939,20,45),(276940,20,47),(276941,20,48),(276913,20,49),(276942,20,50),(276943,20,51),(276944,20,52),(276945,20,53),(276946,20,54),(276947,20,55),(276948,20,56),(276914,20,57),(276949,20,58),(276915,20,59),(276950,20,60),(276951,20,61),(276952,20,64),(276906,20,65),(276953,20,67),(276954,20,69),(276955,20,70),(276956,20,71),(276957,20,72),(276958,20,73),(276959,20,74),(276960,20,75),(276907,20,76),(276961,20,101),(276962,20,102),(276912,20,103),(276963,20,111),(276973,21,1),(276979,21,2),(276978,21,3),(276983,21,6),(276982,21,11),(276965,21,13),(276966,21,18),(276964,21,21),(276967,21,33),(276976,21,36),(276981,21,44),(276980,21,47),(276972,21,49),(276968,21,53),(276975,21,54),(276974,21,58),(276977,21,70),(276969,21,72),(276970,21,76),(276971,21,111),(276988,22,1),(276997,22,2),(276996,22,3),(277004,22,6),(277001,22,11),(276985,22,13),(276987,22,18),(276986,22,21),(276984,22,22),(276989,22,33),(277000,22,36),(277003,22,44),(277002,22,47),(276994,22,49),(276990,22,53),(276999,22,54),(276998,22,58),(276995,22,70),(276991,22,72),(276992,22,76),(276993,22,111),(277017,30,1),(277031,30,2),(277030,30,3),(277006,30,5),(277040,30,6),(277018,30,9),(277041,30,11),(277019,30,13),(277025,30,15),(277020,30,16),(277039,30,17),(277016,30,18),(277038,30,19),(277007,30,20),(277015,30,21),(277008,30,22),(277005,30,30),(277037,30,31),(277036,30,32),(277014,30,33),(277035,30,34),(277013,30,35),(277034,30,36),(277033,30,37),(277032,30,38),(277042,30,39),(277043,30,40),(277044,30,41),(277045,30,42),(277046,30,43),(277047,30,44),(277048,30,45),(277049,30,47),(277050,30,48),(277024,30,49),(277051,30,50),(277052,30,51),(277053,30,52),(277009,30,53),(277054,30,54),(277055,30,55),(277056,30,56),(277023,30,57),(277057,30,58),(277022,30,59),(277058,30,60),(277059,30,61),(277010,30,64),(277021,30,65),(277060,30,67),(277061,30,69),(277029,30,70),(277062,30,71),(277028,30,72),(277063,30,73),(277064,30,74),(277027,30,75),(277011,30,76),(277065,30,101),(277066,30,102),(277026,30,103),(277012,30,111),(277068,31,1),(277069,31,2),(277070,31,3),(277074,31,6),(277073,31,11),(277067,31,31),(277071,31,70),(277072,31,76),(277076,32,1),(277077,32,2),(277078,32,3),(277082,32,6),(277081,32,11),(277075,32,32),(277079,32,70),(277080,32,76),(277083,33,33),(277085,34,1),(277090,34,2),(277089,34,3),(277093,34,6),(277092,34,11),(277086,34,13),(277087,34,33),(277084,34,34),(277088,34,70),(277091,34,76),(277095,35,1),(277101,35,2),(277100,35,3),(277103,35,6),(277102,35,11),(277094,35,35),(277099,35,70),(277096,35,75),(277097,35,76),(277098,35,111),(277108,36,1),(277110,36,2),(277109,36,3),(277114,36,6),(277113,36,11),(277104,36,36),(277105,36,44),(277106,36,47),(277111,36,70),(277112,36,76),(277107,36,111),(277116,37,1),(277121,37,2),(277120,37,3),(277123,37,6),(277122,37,11),(277115,37,37),(277119,37,70),(277117,37,74),(277118,37,76),(277130,38,1),(277133,38,2),(277132,38,3),(277135,38,6),(277134,38,11),(277125,38,13),(277126,38,37),(277124,38,38),(277127,38,64),(277131,38,70),(277129,38,74),(277128,38,76),(277144,39,1),(277154,39,2),(277153,39,3),(277137,39,5),(277161,39,6),(277158,39,11),(277147,39,13),(277143,39,18),(277138,39,21),(277142,39,33),(277141,39,35),(277157,39,36),(277136,39,39),(277160,39,44),(277159,39,47),(277150,39,49),(277145,39,53),(277156,39,54),(277149,39,56),(277139,39,57),(277155,39,58),(277152,39,70),(277148,39,72),(277151,39,75),(277140,39,76),(277146,39,111),(277163,40,1),(277166,40,2),(277165,40,3),(277176,40,6),(277174,40,11),(277169,40,36),(277162,40,40),(277173,40,44),(277172,40,47),(277164,40,49),(277170,40,54),(277171,40,58),(277167,40,70),(277168,40,76),(277175,40,111),(277185,41,1),(277189,41,2),(277188,41,3),(277195,41,6),(277194,41,11),(277178,41,13),(277179,41,35),(277186,41,36),(277180,41,40),(277177,41,41),(277193,41,44),(277192,41,47),(277182,41,49),(277190,41,54),(277191,41,58),(277187,41,70),(277184,41,75),(277181,41,76),(277183,41,111),(277202,42,1),(277210,42,2),(277209,42,3),(277212,42,6),(277211,42,11),(277197,42,35),(277203,42,36),(277196,42,42),(277207,42,44),(277206,42,47),(277198,42,49),(277204,42,54),(277205,42,58),(277208,42,70),(277201,42,75),(277199,42,76),(277200,42,111),(277221,43,1),(277225,43,2),(277224,43,3),(277232,43,6),(277231,43,11),(277214,43,13),(277215,43,18),(277219,43,35),(277226,43,36),(277216,43,42),(277213,43,43),(277230,43,44),(277229,43,47),(277218,43,49),(277227,43,54),(277228,43,58),(277223,43,70),(277222,43,75),(277220,43,76),(277217,43,111),(277234,44,1),(277235,44,2),(277236,44,3),(277240,44,6),(277239,44,11),(277233,44,44),(277237,44,70),(277238,44,76),(277244,45,1),(277246,45,2),(277245,45,3),(277250,45,6),(277249,45,11),(277242,45,13),(277243,45,44),(277241,45,45),(277247,45,70),(277248,45,76),(277252,47,1),(277255,47,2),(277254,47,3),(277259,47,6),(277258,47,11),(277251,47,47),(277256,47,70),(277257,47,76),(277253,47,111),(277270,48,1),(277276,48,2),(277275,48,3),(277278,48,6),(277277,48,11),(277261,48,13),(277262,48,35),(277266,48,36),(277273,48,44),(277263,48,47),(277260,48,48),(277264,48,49),(277271,48,54),(277272,48,58),(277265,48,69),(277274,48,70),(277269,48,75),(277268,48,76),(277267,48,111),(277283,49,1),(277289,49,2),(277288,49,3),(277292,49,6),(277291,49,11),(277280,49,36),(277285,49,44),(277284,49,47),(277279,49,49),(277281,49,54),(277282,49,58),(277287,49,70),(277286,49,76),(277290,49,111),(277309,50,1),(277318,50,2),(277317,50,3),(277313,50,5),(277320,50,6),(277319,50,11),(277294,50,13),(277308,50,18),(277295,50,21),(277307,50,33),(277296,50,35),(277302,50,36),(277315,50,44),(277314,50,47),(277297,50,49),(277293,50,50),(277306,50,53),(277310,50,54),(277312,50,56),(277298,50,57),(277311,50,58),(277299,50,59),(277300,50,60),(277316,50,70),(277305,50,72),(277304,50,75),(277301,50,76),(277303,50,111),(277322,51,1),(277331,51,2),(277330,51,3),(277342,51,6),(277338,51,11),(277327,51,13),(277332,51,18),(277323,51,21),(277333,51,33),(277324,51,35),(277341,51,36),(277344,51,44),(277343,51,47),(277337,51,49),(277321,51,51),(277334,51,53),(277340,51,54),(277339,51,58),(277329,51,70),(277335,51,72),(277325,51,74),(277326,51,75),(277328,51,76),(277336,51,111),(277353,52,1),(277359,52,2),(277358,52,3),(277368,52,6),(277364,52,11),(277346,52,13),(277356,52,18),(277347,52,19),(277352,52,21),(277355,52,33),(277351,52,35),(277367,52,36),(277370,52,44),(277369,52,47),(277363,52,49),(277348,52,51),(277345,52,52),(277360,52,53),(277366,52,54),(277365,52,58),(277357,52,70),(277361,52,72),(277350,52,74),(277354,52,75),(277349,52,76),(277362,52,111),(277372,53,1),(277373,53,2),(277374,53,3),(277378,53,6),(277377,53,11),(277371,53,53),(277375,53,70),(277376,53,76),(277380,54,1),(277381,54,2),(277382,54,3),(277386,54,6),(277385,54,11),(277379,54,54),(277383,54,70),(277384,54,76),(277390,55,1),(277392,55,2),(277391,55,3),(277396,55,6),(277395,55,11),(277388,55,13),(277389,55,54),(277387,55,55),(277393,55,70),(277394,55,76),(277398,56,1),(277399,56,2),(277400,56,3),(277404,56,6),(277403,56,11),(277397,56,56),(277401,56,70),(277402,56,76),(277410,57,1),(277413,57,2),(277412,57,3),(277415,57,6),(277414,57,11),(277406,57,13),(277407,57,33),(277408,57,56),(277405,57,57),(277411,57,70),(277409,57,76),(277417,58,1),(277420,58,2),(277419,58,3),(277423,58,6),(277422,58,11),(277416,58,58),(277421,58,70),(277418,58,76),(277428,59,1),(277440,59,2),(277439,59,3),(277447,59,5),(277451,59,6),(277450,59,11),(277425,59,13),(277437,59,18),(277427,59,21),(277436,59,33),(277429,59,35),(277443,59,36),(277449,59,44),(277448,59,47),(277430,59,49),(277426,59,50),(277435,59,53),(277444,59,54),(277446,59,56),(277431,59,57),(277445,59,58),(277424,59,59),(277432,59,60),(277438,59,70),(277434,59,72),(277441,59,75),(277433,59,76),(277442,59,111),(277462,60,1),(277475,60,2),(277474,60,3),(277453,60,5),(277477,60,6),(277476,60,11),(277468,60,13),(277461,60,18),(277460,60,21),(277459,60,33),(277454,60,35),(277465,60,36),(277471,60,44),(277470,60,47),(277455,60,49),(277458,60,53),(277466,60,54),(277469,60,56),(277456,60,57),(277467,60,58),(277452,60,60),(277473,60,70),(277472,60,72),(277464,60,75),(277457,60,76),(277463,60,111),(277482,61,1),(277486,61,2),(277485,61,3),(277490,61,6),(277489,61,11),(277479,61,13),(277480,61,36),(277481,61,44),(277483,61,47),(277478,61,61),(277484,61,70),(277487,61,76),(277488,61,111),(277491,62,62),(277492,64,64),(277507,65,1),(277516,65,2),(277515,65,3),(277517,65,5),(277521,65,6),(277520,65,11),(277494,65,13),(277495,65,18),(277511,65,21),(277501,65,33),(277496,65,35),(277504,65,36),(277513,65,44),(277512,65,47),(277497,65,49),(277509,65,50),(277519,65,53),(277503,65,54),(277508,65,56),(277498,65,57),(277502,65,58),(277499,65,59),(277510,65,60),(277493,65,65),(277514,65,70),(277518,65,72),(277506,65,75),(277500,65,76),(277505,65,111),(277526,66,1),(277525,66,2),(277527,66,3),(277528,66,5),(277529,66,6),(277523,66,9),(277530,66,11),(277531,66,13),(277532,66,15),(277533,66,16),(277534,66,17),(277535,66,18),(277536,66,19),(277537,66,20),(277538,66,21),(277539,66,22),(277540,66,30),(277541,66,31),(277542,66,32),(277543,66,33),(277544,66,34),(277545,66,35),(277546,66,36),(277547,66,37),(277548,66,38),(277549,66,39),(277550,66,40),(277551,66,41),(277552,66,42),(277553,66,43),(277554,66,44),(277555,66,45),(277556,66,47),(277557,66,48),(277558,66,49),(277559,66,50),(277560,66,51),(277561,66,52),(277562,66,53),(277563,66,54),(277564,66,55),(277565,66,56),(277566,66,57),(277567,66,58),(277568,66,59),(277569,66,60),(277570,66,61),(277571,66,64),(277572,66,65),(277522,66,66),(277573,66,67),(277574,66,69),(277575,66,70),(277576,66,71),(277577,66,72),(277578,66,73),(277579,66,74),(277580,66,75),(277581,66,76),(277582,66,101),(277583,66,102),(277524,66,103),(277584,66,111),(277589,67,1),(277602,67,2),(277601,67,3),(277586,67,5),(277608,67,6),(277604,67,11),(277599,67,13),(277588,67,18),(277590,67,21),(277591,67,33),(277592,67,35),(277607,67,36),(277587,67,37),(277610,67,44),(277609,67,47),(277603,67,49),(277593,67,53),(277606,67,54),(277605,67,58),(277585,67,67),(277600,67,70),(277598,67,72),(277596,67,74),(277597,67,75),(277594,67,76),(277595,67,111),(277619,69,1),(277625,69,2),(277624,69,3),(277627,69,6),(277626,69,11),(277612,69,35),(277620,69,36),(277622,69,44),(277613,69,47),(277614,69,49),(277621,69,54),(277615,69,58),(277611,69,69),(277623,69,70),(277618,69,75),(277617,69,76),(277616,69,111),(277630,70,6),(277629,70,11),(277628,70,70),(277632,71,1),(277635,71,2),(277634,71,3),(277639,71,6),(277638,71,11),(277633,71,58),(277636,71,70),(277631,71,71),(277637,71,76),(277646,72,1),(277653,72,2),(277652,72,3),(277655,72,6),(277654,72,11),(277641,72,18),(277644,72,36),(277650,72,44),(277649,72,47),(277642,72,49),(277647,72,54),(277648,72,58),(277651,72,70),(277640,72,72),(277645,72,76),(277643,72,111),(277662,73,1),(277673,73,2),(277672,73,3),(277657,73,5),(277679,73,6),(277675,73,11),(277670,73,13),(277661,73,18),(277658,73,19),(277660,73,21),(277663,73,33),(277664,73,35),(277678,73,36),(277681,73,44),(277680,73,47),(277674,73,49),(277665,73,53),(277677,73,54),(277676,73,58),(277659,73,64),(277671,73,70),(277669,73,72),(277656,73,73),(277668,73,75),(277666,73,76),(277667,73,111),(277682,74,74),(277683,75,75),(277684,76,76),(277686,100,1),(277687,100,2),(277688,100,3),(277689,100,5),(277690,100,6),(277691,100,9),(277692,100,11),(277693,100,13),(277694,100,15),(277695,100,16),(277696,100,17),(277697,100,18),(277698,100,19),(277699,100,20),(277700,100,21),(277701,100,22),(277702,100,30),(277703,100,31),(277704,100,32),(277705,100,33),(277706,100,34),(277707,100,35),(277708,100,36),(277709,100,37),(277710,100,38),(277711,100,39),(277712,100,40),(277713,100,41),(277714,100,42),(277715,100,43),(277716,100,44),(277717,100,45),(277718,100,47),(277719,100,48),(277720,100,49),(277721,100,50),(277722,100,51),(277723,100,52),(277724,100,53),(277725,100,54),(277726,100,55),(277727,100,56),(277728,100,57),(277729,100,58),(277730,100,59),(277731,100,60),(277732,100,61),(277733,100,62),(277734,100,64),(277735,100,65),(277736,100,66),(277737,100,67),(277738,100,69),(277739,100,70),(277740,100,71),(277741,100,72),(277742,100,73),(277743,100,74),(277744,100,75),(277745,100,76),(277685,100,100),(277746,100,101),(277747,100,102),(277748,100,103),(277749,100,104),(277750,100,105),(277751,100,106),(277752,100,107),(277753,100,108),(277754,100,109),(277755,100,110),(277756,100,111),(277757,100,112),(277758,100,114),(277759,100,115),(277760,100,119),(277762,100,120),(277761,100,121),(277769,101,1),(277773,101,2),(277772,101,3),(277775,101,6),(277774,101,11),(277764,101,13),(277765,101,18),(277766,101,35),(277771,101,70),(277767,101,75),(277768,101,76),(277763,101,101),(277770,101,111),(277777,102,1),(277782,102,2),(277781,102,3),(277787,102,6),(277786,102,11),(277778,102,13),(277779,102,35),(277780,102,70),(277784,102,75),(277783,102,76),(277776,102,102),(277785,102,111),(277789,103,1),(277790,103,2),(277791,103,3),(277792,103,5),(277793,103,6),(277848,103,9),(277794,103,11),(277795,103,13),(277796,103,15),(277797,103,16),(277798,103,17),(277799,103,18),(277800,103,19),(277801,103,20),(277802,103,21),(277803,103,22),(277804,103,30),(277805,103,31),(277806,103,32),(277807,103,33),(277808,103,34),(277809,103,35),(277810,103,36),(277811,103,37),(277812,103,38),(277813,103,39),(277814,103,40),(277815,103,41),(277816,103,42),(277817,103,43),(277818,103,44),(277819,103,45),(277820,103,47),(277821,103,48),(277822,103,49),(277823,103,50),(277824,103,51),(277825,103,52),(277826,103,53),(277827,103,54),(277828,103,55),(277829,103,56),(277830,103,57),(277831,103,58),(277832,103,59),(277833,103,60),(277834,103,61),(277835,103,64),(277836,103,65),(277837,103,67),(277838,103,69),(277839,103,70),(277840,103,71),(277841,103,72),(277842,103,73),(277843,103,74),(277844,103,75),(277845,103,76),(277846,103,101),(277847,103,102),(277788,103,103),(277849,103,111),(277857,104,1),(277856,104,2),(277859,104,3),(277860,104,5),(277861,104,6),(277858,104,9),(277862,104,11),(277863,104,13),(277864,104,15),(277865,104,16),(277866,104,17),(277867,104,18),(277868,104,19),(277869,104,20),(277870,104,21),(277871,104,22),(277872,104,30),(277873,104,31),(277874,104,32),(277875,104,33),(277876,104,34),(277877,104,35),(277878,104,36),(277879,104,37),(277880,104,38),(277881,104,39),(277882,104,40),(277883,104,41),(277884,104,42),(277885,104,43),(277886,104,44),(277887,104,45),(277888,104,47),(277889,104,48),(277890,104,49),(277891,104,50),(277892,104,51),(277893,104,52),(277894,104,53),(277895,104,54),(277896,104,55),(277897,104,56),(277898,104,57),(277899,104,58),(277900,104,59),(277901,104,60),(277902,104,61),(277922,104,62),(277903,104,64),(277904,104,65),(277854,104,66),(277905,104,67),(277906,104,69),(277907,104,70),(277908,104,71),(277909,104,72),(277910,104,73),(277911,104,74),(277912,104,75),(277913,104,76),(277851,104,100),(277914,104,101),(277915,104,102),(277853,104,103),(277850,104,104),(277919,104,105),(277918,104,106),(277925,104,107),(277927,104,108),(277926,104,109),(277923,104,110),(277916,104,111),(277920,104,112),(277921,104,114),(277852,104,115),(277924,104,119),(277855,104,120),(277917,104,121),(277928,105,105),(277931,106,6),(277930,106,11),(277929,106,106),(277943,107,1),(277956,107,2),(277955,107,3),(277934,107,5),(277958,107,6),(277957,107,11),(277949,107,13),(277942,107,18),(277941,107,21),(277940,107,33),(277935,107,35),(277946,107,36),(277952,107,44),(277951,107,47),(277936,107,49),(277939,107,53),(277947,107,54),(277950,107,56),(277937,107,57),(277948,107,58),(277933,107,60),(277954,107,70),(277953,107,72),(277945,107,75),(277938,107,76),(277932,107,107),(277944,107,111),(277960,108,1),(277961,108,2),(277962,108,3),(277966,108,6),(277965,108,11),(277963,108,70),(277964,108,76),(277959,108,108),(277971,109,1),(277973,109,2),(277972,109,3),(277976,109,6),(277975,109,11),(277968,109,13),(277969,109,18),(277974,109,70),(277970,109,76),(277967,109,109),(277978,110,1),(277981,110,2),(277980,110,3),(277984,110,6),(277983,110,11),(277982,110,70),(277979,110,76),(277977,110,110),(277985,111,111),(277987,112,1),(277990,112,2),(277989,112,3),(278000,112,6),(277998,112,11),(277993,112,36),(277997,112,44),(277996,112,47),(277988,112,49),(277994,112,54),(277995,112,58),(277991,112,70),(277992,112,76),(277999,112,111),(277986,112,112),(278005,114,1),(278007,114,2),(278006,114,3),(278017,114,6),(278015,114,11),(278002,114,13),(278010,114,36),(278014,114,44),(278013,114,47),(278004,114,49),(278011,114,54),(278012,114,58),(278008,114,70),(278009,114,76),(278016,114,111),(278003,114,112),(278001,114,114),(278023,115,1),(278022,115,2),(278025,115,3),(278026,115,5),(278027,115,6),(278024,115,9),(278028,115,11),(278029,115,13),(278030,115,15),(278031,115,16),(278032,115,17),(278033,115,18),(278034,115,19),(278035,115,20),(278036,115,21),(278037,115,22),(278038,115,30),(278039,115,31),(278040,115,32),(278041,115,33),(278042,115,34),(278043,115,35),(278044,115,36),(278045,115,37),(278046,115,38),(278047,115,39),(278048,115,40),(278049,115,41),(278050,115,42),(278051,115,43),(278052,115,44),(278053,115,45),(278054,115,47),(278055,115,48),(278056,115,49),(278057,115,50),(278058,115,51),(278059,115,52),(278060,115,53),(278061,115,54),(278062,115,55),(278063,115,56),(278064,115,57),(278065,115,58),(278066,115,59),(278067,115,60),(278068,115,61),(278069,115,64),(278070,115,65),(278019,115,66),(278071,115,67),(278072,115,69),(278073,115,70),(278074,115,71),(278075,115,72),(278076,115,73),(278077,115,74),(278078,115,75),(278079,115,76),(278080,115,101),(278081,115,102),(278020,115,103),(278082,115,111),(278018,115,115),(278021,115,120),(278085,119,1),(278088,119,2),(278087,119,3),(278091,119,6),(278090,119,11),(278089,119,70),(278086,119,76),(278084,119,110),(278083,119,119),(278119,120,1),(278123,120,2),(278122,120,3),(278121,120,5),(278124,120,6),(278116,120,9),(278125,120,11),(278117,120,13),(278126,120,15),(278127,120,16),(278128,120,17),(278129,120,18),(278130,120,19),(278131,120,20),(278132,120,21),(278133,120,22),(278134,120,30),(278135,120,31),(278136,120,32),(278137,120,33),(278138,120,34),(278139,120,35),(278140,120,36),(278141,120,37),(278142,120,38),(278143,120,39),(278144,120,40),(278145,120,41),(278146,120,42),(278147,120,43),(278148,120,44),(278149,120,45),(278150,120,47),(278151,120,48),(278152,120,49),(278153,120,50),(278154,120,51),(278155,120,52),(278156,120,53),(278157,120,54),(278158,120,55),(278159,120,56),(278160,120,57),(278161,120,58),(278162,120,59),(278163,120,60),(278164,120,61),(278165,120,64),(278166,120,65),(278118,120,66),(278167,120,67),(278168,120,69),(278169,120,70),(278170,120,71),(278171,120,72),(278172,120,73),(278173,120,74),(278174,120,75),(278175,120,76),(278176,120,101),(278177,120,102),(278120,120,103),(278178,120,111),(278115,120,120),(278101,121,1),(278106,121,2),(278105,121,3),(278112,121,6),(278108,121,11),(278096,121,13),(278095,121,18),(278093,121,21),(278097,121,33),(278094,121,35),(278111,121,36),(278114,121,44),(278113,121,47),(278107,121,49),(278098,121,53),(278110,121,54),(278109,121,58),(278104,121,70),(278099,121,72),(278102,121,75),(278100,121,76),(278103,121,111),(278092,121,121); +INSERT INTO `roleRole` VALUES (285864,1,1),(285865,1,2),(285866,1,3),(285870,1,6),(285869,1,11),(285867,1,70),(285868,1,76),(285871,2,2),(285873,2,6),(285872,2,11),(285874,3,3),(285876,3,6),(285875,3,11),(285878,5,1),(285891,5,2),(285890,5,3),(285877,5,5),(285897,5,6),(285893,5,11),(285888,5,13),(285879,5,18),(285880,5,21),(285881,5,33),(285882,5,35),(285896,5,36),(285899,5,44),(285898,5,47),(285892,5,49),(285883,5,53),(285895,5,54),(285894,5,58),(285889,5,70),(285887,5,72),(285886,5,75),(285884,5,76),(285885,5,111),(285900,6,6),(285903,9,1),(285904,9,2),(285905,9,3),(285906,9,5),(285907,9,6),(285901,9,9),(285908,9,11),(285909,9,13),(285910,9,15),(285911,9,16),(285912,9,17),(285913,9,18),(285914,9,19),(285915,9,20),(285916,9,21),(285917,9,22),(285918,9,30),(285919,9,31),(285920,9,32),(285921,9,33),(285922,9,34),(285923,9,35),(285924,9,36),(285925,9,37),(285926,9,38),(285927,9,39),(285928,9,40),(285929,9,41),(285930,9,42),(285931,9,43),(285932,9,44),(285933,9,45),(285934,9,47),(285935,9,48),(285936,9,49),(285937,9,50),(285938,9,51),(285939,9,52),(285940,9,53),(285941,9,54),(285942,9,55),(285943,9,56),(285944,9,57),(285945,9,58),(285946,9,59),(285947,9,60),(285948,9,61),(285949,9,64),(285950,9,65),(285951,9,67),(285952,9,69),(285953,9,70),(285954,9,71),(285955,9,72),(285956,9,73),(285957,9,74),(285958,9,75),(285959,9,76),(285960,9,101),(285961,9,102),(285902,9,103),(285963,9,111),(285962,9,122),(285965,11,6),(285964,11,11),(285967,13,1),(285968,13,2),(285969,13,3),(285973,13,6),(285972,13,11),(285966,13,13),(285970,13,70),(285971,13,76),(285980,15,1),(285989,15,2),(285988,15,3),(285991,15,6),(285990,15,11),(285974,15,15),(285975,15,35),(285982,15,36),(285986,15,44),(285985,15,47),(285976,15,49),(285983,15,54),(285977,15,56),(285984,15,58),(285987,15,70),(285979,15,75),(285978,15,76),(285981,15,111),(286000,16,1),(286009,16,2),(286008,16,3),(286011,16,6),(286010,16,11),(285994,16,15),(285992,16,16),(285995,16,35),(286002,16,36),(286006,16,44),(286005,16,47),(285996,16,49),(286003,16,54),(285997,16,56),(286004,16,58),(286007,16,70),(285999,16,75),(285998,16,76),(286001,16,111),(285993,16,122),(286020,17,1),(286036,17,2),(286035,17,3),(286027,17,5),(286059,17,6),(286024,17,9),(286058,17,11),(286023,17,13),(286057,17,15),(286022,17,16),(286012,17,17),(286019,17,18),(286056,17,19),(286013,17,20),(286028,17,21),(286055,17,22),(286054,17,30),(286053,17,31),(286052,17,32),(286030,17,33),(286051,17,34),(286038,17,35),(286033,17,36),(286014,17,37),(286050,17,38),(286015,17,39),(286049,17,40),(286048,17,41),(286047,17,42),(286046,17,43),(286045,17,44),(286060,17,45),(286061,17,47),(286062,17,48),(286025,17,49),(286063,17,50),(286064,17,51),(286065,17,52),(286041,17,53),(286032,17,54),(286066,17,55),(286044,17,56),(286029,17,57),(286031,17,58),(286037,17,59),(286067,17,60),(286068,17,61),(286016,17,64),(286021,17,65),(286017,17,67),(286069,17,69),(286034,17,70),(286070,17,71),(286043,17,72),(286071,17,73),(286026,17,74),(286072,17,75),(286018,17,76),(286073,17,101),(286074,17,102),(286040,17,103),(286042,17,111),(286039,17,122),(286076,18,1),(286079,18,2),(286078,18,3),(286082,18,6),(286081,18,11),(286075,18,18),(286080,18,70),(286077,18,76),(286093,19,1),(286099,19,2),(286098,19,3),(286103,19,6),(286102,19,11),(286085,19,13),(286086,19,18),(286083,19,19),(286084,19,21),(286087,19,33),(286096,19,36),(286101,19,44),(286100,19,47),(286092,19,49),(286088,19,53),(286095,19,54),(286094,19,58),(286097,19,70),(286089,19,72),(286090,19,76),(286091,19,111),(286113,20,1),(286125,20,2),(286124,20,3),(286123,20,5),(286122,20,6),(286105,20,9),(286121,20,11),(286106,20,13),(286120,20,15),(286107,20,16),(286119,20,17),(286111,20,18),(286118,20,19),(286104,20,20),(286126,20,21),(286127,20,22),(286128,20,30),(286129,20,31),(286130,20,32),(286131,20,33),(286132,20,34),(286110,20,35),(286133,20,36),(286134,20,37),(286135,20,38),(286136,20,39),(286137,20,40),(286138,20,41),(286139,20,42),(286140,20,43),(286141,20,44),(286142,20,45),(286143,20,47),(286144,20,48),(286115,20,49),(286145,20,50),(286146,20,51),(286147,20,52),(286148,20,53),(286149,20,54),(286150,20,55),(286151,20,56),(286116,20,57),(286152,20,58),(286117,20,59),(286153,20,60),(286154,20,61),(286155,20,64),(286108,20,65),(286156,20,67),(286157,20,69),(286158,20,70),(286159,20,71),(286160,20,72),(286161,20,73),(286162,20,74),(286163,20,75),(286109,20,76),(286164,20,101),(286165,20,102),(286114,20,103),(286166,20,111),(286112,20,122),(286176,21,1),(286182,21,2),(286181,21,3),(286186,21,6),(286185,21,11),(286168,21,13),(286169,21,18),(286167,21,21),(286170,21,33),(286179,21,36),(286184,21,44),(286183,21,47),(286175,21,49),(286171,21,53),(286178,21,54),(286177,21,58),(286180,21,70),(286172,21,72),(286173,21,76),(286174,21,111),(286191,22,1),(286200,22,2),(286199,22,3),(286207,22,6),(286204,22,11),(286188,22,13),(286190,22,18),(286189,22,21),(286187,22,22),(286192,22,33),(286203,22,36),(286206,22,44),(286205,22,47),(286197,22,49),(286193,22,53),(286202,22,54),(286201,22,58),(286198,22,70),(286194,22,72),(286195,22,76),(286196,22,111),(286220,30,1),(286234,30,2),(286233,30,3),(286209,30,5),(286243,30,6),(286221,30,9),(286244,30,11),(286222,30,13),(286242,30,15),(286223,30,16),(286241,30,17),(286219,30,18),(286240,30,19),(286210,30,20),(286218,30,21),(286211,30,22),(286208,30,30),(286239,30,31),(286238,30,32),(286217,30,33),(286237,30,34),(286216,30,35),(286236,30,36),(286235,30,37),(286245,30,38),(286246,30,39),(286247,30,40),(286248,30,41),(286249,30,42),(286250,30,43),(286251,30,44),(286252,30,45),(286253,30,47),(286254,30,48),(286227,30,49),(286255,30,50),(286256,30,51),(286257,30,52),(286212,30,53),(286258,30,54),(286259,30,55),(286260,30,56),(286226,30,57),(286261,30,58),(286225,30,59),(286262,30,60),(286263,30,61),(286213,30,64),(286224,30,65),(286264,30,67),(286265,30,69),(286232,30,70),(286266,30,71),(286231,30,72),(286267,30,73),(286268,30,74),(286230,30,75),(286214,30,76),(286269,30,101),(286270,30,102),(286229,30,103),(286215,30,111),(286228,30,122),(286272,31,1),(286273,31,2),(286274,31,3),(286278,31,6),(286277,31,11),(286271,31,31),(286275,31,70),(286276,31,76),(286280,32,1),(286281,32,2),(286282,32,3),(286286,32,6),(286285,32,11),(286279,32,32),(286283,32,70),(286284,32,76),(286287,33,33),(286289,34,1),(286294,34,2),(286293,34,3),(286297,34,6),(286296,34,11),(286290,34,13),(286291,34,33),(286288,34,34),(286292,34,70),(286295,34,76),(286299,35,1),(286305,35,2),(286304,35,3),(286307,35,6),(286306,35,11),(286298,35,35),(286303,35,70),(286300,35,75),(286301,35,76),(286302,35,111),(286312,36,1),(286314,36,2),(286313,36,3),(286318,36,6),(286317,36,11),(286308,36,36),(286309,36,44),(286310,36,47),(286315,36,70),(286316,36,76),(286311,36,111),(286320,37,1),(286329,37,2),(286328,37,3),(286335,37,6),(286333,37,11),(286321,37,18),(286326,37,36),(286319,37,37),(286332,37,44),(286331,37,47),(286322,37,49),(286325,37,54),(286330,37,58),(286327,37,70),(286323,37,74),(286324,37,76),(286334,37,111),(286344,38,1),(286348,38,2),(286347,38,3),(286355,38,6),(286353,38,11),(286337,38,13),(286343,38,18),(286345,38,36),(286338,38,37),(286336,38,38),(286352,38,44),(286351,38,47),(286342,38,49),(286349,38,54),(286350,38,58),(286339,38,64),(286346,38,70),(286341,38,74),(286340,38,76),(286354,38,111),(286364,39,1),(286374,39,2),(286373,39,3),(286357,39,5),(286381,39,6),(286378,39,11),(286367,39,13),(286363,39,18),(286358,39,21),(286362,39,33),(286361,39,35),(286377,39,36),(286356,39,39),(286380,39,44),(286379,39,47),(286370,39,49),(286365,39,53),(286376,39,54),(286369,39,56),(286359,39,57),(286375,39,58),(286372,39,70),(286368,39,72),(286371,39,75),(286360,39,76),(286366,39,111),(286383,40,1),(286386,40,2),(286385,40,3),(286396,40,6),(286394,40,11),(286389,40,36),(286382,40,40),(286393,40,44),(286392,40,47),(286384,40,49),(286390,40,54),(286391,40,58),(286387,40,70),(286388,40,76),(286395,40,111),(286405,41,1),(286409,41,2),(286408,41,3),(286415,41,6),(286414,41,11),(286398,41,13),(286399,41,35),(286406,41,36),(286400,41,40),(286397,41,41),(286413,41,44),(286412,41,47),(286402,41,49),(286410,41,54),(286411,41,58),(286407,41,70),(286404,41,75),(286401,41,76),(286403,41,111),(286422,42,1),(286430,42,2),(286429,42,3),(286432,42,6),(286431,42,11),(286417,42,35),(286423,42,36),(286416,42,42),(286427,42,44),(286426,42,47),(286418,42,49),(286424,42,54),(286425,42,58),(286428,42,70),(286421,42,75),(286419,42,76),(286420,42,111),(286441,43,1),(286445,43,2),(286444,43,3),(286452,43,6),(286451,43,11),(286434,43,13),(286435,43,18),(286439,43,35),(286446,43,36),(286436,43,42),(286433,43,43),(286450,43,44),(286449,43,47),(286438,43,49),(286447,43,54),(286448,43,58),(286443,43,70),(286442,43,75),(286440,43,76),(286437,43,111),(286454,44,1),(286455,44,2),(286456,44,3),(286460,44,6),(286459,44,11),(286453,44,44),(286457,44,70),(286458,44,76),(286464,45,1),(286466,45,2),(286465,45,3),(286470,45,6),(286469,45,11),(286462,45,13),(286463,45,44),(286461,45,45),(286467,45,70),(286468,45,76),(286472,47,1),(286475,47,2),(286474,47,3),(286479,47,6),(286478,47,11),(286471,47,47),(286476,47,70),(286477,47,76),(286473,47,111),(286490,48,1),(286496,48,2),(286495,48,3),(286498,48,6),(286497,48,11),(286481,48,13),(286482,48,35),(286486,48,36),(286493,48,44),(286483,48,47),(286480,48,48),(286484,48,49),(286491,48,54),(286492,48,58),(286485,48,69),(286494,48,70),(286489,48,75),(286488,48,76),(286487,48,111),(286503,49,1),(286509,49,2),(286508,49,3),(286512,49,6),(286511,49,11),(286500,49,36),(286505,49,44),(286504,49,47),(286499,49,49),(286501,49,54),(286502,49,58),(286507,49,70),(286506,49,76),(286510,49,111),(286529,50,1),(286538,50,2),(286537,50,3),(286533,50,5),(286540,50,6),(286539,50,11),(286514,50,13),(286528,50,18),(286515,50,21),(286527,50,33),(286516,50,35),(286522,50,36),(286535,50,44),(286534,50,47),(286517,50,49),(286513,50,50),(286526,50,53),(286530,50,54),(286532,50,56),(286518,50,57),(286531,50,58),(286519,50,59),(286520,50,60),(286536,50,70),(286525,50,72),(286524,50,75),(286521,50,76),(286523,50,111),(286542,51,1),(286551,51,2),(286550,51,3),(286562,51,6),(286558,51,11),(286547,51,13),(286552,51,18),(286543,51,21),(286553,51,33),(286544,51,35),(286561,51,36),(286564,51,44),(286563,51,47),(286557,51,49),(286541,51,51),(286554,51,53),(286560,51,54),(286559,51,58),(286549,51,70),(286555,51,72),(286545,51,74),(286546,51,75),(286548,51,76),(286556,51,111),(286573,52,1),(286579,52,2),(286578,52,3),(286588,52,6),(286584,52,11),(286566,52,13),(286576,52,18),(286567,52,19),(286572,52,21),(286575,52,33),(286571,52,35),(286587,52,36),(286590,52,44),(286589,52,47),(286583,52,49),(286568,52,51),(286565,52,52),(286580,52,53),(286586,52,54),(286585,52,58),(286577,52,70),(286581,52,72),(286570,52,74),(286574,52,75),(286569,52,76),(286582,52,111),(286592,53,1),(286593,53,2),(286594,53,3),(286598,53,6),(286597,53,11),(286591,53,53),(286595,53,70),(286596,53,76),(286600,54,1),(286601,54,2),(286602,54,3),(286606,54,6),(286605,54,11),(286599,54,54),(286603,54,70),(286604,54,76),(286610,55,1),(286612,55,2),(286611,55,3),(286616,55,6),(286615,55,11),(286608,55,13),(286609,55,54),(286607,55,55),(286613,55,70),(286614,55,76),(286618,56,1),(286619,56,2),(286620,56,3),(286624,56,6),(286623,56,11),(286617,56,56),(286621,56,70),(286622,56,76),(286630,57,1),(286633,57,2),(286632,57,3),(286635,57,6),(286634,57,11),(286626,57,13),(286627,57,33),(286628,57,56),(286625,57,57),(286631,57,70),(286629,57,76),(286637,58,1),(286640,58,2),(286639,58,3),(286643,58,6),(286642,58,11),(286636,58,58),(286641,58,70),(286638,58,76),(286648,59,1),(286660,59,2),(286659,59,3),(286667,59,5),(286671,59,6),(286670,59,11),(286645,59,13),(286657,59,18),(286647,59,21),(286656,59,33),(286649,59,35),(286663,59,36),(286669,59,44),(286668,59,47),(286650,59,49),(286646,59,50),(286655,59,53),(286664,59,54),(286666,59,56),(286651,59,57),(286665,59,58),(286644,59,59),(286652,59,60),(286658,59,70),(286654,59,72),(286661,59,75),(286653,59,76),(286662,59,111),(286682,60,1),(286695,60,2),(286694,60,3),(286673,60,5),(286697,60,6),(286696,60,11),(286688,60,13),(286681,60,18),(286680,60,21),(286679,60,33),(286674,60,35),(286685,60,36),(286691,60,44),(286690,60,47),(286675,60,49),(286678,60,53),(286686,60,54),(286689,60,56),(286676,60,57),(286687,60,58),(286672,60,60),(286693,60,70),(286692,60,72),(286684,60,75),(286677,60,76),(286683,60,111),(286702,61,1),(286706,61,2),(286705,61,3),(286710,61,6),(286709,61,11),(286699,61,13),(286700,61,36),(286701,61,44),(286703,61,47),(286698,61,61),(286704,61,70),(286707,61,76),(286708,61,111),(286711,62,62),(286712,64,64),(286727,65,1),(286736,65,2),(286735,65,3),(286737,65,5),(286741,65,6),(286740,65,11),(286714,65,13),(286715,65,18),(286731,65,21),(286721,65,33),(286716,65,35),(286724,65,36),(286733,65,44),(286732,65,47),(286717,65,49),(286729,65,50),(286739,65,53),(286723,65,54),(286728,65,56),(286718,65,57),(286722,65,58),(286719,65,59),(286730,65,60),(286713,65,65),(286734,65,70),(286738,65,72),(286726,65,75),(286720,65,76),(286725,65,111),(286746,66,1),(286745,66,2),(286747,66,3),(286748,66,5),(286749,66,6),(286743,66,9),(286750,66,11),(286751,66,13),(286752,66,15),(286753,66,16),(286754,66,17),(286755,66,18),(286756,66,19),(286757,66,20),(286758,66,21),(286759,66,22),(286760,66,30),(286761,66,31),(286762,66,32),(286763,66,33),(286764,66,34),(286765,66,35),(286766,66,36),(286767,66,37),(286768,66,38),(286769,66,39),(286770,66,40),(286771,66,41),(286772,66,42),(286773,66,43),(286774,66,44),(286775,66,45),(286776,66,47),(286777,66,48),(286778,66,49),(286779,66,50),(286780,66,51),(286781,66,52),(286782,66,53),(286783,66,54),(286784,66,55),(286785,66,56),(286786,66,57),(286787,66,58),(286788,66,59),(286789,66,60),(286790,66,61),(286791,66,64),(286792,66,65),(286742,66,66),(286793,66,67),(286794,66,69),(286795,66,70),(286796,66,71),(286797,66,72),(286798,66,73),(286799,66,74),(286800,66,75),(286801,66,76),(286802,66,101),(286803,66,102),(286744,66,103),(286805,66,111),(286804,66,122),(286810,67,1),(286827,67,2),(286826,67,3),(286807,67,5),(286831,67,6),(286830,67,11),(286824,67,13),(286809,67,18),(286811,67,21),(286812,67,33),(286813,67,35),(286821,67,36),(286808,67,37),(286829,67,44),(286828,67,47),(286817,67,49),(286814,67,53),(286820,67,54),(286819,67,58),(286806,67,67),(286825,67,70),(286823,67,72),(286818,67,74),(286822,67,75),(286815,67,76),(286816,67,111),(286840,69,1),(286846,69,2),(286845,69,3),(286848,69,6),(286847,69,11),(286833,69,35),(286841,69,36),(286843,69,44),(286834,69,47),(286835,69,49),(286842,69,54),(286836,69,58),(286832,69,69),(286844,69,70),(286839,69,75),(286838,69,76),(286837,69,111),(286851,70,6),(286850,70,11),(286849,70,70),(286853,71,1),(286856,71,2),(286855,71,3),(286860,71,6),(286859,71,11),(286854,71,58),(286857,71,70),(286852,71,71),(286858,71,76),(286867,72,1),(286874,72,2),(286873,72,3),(286876,72,6),(286875,72,11),(286862,72,18),(286865,72,36),(286871,72,44),(286870,72,47),(286863,72,49),(286868,72,54),(286869,72,58),(286872,72,70),(286861,72,72),(286866,72,76),(286864,72,111),(286883,73,1),(286894,73,2),(286893,73,3),(286878,73,5),(286900,73,6),(286896,73,11),(286891,73,13),(286882,73,18),(286879,73,19),(286881,73,21),(286884,73,33),(286885,73,35),(286899,73,36),(286902,73,44),(286901,73,47),(286895,73,49),(286886,73,53),(286898,73,54),(286897,73,58),(286880,73,64),(286892,73,70),(286890,73,72),(286877,73,73),(286889,73,75),(286887,73,76),(286888,73,111),(286903,74,74),(286904,75,75),(286905,76,76),(286907,100,1),(286908,100,2),(286909,100,3),(286910,100,5),(286911,100,6),(286912,100,9),(286913,100,11),(286914,100,13),(286915,100,15),(286916,100,16),(286917,100,17),(286918,100,18),(286919,100,19),(286920,100,20),(286921,100,21),(286922,100,22),(286923,100,30),(286924,100,31),(286925,100,32),(286926,100,33),(286927,100,34),(286928,100,35),(286929,100,36),(286930,100,37),(286931,100,38),(286932,100,39),(286933,100,40),(286934,100,41),(286935,100,42),(286936,100,43),(286937,100,44),(286938,100,45),(286939,100,47),(286940,100,48),(286941,100,49),(286942,100,50),(286943,100,51),(286944,100,52),(286945,100,53),(286946,100,54),(286947,100,55),(286948,100,56),(286949,100,57),(286950,100,58),(286951,100,59),(286952,100,60),(286953,100,61),(286954,100,62),(286955,100,64),(286956,100,65),(286957,100,66),(286958,100,67),(286959,100,69),(286960,100,70),(286961,100,71),(286962,100,72),(286963,100,73),(286964,100,74),(286965,100,75),(286966,100,76),(286906,100,100),(286967,100,101),(286968,100,102),(286969,100,103),(286970,100,104),(286971,100,105),(286972,100,106),(286973,100,107),(286974,100,108),(286975,100,109),(286976,100,110),(286977,100,111),(286978,100,112),(286979,100,114),(286980,100,115),(286981,100,119),(286984,100,120),(286982,100,121),(286983,100,122),(286991,101,1),(286995,101,2),(286994,101,3),(286997,101,6),(286996,101,11),(286986,101,13),(286987,101,18),(286988,101,35),(286993,101,70),(286989,101,75),(286990,101,76),(286985,101,101),(286992,101,111),(286999,102,1),(287004,102,2),(287003,102,3),(287009,102,6),(287008,102,11),(287000,102,13),(287001,102,35),(287002,102,70),(287006,102,75),(287005,102,76),(286998,102,102),(287007,102,111),(287011,103,1),(287012,103,2),(287013,103,3),(287014,103,5),(287015,103,6),(287070,103,9),(287016,103,11),(287017,103,13),(287018,103,15),(287019,103,16),(287020,103,17),(287021,103,18),(287022,103,19),(287023,103,20),(287024,103,21),(287025,103,22),(287026,103,30),(287027,103,31),(287028,103,32),(287029,103,33),(287030,103,34),(287031,103,35),(287032,103,36),(287033,103,37),(287034,103,38),(287035,103,39),(287036,103,40),(287037,103,41),(287038,103,42),(287039,103,43),(287040,103,44),(287041,103,45),(287042,103,47),(287043,103,48),(287044,103,49),(287045,103,50),(287046,103,51),(287047,103,52),(287048,103,53),(287049,103,54),(287050,103,55),(287051,103,56),(287052,103,57),(287053,103,58),(287054,103,59),(287055,103,60),(287056,103,61),(287057,103,64),(287058,103,65),(287059,103,67),(287060,103,69),(287061,103,70),(287062,103,71),(287063,103,72),(287064,103,73),(287065,103,74),(287066,103,75),(287067,103,76),(287068,103,101),(287069,103,102),(287010,103,103),(287072,103,111),(287071,103,122),(287080,104,1),(287079,104,2),(287082,104,3),(287083,104,5),(287084,104,6),(287081,104,9),(287085,104,11),(287086,104,13),(287087,104,15),(287088,104,16),(287089,104,17),(287090,104,18),(287091,104,19),(287092,104,20),(287093,104,21),(287094,104,22),(287095,104,30),(287096,104,31),(287097,104,32),(287098,104,33),(287099,104,34),(287100,104,35),(287101,104,36),(287102,104,37),(287103,104,38),(287104,104,39),(287105,104,40),(287106,104,41),(287107,104,42),(287108,104,43),(287109,104,44),(287110,104,45),(287111,104,47),(287112,104,48),(287113,104,49),(287114,104,50),(287115,104,51),(287116,104,52),(287117,104,53),(287118,104,54),(287119,104,55),(287120,104,56),(287121,104,57),(287122,104,58),(287123,104,59),(287124,104,60),(287125,104,61),(287146,104,62),(287126,104,64),(287127,104,65),(287077,104,66),(287128,104,67),(287129,104,69),(287130,104,70),(287131,104,71),(287132,104,72),(287133,104,73),(287134,104,74),(287135,104,75),(287136,104,76),(287074,104,100),(287137,104,101),(287138,104,102),(287076,104,103),(287073,104,104),(287143,104,105),(287142,104,106),(287149,104,107),(287151,104,108),(287150,104,109),(287147,104,110),(287140,104,111),(287144,104,112),(287145,104,114),(287075,104,115),(287148,104,119),(287078,104,120),(287141,104,121),(287139,104,122),(287152,105,105),(287155,106,6),(287154,106,11),(287153,106,106),(287167,107,1),(287180,107,2),(287179,107,3),(287158,107,5),(287182,107,6),(287181,107,11),(287173,107,13),(287166,107,18),(287165,107,21),(287164,107,33),(287159,107,35),(287170,107,36),(287176,107,44),(287175,107,47),(287160,107,49),(287163,107,53),(287171,107,54),(287174,107,56),(287161,107,57),(287172,107,58),(287157,107,60),(287178,107,70),(287177,107,72),(287169,107,75),(287162,107,76),(287156,107,107),(287168,107,111),(287184,108,1),(287185,108,2),(287186,108,3),(287190,108,6),(287189,108,11),(287187,108,70),(287188,108,76),(287183,108,108),(287195,109,1),(287197,109,2),(287196,109,3),(287200,109,6),(287199,109,11),(287192,109,13),(287193,109,18),(287198,109,70),(287194,109,76),(287191,109,109),(287202,110,1),(287205,110,2),(287204,110,3),(287208,110,6),(287207,110,11),(287206,110,70),(287203,110,76),(287201,110,110),(287209,111,111),(287211,112,1),(287214,112,2),(287213,112,3),(287224,112,6),(287222,112,11),(287217,112,36),(287221,112,44),(287220,112,47),(287212,112,49),(287218,112,54),(287219,112,58),(287215,112,70),(287216,112,76),(287223,112,111),(287210,112,112),(287229,114,1),(287231,114,2),(287230,114,3),(287241,114,6),(287239,114,11),(287226,114,13),(287234,114,36),(287238,114,44),(287237,114,47),(287228,114,49),(287235,114,54),(287236,114,58),(287232,114,70),(287233,114,76),(287240,114,111),(287227,114,112),(287225,114,114),(287247,115,1),(287246,115,2),(287249,115,3),(287250,115,5),(287251,115,6),(287248,115,9),(287252,115,11),(287253,115,13),(287254,115,15),(287255,115,16),(287256,115,17),(287257,115,18),(287258,115,19),(287259,115,20),(287260,115,21),(287261,115,22),(287262,115,30),(287263,115,31),(287264,115,32),(287265,115,33),(287266,115,34),(287267,115,35),(287268,115,36),(287269,115,37),(287270,115,38),(287271,115,39),(287272,115,40),(287273,115,41),(287274,115,42),(287275,115,43),(287276,115,44),(287277,115,45),(287278,115,47),(287279,115,48),(287280,115,49),(287281,115,50),(287282,115,51),(287283,115,52),(287284,115,53),(287285,115,54),(287286,115,55),(287287,115,56),(287288,115,57),(287289,115,58),(287290,115,59),(287291,115,60),(287292,115,61),(287293,115,64),(287294,115,65),(287243,115,66),(287295,115,67),(287296,115,69),(287297,115,70),(287298,115,71),(287299,115,72),(287300,115,73),(287301,115,74),(287302,115,75),(287303,115,76),(287304,115,101),(287305,115,102),(287244,115,103),(287307,115,111),(287242,115,115),(287245,115,120),(287306,115,122),(287310,119,1),(287313,119,2),(287312,119,3),(287316,119,6),(287315,119,11),(287314,119,70),(287311,119,76),(287309,119,110),(287308,119,119),(287363,120,1),(287367,120,2),(287366,120,3),(287365,120,5),(287368,120,6),(287360,120,9),(287369,120,11),(287361,120,13),(287370,120,15),(287371,120,16),(287372,120,17),(287373,120,18),(287374,120,19),(287375,120,20),(287376,120,21),(287377,120,22),(287378,120,30),(287379,120,31),(287380,120,32),(287381,120,33),(287382,120,34),(287383,120,35),(287384,120,36),(287385,120,37),(287386,120,38),(287387,120,39),(287388,120,40),(287389,120,41),(287390,120,42),(287391,120,43),(287392,120,44),(287393,120,45),(287394,120,47),(287395,120,48),(287396,120,49),(287397,120,50),(287398,120,51),(287399,120,52),(287400,120,53),(287401,120,54),(287402,120,55),(287403,120,56),(287404,120,57),(287405,120,58),(287406,120,59),(287407,120,60),(287408,120,61),(287409,120,64),(287410,120,65),(287362,120,66),(287411,120,67),(287412,120,69),(287413,120,70),(287414,120,71),(287415,120,72),(287416,120,73),(287417,120,74),(287418,120,75),(287419,120,76),(287420,120,101),(287421,120,102),(287364,120,103),(287423,120,111),(287359,120,120),(287422,120,122),(287326,121,1),(287331,121,2),(287330,121,3),(287337,121,6),(287333,121,11),(287321,121,13),(287320,121,18),(287318,121,21),(287322,121,33),(287319,121,35),(287336,121,36),(287339,121,44),(287338,121,47),(287332,121,49),(287323,121,53),(287335,121,54),(287334,121,58),(287329,121,70),(287324,121,72),(287327,121,75),(287325,121,76),(287328,121,111),(287317,121,121),(287347,122,1),(287356,122,2),(287355,122,3),(287358,122,6),(287357,122,11),(287341,122,15),(287342,122,35),(287349,122,36),(287353,122,44),(287352,122,47),(287343,122,49),(287350,122,54),(287344,122,56),(287351,122,58),(287354,122,70),(287346,122,75),(287345,122,76),(287348,122,111),(287340,122,122); /*!40000 ALTER TABLE `roleRole` ENABLE KEYS */; UNLOCK TABLES; @@ -140,11 +140,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-06-26 8:40:02 +-- Dump completed on 2023-08-30 15:53:15 USE `salix`; --- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db1.static.verdnatura.es Database: salix +-- Host: db2.static.verdnatura.es Database: salix -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -164,7 +164,7 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','claimManager'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','claimManager'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','logisticBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'Calendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'Calendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','*','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','deliveryBoss'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','claimManager'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(222,'Client','*','READ','ALLOW','ROLE','trainee'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','find','READ','ALLOW','ROLE','hr'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'),(236,'Buy','*','*','ALLOW','ROLE','buyer'),(237,'WorkerDms','filter','*','ALLOW','ROLE','employee'),(238,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(239,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(240,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative'),(242,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(244,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(248,'RoleMapping','*','READ','ALLOW','ROLE','account'),(249,'UserPassword','*','READ','ALLOW','ROLE','account'),(250,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(251,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(252,'Supplier','*','READ','ALLOW','ROLE','employee'),(253,'Supplier','*','WRITE','ALLOW','ROLE','administrative'),(254,'SupplierLog','*','READ','ALLOW','ROLE','employee'),(256,'Image','*','WRITE','ALLOW','ROLE','employee'),(257,'FixedPrice','*','*','ALLOW','ROLE','buyer'),(258,'PayDem','*','READ','ALLOW','ROLE','employee'),(259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant'),(260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee'),(261,'SupplierAccount','*','*','ALLOW','ROLE','administrative'),(262,'Entry','*','*','ALLOW','ROLE','administrative'),(263,'InvoiceIn','*','*','ALLOW','ROLE','administrative'),(264,'StarredModule','*','*','ALLOW','ROLE','employee'),(265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss'),(266,'ZoneLog','*','READ','ALLOW','ROLE','employee'),(267,'Genus','*','WRITE','ALLOW','ROLE','logisticBoss'),(268,'Specie','*','WRITE','ALLOW','ROLE','logisticBoss'),(269,'InvoiceOut','createPdf','WRITE','ALLOW','ROLE','employee'),(270,'SupplierAddress','*','*','ALLOW','ROLE','employee'),(271,'SalesMonitor','*','*','ALLOW','ROLE','employee'),(272,'InvoiceInLog','*','READ','ALLOW','ROLE','employee'),(273,'InvoiceInTax','*','*','ALLOW','ROLE','administrative'),(274,'InvoiceInLog','*','READ','ALLOW','ROLE','administrative'),(275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'),(276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'),(277,'Role','*','*','ALLOW','ROLE','it'),(278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'),(279,'MailAlias','*','*','ALLOW','ROLE','marketing'),(283,'EntryObservation','*','*','ALLOW','ROLE','buyer'),(284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'),(285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'),(286,'ACL','*','*','ALLOW','ROLE','developer'),(287,'AccessToken','*','*','ALLOW','ROLE','developer'),(288,'MailAliasAccount','*','*','ALLOW','ROLE','marketing'),(289,'MailAliasAccount','*','*','ALLOW','ROLE','hr'),(291,'MailForward','*','*','ALLOW','ROLE','marketing'),(292,'MailForward','*','*','ALLOW','ROLE','hr'),(293,'RoleInherit','*','*','ALLOW','ROLE','it'),(294,'RoleRole','*','*','ALLOW','ROLE','it'),(295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'),(296,'Collection','*','READ','ALLOW','ROLE','employee'),(297,'Sale','refund','WRITE','ALLOW','ROLE','invoicing'),(298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'),(299,'Collection','setSaleQuantity','*','ALLOW','ROLE','employee'),(302,'AgencyTerm','*','*','ALLOW','ROLE','administrative'),(303,'ClaimLog','*','READ','ALLOW','ROLE','claimManager'),(304,'Edi','updateData','WRITE','ALLOW','ROLE','employee'),(305,'EducationLevel','*','*','ALLOW','ROLE','employee'),(306,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(307,'SupplierAgencyTerm','*','*','ALLOW','ROLE','administrative'),(308,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(309,'Zone','getZoneClosing','*','ALLOW','ROLE','employee'),(310,'ExpeditionState','*','READ','ALLOW','ROLE','employee'),(311,'Expense','*','READ','ALLOW','ROLE','employee'),(312,'Expense','*','WRITE','ALLOW','ROLE','administrative'),(314,'SupplierActivity','*','READ','ALLOW','ROLE','employee'),(315,'SupplierActivity','*','WRITE','ALLOW','ROLE','administrative'),(316,'Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee'),(317,'ClientUnpaid','*','*','ALLOW','ROLE','administrative'),(318,'MdbVersion','*','*','ALLOW','ROLE','developer'),(319,'ItemType','*','READ','ALLOW','ROLE','employee'),(320,'ItemType','*','WRITE','ALLOW','ROLE','buyer'),(321,'InvoiceOut','refund','WRITE','ALLOW','ROLE','invoicing'),(322,'InvoiceOut','refund','WRITE','ALLOW','ROLE','salesAssistant'),(323,'InvoiceOut','refund','WRITE','ALLOW','ROLE','claimManager'),(324,'Ticket','refund','WRITE','ALLOW','ROLE','invoicing'),(325,'Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'),(326,'Ticket','refund','WRITE','ALLOW','ROLE','claimManager'),(327,'Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'),(328,'Sale','refund','WRITE','ALLOW','ROLE','claimManager'),(329,'TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'),(330,'ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'),(331,'ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'),(332,'Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),(333,'Client','updateUser','WRITE','ALLOW','ROLE','salesPerson'),(334,'ShelvingLog','*','READ','ALLOW','ROLE','employee'),(335,'ZoneExclusionGeo','*','READ','ALLOW','ROLE','employee'),(336,'ZoneExclusionGeo','*','WRITE','ALLOW','ROLE','deliveryBoss'),(337,'Parking','*','*','ALLOW','ROLE','employee'),(338,'Shelving','*','*','ALLOW','ROLE','employee'),(339,'OsTicket','*','*','ALLOW','ROLE','employee'),(340,'OsTicketConfig','*','*','ALLOW','ROLE','it'),(341,'ClientConsumptionQueue','*','WRITE','ALLOW','ROLE','employee'),(342,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','employee'),(343,'Ticket','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(344,'Ticket','deliveryNoteCsvPdf','READ','ALLOW','ROLE','employee'),(345,'Ticket','deliveryNoteCsvEmail','READ','ALLOW','ROLE','employee'),(346,'Client','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(347,'Client','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(348,'Client','clientWelcomeHtml','READ','ALLOW','ROLE','employee'),(349,'Client','clientWelcomeEmail','WRITE','ALLOW','ROLE','employee'),(350,'Client','creditRequestPdf','READ','ALLOW','ROLE','employee'),(351,'Client','creditRequestHtml','READ','ALLOW','ROLE','employee'),(352,'Client','creditRequestEmail','WRITE','ALLOW','ROLE','employee'),(353,'Client','printerSetupHtml','READ','ALLOW','ROLE','employee'),(354,'Client','printerSetupEmail','WRITE','ALLOW','ROLE','employee'),(355,'Client','sepaCoreEmail','WRITE','ALLOW','ROLE','employee'),(356,'Client','letterDebtorPdf','READ','ALLOW','ROLE','employee'),(357,'Client','letterDebtorStHtml','READ','ALLOW','ROLE','employee'),(358,'Client','letterDebtorStEmail','WRITE','ALLOW','ROLE','employee'),(359,'Client','letterDebtorNdHtml','READ','ALLOW','ROLE','employee'),(360,'Client','letterDebtorNdEmail','WRITE','ALLOW','ROLE','employee'),(361,'Client','clientDebtStatementPdf','READ','ALLOW','ROLE','employee'),(362,'Client','clientDebtStatementHtml','READ','ALLOW','ROLE','employee'),(363,'Client','clientDebtStatementEmail','WRITE','ALLOW','ROLE','employee'),(364,'Client','incotermsAuthorizationPdf','READ','ALLOW','ROLE','employee'),(365,'Client','incotermsAuthorizationHtml','READ','ALLOW','ROLE','employee'),(366,'Client','incotermsAuthorizationEmail','WRITE','ALLOW','ROLE','employee'),(367,'Client','consumptionSendQueued','WRITE','ALLOW','ROLE','system'),(368,'InvoiceOut','invoiceEmail','WRITE','ALLOW','ROLE','employee'),(369,'InvoiceOut','exportationPdf','READ','ALLOW','ROLE','employee'),(370,'InvoiceOut','sendQueued','WRITE','ALLOW','ROLE','system'),(371,'Ticket','invoiceCsvPdf','READ','ALLOW','ROLE','employee'),(372,'Ticket','invoiceCsvEmail','WRITE','ALLOW','ROLE','employee'),(373,'Supplier','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(374,'Supplier','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(375,'Travel','extraCommunityPdf','READ','ALLOW','ROLE','employee'),(376,'Travel','extraCommunityEmail','WRITE','ALLOW','ROLE','employee'),(377,'Entry','entryOrderPdf','READ','ALLOW','ROLE','employee'),(378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','ROLE','system'),(379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system'),(380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee'),(381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager'),(382,'Item','labelPdf','READ','ALLOW','ROLE','employee'),(383,'Sector','*','READ','ALLOW','ROLE','employee'),(384,'Sector','*','WRITE','ALLOW','ROLE','employee'),(385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee'),(386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'),(387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'),(388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'),(389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager'),(390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'),(391,'Notification','*','WRITE','ALLOW','ROLE','system'),(392,'Boxing','*','*','ALLOW','ROLE','employee'),(393,'Url','*','READ','ALLOW','ROLE','employee'),(394,'Url','*','WRITE','ALLOW','ROLE','it'),(395,'ItemShelving','*','READ','ALLOW','ROLE','employee'),(396,'ItemShelving','*','WRITE','ALLOW','ROLE','production'),(397,'ItemShelvingPlacementSupplyStock','*','READ','ALLOW','ROLE','employee'),(398,'NotificationQueue','*','*','ALLOW','ROLE','employee'),(399,'InvoiceOut','clientsToInvoice','WRITE','ALLOW','ROLE','invoicing'),(400,'InvoiceOut','invoiceClient','WRITE','ALLOW','ROLE','invoicing'),(401,'Sale','editTracked','WRITE','ALLOW','ROLE','production'),(402,'Sale','editFloramondo','WRITE','ALLOW','ROLE','salesAssistant'),(403,'Receipt','balanceCompensationEmail','WRITE','ALLOW','ROLE','employee'),(404,'Receipt','balanceCompensationPdf','READ','ALLOW','ROLE','employee'),(405,'Ticket','getTicketsFuture','READ','ALLOW','ROLE','employee'),(406,'Ticket','merge','WRITE','ALLOW','ROLE','employee'),(407,'Sale','editFloramondo','WRITE','ALLOW','ROLE','logistic'),(408,'ZipConfig','*','*','ALLOW','ROLE','employee'),(409,'Item','*','WRITE','ALLOW','ROLE','administrative'),(410,'Sale','editCloned','WRITE','ALLOW','ROLE','buyer'),(411,'Sale','editCloned','WRITE','ALLOW','ROLE','salesAssistant'),(414,'MdbVersion','*','READ','ALLOW','ROLE','$everyone'),(416,'TicketLog','getChanges','READ','ALLOW','ROLE','employee'),(417,'Ticket','getTicketsAdvance','READ','ALLOW','ROLE','employee'),(418,'EntryLog','*','READ','ALLOW','ROLE','administrative'),(419,'Sale','editTracked','WRITE','ALLOW','ROLE','buyer'),(420,'MdbBranch','*','READ','ALLOW','ROLE','$everyone'),(421,'ItemShelvingSale','*','*','ALLOW','ROLE','employee'),(422,'Docuware','checkFile','READ','ALLOW','ROLE','employee'),(423,'Docuware','download','READ','ALLOW','ROLE','salesPerson'),(424,'Docuware','upload','WRITE','ALLOW','ROLE','productionAssi'),(425,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','salesPerson'),(426,'TpvTransaction','confirm','WRITE','ALLOW','ROLE','$everyone'),(427,'TpvTransaction','start','WRITE','ALLOW','ROLE','$authenticated'),(428,'TpvTransaction','end','WRITE','ALLOW','ROLE','$authenticated'),(429,'ItemConfig','*','READ','ALLOW','ROLE','employee'),(431,'Tag','onSubmit','WRITE','ALLOW','ROLE','employee'),(432,'Worker','updateAttributes','WRITE','ALLOW','ROLE','hr'),(433,'Worker','createAbsence','*','ALLOW','ROLE','employee'),(434,'Worker','updateAbsence','WRITE','ALLOW','ROLE','employee'),(435,'Worker','deleteAbsence','*','ALLOW','ROLE','employee'),(436,'Worker','new','WRITE','ALLOW','ROLE','hr'),(437,'Role','*','READ','ALLOW','ROLE','hr'),(438,'Client','getClientOrSupplierReference','READ','ALLOW','ROLE','employee'),(439,'NotificationSubscription','*','*','ALLOW','ROLE','employee'),(440,'NotificationAcl','*','READ','ALLOW','ROLE','employee'),(441,'MdbApp','*','READ','ALLOW','ROLE','$everyone'),(442,'MdbApp','*','*','ALLOW','ROLE','developer'),(443,'ItemConfig','*','*','ALLOW','ROLE','employee'),(444,'DeviceProduction','*','*','ALLOW','ROLE','hr'),(445,'DeviceProductionModels','*','*','ALLOW','ROLE','hr'),(446,'DeviceProductionState','*','*','ALLOW','ROLE','hr'),(447,'DeviceProductionUser','*','*','ALLOW','ROLE','hr'),(448,'DeviceProduction','*','*','ALLOW','ROLE','productionAssi'),(449,'DeviceProductionModels','*','*','ALLOW','ROLE','productionAssi'),(450,'DeviceProductionState','*','*','ALLOW','ROLE','productionAssi'),(451,'DeviceProductionUser','*','*','ALLOW','ROLE','productionAssi'),(452,'Worker','deallocatePDA','*','ALLOW','ROLE','hr'),(453,'Worker','allocatePDA','*','ALLOW','ROLE','hr'),(454,'Worker','deallocatePDA','*','ALLOW','ROLE','productionAssi'),(455,'Worker','allocatePDA','*','ALLOW','ROLE','productionAssi'),(456,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(457,'Account','setPassword','WRITE','ALLOW','ROLE','itManagement'),(458,'Operator','*','READ','ALLOW','ROLE','employee'),(459,'Operator','*','WRITE','ALLOW','ROLE','employee'),(460,'InvoiceIn','getSerial','READ','ALLOW','ROLE','administrative'),(461,'Ticket','saveSign','WRITE','ALLOW','ROLE','employee'),(462,'InvoiceOut','negativeBases','READ','ALLOW','ROLE','administrative'),(463,'InvoiceOut','negativeBasesCsv','READ','ALLOW','ROLE','administrative'),(464,'WorkerObservation','*','*','ALLOW','ROLE','hr'),(465,'ClientInforma','*','READ','ALLOW','ROLE','employee'),(466,'ClientInforma','*','WRITE','ALLOW','ROLE','financial'),(467,'Receipt','receiptEmail','*','ALLOW','ROLE','salesAssistant'),(468,'Client','setRating','WRITE','ALLOW','ROLE','financial'),(469,'Client','*','READ','ALLOW','ROLE','employee'),(470,'Client','addressesPropagateRe','*','ALLOW','ROLE','employee'),(471,'Client','canBeInvoiced','*','ALLOW','ROLE','employee'),(472,'Client','canCreateTicket','*','ALLOW','ROLE','employee'),(473,'Client','consumption','*','ALLOW','ROLE','employee'),(474,'Client','createAddress','*','ALLOW','ROLE','employee'),(475,'Client','createWithUser','*','ALLOW','ROLE','employee'),(476,'Client','extendedListFilter','*','ALLOW','ROLE','employee'),(477,'Client','getAverageInvoiced','*','ALLOW','ROLE','employee'),(478,'Client','getCard','*','ALLOW','ROLE','employee'),(479,'Client','getDebt','*','ALLOW','ROLE','employee'),(480,'Client','getMana','*','ALLOW','ROLE','employee'),(481,'Client','transactions','*','ALLOW','ROLE','employee'),(482,'Client','hasCustomerRole','*','ALLOW','ROLE','employee'),(483,'Client','isValidClient','*','ALLOW','ROLE','employee'),(484,'Client','lastActiveTickets','*','ALLOW','ROLE','employee'),(485,'Client','sendSms','*','ALLOW','ROLE','employee'),(486,'Client','setPassword','*','ALLOW','ROLE','employee'),(487,'Client','summary','*','ALLOW','ROLE','employee'),(488,'Client','updateAddress','*','ALLOW','ROLE','employee'),(489,'Client','updateFiscalData','*','ALLOW','ROLE','employee'),(491,'Client','uploadFile','*','ALLOW','ROLE','employee'),(492,'Client','campaignMetricsPdf','*','ALLOW','ROLE','employee'),(493,'Client','campaignMetricsEmail','*','ALLOW','ROLE','employee'),(494,'Client','clientWelcomeHtml','*','ALLOW','ROLE','employee'),(495,'Client','clientWelcomeEmail','*','ALLOW','ROLE','employee'),(496,'Client','printerSetupHtml','*','ALLOW','ROLE','employee'),(497,'Client','printerSetupEmail','*','ALLOW','ROLE','employee'),(498,'Client','sepaCoreEmail','*','ALLOW','ROLE','employee'),(499,'Client','letterDebtorPdf','*','ALLOW','ROLE','employee'),(500,'Client','letterDebtorStHtml','*','ALLOW','ROLE','employee'),(501,'Client','letterDebtorStEmail','*','ALLOW','ROLE','employee'),(502,'Client','letterDebtorNdHtml','*','ALLOW','ROLE','employee'),(503,'Client','letterDebtorNdEmail','*','ALLOW','ROLE','employee'),(504,'Client','clientDebtStatementPdf','*','ALLOW','ROLE','employee'),(505,'Client','clientDebtStatementHtml','*','ALLOW','ROLE','employee'),(506,'Client','clientDebtStatementEmail','*','ALLOW','ROLE','employee'),(507,'Client','creditRequestPdf','*','ALLOW','ROLE','employee'),(508,'Client','creditRequestHtml','*','ALLOW','ROLE','employee'),(509,'Client','creditRequestEmail','*','ALLOW','ROLE','employee'),(510,'Client','incotermsAuthorizationPdf','*','ALLOW','ROLE','employee'),(511,'Client','incotermsAuthorizationHtml','*','ALLOW','ROLE','employee'),(512,'Client','incotermsAuthorizationEmail','*','ALLOW','ROLE','employee'),(513,'Client','consumptionSendQueued','*','ALLOW','ROLE','employee'),(514,'Client','filter','*','ALLOW','ROLE','employee'),(515,'Client','getClientOrSupplierReference','*','ALLOW','ROLE','employee'),(516,'Client','upsert','*','ALLOW','ROLE','employee'),(517,'Client','create','*','ALLOW','ROLE','employee'),(518,'Client','replaceById','*','ALLOW','ROLE','employee'),(519,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(520,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(521,'Client','deleteById','*','ALLOW','ROLE','employee'),(522,'Client','replaceOrCreate','*','ALLOW','ROLE','employee'),(523,'Client','updateAll','*','ALLOW','ROLE','employee'),(524,'Client','upsertWithWhere','*','ALLOW','ROLE','employee'),(525,'Defaulter','observationEmail','WRITE','ALLOW','ROLE','employee'),(526,'VnUser','*','*','ALLOW','ROLE','employee'),(527,'VnUser','acl','READ','ALLOW','ROLE','account'),(528,'VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'),(529,'VnUser','changePassword','WRITE','ALLOW','ROLE','account'),(530,'Account','exists','READ','ALLOW','ROLE','account'),(531,'Account','exists','READ','ALLOW','ROLE','account'),(532,'UserLog','*','READ','ALLOW','ROLE','employee'),(533,'RoleLog','*','READ','ALLOW','ROLE','employee'),(534,'WagonType','*','*','ALLOW','ROLE','productionAssi'),(535,'WagonTypeColor','*','*','ALLOW','ROLE','productionAssi'),(536,'WagonTypeTray','*','*','ALLOW','ROLE','productionAssi'),(537,'WagonConfig','*','*','ALLOW','ROLE','productionAssi'),(538,'CollectionWagon','*','*','ALLOW','ROLE','productionAssi'),(539,'CollectionWagonTicket','*','*','ALLOW','ROLE','productionAssi'),(540,'Wagon','*','*','ALLOW','ROLE','productionAssi'),(541,'WagonType','createWagonType','*','ALLOW','ROLE','productionAssi'),(542,'WagonType','deleteWagonType','*','ALLOW','ROLE','productionAssi'),(543,'WagonType','editWagonType','*','ALLOW','ROLE','productionAssi'),(544,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(545,'Agency','find','READ','ALLOW','ROLE','employee'),(546,'Agency','seeExpired','READ','ALLOW','ROLE','coolerAssist'),(547,'WorkerLog','models','READ','ALLOW','ROLE','hr'),(548,'Ticket','editDiscount','WRITE','ALLOW','ROLE','claimManager'),(549,'Ticket','editDiscount','WRITE','ALLOW','ROLE','salesPerson'),(550,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','salesAssistant'),(551,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','deliveryBoss'),(552,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','buyer'),(553,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','claimManager'),(554,'Ticket','deleteTicketWithPartPrepared','WRITE','ALLOW','ROLE','salesAssistant'),(555,'Ticket','editZone','WRITE','ALLOW','ROLE','deliveryBoss'),(556,'State','editableStates','READ','ALLOW','ROLE','employee'),(557,'State','seeEditableStates','READ','ALLOW','ROLE','administrative'),(558,'State','seeEditableStates','READ','ALLOW','ROLE','production'),(559,'State','isSomeEditable','READ','ALLOW','ROLE','salesPerson'),(560,'State','isAllEditable','READ','ALLOW','ROLE','production'),(561,'State','isAllEditable','READ','ALLOW','ROLE','administrative'),(562,'Agency','seeExpired','READ','ALLOW','ROLE','administrative'),(563,'Agency','seeExpired','READ','ALLOW','ROLE','productionBoss'),(564,'Claim','createAfterDeadline','WRITE','ALLOW','ROLE','claimManager'),(565,'Client','editAddressLogifloraAllowed','WRITE','ALLOW','ROLE','salesAssistant'),(566,'Client','editFiscalDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(567,'Client','editVerifiedDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(568,'Client','editCredit','WRITE','ALLOW','ROLE','employee'),(569,'Client','isNotEditableCredit','WRITE','ALLOW','ROLE','financialBoss'),(570,'InvoiceOut','canCreatePdf','WRITE','ALLOW','ROLE','invoicing'),(571,'Supplier','editPayMethodCheck','WRITE','ALLOW','ROLE','financial'),(572,'Worker','isTeamBoss','WRITE','ALLOW','ROLE','teamBoss'),(573,'Worker','forceIsSubordinate','READ','ALLOW','ROLE','hr'),(574,'Claim','editState','WRITE','ALLOW','ROLE','claimManager'),(575,'Claim','find','READ','ALLOW','ROLE','salesPerson'),(576,'Claim','findById','READ','ALLOW','ROLE','salesPerson'),(577,'Claim','findOne','READ','ALLOW','ROLE','salesPerson'),(578,'Claim','getSummary','READ','ALLOW','ROLE','salesPerson'),(579,'Claim','updateClaim','WRITE','ALLOW','ROLE','salesPerson'),(580,'Claim','regularizeClaim','WRITE','ALLOW','ROLE','claimManager'),(581,'Claim','updateClaimDestination','WRITE','ALLOW','ROLE','claimManager'),(582,'Claim','downloadFile','READ','ALLOW','ROLE','claimManager'),(583,'Claim','deleteById','WRITE','ALLOW','ROLE','claimManager'),(584,'Claim','filter','READ','ALLOW','ROLE','salesPerson'),(585,'Claim','logs','READ','ALLOW','ROLE','claimManager'),(586,'Ticket','find','READ','ALLOW','ROLE','employee'),(587,'Ticket','findById','READ','ALLOW','ROLE','employee'),(588,'Ticket','findOne','READ','ALLOW','ROLE','employee'),(589,'Ticket','getVolume','READ','ALLOW','ROLE','employee'),(590,'Ticket','getTotalVolume','READ','ALLOW','ROLE','employee'),(591,'Ticket','summary','READ','ALLOW','ROLE','employee'),(592,'Ticket','priceDifference','READ','ALLOW','ROLE','employee'),(593,'Ticket','componentUpdate','WRITE','ALLOW','ROLE','employee'),(594,'Ticket','new','WRITE','ALLOW','ROLE','employee'),(595,'Ticket','isEditable','READ','ALLOW','ROLE','employee'),(596,'Ticket','setDeleted','WRITE','ALLOW','ROLE','employee'),(597,'Ticket','restore','WRITE','ALLOW','ROLE','employee'),(598,'Ticket','getSales','READ','ALLOW','ROLE','employee'),(599,'Ticket','getSalesPersonMana','READ','ALLOW','ROLE','employee'),(600,'Ticket','filter','READ','ALLOW','ROLE','employee'),(601,'Ticket','makeInvoice','WRITE','ALLOW','ROLE','employee'),(602,'Ticket','updateEditableTicket','WRITE','ALLOW','ROLE','employee'),(603,'Ticket','updateDiscount','WRITE','ALLOW','ROLE','employee'),(604,'Ticket','transferSales','WRITE','ALLOW','ROLE','employee'),(605,'Ticket','sendSms','WRITE','ALLOW','ROLE','employee'),(606,'Ticket','isLocked','READ','ALLOW','ROLE','employee'),(607,'Ticket','freightCost','READ','ALLOW','ROLE','employee'),(608,'Ticket','getComponentsSum','READ','ALLOW','ROLE','employee'),(609,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','delivery'),(610,'Ticket','deliveryNoteCsv','READ','ALLOW','ROLE','employee'),(611,'State','find','READ','ALLOW','ROLE','employee'),(612,'State','findById','READ','ALLOW','ROLE','employee'),(613,'State','findOne','READ','ALLOW','ROLE','employee'),(614,'Worker','find','READ','ALLOW','ROLE','employee'),(615,'Worker','findById','READ','ALLOW','ROLE','employee'),(616,'Worker','findOne','READ','ALLOW','ROLE','employee'),(617,'Worker','filter','READ','ALLOW','ROLE','employee'),(618,'Worker','getWorkedHours','READ','ALLOW','ROLE','employee'),(619,'Worker','active','READ','ALLOW','ROLE','employee'),(620,'Worker','activeWithRole','READ','ALLOW','ROLE','employee'),(621,'Worker','uploadFile','WRITE','ALLOW','ROLE','hr'),(622,'Worker','contracts','READ','ALLOW','ROLE','employee'),(623,'Worker','holidays','READ','ALLOW','ROLE','employee'),(624,'Worker','activeContract','READ','ALLOW','ROLE','employee'),(625,'Worker','activeWithInheritedRole','READ','ALLOW','ROLE','employee'),(626,'Ticket','collectionLabel','READ','ALLOW','ROLE','employee'),(628,'Ticket','expeditionPalletLabel','READ','ALLOW','ROLE','employee'),(629,'Ticket','editDiscount','WRITE','ALLOW','ROLE','artificialBoss'),(630,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesTeamBoss'),(635,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','administrative'),(636,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesPerson'),(637,'Claim','downloadFile','READ','ALLOW','ROLE','salesPerson'),(638,'Agency','seeExpired','READ','ALLOW','ROLE','artificialBoss'),(639,'Agency','seeExpired','READ','ALLOW','ROLE','logistic'),(640,'Claim','filter','READ','ALLOW','ROLE','buyer'),(641,'Claim','find','READ','ALLOW','ROLE','buyer'),(642,'Claim','findById','READ','ALLOW','ROLE','buyer'),(643,'Claim','getSummary','READ','ALLOW','ROLE','buyer'),(644,'Claim','filter','READ','ALLOW','ROLE','handmadeBoss'),(645,'Claim','find','READ','ALLOW','ROLE','handmadeBoss'),(646,'Claim','findById','READ','ALLOW','ROLE','handmadeBoss'),(647,'Claim','getSummary','READ','ALLOW','ROLE','handmadeBoss'),(648,'Claim','__get__lines','READ','ALLOW','ROLE','claimManager'),(649,'Claim','__get__lines','READ','ALLOW','ROLE','salesPerson'),(650,'Claim','getSummary','READ','ALLOW','ROLE','deliveryBoss'),(651,'Claim','findById','READ','ALLOW','ROLE','deliveryBoss'),(652,'Claim','find','READ','ALLOW','ROLE','deliveryBoss'),(653,'Claim','filter','READ','ALLOW','ROLE','deliveryBoss'),(654,'Ticket','editZone','WRITE','ALLOW','ROLE','logistic'); +INSERT INTO `ACL` VALUES (3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','claimManager'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','claimManager'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','logisticBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'Calendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'Calendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','*','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','deliveryBoss'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','claimManager'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(222,'Client','*','READ','ALLOW','ROLE','trainee'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','find','READ','ALLOW','ROLE','hr'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'),(236,'Buy','*','*','ALLOW','ROLE','buyer'),(237,'WorkerDms','filter','*','ALLOW','ROLE','employee'),(238,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(239,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(240,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative'),(242,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(244,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(248,'RoleMapping','*','READ','ALLOW','ROLE','account'),(249,'UserPassword','*','READ','ALLOW','ROLE','account'),(250,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(251,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(252,'Supplier','*','READ','ALLOW','ROLE','employee'),(253,'Supplier','*','WRITE','ALLOW','ROLE','administrative'),(254,'SupplierLog','*','READ','ALLOW','ROLE','employee'),(256,'Image','*','WRITE','ALLOW','ROLE','employee'),(257,'FixedPrice','*','*','ALLOW','ROLE','buyer'),(258,'PayDem','*','READ','ALLOW','ROLE','employee'),(259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant'),(260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee'),(261,'SupplierAccount','*','*','ALLOW','ROLE','administrative'),(262,'Entry','*','*','ALLOW','ROLE','administrative'),(263,'InvoiceIn','*','*','ALLOW','ROLE','administrative'),(264,'StarredModule','*','*','ALLOW','ROLE','employee'),(265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss'),(266,'ZoneLog','*','READ','ALLOW','ROLE','employee'),(267,'Genus','*','WRITE','ALLOW','ROLE','logisticBoss'),(268,'Specie','*','WRITE','ALLOW','ROLE','logisticBoss'),(269,'InvoiceOut','createPdf','WRITE','ALLOW','ROLE','employee'),(270,'SupplierAddress','*','*','ALLOW','ROLE','employee'),(271,'SalesMonitor','*','*','ALLOW','ROLE','employee'),(272,'InvoiceInLog','*','READ','ALLOW','ROLE','employee'),(273,'InvoiceInTax','*','*','ALLOW','ROLE','administrative'),(274,'InvoiceInLog','*','READ','ALLOW','ROLE','administrative'),(275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'),(276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'),(278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'),(279,'MailAlias','*','*','ALLOW','ROLE','marketing'),(283,'EntryObservation','*','*','ALLOW','ROLE','buyer'),(284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'),(285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'),(286,'ACL','*','*','ALLOW','ROLE','developer'),(287,'AccessToken','*','*','ALLOW','ROLE','developer'),(293,'RoleInherit','*','*','ALLOW','ROLE','it'),(294,'RoleRole','*','*','ALLOW','ROLE','it'),(295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'),(296,'Collection','*','READ','ALLOW','ROLE','employee'),(297,'Sale','refund','WRITE','ALLOW','ROLE','invoicing'),(298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'),(299,'Collection','setSaleQuantity','*','ALLOW','ROLE','employee'),(302,'AgencyTerm','*','*','ALLOW','ROLE','administrative'),(303,'ClaimLog','*','READ','ALLOW','ROLE','claimManager'),(304,'Edi','updateData','WRITE','ALLOW','ROLE','employee'),(305,'EducationLevel','*','*','ALLOW','ROLE','employee'),(306,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(307,'SupplierAgencyTerm','*','*','ALLOW','ROLE','administrative'),(308,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(309,'Zone','getZoneClosing','*','ALLOW','ROLE','employee'),(310,'ExpeditionState','*','READ','ALLOW','ROLE','employee'),(311,'Expense','*','READ','ALLOW','ROLE','employee'),(312,'Expense','*','WRITE','ALLOW','ROLE','administrative'),(314,'SupplierActivity','*','READ','ALLOW','ROLE','employee'),(315,'SupplierActivity','*','WRITE','ALLOW','ROLE','administrative'),(316,'Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee'),(317,'ClientUnpaid','*','*','ALLOW','ROLE','administrative'),(318,'MdbVersion','*','*','ALLOW','ROLE','developer'),(319,'ItemType','*','READ','ALLOW','ROLE','employee'),(320,'ItemType','*','WRITE','ALLOW','ROLE','buyer'),(321,'InvoiceOut','refund','WRITE','ALLOW','ROLE','invoicing'),(322,'InvoiceOut','refund','WRITE','ALLOW','ROLE','salesAssistant'),(323,'InvoiceOut','refund','WRITE','ALLOW','ROLE','claimManager'),(324,'Ticket','refund','WRITE','ALLOW','ROLE','invoicing'),(325,'Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'),(326,'Ticket','refund','WRITE','ALLOW','ROLE','claimManager'),(327,'Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'),(328,'Sale','refund','WRITE','ALLOW','ROLE','claimManager'),(329,'TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'),(330,'ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'),(331,'ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'),(332,'Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),(333,'Client','updateUser','WRITE','ALLOW','ROLE','salesPerson'),(334,'ShelvingLog','*','READ','ALLOW','ROLE','employee'),(335,'ZoneExclusionGeo','*','READ','ALLOW','ROLE','employee'),(336,'ZoneExclusionGeo','*','WRITE','ALLOW','ROLE','deliveryBoss'),(337,'Parking','*','*','ALLOW','ROLE','employee'),(338,'Shelving','*','*','ALLOW','ROLE','employee'),(339,'OsTicket','*','*','ALLOW','ROLE','employee'),(340,'OsTicketConfig','*','*','ALLOW','ROLE','it'),(341,'ClientConsumptionQueue','*','WRITE','ALLOW','ROLE','employee'),(342,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','employee'),(343,'Ticket','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(344,'Ticket','deliveryNoteCsvPdf','READ','ALLOW','ROLE','employee'),(345,'Ticket','deliveryNoteCsvEmail','READ','ALLOW','ROLE','employee'),(346,'Client','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(347,'Client','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(348,'Client','clientWelcomeHtml','READ','ALLOW','ROLE','employee'),(349,'Client','clientWelcomeEmail','WRITE','ALLOW','ROLE','employee'),(350,'Client','creditRequestPdf','READ','ALLOW','ROLE','employee'),(351,'Client','creditRequestHtml','READ','ALLOW','ROLE','employee'),(352,'Client','creditRequestEmail','WRITE','ALLOW','ROLE','employee'),(353,'Client','printerSetupHtml','READ','ALLOW','ROLE','employee'),(354,'Client','printerSetupEmail','WRITE','ALLOW','ROLE','employee'),(355,'Client','sepaCoreEmail','WRITE','ALLOW','ROLE','employee'),(356,'Client','letterDebtorPdf','READ','ALLOW','ROLE','employee'),(357,'Client','letterDebtorStHtml','READ','ALLOW','ROLE','employee'),(358,'Client','letterDebtorStEmail','WRITE','ALLOW','ROLE','employee'),(359,'Client','letterDebtorNdHtml','READ','ALLOW','ROLE','employee'),(360,'Client','letterDebtorNdEmail','WRITE','ALLOW','ROLE','employee'),(361,'Client','clientDebtStatementPdf','READ','ALLOW','ROLE','employee'),(362,'Client','clientDebtStatementHtml','READ','ALLOW','ROLE','employee'),(363,'Client','clientDebtStatementEmail','WRITE','ALLOW','ROLE','employee'),(364,'Client','incotermsAuthorizationPdf','READ','ALLOW','ROLE','employee'),(365,'Client','incotermsAuthorizationHtml','READ','ALLOW','ROLE','employee'),(366,'Client','incotermsAuthorizationEmail','WRITE','ALLOW','ROLE','employee'),(367,'Client','consumptionSendQueued','WRITE','ALLOW','ROLE','system'),(368,'InvoiceOut','invoiceEmail','WRITE','ALLOW','ROLE','employee'),(369,'InvoiceOut','exportationPdf','READ','ALLOW','ROLE','employee'),(370,'InvoiceOut','sendQueued','WRITE','ALLOW','ROLE','system'),(371,'Ticket','invoiceCsvPdf','READ','ALLOW','ROLE','employee'),(372,'Ticket','invoiceCsvEmail','WRITE','ALLOW','ROLE','employee'),(373,'Supplier','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(374,'Supplier','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(375,'Travel','extraCommunityPdf','READ','ALLOW','ROLE','employee'),(376,'Travel','extraCommunityEmail','WRITE','ALLOW','ROLE','employee'),(377,'Entry','entryOrderPdf','READ','ALLOW','ROLE','employee'),(378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','ROLE','system'),(379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system'),(380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee'),(381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager'),(382,'Item','labelPdf','READ','ALLOW','ROLE','employee'),(383,'Sector','*','READ','ALLOW','ROLE','employee'),(384,'Sector','*','WRITE','ALLOW','ROLE','employee'),(385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee'),(386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'),(387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'),(388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'),(389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager'),(390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'),(391,'Notification','*','WRITE','ALLOW','ROLE','system'),(392,'Boxing','*','*','ALLOW','ROLE','employee'),(393,'Url','*','READ','ALLOW','ROLE','employee'),(394,'Url','*','WRITE','ALLOW','ROLE','it'),(395,'ItemShelving','*','READ','ALLOW','ROLE','employee'),(396,'ItemShelving','*','WRITE','ALLOW','ROLE','production'),(397,'ItemShelvingPlacementSupplyStock','*','READ','ALLOW','ROLE','employee'),(398,'NotificationQueue','*','*','ALLOW','ROLE','employee'),(399,'InvoiceOut','clientsToInvoice','WRITE','ALLOW','ROLE','invoicing'),(400,'InvoiceOut','invoiceClient','WRITE','ALLOW','ROLE','invoicing'),(401,'Sale','editTracked','WRITE','ALLOW','ROLE','production'),(402,'Sale','editFloramondo','WRITE','ALLOW','ROLE','salesAssistant'),(403,'Receipt','balanceCompensationEmail','WRITE','ALLOW','ROLE','employee'),(404,'Receipt','balanceCompensationPdf','READ','ALLOW','ROLE','employee'),(405,'Ticket','getTicketsFuture','READ','ALLOW','ROLE','employee'),(406,'Ticket','merge','WRITE','ALLOW','ROLE','employee'),(407,'Sale','editFloramondo','WRITE','ALLOW','ROLE','logistic'),(408,'ZipConfig','*','*','ALLOW','ROLE','employee'),(409,'Item','*','WRITE','ALLOW','ROLE','administrative'),(410,'Sale','editCloned','WRITE','ALLOW','ROLE','buyer'),(411,'Sale','editCloned','WRITE','ALLOW','ROLE','salesAssistant'),(414,'MdbVersion','*','READ','ALLOW','ROLE','$everyone'),(416,'TicketLog','getChanges','READ','ALLOW','ROLE','employee'),(417,'Ticket','getTicketsAdvance','READ','ALLOW','ROLE','employee'),(418,'EntryLog','*','READ','ALLOW','ROLE','administrative'),(419,'Sale','editTracked','WRITE','ALLOW','ROLE','buyer'),(420,'MdbBranch','*','READ','ALLOW','ROLE','$everyone'),(421,'ItemShelvingSale','*','*','ALLOW','ROLE','employee'),(422,'Docuware','checkFile','READ','ALLOW','ROLE','employee'),(423,'Docuware','download','READ','ALLOW','ROLE','salesPerson'),(424,'Docuware','upload','WRITE','ALLOW','ROLE','productionAssi'),(425,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','salesPerson'),(426,'TpvTransaction','confirm','WRITE','ALLOW','ROLE','$everyone'),(427,'TpvTransaction','start','WRITE','ALLOW','ROLE','$authenticated'),(428,'TpvTransaction','end','WRITE','ALLOW','ROLE','$authenticated'),(429,'ItemConfig','*','READ','ALLOW','ROLE','employee'),(431,'Tag','onSubmit','WRITE','ALLOW','ROLE','employee'),(432,'Worker','updateAttributes','WRITE','ALLOW','ROLE','hr'),(433,'Worker','createAbsence','*','ALLOW','ROLE','employee'),(434,'Worker','updateAbsence','WRITE','ALLOW','ROLE','employee'),(435,'Worker','deleteAbsence','*','ALLOW','ROLE','employee'),(436,'Worker','new','WRITE','ALLOW','ROLE','hr'),(438,'Client','getClientOrSupplierReference','READ','ALLOW','ROLE','employee'),(439,'NotificationSubscription','*','*','ALLOW','ROLE','employee'),(440,'NotificationAcl','*','READ','ALLOW','ROLE','employee'),(441,'MdbApp','*','READ','ALLOW','ROLE','$everyone'),(442,'MdbApp','*','*','ALLOW','ROLE','developer'),(443,'ItemConfig','*','*','ALLOW','ROLE','employee'),(444,'DeviceProduction','*','*','ALLOW','ROLE','hr'),(445,'DeviceProductionModels','*','*','ALLOW','ROLE','hr'),(446,'DeviceProductionState','*','*','ALLOW','ROLE','hr'),(447,'DeviceProductionUser','*','*','ALLOW','ROLE','hr'),(448,'DeviceProduction','*','*','ALLOW','ROLE','productionAssi'),(449,'DeviceProductionModels','*','*','ALLOW','ROLE','productionAssi'),(450,'DeviceProductionState','*','*','ALLOW','ROLE','productionAssi'),(451,'DeviceProductionUser','*','*','ALLOW','ROLE','productionAssi'),(452,'Worker','deallocatePDA','*','ALLOW','ROLE','hr'),(453,'Worker','allocatePDA','*','ALLOW','ROLE','hr'),(454,'Worker','deallocatePDA','*','ALLOW','ROLE','productionAssi'),(455,'Worker','allocatePDA','*','ALLOW','ROLE','productionAssi'),(456,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(457,'Account','setPassword','WRITE','ALLOW','ROLE','itManagement'),(458,'Operator','*','READ','ALLOW','ROLE','employee'),(459,'Operator','*','WRITE','ALLOW','ROLE','employee'),(460,'InvoiceIn','getSerial','READ','ALLOW','ROLE','administrative'),(461,'Ticket','saveSign','WRITE','ALLOW','ROLE','employee'),(462,'InvoiceOut','negativeBases','READ','ALLOW','ROLE','administrative'),(463,'InvoiceOut','negativeBasesCsv','READ','ALLOW','ROLE','administrative'),(464,'WorkerObservation','*','*','ALLOW','ROLE','hr'),(465,'ClientInforma','*','READ','ALLOW','ROLE','employee'),(466,'ClientInforma','*','WRITE','ALLOW','ROLE','financial'),(467,'Receipt','receiptEmail','*','ALLOW','ROLE','salesAssistant'),(468,'Client','setRating','WRITE','ALLOW','ROLE','financial'),(469,'Client','*','READ','ALLOW','ROLE','employee'),(470,'Client','addressesPropagateRe','*','ALLOW','ROLE','employee'),(471,'Client','canBeInvoiced','*','ALLOW','ROLE','employee'),(472,'Client','canCreateTicket','*','ALLOW','ROLE','employee'),(473,'Client','consumption','*','ALLOW','ROLE','employee'),(474,'Client','createAddress','*','ALLOW','ROLE','employee'),(475,'Client','createWithUser','*','ALLOW','ROLE','employee'),(476,'Client','extendedListFilter','*','ALLOW','ROLE','employee'),(477,'Client','getAverageInvoiced','*','ALLOW','ROLE','employee'),(478,'Client','getCard','*','ALLOW','ROLE','employee'),(479,'Client','getDebt','*','ALLOW','ROLE','employee'),(480,'Client','getMana','*','ALLOW','ROLE','employee'),(481,'Client','transactions','*','ALLOW','ROLE','employee'),(482,'Client','hasCustomerRole','*','ALLOW','ROLE','employee'),(483,'Client','isValidClient','*','ALLOW','ROLE','employee'),(484,'Client','lastActiveTickets','*','ALLOW','ROLE','employee'),(485,'Client','sendSms','*','ALLOW','ROLE','employee'),(486,'Client','setPassword','*','ALLOW','ROLE','employee'),(487,'Client','summary','*','ALLOW','ROLE','employee'),(488,'Client','updateAddress','*','ALLOW','ROLE','employee'),(489,'Client','updateFiscalData','*','ALLOW','ROLE','employee'),(491,'Client','uploadFile','*','ALLOW','ROLE','employee'),(492,'Client','campaignMetricsPdf','*','ALLOW','ROLE','employee'),(493,'Client','campaignMetricsEmail','*','ALLOW','ROLE','employee'),(494,'Client','clientWelcomeHtml','*','ALLOW','ROLE','employee'),(495,'Client','clientWelcomeEmail','*','ALLOW','ROLE','employee'),(496,'Client','printerSetupHtml','*','ALLOW','ROLE','employee'),(497,'Client','printerSetupEmail','*','ALLOW','ROLE','employee'),(498,'Client','sepaCoreEmail','*','ALLOW','ROLE','employee'),(499,'Client','letterDebtorPdf','*','ALLOW','ROLE','employee'),(500,'Client','letterDebtorStHtml','*','ALLOW','ROLE','employee'),(501,'Client','letterDebtorStEmail','*','ALLOW','ROLE','employee'),(502,'Client','letterDebtorNdHtml','*','ALLOW','ROLE','employee'),(503,'Client','letterDebtorNdEmail','*','ALLOW','ROLE','employee'),(504,'Client','clientDebtStatementPdf','*','ALLOW','ROLE','employee'),(505,'Client','clientDebtStatementHtml','*','ALLOW','ROLE','employee'),(506,'Client','clientDebtStatementEmail','*','ALLOW','ROLE','employee'),(507,'Client','creditRequestPdf','*','ALLOW','ROLE','employee'),(508,'Client','creditRequestHtml','*','ALLOW','ROLE','employee'),(509,'Client','creditRequestEmail','*','ALLOW','ROLE','employee'),(510,'Client','incotermsAuthorizationPdf','*','ALLOW','ROLE','employee'),(511,'Client','incotermsAuthorizationHtml','*','ALLOW','ROLE','employee'),(512,'Client','incotermsAuthorizationEmail','*','ALLOW','ROLE','employee'),(513,'Client','consumptionSendQueued','*','ALLOW','ROLE','employee'),(514,'Client','filter','*','ALLOW','ROLE','employee'),(515,'Client','getClientOrSupplierReference','*','ALLOW','ROLE','employee'),(516,'Client','upsert','*','ALLOW','ROLE','employee'),(517,'Client','create','*','ALLOW','ROLE','employee'),(518,'Client','replaceById','*','ALLOW','ROLE','employee'),(519,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(520,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(521,'Client','deleteById','*','ALLOW','ROLE','employee'),(522,'Client','replaceOrCreate','*','ALLOW','ROLE','employee'),(523,'Client','updateAll','*','ALLOW','ROLE','employee'),(524,'Client','upsertWithWhere','*','ALLOW','ROLE','employee'),(525,'Defaulter','observationEmail','WRITE','ALLOW','ROLE','employee'),(527,'VnUser','acl','READ','ALLOW','ROLE','account'),(528,'VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'),(530,'Account','exists','READ','ALLOW','ROLE','account'),(531,'Account','exists','READ','ALLOW','ROLE','account'),(532,'UserLog','*','READ','ALLOW','ROLE','employee'),(533,'RoleLog','*','READ','ALLOW','ROLE','employee'),(534,'WagonType','*','*','ALLOW','ROLE','productionAssi'),(535,'WagonTypeColor','*','*','ALLOW','ROLE','productionAssi'),(536,'WagonTypeTray','*','*','ALLOW','ROLE','productionAssi'),(537,'WagonConfig','*','*','ALLOW','ROLE','productionAssi'),(538,'CollectionWagon','*','*','ALLOW','ROLE','productionAssi'),(539,'CollectionWagonTicket','*','*','ALLOW','ROLE','productionAssi'),(540,'Wagon','*','*','ALLOW','ROLE','productionAssi'),(541,'WagonType','createWagonType','*','ALLOW','ROLE','productionAssi'),(542,'WagonType','deleteWagonType','*','ALLOW','ROLE','productionAssi'),(543,'WagonType','editWagonType','*','ALLOW','ROLE','productionAssi'),(544,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(545,'Agency','find','READ','ALLOW','ROLE','employee'),(546,'Agency','seeExpired','READ','ALLOW','ROLE','coolerAssist'),(547,'WorkerLog','models','READ','ALLOW','ROLE','hr'),(548,'Ticket','editDiscount','WRITE','ALLOW','ROLE','claimManager'),(549,'Ticket','editDiscount','WRITE','ALLOW','ROLE','salesPerson'),(550,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','salesAssistant'),(551,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','deliveryBoss'),(552,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','buyer'),(553,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','claimManager'),(554,'Ticket','deleteTicketWithPartPrepared','WRITE','ALLOW','ROLE','salesAssistant'),(555,'Ticket','editZone','WRITE','ALLOW','ROLE','deliveryBoss'),(556,'State','editableStates','READ','ALLOW','ROLE','employee'),(557,'State','seeEditableStates','READ','ALLOW','ROLE','administrative'),(558,'State','seeEditableStates','READ','ALLOW','ROLE','production'),(559,'State','isSomeEditable','READ','ALLOW','ROLE','salesPerson'),(560,'State','isAllEditable','READ','ALLOW','ROLE','production'),(561,'State','isAllEditable','READ','ALLOW','ROLE','administrative'),(562,'Agency','seeExpired','READ','ALLOW','ROLE','administrative'),(563,'Agency','seeExpired','READ','ALLOW','ROLE','productionBoss'),(564,'Claim','createAfterDeadline','WRITE','ALLOW','ROLE','claimManager'),(565,'Client','editAddressLogifloraAllowed','WRITE','ALLOW','ROLE','salesAssistant'),(566,'Client','editFiscalDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(567,'Client','editVerifiedDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(568,'Client','editCredit','WRITE','ALLOW','ROLE','financialBoss'),(569,'Client','zeroCreditEditor','WRITE','ALLOW','ROLE','financialBoss'),(570,'InvoiceOut','canCreatePdf','WRITE','ALLOW','ROLE','invoicing'),(571,'Supplier','editPayMethodCheck','WRITE','ALLOW','ROLE','financial'),(572,'Worker','isTeamBoss','WRITE','ALLOW','ROLE','teamBoss'),(573,'Worker','forceIsSubordinate','READ','ALLOW','ROLE','hr'),(574,'Claim','editState','WRITE','ALLOW','ROLE','claimManager'),(575,'Claim','find','READ','ALLOW','ROLE','salesPerson'),(576,'Claim','findById','READ','ALLOW','ROLE','salesPerson'),(577,'Claim','findOne','READ','ALLOW','ROLE','salesPerson'),(578,'Claim','getSummary','READ','ALLOW','ROLE','salesPerson'),(579,'Claim','updateClaim','WRITE','ALLOW','ROLE','salesPerson'),(580,'Claim','regularizeClaim','WRITE','ALLOW','ROLE','claimManager'),(581,'Claim','updateClaimDestination','WRITE','ALLOW','ROLE','claimManager'),(582,'Claim','downloadFile','READ','ALLOW','ROLE','claimManager'),(583,'Claim','deleteById','WRITE','ALLOW','ROLE','claimManager'),(584,'Claim','filter','READ','ALLOW','ROLE','salesPerson'),(585,'Claim','logs','READ','ALLOW','ROLE','claimManager'),(586,'Ticket','find','READ','ALLOW','ROLE','employee'),(587,'Ticket','findById','READ','ALLOW','ROLE','employee'),(588,'Ticket','findOne','READ','ALLOW','ROLE','employee'),(589,'Ticket','getVolume','READ','ALLOW','ROLE','employee'),(590,'Ticket','getTotalVolume','READ','ALLOW','ROLE','employee'),(591,'Ticket','summary','READ','ALLOW','ROLE','employee'),(592,'Ticket','priceDifference','READ','ALLOW','ROLE','employee'),(593,'Ticket','componentUpdate','WRITE','ALLOW','ROLE','employee'),(594,'Ticket','new','WRITE','ALLOW','ROLE','employee'),(595,'Ticket','isEditable','READ','ALLOW','ROLE','employee'),(596,'Ticket','setDeleted','WRITE','ALLOW','ROLE','salesPerson'),(597,'Ticket','restore','WRITE','ALLOW','ROLE','employee'),(598,'Ticket','getSales','READ','ALLOW','ROLE','employee'),(599,'Ticket','getSalesPersonMana','READ','ALLOW','ROLE','employee'),(600,'Ticket','filter','READ','ALLOW','ROLE','employee'),(601,'Ticket','makeInvoice','WRITE','ALLOW','ROLE','employee'),(602,'Ticket','updateEditableTicket','WRITE','ALLOW','ROLE','employee'),(603,'Ticket','updateDiscount','WRITE','ALLOW','ROLE','employee'),(604,'Ticket','transferSales','WRITE','ALLOW','ROLE','employee'),(605,'Ticket','sendSms','WRITE','ALLOW','ROLE','employee'),(606,'Ticket','isLocked','READ','ALLOW','ROLE','employee'),(607,'Ticket','freightCost','READ','ALLOW','ROLE','employee'),(608,'Ticket','getComponentsSum','READ','ALLOW','ROLE','employee'),(609,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','delivery'),(610,'Ticket','deliveryNoteCsv','READ','ALLOW','ROLE','employee'),(611,'State','find','READ','ALLOW','ROLE','employee'),(612,'State','findById','READ','ALLOW','ROLE','employee'),(613,'State','findOne','READ','ALLOW','ROLE','employee'),(614,'Worker','find','READ','ALLOW','ROLE','employee'),(615,'Worker','findById','READ','ALLOW','ROLE','employee'),(616,'Worker','findOne','READ','ALLOW','ROLE','employee'),(617,'Worker','filter','READ','ALLOW','ROLE','employee'),(618,'Worker','getWorkedHours','READ','ALLOW','ROLE','employee'),(619,'Worker','active','READ','ALLOW','ROLE','employee'),(620,'Worker','activeWithRole','READ','ALLOW','ROLE','employee'),(621,'Worker','uploadFile','WRITE','ALLOW','ROLE','hr'),(622,'Worker','contracts','READ','ALLOW','ROLE','employee'),(623,'Worker','holidays','READ','ALLOW','ROLE','employee'),(624,'Worker','activeContract','READ','ALLOW','ROLE','employee'),(625,'Worker','activeWithInheritedRole','READ','ALLOW','ROLE','employee'),(626,'Ticket','collectionLabel','READ','ALLOW','ROLE','employee'),(628,'Ticket','expeditionPalletLabel','READ','ALLOW','ROLE','employee'),(629,'Ticket','editDiscount','WRITE','ALLOW','ROLE','artificialBoss'),(630,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesTeamBoss'),(635,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','administrative'),(636,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesPerson'),(637,'Claim','downloadFile','READ','ALLOW','ROLE','salesPerson'),(638,'Agency','seeExpired','READ','ALLOW','ROLE','artificialBoss'),(639,'Agency','seeExpired','READ','ALLOW','ROLE','logisticAssistant'),(640,'Claim','filter','READ','ALLOW','ROLE','buyer'),(641,'Claim','find','READ','ALLOW','ROLE','buyer'),(642,'Claim','findById','READ','ALLOW','ROLE','buyer'),(643,'Claim','getSummary','READ','ALLOW','ROLE','buyer'),(644,'Claim','filter','READ','ALLOW','ROLE','handmadeBoss'),(645,'Claim','find','READ','ALLOW','ROLE','handmadeBoss'),(646,'Claim','findById','READ','ALLOW','ROLE','handmadeBoss'),(647,'Claim','getSummary','READ','ALLOW','ROLE','handmadeBoss'),(648,'Claim','__get__lines','READ','ALLOW','ROLE','claimManager'),(649,'Claim','__get__lines','READ','ALLOW','ROLE','salesPerson'),(650,'Claim','getSummary','READ','ALLOW','ROLE','deliveryBoss'),(651,'Claim','findById','READ','ALLOW','ROLE','deliveryBoss'),(652,'Claim','find','READ','ALLOW','ROLE','deliveryBoss'),(653,'Claim','filter','READ','ALLOW','ROLE','deliveryBoss'),(654,'Ticket','editZone','WRITE','ALLOW','ROLE','logisticAssistant'),(655,'Entry','addFromPackaging','WRITE','ALLOW','ROLE','production'),(656,'Entry','addFromBuy','WRITE','ALLOW','ROLE','production'),(657,'Supplier','getItemsPackaging','READ','ALLOW','ROLE','production'),(658,'Ticket','closeAll','WRITE','ALLOW','ROLE','system'),(659,'Account','*','*','ALLOW','ROLE','itManagement'),(660,'Account','*','READ','ALLOW','ROLE','employee'),(664,'MailForward','*','*','ALLOW','ROLE','itManagement'),(665,'Role','*','READ','ALLOW','ROLE','employee'),(666,'Role','*','WRITE','ALLOW','ROLE','it'),(667,'VnUser','*','*','ALLOW','ROLE','itManagement'),(668,'VnUser','__get__preview','READ','ALLOW','ROLE','employee'),(669,'VnUser','preview','*','ALLOW','ROLE','employee'),(670,'VnUser','create','*','ALLOW','ROLE','itManagement'),(671,'VnUser','renewToken','WRITE','ALLOW','ROLE','employee'),(672,'PackingSiteAdvanced','*','*','ALLOW','ROLE','production'),(673,'InvoiceOut','makePdfAndNotify','WRITE','ALLOW','ROLE','invoicing'),(674,'InvoiceOutConfig','*','READ','ALLOW','ROLE','invoicing'),(676,'Ticket','invoiceTickets','WRITE','ALLOW','ROLE','employee'),(680,'MailAliasAccount','*','READ','ALLOW','ROLE','employee'),(681,'MailAliasAccount','create','WRITE','ALLOW','ROLE','employee'),(682,'MailAliasAccount','deleteById','WRITE','ALLOW','ROLE','employee'),(683,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','itManagement'),(684,'WorkerDisableExcluded','*','READ','ALLOW','ROLE','itManagement'),(685,'WorkerDisableExcluded','*','WRITE','ALLOW','ROLE','itManagement'),(686,'MailForward','*','*','ALLOW','ROLE','hr'),(687,'ClientSms','find','READ','ALLOW','ROLE','employee'),(688,'ClientSms','create','WRITE','ALLOW','ROLE','employee'),(689,'Vehicle','sorted','WRITE','ALLOW','ROLE','employee'),(690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss'),(691,'Roadmap','*','*','ALLOW','ROLE','productionBoss'),(692,'ExpeditionTruck','*','*','ALLOW','ROLE','palletizerBoss'),(693,'ExpeditionTruck','*','*','ALLOW','ROLE','productionBoss'),(694,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','marketingBoss'),(695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee'),(696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee'),(697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative'),(698,'Ticket','canEditWeekly','WRITE','ALLOW','ROLE','buyer'),(699,'TicketSms','find','READ','ALLOW','ROLE','salesPerson'),(701,'Docuware','upload','WRITE','ALLOW','ROLE','deliveryBoss'),(702,'Ticket','docuwareDownload','READ','ALLOW','ROLE','salesPerson'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -184,7 +184,7 @@ UNLOCK TABLES; LOCK TABLES `module` WRITE; /*!40000 ALTER TABLE `module` DISABLE KEYS */; -INSERT INTO `module` VALUES ('account'),('claim'),('customer'),('entry'),('invoiceIn'),('invoiceOut'),('item'),('monitor'),('order'),('route'),('shelving'),('supplier'),('ticket'),('travel'),('worker'),('zone'); +INSERT INTO `module` VALUES ('account'),('claim'),('customer'),('entry'),('invoiceIn'),('invoiceOut'),('item'),('monitor'),('order'),('route'),('shelving'),('supplier'),('ticket'),('travel'),('wagon'),('worker'),('zone'); /*!40000 ALTER TABLE `module` ENABLE KEYS */; UNLOCK TABLES; @@ -206,11 +206,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-06-26 8:40:03 +-- Dump completed on 2023-08-30 15:53:15 USE `vn`; --- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db1.static.verdnatura.es Database: vn +-- Host: db2.static.verdnatura.es Database: vn -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -400,7 +400,7 @@ UNLOCK TABLES; LOCK TABLES `department` WRITE; /*!40000 ALTER TABLE `department` DISABLE KEYS */; -INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,104,763,0,0,0,0,30,NULL,'/',NULL,0,NULL,0,0,0,0,NULL),(22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL),(31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL),(36,NULL,'LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(37,'PROD','PRODUCCION',12,27,NULL,72,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL),(38,NULL,'SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(43,'VT','VENTAS',30,53,NULL,0,0,0,1,11,1,'/1/',NULL,1,'',1,0,0,0,NULL),(44,'management','GERENCIA',54,55,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(45,NULL,'LOGISTICA',56,57,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(46,'delivery','REPARTO',58,59,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(48,NULL,'ALMACENAJE',60,61,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(49,NULL,'PROPIEDAD',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(52,NULL,'CARGA AEREA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(54,NULL,'ORNAMENTALES',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(55,NULL,'TALLER NATURAL',70,73,14548,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,1,1,0,1118),(56,NULL,'TALLER ARTIFICIAL',71,72,8470,72,0,0,2,0,55,'/1/55/',NULL,0,NULL,0,1,1,0,1927),(58,'CMP','CAMPOS',74,77,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(59,NULL,'MANTENIMIENTO',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(60,NULL,'RECLAMACIONES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL),(61,NULL,'VNH',82,85,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(66,NULL,'VERDNAMADRID',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL),(69,NULL,'VERDNABARNA',88,89,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(80,NULL,'EQUIPO J VALLES',31,32,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(86,NULL,'LIMPIEZA',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(89,NULL,'COORDINACION',92,93,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(90,NULL,'TRAILER',83,84,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(92,NULL,'EQUIPO SILVERIO',33,34,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(93,NULL,'CONFECCION',94,95,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(94,NULL,'EQUIPO J BROCAL',35,36,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(95,NULL,'EQUIPO C ZAMBRANO',37,38,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(96,NULL,'EQUIPO C LOPEZ',39,40,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(115,NULL,'EQUIPO CLAUDI',41,42,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',43,44,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(124,NULL,'CONTROL INTERNO',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL),(125,NULL,'EQUIPO MIRIAM MAR',45,46,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(126,NULL,'PRESERVADO',98,99,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(130,NULL,'REVISION',25,26,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(131,NULL,'INVERNADERO',75,76,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL),(132,NULL,'EQUIPO DC',47,48,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(133,'franceTeam','EQUIPO FRANCIA',49,50,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(134,NULL,'EQUIPO RODRI',51,52,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(135,'routers','ENRUTADORES',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(136,'heavyVehicles','VEHICULOS PESADOS',102,103,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL); +INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,104,763,0,0,0,0,30,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL),(22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL),(31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL),(36,NULL,'LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(37,'PROD','PRODUCCION',12,27,NULL,72,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL),(38,NULL,'SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(43,'VT','VENTAS',30,53,NULL,0,0,0,1,11,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL),(44,'management','GERENCIA',54,55,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(45,NULL,'LOGISTICA',56,57,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(46,'delivery','REPARTO',58,59,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL),(48,NULL,'ALMACENAJE',60,61,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(49,NULL,'PROPIEDAD',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(52,NULL,'CARGA AEREA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(54,NULL,'ORNAMENTALES',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(55,NULL,'TALLER NATURAL',70,73,14548,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,1,1,0,1118,NULL),(56,NULL,'TALLER ARTIFICIAL',71,72,8470,72,0,0,2,0,55,'/1/55/',NULL,0,NULL,0,1,1,0,1927,NULL),(58,'CMP','CAMPOS',74,77,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(59,NULL,'MANTENIMIENTO',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL),(60,NULL,'RECLAMACIONES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL),(61,NULL,'VNH',82,85,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(66,NULL,'VERDNAMADRID',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL),(69,NULL,'VERDNABARNA',88,89,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(80,NULL,'EQUIPO J VALLES',31,32,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(86,NULL,'LIMPIEZA',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(89,NULL,'COORDINACION',92,93,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(90,NULL,'TRAILER',83,84,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(92,NULL,'EQUIPO SILVERIO',33,34,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(93,NULL,'CONFECCION',94,95,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL,NULL),(94,NULL,'EQUIPO J BROCAL',35,36,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(95,NULL,'EQUIPO C ZAMBRANO',37,38,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(96,NULL,'EQUIPO C LOPEZ',39,40,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(115,NULL,'EQUIPO CLAUDI',41,42,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',43,44,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(124,NULL,'CONTROL INTERNO',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL),(125,NULL,'EQUIPO MIRIAM MAR',45,46,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(126,NULL,'PRESERVADO',98,99,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,NULL,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(130,NULL,'REVISION',25,26,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(131,NULL,'INVERNADERO',75,76,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL),(132,NULL,'EQUIPO DC',47,48,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(133,'franceTeam','EQUIPO FRANCIA',49,50,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(134,NULL,'EQUIPO RODRI',51,52,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(135,'routers','ENRUTADORES',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL),(136,'heavyVehicles','VEHICULOS PESADOS',102,103,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; @@ -410,7 +410,7 @@ UNLOCK TABLES; LOCK TABLES `docuware` WRITE; /*!40000 ALTER TABLE `docuware` DISABLE KEYS */; -INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N'),(2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N'); +INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL),(2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL),(3,'hr','RRHH','find','Búsqueda','N__DOCUMENTO',3); /*!40000 ALTER TABLE `docuware` ENABLE KEYS */; UNLOCK TABLES; @@ -502,11 +502,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-06-26 8:40:09 +-- Dump completed on 2023-08-30 15:53:19 USE `cache`; --- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db1.static.verdnatura.es Database: cache +-- Host: db2.static.verdnatura.es Database: cache -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -538,11 +538,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-06-26 8:40:10 +-- Dump completed on 2023-08-30 15:53:20 USE `hedera`; --- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db1.static.verdnatura.es Database: hedera +-- Host: db2.static.verdnatura.es Database: hedera -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -662,7 +662,7 @@ UNLOCK TABLES; LOCK TABLES `restPriv` WRITE; /*!40000 ALTER TABLE `restPriv` DISABLE KEYS */; -INSERT INTO `restPriv` VALUES (1,'tpv/transaction',2),(3,'image/upload',1),(5,'user/supplant',104),(10,'misc/captcha',NULL),(11,'core/log',NULL),(14,'core/query',NULL),(15,'user/recover-password',NULL),(16,'user/restore-password',NULL),(17,'dms/invoice',2),(18,'image/thumb',NULL),(19,'misc/contact',NULL),(20,'misc/production',NULL),(21,'tpv/confirm-post',NULL),(22,'tpv/confirm-soap',NULL),(23,'client/supplant',18),(24,'client/supplant',35); +INSERT INTO `restPriv` VALUES (1,'tpv/transaction',2),(3,'image/upload',1),(5,'user/supplant',104),(10,'misc/captcha',NULL),(11,'core/log',NULL),(14,'core/query',NULL),(15,'user/recover-password',NULL),(16,'user/restore-password',NULL),(17,'dms/invoice',2),(18,'image/thumb',NULL),(19,'misc/contact',NULL),(20,'misc/production',NULL),(21,'tpv/confirm-post',NULL),(22,'tpv/confirm-soap',NULL),(23,'client/supplant',18),(24,'client/supplant',35),(25,'user/logout',NULL); /*!40000 ALTER TABLE `restPriv` ENABLE KEYS */; UNLOCK TABLES; @@ -704,57 +704,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-06-26 8:40:14 -USE `postgresql`; --- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) --- --- Host: db1.static.verdnatura.es Database: postgresql --- ------------------------------------------------------ --- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Dumping data for table `labour_agreement` --- - -LOCK TABLES `labour_agreement` WRITE; -/*!40000 ALTER TABLE `labour_agreement` DISABLE KEYS */; -INSERT INTO `labour_agreement` VALUES (1,2.5,1830,'Flores y Plantas','2012-01-01',NULL); -/*!40000 ALTER TABLE `labour_agreement` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Dumping data for table `media_type` --- - -LOCK TABLES `media_type` WRITE; -/*!40000 ALTER TABLE `media_type` DISABLE KEYS */; -INSERT INTO `media_type` VALUES (3,'email'),(12,'extension movil'),(6,'facebook'),(2,'fijo'),(11,'material'),(10,'movil empresa'),(1,'movil personal'),(5,'msn'),(9,'seg social'),(4,'skype'),(7,'web'); -/*!40000 ALTER TABLE `media_type` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2023-06-26 8:40:15 +-- Dump completed on 2023-08-30 15:53:22 USE `sage`; --- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db1.static.verdnatura.es Database: sage +-- Host: db2.static.verdnatura.es Database: sage -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -804,7 +758,7 @@ UNLOCK TABLES; LOCK TABLES `taxType` WRITE; /*!40000 ALTER TABLE `taxType` DISABLE KEYS */; -INSERT INTO `taxType` VALUES (2,NULL,0),(4,'national4',0),(5,NULL,0),(6,NULL,1),(7,NULL,1),(8,NULL,1),(10,'national10',0),(11,NULL,0),(16,'CEEServices21',1),(18,NULL,0),(20,'national0',0),(21,'national21',0),(22,'import10',0),(26,NULL,0),(90,'import21',0),(91,NULL,0),(92,NULL,0),(93,NULL,0),(94,NULL,0),(100,NULL,0),(108,NULL,0),(109,NULL,0),(110,NULL,1),(111,NULL,0),(112,NULL,0),(113,'ISP21',0),(114,NULL,0),(115,'import4',0); +INSERT INTO `taxType` VALUES (2,'nonTaxable',0),(4,'national4',0),(5,NULL,0),(6,NULL,1),(7,NULL,1),(8,NULL,1),(10,'national10',0),(11,NULL,0),(16,'CEEServices21',1),(18,NULL,0),(20,'national0',0),(21,'national21',0),(22,'import10',0),(26,NULL,0),(90,'import21',0),(91,NULL,0),(92,NULL,0),(93,NULL,0),(94,NULL,0),(100,NULL,0),(108,NULL,0),(109,NULL,0),(110,NULL,1),(111,NULL,0),(112,NULL,0),(113,'ISP21',0),(114,NULL,0),(115,'import4',0); /*!40000 ALTER TABLE `taxType` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -816,4 +770,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-06-26 8:40:15 +-- Dump completed on 2023-08-30 15:53:22 diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 4e7127310..218d1c183 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -1,7 +1,6 @@ --- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) -- - --- Host: db1.static.verdnatura.es Database: account +-- Host: db2.static.verdnatura.es Database: account -- ------------------------------------------------------ -- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log @@ -157,10 +156,9 @@ DROP TABLE IF EXISTS `accountDovecot`; /*!50001 DROP VIEW IF EXISTS `accountDovecot`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `accountDovecot` ( - `name` tinyint NOT NULL, - `password` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `accountDovecot` AS SELECT + 1 AS `name`, + 1 AS `password` */; SET character_set_client = @saved_cs_client; -- @@ -190,10 +188,9 @@ DROP TABLE IF EXISTS `emailUser`; /*!50001 DROP VIEW IF EXISTS `emailUser`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `emailUser` ( - `userFk` tinyint NOT NULL, - `email` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `emailUser` AS SELECT + 1 AS `userFk`, + 1 AS `email` */; SET character_set_client = @saved_cs_client; -- @@ -455,9 +452,8 @@ DROP TABLE IF EXISTS `myRole`; /*!50001 DROP VIEW IF EXISTS `myRole`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myRole` ( - `id` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myRole` AS SELECT + 1 AS `id` */; SET character_set_client = @saved_cs_client; -- @@ -468,16 +464,15 @@ DROP TABLE IF EXISTS `myUser`; /*!50001 DROP VIEW IF EXISTS `myUser`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myUser` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `active` tinyint NOT NULL, - `email` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `lang` tinyint NOT NULL, - `role` tinyint NOT NULL, - `recoverPass` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myUser` AS SELECT + 1 AS `id`, + 1 AS `name`, + 1 AS `active`, + 1 AS `email`, + 1 AS `nickname`, + 1 AS `lang`, + 1 AS `role`, + 1 AS `recoverPass` */; SET character_set_client = @saved_cs_client; -- @@ -765,6 +760,7 @@ CREATE TABLE `user` ( `hasGrant` tinyint(1) NOT NULL, `editorFk` int(10) unsigned DEFAULT NULL, `passExpired` date DEFAULT NULL, + `twoFactor` enum('email') DEFAULT NULL COMMENT 'Two-factor auth type', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), UNIQUE KEY `mail` (`email`), @@ -791,7 +787,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); - + CALL user_checkName(NEW.`name`); IF NEW.nickname = '' THEN @@ -992,6 +988,8 @@ CREATE TABLE `userSync` ( -- -- Dumping routines for database 'account' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `myUser_checkLogin` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -999,8 +997,6 @@ CREATE TABLE `userSync` ( /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `myUser_checkLogin`() RETURNS tinyint(1) READS SQL DATA @@ -1022,7 +1018,7 @@ BEGIN SET vSignature = util.hmacSha2(256, CONCAT_WS('/', @userId, @userName), vKey); RETURN vSignature = @userSignature; END IF; - + RETURN FALSE; END ;; @@ -1031,6 +1027,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `myUser_getId` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1038,8 +1036,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `myUser_getId`() RETURNS int(11) READS SQL DATA @@ -1051,7 +1047,7 @@ BEGIN * @return The user id */ DECLARE vUser INT DEFAULT NULL; - + IF myUser_checkLogin() THEN SET vUser = @userId; @@ -1059,7 +1055,7 @@ BEGIN SELECT id INTO vUser FROM user WHERE name = LEFT(USER(), INSTR(USER(), '@') - 1); END IF; - + RETURN vUser; END ;; DELIMITER ; @@ -1067,6 +1063,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `myUser_getName` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1074,8 +1072,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `myUser_getName`() RETURNS varchar(30) CHARSET utf8mb3 COLLATE utf8mb3_general_ci NO SQL @@ -1094,7 +1090,7 @@ BEGIN ELSE SET vUser = LEFT(USER(), INSTR(USER(), '@') - 1); END IF; - + RETURN vUser; END ;; DELIMITER ; @@ -1102,6 +1098,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `myUser_hasRole` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1109,8 +1107,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `myUser_hasRole`(vRoleName VARCHAR(255)) RETURNS tinyint(1) DETERMINISTIC @@ -1128,6 +1124,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `myUser_hasRoleId` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1135,8 +1133,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `myUser_hasRoleId`(vRoleId INT) RETURNS tinyint(1) DETERMINISTIC @@ -1154,6 +1150,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `passwordGenerate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1161,8 +1159,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `passwordGenerate`() RETURNS text CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci READS SQL DATA @@ -1189,10 +1185,10 @@ BEGIN DECLARE vDigitChars TEXT DEFAULT '1234567890'; DECLARE vPunctChars TEXT DEFAULT '!$%&()=.'; - SELECT length, nAlpha, nUpper, nDigits, nPunct + SELECT length, nAlpha, nUpper, nDigits, nPunct INTO vMinLength, vMinAlpha, vMinUpper, vMinDigits, vMinPunct FROM userPassword; - WHILE LENGTH(vPwd) < vMinLength OR vAlpha < vMinAlpha + WHILE LENGTH(vPwd) < vMinLength OR vAlpha < vMinAlpha OR vUpper < vMinUpper OR vDigits < vMinDigits OR vPunct < vMinPunct DO SET vRandIndex = FLOOR((RAND() * 4) + 1); @@ -1218,6 +1214,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `toUnixDays` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1225,8 +1223,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `toUnixDays`(vDate DATE) RETURNS int(11) DETERMINISTIC @@ -1244,6 +1240,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `user_getMysqlRole` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1251,8 +1249,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `user_getMysqlRole`(vUserName VARCHAR(255)) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC @@ -1267,7 +1263,7 @@ BEGIN DECLARE vRole VARCHAR(255); SELECT CONCAT(IF(r.hasLogin, c.rolePrefix, ''), r.name) INTO vRole - FROM role r + FROM role r JOIN user u ON u.role = r.id JOIN roleConfig c WHERE u.name = vUserName; @@ -1279,6 +1275,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `user_getNameFromId` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1286,24 +1284,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `user_getNameFromId`(vSelf INT) RETURNS varchar(30) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC BEGIN /** * Gets user name from it's id. - * + * * @param vSelf The user id * @return The user name */ DECLARE vName VARCHAR(30); - - SELECT `name` INTO vName - FROM user + + SELECT `name` INTO vName + FROM user WHERE id = vSelf; - + RETURN vName; END ;; DELIMITER ; @@ -1311,6 +1307,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `user_hasRole` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1318,8 +1316,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `user_hasRole`(vUserName VARCHAR(255), vRoleName VARCHAR(255)) RETURNS tinyint(1) DETERMINISTIC @@ -1347,6 +1343,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `user_hasRoleId` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1354,8 +1352,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `user_hasRoleId`(vUser VARCHAR(255), vRoleId INT) RETURNS tinyint(1) DETERMINISTIC @@ -1375,7 +1371,7 @@ BEGIN JOIN role r ON r.id = rr.inheritsFrom WHERE u.`name` = vUser AND r.id = vRoleId; - + RETURN vHasRole; END ;; DELIMITER ; @@ -1383,6 +1379,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myUser_login` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1390,8 +1388,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myUser_login`(vUserName VARCHAR(255), vPassword VARCHAR(255)) READS SQL DATA @@ -1409,7 +1405,7 @@ BEGIN AND password = MD5(vPassword) AND active; - IF vAuthIsOk + IF vAuthIsOk THEN CALL myUser_loginWithName (vUserName); ELSE @@ -1421,6 +1417,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myUser_loginWithKey` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1428,8 +1426,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myUser_loginWithKey`(vUserName VARCHAR(255), vKey VARCHAR(255)) READS SQL DATA @@ -1455,6 +1451,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myUser_loginWithName` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1462,15 +1460,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myUser_loginWithName`(vUserName VARCHAR(255)) READS SQL DATA BEGIN /** * Logs in using only the user name. This procedure is intended to be executed - * by users with a high level of privileges so that normal users should not have + * by users with a high level of privileges so that normal users should not have * execute permissions on it. * * @param vUserName The user name @@ -1492,6 +1488,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myUser_logout` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1499,14 +1497,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myUser_logout`() BEGIN /** * Logouts the user. - */ + */ SET @userId = NULL; SET @userName = NULL; SET @userSignature = NULL; @@ -1516,6 +1512,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `role_checkName` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1523,8 +1521,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `role_checkName`(vRoleName VARCHAR(255)) BEGIN @@ -1545,6 +1541,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `role_getDescendents` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1552,8 +1550,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `role_getDescendents`(vSelf INT) BEGIN @@ -1604,9 +1600,9 @@ BEGIN SELECT COUNT(*) > 0 INTO vIsRoot FROM tmp.role t - JOIN role r ON r.id = t.id + JOIN role r ON r.id = t.id WHERE r.`name` = 'root'; - + IF vIsRoot THEN INSERT IGNORE INTO tmp.role (id) SELECT id FROM role; @@ -1622,6 +1618,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `role_sync` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1629,8 +1627,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `role_sync`() BEGIN @@ -1686,6 +1682,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `role_syncPrivileges` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1693,8 +1691,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `role_syncPrivileges`() BEGIN @@ -2264,6 +2260,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `user_checkName` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2271,8 +2269,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `user_checkName`(vUserName VARCHAR(255)) BEGIN @@ -2292,6 +2288,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `user_checkPassword` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2299,8 +2297,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `user_checkPassword`(vPassword VARCHAR(255)) BEGIN @@ -2325,7 +2321,7 @@ BEGIN IF vChr REGEXP '[[:alpha:]]' THEN SET vNAlpha = vNAlpha+1; - + IF vChr REGEXP '[A-Z]' THEN SET vNUpper = vNUpper+1; @@ -2377,16 +2373,15 @@ DROP TABLE IF EXISTS `bajasLaborales`; /*!50001 DROP VIEW IF EXISTS `bajasLaborales`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `bajasLaborales` ( - `firstname` tinyint NOT NULL, - `name` tinyint NOT NULL, - `businessFk` tinyint NOT NULL, - `lastDate` tinyint NOT NULL, - `endContract` tinyint NOT NULL, - `type` tinyint NOT NULL, - `dias` tinyint NOT NULL, - `userFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `bajasLaborales` AS SELECT + 1 AS `firstname`, + 1 AS `name`, + 1 AS `businessFk`, + 1 AS `lastDate`, + 1 AS `endContract`, + 1 AS `type`, + 1 AS `dias`, + 1 AS `userFk` */; SET character_set_client = @saved_cs_client; -- @@ -2460,6 +2455,23 @@ CREATE TABLE `clientDied` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Clientes que no han comprado en los ultimos 3 meses, se actualiza con proceso nocturno el 3 de cada mes'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `clientDiedPeriod` +-- + +DROP TABLE IF EXISTS `clientDiedPeriod`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clientDiedPeriod` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `countryFk` mediumint(8) unsigned NOT NULL, + `days` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `clientDiedPeriod_UN` (`countryFk`), + CONSTRAINT `clientDiedPeriod_FK` FOREIGN KEY (`countryFk`) REFERENCES `vn`.`country` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Define lo que es un periodo para los clientes de los diferentes países'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `clientNewBorn` -- @@ -2649,6 +2661,43 @@ CREATE TABLE `inspeccionSS_2021` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='bs.inspeccionSS_2021_add()'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `inventoryDiscrepancy` +-- + +DROP TABLE IF EXISTS `inventoryDiscrepancy`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `inventoryDiscrepancy` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `warehouseFk` int(11) NOT NULL, + `timed` timestamp NOT NULL DEFAULT current_timestamp(), + `alert` int(11) NOT NULL DEFAULT 0, + `quantity` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='This table collects the discrepancies between theorical inventory and located items'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `inventoryDiscrepancyDetail` +-- + +DROP TABLE IF EXISTS `inventoryDiscrepancyDetail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `inventoryDiscrepancyDetail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `warehouseFk` int(11) NOT NULL, + `itemFk` int(11) NOT NULL, + `theorical` int(11) DEFAULT NULL COMMENT 'theorical stock: purchases vs. sales', + `visible` int(11) DEFAULT NULL COMMENT 'located stock', + `notPicked` int(11) DEFAULT NULL COMMENT 'sales not picked yet', + `alert` int(11) DEFAULT NULL COMMENT 'alert level for this discrepancy', + PRIMARY KEY (`id`), + UNIQUE KEY `inventoryDiscrepancyDetail_UN` (`warehouseFk`,`itemFk`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Last discrepancies'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `lastIndicators` -- @@ -2657,31 +2706,30 @@ DROP TABLE IF EXISTS `lastIndicators`; /*!50001 DROP VIEW IF EXISTS `lastIndicators`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `lastIndicators` ( - `updated` tinyint NOT NULL, - `lastYearSales` tinyint NOT NULL, - `incLastYearSales` tinyint NOT NULL, - `totalGreuge` tinyint NOT NULL, - `incTotalGreuge` tinyint NOT NULL, - `latePaymentRate` tinyint NOT NULL, - `incLatePaymentRate` tinyint NOT NULL, - `countEmployee` tinyint NOT NULL, - `incCountEmployee` tinyint NOT NULL, - `averageMana` tinyint NOT NULL, - `incAverageMana` tinyint NOT NULL, - `bankingPool` tinyint NOT NULL, - `incbankingPool` tinyint NOT NULL, - `lastMonthActiveClients` tinyint NOT NULL, - `incLastMonthActiveClients` tinyint NOT NULL, - `lastMonthLostClients` tinyint NOT NULL, - `incLastMonthLostClients` tinyint NOT NULL, - `lastMonthNewClients` tinyint NOT NULL, - `incLastMonthNewClients` tinyint NOT NULL, - `lastMonthWebBuyingRate` tinyint NOT NULL, - `incLastMonthWebBuyingRate` tinyint NOT NULL, - `thisWeekSales` tinyint NOT NULL, - `lastYearWeekSales` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `lastIndicators` AS SELECT + 1 AS `updated`, + 1 AS `lastYearSales`, + 1 AS `incLastYearSales`, + 1 AS `totalGreuge`, + 1 AS `incTotalGreuge`, + 1 AS `latePaymentRate`, + 1 AS `incLatePaymentRate`, + 1 AS `countEmployee`, + 1 AS `incCountEmployee`, + 1 AS `averageMana`, + 1 AS `incAverageMana`, + 1 AS `bankingPool`, + 1 AS `incbankingPool`, + 1 AS `lastMonthActiveClients`, + 1 AS `incLastMonthActiveClients`, + 1 AS `lastMonthLostClients`, + 1 AS `incLastMonthLostClients`, + 1 AS `lastMonthNewClients`, + 1 AS `incLastMonthNewClients`, + 1 AS `lastMonthWebBuyingRate`, + 1 AS `incLastMonthWebBuyingRate`, + 1 AS `thisWeekSales`, + 1 AS `lastYearWeekSales` */; SET character_set_client = @saved_cs_client; -- @@ -2744,7 +2792,7 @@ BEGIN IF NOT (NEW.`schema`REGEXP '^[0-9a-zA-Z_]+$') OR NOT (NEW.`procedure`REGEXP '^[0-9a-zA-Z_]+$') THEN CALL util.throw('ONLY_ALPHANUMERICS_ALLOWED'); - + END IF; END */;; @@ -2770,7 +2818,7 @@ BEGIN IF NOT (NEW.`schema`REGEXP '^[0-9a-zA-Z_]+$') OR NOT (NEW.`procedure`REGEXP '^[0-9a-zA-Z_]+$') THEN CALL util.throw('ONLY_ALPHANUMERICS_ALLOWED'); - + END IF; END */;; @@ -2802,13 +2850,12 @@ DROP TABLE IF EXISTS `packingSpeed`; /*!50001 DROP VIEW IF EXISTS `packingSpeed`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `packingSpeed` ( - `hora` tinyint NOT NULL, - `minuto` tinyint NOT NULL, - `cm3` tinyint NOT NULL, - `warehouse_id` tinyint NOT NULL, - `odbc_date` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `packingSpeed` AS SELECT + 1 AS `hora`, + 1 AS `minuto`, + 1 AS `cm3`, + 1 AS `warehouse_id`, + 1 AS `odbc_date` */; SET character_set_client = @saved_cs_client; -- @@ -2858,13 +2905,12 @@ DROP TABLE IF EXISTS `s1_ticketDetail`; /*!50001 DROP VIEW IF EXISTS `s1_ticketDetail`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `s1_ticketDetail` ( - `ticketFk` tinyint NOT NULL, - `ticketAmount` tinyint NOT NULL, - `ticketLines` tinyint NOT NULL, - `ticketM3` tinyint NOT NULL, - `shipped` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `s1_ticketDetail` AS SELECT + 1 AS `ticketFk`, + 1 AS `ticketAmount`, + 1 AS `ticketLines`, + 1 AS `ticketM3`, + 1 AS `shipped` */; SET character_set_client = @saved_cs_client; -- @@ -2875,20 +2921,19 @@ DROP TABLE IF EXISTS `s21_saleDetail`; /*!50001 DROP VIEW IF EXISTS `s21_saleDetail`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `s21_saleDetail` ( - `dia` tinyint NOT NULL, - `año` tinyint NOT NULL, - `mes` tinyint NOT NULL, - `concepto` tinyint NOT NULL, - `unidades` tinyint NOT NULL, - `precio` tinyint NOT NULL, - `venta` tinyint NOT NULL, - `familia` tinyint NOT NULL, - `comprador` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `volume` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `s21_saleDetail` AS SELECT + 1 AS `dia`, + 1 AS `año`, + 1 AS `mes`, + 1 AS `concepto`, + 1 AS `unidades`, + 1 AS `precio`, + 1 AS `venta`, + 1 AS `familia`, + 1 AS `comprador`, + 1 AS `itemFk`, + 1 AS `ticketFk`, + 1 AS `volume` */; SET character_set_client = @saved_cs_client; -- @@ -2928,7 +2973,6 @@ DROP TABLE IF EXISTS `salesByItemTypeDay`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `salesByItemTypeDay` ( `itemTypeFk` smallint(5) unsigned NOT NULL, - `itemCategoryFk` int(10) unsigned NOT NULL, `dated` date NOT NULL, `netSale` int(11) NOT NULL DEFAULT 0, `stems` int(11) NOT NULL DEFAULT 0, @@ -2939,13 +2983,10 @@ CREATE TABLE `salesByItemTypeDay` ( `accepted` decimal(10,2) NOT NULL DEFAULT 0.00, `sale` decimal(10,2) NOT NULL DEFAULT 0.00, `buy` decimal(10,2) NOT NULL DEFAULT 0.00, - `saleComponent` decimal(10,2) NOT NULL DEFAULT 0.00, `costComponent` decimal(10,2) NOT NULL DEFAULT 0.00, `marginComponent` decimal(10,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`itemTypeFk`,`dated`), - KEY `itemTypeSalesByweek_itemCategoryFk_idx` (`itemCategoryFk`), KEY `itemTypeSalesByweek_period_idx` (`dated`), - CONSTRAINT `itemTypeSalesByweek_itemCategoryFk` FOREIGN KEY (`itemCategoryFk`) REFERENCES `vn`.`itemCategory` (`id`) ON UPDATE CASCADE, CONSTRAINT `itemTypeSalesByweek_itemTypeFk` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn`.`itemType` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Ventas diarias agrupadas por reino y familia'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3083,16 +3124,15 @@ DROP TABLE IF EXISTS `ventas`; /*!50001 DROP VIEW IF EXISTS `ventas`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ventas` ( - `Id_Movimiento` tinyint NOT NULL, - `importe` tinyint NOT NULL, - `recargo` tinyint NOT NULL, - `fecha` tinyint NOT NULL, - `tipo_id` tinyint NOT NULL, - `Id_Cliente` tinyint NOT NULL, - `empresa_id` tinyint NOT NULL, - `margen` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ventas` AS SELECT + 1 AS `Id_Movimiento`, + 1 AS `importe`, + 1 AS `recargo`, + 1 AS `fecha`, + 1 AS `tipo_id`, + 1 AS `Id_Cliente`, + 1 AS `empresa_id`, + 1 AS `margen` */; SET character_set_client = @saved_cs_client; -- @@ -3205,7 +3245,63 @@ CREATE TABLE `workerProductivityConfig` ( -- Dumping events for database 'bs' -- /*!50106 SET @save_time_zone= @@TIME_ZONE */ ; -/*!50106 DROP EVENT IF EXISTS `nightTask_launchAll` */; +/*!50106 DROP EVENT IF EXISTS `clientDied_recalc` */; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `clientDied_recalc` ON SCHEDULE EVERY 1 DAY STARTS '2023-06-01 03:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO BEGIN + DECLARE vDone INT DEFAULT FALSE; + DECLARE vCountryFk INT; + DECLARE vDays INT; + + DECLARE cur CURSOR FOR + SELECT countryFk, days + FROM clientDiedPeriod; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + OPEN cur; + read_loop: LOOP + SET vDone = FALSE; + FETCH cur INTO vCountryFk, vDays; + IF vDone THEN + LEAVE read_loop; + END IF; + CALL clientDied_recalc(vDays, (SELECT code FROM vn.country WHERE id = vCountryFk)); + END LOOP; + CLOSE cur; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +/*!50106 DROP EVENT IF EXISTS `inventoryDiscrepancy_launch` */;; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `inventoryDiscrepancy_launch` ON SCHEDULE EVERY 15 MINUTE STARTS '2023-07-18 00:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL bs.inventoryDiscrepancyDetail_replace() */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +/*!50106 DROP EVENT IF EXISTS `nightTask_launchAll` */;; DELIMITER ;; /*!50003 SET @saved_cs_client = @@character_set_client */ ;; /*!50003 SET @saved_cs_results = @@character_set_results */ ;; @@ -3229,6 +3325,8 @@ DELIMITER ; -- -- Dumping routines for database 'bs' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `tramo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3236,8 +3334,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `tramo`(vDateTime DATETIME) RETURNS varchar(20) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci NO SQL @@ -3245,11 +3341,11 @@ BEGIN DECLARE vTramo VARCHAR(20); DECLARE vHour INT; - + SET vHour = HOUR(vDateTime) ; - + SET vTramo = - CASE + CASE WHEN vHour BETWEEN 0 AND 14 THEN 'Mañana' WHEN vHour BETWEEN 15 AND 24 THEN 'Tarde' END ; @@ -3261,6 +3357,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `bancos_evolution_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3268,8 +3366,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `bancos_evolution_add`(vStartingDate DATE) BEGIN @@ -3277,7 +3373,7 @@ BEGIN * Inserta en la tabla bancos_evolution los saldos acumulados de cada banco * * @param vStartingDate Fecha desde la cual se recalculan la tabla bs.bancos_evolution - */ + */ DECLARE vCurrentDate DATE; DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, util.VN_CURDATE()); IF IFNULL(vStartingDate,0) < TIMESTAMPADD(YEAR, -5, util.VN_CURDATE()) THEN @@ -3291,49 +3387,49 @@ BEGIN SELECT vCurrentDate, Id_Banco, deuda FROM bs.bancos_evolution WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate); - + WHILE vCurrentDate < vMaxDate DO -- insertar solo el dia de ayer INSERT INTO bs.bancos_evolution(Fecha ,Id_Banco, saldo) - SELECT vCurrentDate, Id_Banco, SUM(saldo) + SELECT vCurrentDate, Id_Banco, SUM(saldo) FROM ( SELECT Id_Banco ,saldo FROM bs.bancos_evolution WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate) -- los saldos acumulados del dia anterior UNION ALL - + SELECT c.Id_Banco, IFNULL(SUM(Entrada),0) - IFNULL(SUM(Salida),0) as saldo FROM vn2008.Cajas c JOIN vn2008.Bancos b using(Id_Banco) -- saldos de las cajas - JOIN vn.accountingType at2 ON at2.id = b.cash + JOIN vn.accountingType at2 ON at2.id = b.cash WHERE at2.code IN ('wireTransfer','fundingLine') AND Cajafecha = vCurrentDate AND (Serie = 'MB' OR at2.code = 'fundingLine') GROUP BY Id_Banco - )sub + )sub GROUP BY Id_Banco ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo); - + SET vCurrentDate = TIMESTAMPADD(DAY,1,vCurrentDate); END WHILE; - -- Ahora actualizamos la quilla + -- Ahora actualizamos la quilla UPDATE bs.bancos_evolution be JOIN ( SELECT bp.Id_Banco, - sum(bp.importe) as quilla, t.dated - FROM vn.time t + FROM vn.time t JOIN vn2008.Bancos_poliza bp ON t.dated between apertura AND IFNULL(cierre, t.dated) WHERE t.dated BETWEEN vStartingDate AND vMaxDate GROUP BY Id_Banco, t.dated ) sub ON be.Id_Banco = sub.Id_Banco AND sub.dated = be.Fecha - SET be.quilla = sub.quilla; + SET be.quilla = sub.quilla; -- pagos futuros no concilidados INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo) SELECT t.dated, p.id_banco, - importe - FROM vn.time t + FROM vn.time t join vn2008.pago p ON p.fecha <= t.dated WHERE t.dated BETWEEN util.VN_CURDATE() AND vMaxDate AND p.fecha BETWEEN util.VN_CURDATE() AND vMaxDate @@ -3343,7 +3439,7 @@ BEGIN -- cobros futuros INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo) SELECT t.dated, r.Id_Banco, SUM(Entregado) - FROM vn.time t + FROM vn.time t JOIN vn2008.Recibos r ON r.Fechacobro <= t.dated WHERE r.Fechacobro > util.VN_CURDATE() AND r.Fechacobro <= vMaxDate AND t.dated BETWEEN util.VN_CURDATE() AND vMaxDate @@ -3353,10 +3449,10 @@ BEGIN -- saldos de la tabla prevision INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo) SELECT t.dated, sp.Id_Banco, SUM(Importe) - FROM vn.time t + FROM vn.time t JOIN vn2008.Saldos_Prevision sp ON sp.Fecha <= t.dated JOIN vn2008.Bancos b ON sp.Id_Banco = b.Id_Banco - JOIN vn.accountingType at2 ON at2.id = b.cash + JOIN vn.accountingType at2 ON at2.id = b.cash WHERE at2.code IN ('wireTransfer','fundingLine') AND t.dated BETWEEN vStartingDate AND vMaxDate GROUP BY t.dated, sp.Id_Banco @@ -3370,12 +3466,12 @@ BEGIN -- Deuda UPDATE bs.bancos_evolution be JOIN vn2008.Bancos b using(Id_Banco) - JOIN vn.accountingType at2 ON at2.id = b.cash + JOIN vn.accountingType at2 ON at2.id = b.cash SET be.deuda = IF(at2.code = 'fundingLine', be.saldo_aux, 0) , be.saldo = IF(at2.code = 'fundingLine', 0, be.saldo_aux) WHERE Fecha >= vStartingDate; - -- Liquidez + -- Liquidez update bs.bancos_evolution set liquidez = saldo - quilla + deuda WHERE Fecha >= vStartingDate; -- Disponibilidad update bs.bancos_evolution set `disponibilidad ajena` = - quilla + deuda WHERE Fecha >= vStartingDate; @@ -3386,6 +3482,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `campaignComparative` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3393,19 +3491,17 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `campaignComparative`(vDateFrom DATE, vDateTo DATE) BEGIN - SELECT - workerName, - id, - name, - CAST(SUM(previousAmmount) AS DECIMAL(10, 0)) AS previousAmmount, - CAST(SUM(currentAmmount) AS DECIMAL(10, 0)) AS currentAmmount + SELECT + workerName, + id, + name, + CAST(SUM(previousAmmount) AS DECIMAL(10, 0)) AS previousAmmount, + CAST(SUM(currentAmmount) AS DECIMAL(10, 0)) AS currentAmmount FROM ( - (SELECT + (SELECT CONCAT(w.firstname, ' ', w.lastName) AS workerName, c.id, c.name, @@ -3414,11 +3510,11 @@ BEGIN FROM bs.ventas v INNER JOIN vn.`client` c ON v.Id_Cliente = c.id INNER JOIN vn.worker w ON c.salesPersonFk = w.id - WHERE v.fecha BETWEEN DATE_ADD(vDateFrom, INTERVAL - 1 YEAR) + WHERE v.fecha BETWEEN DATE_ADD(vDateFrom, INTERVAL - 1 YEAR) AND DATE_ADD(vDateTo, INTERVAL - 1 YEAR) GROUP BY w.id, v.Id_Cliente) UNION ALL - (SELECT + (SELECT CONCAT(w.firstname, ' ', w.lastName) AS workerName, c.id, c.name, @@ -3441,6 +3537,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `carteras_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3448,31 +3546,31 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `carteras_add`() -BEGIN -/** - * Inserta en @bs.carteras. - */ - DELETE FROM bs.carteras - WHERE Año >= YEAR(util.VN_CURDATE()) - 1; - - INSERT INTO bs.carteras(Año,Mes,CodigoTrabajador,Peso) - SELECT t.year AS Año, t.month AS Mes, w.code AS CodigoTrabajador, SUM(v.importe) AS Peso - FROM vn.time t - JOIN bs.ventas v on t.dated = v.fecha - JOIN vn.client c on c.id = v.Id_Cliente - JOIN vn.worker w ON w.id = c.salesPersonFk - WHERE t.year >= YEAR(util.VN_CURDATE()) - 1 - GROUP BY w.code, t.year , t.month; +BEGIN +/** + * Inserta en @bs.carteras. + */ + DELETE FROM bs.carteras + WHERE Año >= YEAR(util.VN_CURDATE()) - 1; + + INSERT INTO bs.carteras(Año,Mes,CodigoTrabajador,Peso) + SELECT t.year AS Año, t.month AS Mes, w.code AS CodigoTrabajador, SUM(v.importe) AS Peso + FROM vn.time t + JOIN bs.ventas v on t.dated = v.fecha + JOIN vn.client c on c.id = v.Id_Cliente + JOIN vn.worker w ON w.id = c.salesPersonFk + WHERE t.year >= YEAR(util.VN_CURDATE()) - 1 + GROUP BY w.code, t.year , t.month; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3480,8 +3578,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() BEGIN @@ -3498,30 +3594,32 @@ BEGIN DELETE FROM bs.clientNewBorn WHERE lastShipped < vOneYearAgo; - + DELETE FROM ventas WHERE fecha < vFourYearsAgo; - + DELETE FROM payMethodClient WHERE dated < vOneYearAgo; DELETE FROM payMethodClientEvolution WHERE dated < vFourYearsAgo; - DELETE FROM bs.salesByclientSalesPerson + DELETE FROM bs.salesByclientSalesPerson WHERE dated < vFourYearsAgo; - - DELETE FROM bs.m3 + + DELETE FROM bs.m3 WHERE fecha < vTwoYearAgo; DELETE FROM salesByItemTypeDay - WHERE dated < vThreeYearAgo; + WHERE dated < vThreeYearAgo; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clientDied_recalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3529,46 +3627,77 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientDied_recalc`() +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientDied_recalc`( + vDays INT, + vCountryCode VARCHAR(2) +) BEGIN - SET @primerAviso := TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); - SET @segundoAviso := TIMESTAMPADD(MONTH,-2,util.VN_CURDATE()); - SET @tercerAviso := TIMESTAMPADD(MONTH,-3,util.VN_CURDATE()); +/** + * Recalcula los clientes inactivos y hace insert en la tabla clientDied + * estableciendo hasta 3 avisos en función del periodo y el código de país. + * + * @param vDays El número de días a considerar para la inactividad del cliente + * @param vCountryCode El código del país para filtrar los clientes + */ + DECLARE vFirstPeriod , vSecondPeriod, vThridPeriod DATE; + SET vFirstPeriod = util.VN_CURDATE() - INTERVAL vDays DAY; + SET vSecondPeriod = util.VN_CURDATE() - INTERVAL vDays * 2 DAY; + SET vThridPeriod = util.VN_CURDATE() - INTERVAL vDays * 3 DAY; - TRUNCATE TABLE bs.clientDied; + DELETE cd.* FROM clientDied cd + JOIN ( + SELECT c.id FROM vn.client c + JOIN vn.country co ON co.id = c.countryFk + WHERE co.code = vCountryCode + ) sub ON sub.id = cd.id; - INSERT INTO bs.clientDied - SELECT c.id, - c.name clientName, - maxIssued lastInvoiced, - w.code workerCode, - b.code Boss, + INSERT INTO clientDied (id, clientName, lastInvoiced, workerCode, Boss, Aviso) + SELECT c.id, + c.name, + sub.lastShipped, + w.code, + b.code, CASE - WHEN IFNULL(maxIssued,'2000-01-01') < @tercerAviso THEN 'Tercer Aviso' - WHEN maxIssued < @segundoAviso THEN 'Segundo Aviso' - WHEN maxIssued < @primerAviso THEN 'Primer Aviso' - END as Aviso + WHEN lastShipped < vThridPeriod OR lastShipped IS NULL THEN 'Tercer Aviso' + WHEN lastShipped < vSecondPeriod THEN 'Segundo Aviso' + WHEN lastShipped < vFirstPeriod THEN 'Primer Aviso' + END FROM vn.client c + JOIN vn.country co ON co .id = c.countryFk JOIN vn.worker w ON w.id = c.salesPersonFk JOIN vn.worker b ON b.id = w.bossFk JOIN vn.workerMana wm ON wm.workerFk = c.salesPersonFk - LEFT JOIN (SELECT clientFk, max(issued) as maxIssued FROM vn.invoiceOut GROUP BY clientFk) io ON io.clientFk = c.id - WHERE (maxIssued IS NULL OR maxIssued < @primerAviso) - AND c.created < @tercerAviso; - - DELETE cd.* FROM bs.clientDied cd - JOIN vn.ticket t ON t.clientFk = cd.id - WHERE t.refFk IS NULL - AND t.shipped >=TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); + LEFT JOIN ( + SELECT c.id, DATE(MAX(t.shipped)) lastShipped + FROM vn.client c + LEFT JOIN vn.ticket t ON t.clientFk = c.id + LEFT JOIN vn.country co ON co.id = c.countryFk + WHERE co.code = vCountryCode + AND (t.shipped <= util.VN_CURDATE() OR t.shipped IS NULL) + GROUP BY c.id + ) sub ON sub.id = c.id + LEFT JOIN vn.clientObservation cob ON cob.clientFk = c.id + AND cob.created > vThridPeriod + WHERE (sub.lastShipped < vFirstPeriod OR sub.lastShipped IS NULL) + AND c.created < vThridPeriod + AND co.code = vCountryCode + AND cob.`text` IS NULL + AND c.id NOT IN ( + SELECT DISTINCT clientFk + FROM vn.ticket + WHERE refFk IS NULL + AND shipped >= vFirstPeriod + ) + GROUP BY c.id; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clientNewBorn_recalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3576,23 +3705,21 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientNewBorn_recalc`() BLOCK1: BEGIN DECLARE vClientFk INT; - DECLARE vShipped DATE; + DECLARE vShipped DATE; DECLARE vPreviousShipped DATE; - DECLARE vDone boolean; - DECLARE cur cursor for - - SELECT clientFk, firstShipped - FROM bs.clientNewBorn; - - DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE; - SET vDone := FALSE; + DECLARE vDone boolean; + DECLARE cur cursor for + + SELECT clientFk, firstShipped + FROM bs.clientNewBorn; + + DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE; + SET vDone := FALSE; DELETE FROM bs.clientNewBorn WHERE isModified = FALSE; @@ -3604,7 +3731,7 @@ BLOCK1: BEGIN WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, util.VN_CURDATE()) AND util.VN_CURDATE() AND cb.isModified is null GROUP BY c.id; OPEN cur; - + LOOP1: LOOP SET vDone := FALSE; FETCH cur INTO vClientFk, vShipped; @@ -3615,37 +3742,37 @@ BLOCK1: BEGIN END IF; BLOCK2: BEGIN - DECLARE vCurrentShipped DATE; - DECLARE vDone2 boolean; + DECLARE vCurrentShipped DATE; + DECLARE vDone2 boolean; DECLARE cur2 CURSOR FOR - SELECT shipped - FROM vn.ticket + SELECT shipped + FROM vn.ticket WHERE clientFk = vClientFk AND shipped <= util.VN_CURDATE() ORDER BY shipped DESC; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone2 = TRUE; SET vDone2 := FALSE; OPEN cur2; - + SET vPreviousShipped := vShipped; LOOP2: LOOP SET vDone2 := FALSE; FETCH cur2 INTO vCurrentShipped; - + IF DATEDIFF(vPreviousShipped,vCurrentShipped) > 365 THEN - UPDATE bs.clientNewBorn - SET firstShipped = vPreviousShipped + UPDATE bs.clientNewBorn + SET firstShipped = vPreviousShipped WHERE clientFk= vClientFk; - + CLOSE cur2; - LEAVE LOOP2; + LEAVE LOOP2; END IF; - + SET vPreviousShipped := vCurrentShipped; IF vDone2 THEN - UPDATE bs.clientNewBorn - SET firstShipped = vCurrentShipped + UPDATE bs.clientNewBorn + SET firstShipped = vCurrentShipped WHERE clientFk= vClientFk; CLOSE cur2; LEAVE LOOP2; @@ -3655,20 +3782,22 @@ BLOCK1: BEGIN END BLOCK2; END LOOP LOOP1; - UPDATE bs.clientNewBorn cnb + UPDATE bs.clientNewBorn cnb LEFT JOIN (SELECT DISTINCT t.clientFk FROM vn.ticket t JOIN vn.productionConfig pc WHERE t.shipped BETWEEN util.VN_CURDATE() + INTERVAL -(`notBuyingMonths`) MONTH AND util.VN_CURDATE() + INTERVAL -(`pc`.`rookieDays`) DAY) notRookie ON notRookie.clientFk = cnb.clientFk - SET cnb.isRookie = ISNULL(notRookie.clientFk); - + SET cnb.isRookie = ISNULL(notRookie.clientFk); + END BLOCK1 ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `comercialesCompleto` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3676,25 +3805,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `comercialesCompleto`(IN vWorker INT, vDate DATE) BEGIN DECLARE vAYearAgoStarted DATE DEFAULT DATE_FORMAT(TIMESTAMPADD(YEAR, - 1, vDate), '%Y-%m-01'); DECLARE vAYearAgoEnded DATE DEFAULT TIMESTAMPADD(YEAR, - 1, LAST_DAY(vDate)); - + CALL vn.worker_GetHierarchy(vWorker); - + INSERT IGNORE INTO tmp.workerHierarchyList (workerFk) SELECT wd2.workerFk FROM vn.workerDepartment wd2 WHERE wd2.workerFk = vWorker; - + -- Falta que en algunos casos solo tenga en cuenta los tipos afectados. - SELECT + SELECT c.Id_Cliente id_cliente, - c.calidad, c.Cliente cliente, cr.recobro * 100 tarifa, c.Telefono telefono, @@ -3718,7 +3844,7 @@ BEGIN FROM vn2008.Clientes c LEFT JOIN - (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge + (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge FROM vn2008.Greuges g JOIN vn.`client` c ON c.id = g.Id_Cliente LEFT JOIN vn.worker w ON c.salesPersonFk = w.id @@ -3740,14 +3866,14 @@ BEGIN WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, vDate) AND vDate GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente LEFT JOIN - (SELECT + (SELECT Id_Cliente, SUM(importe) consumo FROM bs.ventas v INNER JOIN vn2008.Clientes c USING (Id_Cliente) LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente LEFT JOIN @@ -3794,6 +3920,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `compradores_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3801,24 +3929,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `compradores_add`(IN vYear INT, IN vWeekFrom INT, IN vWeekTo INT) BEGIN /** * Sustituye los registros de "bs.compradores". - * + * * @param vYear: año ventas * @param vWeekFrom: semana desde * @param vWeekTo: semana hasta */ REPLACE bs.compradores - SELECT it.workerFk AS Id_Trabajador, vYear AS año, tm.week AS semana, SUM(importe) AS importe, 0 AS comision + SELECT it.workerFk AS Id_Trabajador, vYear AS año, tm.week AS semana, SUM(importe) AS importe, 0 AS comision FROM bs.ventas v JOIN vn.time tm ON tm.dated = v.fecha - JOIN vn.itemType it ON it.id = v.tipo_id - WHERE tm.year = vYear + JOIN vn.itemType it ON it.id = v.tipo_id + WHERE tm.year = vYear AND tm.week BETWEEN vWeekFrom AND vWeekTo AND it.categoryFk != 6 GROUP BY it.workerFk, tm.week; @@ -3828,6 +3954,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `compradores_add_launcher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3835,8 +3963,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `compradores_add_launcher`() BEGIN @@ -3844,22 +3970,22 @@ BEGIN DECLARE vYear INT; DECLARE vWeek INT; DECLARE done BOOL DEFAULT FALSE; - + DECLARE rs CURSOR FOR SELECT year, week FROM vn.time - WHERE dated <= util.VN_CURDATE() - AND year = vYear + WHERE dated <= util.VN_CURDATE() + AND year = vYear AND week >= vWeek; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SELECT MAX(año) INTO vYear + + SELECT MAX(año) INTO vYear FROM compradores; - + SELECT MAX(semana) INTO vWeek - FROM compradores - WHERE año = vYear; + FROM compradores + WHERE año = vYear; OPEN rs; @@ -3868,7 +3994,7 @@ BEGIN WHILE NOT done DO CALL compradores_add(vYear, vWeek, vWeek); - + FETCH rs INTO vYear, vWeek; END WHILE; @@ -3876,13 +4002,15 @@ BEGIN CLOSE rs; CALL compradores_evolution_add; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `compradores_evolution_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3890,24 +4018,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `compradores_evolution_add`() BEGIN /** * Inserta en la tabla compradores_evolution las ventas acumuladas en los ultimos 365 dias - * + * */ DECLARE vDated DATE; DECLARE vCount INT DEFAULT 1; - SELECT MAX(fecha) + INTERVAL 1 DAY INTO vDated + SELECT MAX(fecha) + INTERVAL 1 DAY INTO vDated FROM compradores_evolution; IF vDated IS NULL THEN - - SELECT MIN(dated) INTO vDated + + SELECT MIN(dated) INTO vDated FROM sale; INSERT INTO compradores_evolution( @@ -3928,7 +4054,7 @@ BEGIN WHILE vDated < util.VN_CURDATE() DO SET vCount = vCount + 1; - + REPLACE compradores_evolution( Id_Trabajador, fecha, @@ -3940,18 +4066,18 @@ BEGIN SELECT Id_Trabajador, importe FROM compradores_evolution JOIN ( - SELECT DISTINCT it.workerFk - FROM vn.itemType it + SELECT DISTINCT it.workerFk + FROM vn.itemType it )sub2 ON sub2.workerFk = Id_Trabajador - WHERE fecha = vDated - INTERVAL 1 DAY + WHERE fecha = vDated - INTERVAL 1 DAY UNION ALL - SELECT it.workerFk, s.amount * IF(s.dated < vDated, -1, 1) + SELECT it.workerFk, s.amount * IF(s.dated < vDated, -1, 1) FROM sale s JOIN vn.itemType it ON it.id = s.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk WHERE s.dated IN (vDated, vDated - INTERVAL 1 YEAR) AND ic.merchandise - )sub + )sub GROUP BY Id_Trabajador; SET vDated = vDated + INTERVAL 1 DAY; @@ -3962,6 +4088,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `fondo_evolution_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3969,8 +4097,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fondo_evolution_add`() BEGIN @@ -3978,49 +4104,49 @@ BEGIN * Inserta en la tabla fondo_maniobra los saldos acumulados en los ultimos 365 dias */ DECLARE datFEC DATE DEFAULT '2015-01-01'; - - SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) - INTO datFEC + + SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) + INTO datFEC FROM bs.fondo_maniobra; - + WHILE datFEC < util.VN_CURDATE() DO - + IF DAY(datFEC) MOD 28 = 0 THEN -- esto solo sirve para no aburrirse mientras esperamos... SELECT datFEC; END IF; - + REPLACE bs.fondo_maniobra(Fecha, clientes_facturas, clientes_cobros,proveedores_facturas,proveedores_pagos, fondo) SELECT datFEC AS Fecha, Facturas, Cobros,Recibidas,Pagos, Facturas + Cobros + Recibidas + Pagos FROM ( SELECT SUM(io.amount) AS Facturas FROM vn.invoiceOut io - JOIN vn.client c ON io.clientFk = c.id + JOIN vn.client c ON io.clientFk = c.id WHERE c.isRelevant - AND io.companyFk <> 1381 + AND io.companyFk <> 1381 AND io.issued BETWEEN '2011-01-01' AND datFEC ) fac JOIN ( SELECT - SUM(r.amountPaid) AS Cobros - FROM vn.receipt r - JOIN vn.client c ON r.clientFk = c.id - WHERE c.isRelevant + FROM vn.receipt r + JOIN vn.client c ON r.clientFk = c.id + WHERE c.isRelevant AND r.companyFk <> 1381 AND r.payed BETWEEN '2011-01-01' AND datFEC ) cob JOIN ( SELECT - SUM(id.amount) AS Recibidas - FROM vn.invoiceIn ii - JOIN vn.invoiceInDueDay id ON ii.id = id.invoiceInFk + FROM vn.invoiceIn ii + JOIN vn.invoiceInDueDay id ON ii.id = id.invoiceInFk WHERE ii.companyFk <> 1381 AND ii.issued BETWEEN '2015-01-01' AND datFEC ) rec JOIN ( SELECT SUM(p.amount) AS Pagos - FROM vn.payment p - WHERE p.companyFk <>1381 + FROM vn.payment p + WHERE p.companyFk <>1381 AND p.received BETWEEN '2015-01-01' AND datFEC ) pag; - + UPDATE bs.fondo_maniobra JOIN ( SELECT AVG(fondo) AS media @@ -4028,7 +4154,7 @@ BEGIN WHERE fecha <= datFEC ) sub SET fondo_medio = media WHERE fecha = datFEC; - + SET datFEC = TIMESTAMPADD(DAY,1,datFEC); END WHILE; @@ -4040,6 +4166,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `fruitsEvolution` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4047,12 +4175,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fruitsEvolution`() BEGIN -select Id_Cliente, +select Id_Cliente, Cliente, count(semana) as semanas, (w.code IS NOT NULL) isWorker from ( select distinct v.Id_Cliente, c.name as Cliente, week(fecha, 3) as semana @@ -4070,6 +4196,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `indicatorsUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4077,8 +4205,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `indicatorsUpdate`(vDated DATE) BEGIN @@ -4093,40 +4219,40 @@ BEGIN -- Ventas totales del ultimo año UPDATE indicators - SET lastYearSales = + SET lastYearSales = (SELECT SUM(importe + recargo) FROM ventas v JOIN vn2008.empresa e ON e.id = v.empresa_id JOIN vn2008.empresa_grupo eg ON eg.empresa_grupo_id = e.empresa_grupo WHERE fecha BETWEEN oneYearBefore AND vDated AND eg.grupo = 'Verdnatura' - ) + ) WHERE updated = vDated; - + -- Greuge total acumulado UPDATE indicators - SET totalGreuge = + SET totalGreuge = (SELECT SUM(amount) FROM vn.greuge WHERE shipped <= vDated - ) + ) WHERE updated = vDated; -- Tasa de morosidad con respecto a las ventas del último mes UPDATE indicators - SET latePaymentRate = - (SELECT SUM(amount) - FROM bi.defaulters + SET latePaymentRate = + (SELECT SUM(amount) + FROM bi.defaulters WHERE date = vDated AND amount > 0) / - (SELECT SUM(importe + recargo) - FROM ventas + (SELECT SUM(importe + recargo) + FROM ventas WHERE fecha BETWEEN oneMonthBefore AND vDated) WHERE updated = vDated; -- Número de trabajadores activos UPDATE indicators - SET countEmployee = + SET countEmployee = (SELECT CAST(SUM(ct.hoursWeek) / 40 AS DECIMAL (10, 2)) FROM vn.business b JOIN vn.calendarType ct ON ct.id = b.calendarTypeFk @@ -4145,7 +4271,7 @@ BEGIN -- Número de clientes que han comprado en los últimos 30 dias UPDATE indicators - SET lastMonthActiveClients = + SET lastMonthActiveClients = (SELECT COUNT(DISTINCT t.clientFk) FROM vn.ticket t WHERE t.shipped BETWEEN oneMonthBefore AND vDated @@ -4154,9 +4280,9 @@ BEGIN -- Número de clientes que no han comprado en los últimos 30 dias, pero compraron en los 30 anteriores UPDATE indicators - SET lastMonthLostClients = + SET lastMonthLostClients = (SELECT COUNT(lm.clientFk) - FROM + FROM (SELECT DISTINCT t.clientFk FROM vn.ticket t WHERE t.shipped BETWEEN oneMonthBefore AND vDated @@ -4173,9 +4299,9 @@ BEGIN -- Número de clientes que han comprado en los últimos 30 dias, pero no compraron en los 30 anteriores UPDATE indicators - SET lastMonthNewClients = + SET lastMonthNewClients = (SELECT COUNT(cm.clientFk) - FROM + FROM (SELECT DISTINCT t.clientFk FROM vn.ticket t WHERE t.shipped BETWEEN oneMonthBefore AND vDated @@ -4201,7 +4327,7 @@ BEGIN -- Cálculo de las ventas agrupado por semanas SELECT week INTO vWeek - FROM vn.time + FROM vn.time WHERE dated = vDated; TRUNCATE salesByWeek; @@ -4215,12 +4341,12 @@ BEGIN -- Indicador Ventas semana actual UPDATE indicators i - JOIN salesByWeek s ON s.week= vWeek + JOIN salesByWeek s ON s.week= vWeek AND s.year = YEAR(vDated) SET i.thisWeekSales = s.sales WHERE updated = vDated; - -- Indicador ventas semana actual en el año pasado + -- Indicador ventas semana actual en el año pasado UPDATE indicators i JOIN salesByWeek s ON s.week = vWeek AND s.year = YEAR(vDated)-1 @@ -4233,6 +4359,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `indicatorsUpdateLauncher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4240,8 +4368,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `indicatorsUpdateLauncher`() BEGIN @@ -4251,15 +4377,15 @@ BEGIN SELECT IFNULL(TIMESTAMPADD(DAY,1,MAX(updated)), '2018-04-01') INTO vDated FROM bs.indicators; - + WHILE vDated < util.VN_CURDATE() DO - + CALL indicatorsUpdate(vDated); - + SELECT TIMESTAMPADD(DAY,1,MAX(updated)) INTO vDated FROM bs.indicators; - + END WHILE; END ;; @@ -4268,6 +4394,113 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `inventoryDiscrepancyDetail_replace` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryDiscrepancyDetail_replace`() +BEGIN +/** + * Replace all records in table inventoryDiscrepancyDetail and insert new + * records into inventoryDiscrepancy for all inventory warehouses. + */ + DECLARE vDone INT DEFAULT FALSE; + DECLARE vCalc INT; + DECLARE vWarehouseFk INT; + + DECLARE cWarehouses CURSOR FOR + SELECT id + FROM vn.warehouse + WHERE isInventory; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + TRUNCATE TABLE inventoryDiscrepancyDetail; + + OPEN cWarehouses; + read_loop: LOOP + SET vDone = FALSE; + FETCH cWarehouses INTO vWarehouseFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + CALL cache.visible_refresh(vCalc, FALSE, vWarehouseFk); + + CREATE OR REPLACE TEMPORARY TABLE tVisible + SELECT itemFk, SUM(visible) totalVisible + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + WHERE sc.warehouseFk = vWarehouseFk + GROUP BY itemFk; + + INSERT INTO inventoryDiscrepancyDetail( + warehouseFk, + itemFk, + theorical, + visible, + notPicked, + alert) + SELECT vWarehouseFk warehouseFk, + v.item_id itemFk, + v.visible, + tv.totalVisible, + s.notPicked, + CASE + WHEN s.notPicked > IFNULL(tv.totalVisible, 0) THEN 0 + WHEN v.visible > IFNULL((tv.totalVisible * 2), 0) THEN 1 + WHEN v.visible > tv.totalVisible THEN 2 + ELSE 3 + END alert + FROM cache.visible v + LEFT JOIN tVisible tv ON tv.itemFk = v.item_id + JOIN ( + SELECT s.itemFk, SUM(s.quantity) notPicked + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.alertLevel al ON al.id = ts.alertLevel + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) + AND s.isPicked = FALSE + AND al.code = 'FREE' + AND t.warehouseFk = vWarehouseFk + GROUP BY s.itemFk + HAVING notPicked + ) s ON s.itemFk = v.item_id + WHERE v.calc_id = vCalc + AND NOT v.visible <=> tv.totalVisible; + + END LOOP; + CLOSE cWarehouses; + + INSERT INTO inventoryDiscrepancy( + warehouseFk, + alert, + quantity) + SELECT warehouseFk, + alert, + COUNT(*) + FROM inventoryDiscrepancyDetail + GROUP BY warehouseFk, alert; + + DROP TEMPORARY TABLE IF EXISTS tVisible; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `m3Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4275,23 +4508,21 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `m3Add`() BEGIN DECLARE datSTART DATE; DECLARE datEND DATE; - + SELECT TIMESTAMPADD(WEEK, -1,MAX(fecha)) INTO datSTART FROM bs.m3; - + SET datEND = TIMESTAMPADD(DAY,-1,util.VN_CURDATE()); - - DELETE FROM bs.m3 + + DELETE FROM bs.m3 WHERE fecha >= datSTART; - + INSERT INTO bs.m3 (fecha, provinceFk, warehouseFk, m3, year, month, week, day, dayName, euros) SELECT v.fecha, a.provinceFk, t.warehouseFk, sum(s.quantity * ic.cm3delivery) / 1000000 AS m3, tm.year, tm.month, tm.week, tm.day, dayname(v.fecha), sum(importe) @@ -4313,6 +4544,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `manaCustomerUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4320,8 +4553,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `manaCustomerUpdate`() BEGIN @@ -4334,51 +4565,51 @@ BEGIN DECLARE vManaBankId INT; DECLARE vManaGreugeTypeId INT; - SELECT id INTO vManaId + SELECT id INTO vManaId FROM vn.component WHERE code = 'mana'; - - SELECT id INTO vManaAutoId + + SELECT id INTO vManaAutoId FROM vn.component WHERE code = 'autoMana'; - + SELECT id INTO vClaimManaId FROM vn.component WHERE code = 'manaClaim'; - - SELECT id INTO vManaBankId + + SELECT id INTO vManaBankId FROM vn.bank WHERE code = 'mana'; - - SELECT id INTO vManaGreugeTypeId + + SELECT id INTO vManaGreugeTypeId FROM vn.greugeType WHERE code = 'mana'; SELECT IFNULL(MAX(dated), '2016-01-01') - INTO vFromDated + INTO vFromDated FROM vn.clientManaCache; - + DELETE FROM vn.clientManaCache WHERE dated = vFromDated; SELECT IFNULL(MAX(dated), '2016-01-01') - INTO vFromDated + INTO vFromDated FROM vn.clientManaCache; WHILE timestampadd(DAY,30,vFromDated) < util.VN_CURDATE() DO SELECT timestampadd(DAY,30,vFromDated), - timestampadd(DAY,-90,vFromDated) - INTO + timestampadd(DAY,-90,vFromDated) + INTO vToDated, vForDeleteDated; - + DELETE FROM vn.clientManaCache WHERE dated <= vForDeleteDated; INSERT INTO vn.clientManaCache(clientFk, mana, dated) - SELECT + SELECT Id_Cliente, cast(sum(mana) as decimal(10,2)) as mana, - vToDated as dated - FROM + vToDated as dated + FROM ( SELECT cs.Id_Cliente, Cantidad * Valor as mana FROM vn2008.Tickets t @@ -4386,20 +4617,20 @@ BEGIN JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento WHERE Id_Componente IN (vManaAutoId, vManaId, vClaimManaId) - AND t.Fecha > vFromDated + AND t.Fecha > vFromDated AND date(t.Fecha) <= vToDated UNION ALL SELECT r.Id_Cliente, - Entregado FROM vn2008.Recibos r WHERE Id_Banco = vManaBankId - AND Fechacobro > vFromDated + AND Fechacobro > vFromDated AND Fechacobro <= vToDated - + UNION ALL SELECT g.Id_Cliente, g.Importe FROM vn2008.Greuges g WHERE Greuges_type_id = vManaGreugeTypeId - AND Fecha > vFromDated + AND Fecha > vFromDated AND Fecha <= vToDated UNION ALL SELECT clientFk, mana @@ -4410,7 +4641,7 @@ BEGIN HAVING Id_Cliente; SET vFromDated = vToDated; - + END WHILE; END ;; @@ -4419,6 +4650,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `manaSpellers_actualize` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4426,27 +4659,25 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `manaSpellers_actualize`() BEGIN -/** - * Recalcula el valor del campo con el modificador de precio +/** + * Recalcula el valor del campo con el modificador de precio * para el componente de maná automático. */ - UPDATE vn.workerMana wm + UPDATE vn.workerMana wm JOIN ( - SELECT c.lastSalesPersonFk, + SELECT c.lastSalesPersonFk, FLOOR(SUM(s.amount) / 12) amount FROM salesByclientSalesPerson s JOIN vn.client c ON c.id = s.clientFk WHERE s.dated BETWEEN util.VN_CURDATE() - INTERVAL 1 YEAR AND util.VN_CURDATE() GROUP BY c.lastSalesPersonFk - )avgPortfolioWeight ON avgPortfolioWeight.lastSalesPersonFk = wm.workerFk + )avgPortfolioWeight ON avgPortfolioWeight.lastSalesPersonFk = wm.workerFk JOIN vn.salespersonConfig spc SET wm.pricesModifierRate = GREATEST( - spc.manaMinRate, + spc.manaMinRate, LEAST(spc.manaMaxRate, ROUND( - wm.amount / avgPortfolioWeight.amount))); END ;; DELIMITER ; @@ -4454,6 +4685,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `nightTask_launchAll` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4461,8 +4694,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `nightTask_launchAll`() BEGIN @@ -4479,8 +4710,8 @@ BEGIN DECLARE vId INT; DECLARE rs CURSOR FOR - SELECT id, `schema`, `procedure` - FROM nightTask + SELECT id, `schema`, `procedure` + FROM nightTask WHERE finished <= util.VN_CURDATE() OR finished IS NULL ORDER BY `order`; @@ -4513,7 +4744,7 @@ BEGIN vError, vErrorCode ); - + IF vError IS NOT NULL THEN SET vNErrors = vNErrors + 1; @@ -4551,6 +4782,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `nightTask_launchTask` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4558,8 +4791,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `nightTask_launchTask`( vSchema VARCHAR(255), @@ -4583,13 +4814,15 @@ BEGIN vError = MESSAGE_TEXT, vErrorCode = RETURNED_SQLSTATE; - CALL util.exec(CONCAT('CALL `', vSchema ,'`.`', vProcedure ,'`')); + CALL util.exec(CONCAT('CALL `', vSchema ,'`.`', vProcedure ,'`')); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `payMethodClientAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4597,33 +4830,33 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `payMethodClientAdd`() BEGIN - INSERT IGNORE INTO `bs`.`payMethodClient` (dated, payMethodFk, clientFk) + INSERT IGNORE INTO `bs`.`payMethodClient` (dated, payMethodFk, clientFk) SELECT util.VN_CURDATE(), c.payMethodFk, c.id - FROM vn.client c + FROM vn.client c JOIN vn.payMethod p ON c.payMethodFk = p.id; - + TRUNCATE `bs`.`payMethodClientEvolution` ; - + INSERT INTO `bs`.`payMethodClientEvolution` (dated, payMethodName, amountClient, amount, equalizationTax) - SELECT p.dated, pm.name, COUNT(p.clientFk), SUM(sub.importe) , SUM(sub.recargo) + SELECT p.dated, pm.name, COUNT(p.clientFk), SUM(sub.importe) , SUM(sub.recargo) FROM bs.payMethodClient p - JOIN (SELECT SUM(v.importe) AS importe, SUM(v.recargo) as recargo, v.fecha, v.Id_cliente + JOIN (SELECT SUM(v.importe) AS importe, SUM(v.recargo) as recargo, v.fecha, v.Id_cliente FROM bs.ventas v WHERE v.fecha>= (SELECT MIN(dated) FROM bs. payMethodClient) GROUP BY v.Id_cliente, v.fecha) sub ON sub.fecha = p.dated AND sub.Id_cliente = p.ClientFk JOIN vn.payMethod pm ON p.payMethodFk = pm.id - GROUP BY dated,payMethodFk; + GROUP BY dated,payMethodFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleGraphic` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4631,18 +4864,16 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGraphic`(IN vItemFk INT, IN vTypeFk INT, IN vCategoryFk INT, IN vFromDate DATE, IN vToDate DATE, IN vProducerFk INT) BEGIN - + DECLARE vFromDateLastYear DATE; DECLARE vToDateLastYear DATE; DECLARE vFromDateTwoYearsAgo DATE; DECLARE vToDateTwoYearsAgo DATE; - + SET vItemFk = IFNULL(vItemFk,0); SET vTypeFk = IFNULL(vTypeFk, 0); SET vCategoryFk = IFNULL(vCategoryFk,0); @@ -4657,25 +4888,27 @@ BEGIN SELECT s.quantity, CAST(v.importe AS DECIMAL(10,0)) importe, v.fecha FROM bs.ventas v - JOIN vn.sale s ON s.id = v.Id_Movimiento - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.sale s ON s.id = v.Id_Movimiento + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk WHERE vItemFk IN (i.id, 0) AND vTypeFk IN (i.typeFk, 0) AND vCategoryFk IN (it.categoryFk, 0) AND vProducerFk IN (i.producerFk, 0) AND (v.fecha BETWEEN vFromDate AND vToDate OR v.fecha BETWEEN vFromDateLastYear AND vToDateLastYear - OR v.fecha BETWEEN vFromDateTwoYearsAgo AND vToDateTwoYearsAgo + OR v.fecha BETWEEN vFromDateTwoYearsAgo AND vToDateTwoYearsAgo ); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `salePersonEvolutionAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4683,32 +4916,32 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `salePersonEvolutionAdd`(IN vDateStart DATETIME) BEGIN - DELETE FROM bs.salePersonEvolution + DELETE FROM bs.salePersonEvolution WHERE dated <= DATE_SUB(util.VN_CURDATE(), INTERVAL 1 YEAR); - - + + INSERT INTO bs.salePersonEvolution (dated, amount, equalizationTax, salesPersonFk) - SELECT fecha dated, - CAST(SUM(importe) AS DECIMAL(10,2) ) amount, + SELECT fecha dated, + CAST(SUM(importe) AS DECIMAL(10,2) ) amount, CAST(SUM(recargo) AS DECIMAL(10,2) ) equalizationTax , IFNULL(salesPersonFk,0) salesPersonFk FROM bs.ventas v - JOIN vn.client c ON v.Id_Cliente = c.id + JOIN vn.client c ON v.Id_Cliente = c.id JOIN vn.company co ON co.id = v.empresa_id WHERE co.code = "VNL" AND fecha >= vDateStart GROUP BY v.fecha,c.salesPersonFk - ORDER BY salesPersonFk,dated ASC; + ORDER BY salesPersonFk,dated ASC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `salesByclientSalesPerson_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4716,15 +4949,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `salesByclientSalesPerson_add`(vDatedFrom DATE) BEGIN /** * Agrupa las ventas por cliente/comercial/fecha en la tabla bs.salesByclientSalesPerson * El asociación cliente/comercial/fecha, se mantiene correcta en el tiempo - * + * * @param vDatedFrom el cálculo se realizará desde la fecha introducida hasta ayer */ @@ -4732,17 +4963,17 @@ BEGIN SET vDatedFrom = util.VN_CURDATE() - INTERVAL 1 MONTH; END IF; - UPDATE salesByclientSalesPerson + UPDATE salesByclientSalesPerson SET amount = 0, equalizationTax = 0, amountNewBorn = 0 WHERE dated BETWEEN vDatedFrom AND util.yesterday(); - - INSERT INTO salesByclientSalesPerson( - dated, - salesPersonFk, - clientFk, - amount, + + INSERT INTO salesByclientSalesPerson( + dated, + salesPersonFk, + clientFk, + amount, equalizationTax) SELECT s.dated, c.salesPersonFk, @@ -4751,7 +4982,7 @@ BEGIN SUM(s.surcharge) FROM sale s JOIN vn.client c on s.clientFk = c.id - WHERE s.dated BETWEEN vDatedFrom AND util.yesterday() + WHERE s.dated BETWEEN vDatedFrom AND util.yesterday() GROUP BY s.dated, c.salesPersonFk, s.clientFk ON DUPLICATE KEY UPDATE amount= VALUES(amount), equalizationTax= VALUES(equalizationTax); @@ -4768,6 +4999,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `salesByItemTypeDay_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4775,181 +5008,124 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `salesByItemTypeDay_add`(vDateStart DATE, vDateEnd DATE) +CREATE DEFINER=`root`@`localhost` PROCEDURE `salesByItemTypeDay_add`( + vDateStart DATE, + vDateEnd DATE +) BEGIN /** - * Almacena datos relativos a las ventas de artículos agrupados por reino, familia y dia + * Almacena datos relativos a las ventas de artículos + * agrupados por reino, familia y día * * @param vDateStart * @param vDateEnd */ - - DELETE FROM bs.salesByItemTypeDay + DELETE FROM salesByItemTypeDay WHERE dated BETWEEN vDateStart AND vDateEnd; - INSERT INTO bs.salesByItemTypeDay (itemTypeFk, itemCategoryFk, dated) - SELECT id, categoryFk, dated - FROM vn.itemType - JOIN vn.`time` - WHERE dated BETWEEN vDateStart AND vDateEnd; + INSERT INTO salesByItemTypeDay (itemTypeFk, dated, `references`, netSale, stems) + SELECT it.id itemTypeFk, + bs.dated, + COUNT(DISTINCT(i.id)) `references`, + SUM(bs.amount) netSale, + SUM(i.stems * s.quantity) stems + FROM sale bs + JOIN vn.itemType it ON it.id = bs.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.sale s ON s.id = bs.saleFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticket t ON t.id = s.ticketFk + WHERE ic.merchandise + AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) + GROUP BY it.id, bs.dated; - UPDATE bs.salesByItemTypeDay it - JOIN (SELECT ic.id itemCategoryFk, - it.id itemTypeFk, - bs.dated, - SUM(bs.amount) netSale - FROM bs.sale bs - JOIN vn.itemType it ON it.id = bs.typeFk - JOIN vn .itemCategory ic ON ic.id = it.categoryFk - JOIN vn.client c on c.id = bs.clientFk - JOIN vn.sale s ON s.id = bs.saleFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.`time` ti ON ti.dated = bs.dated - WHERE ic.merchandise - AND bs.dated BETWEEN vDateStart AND vDateEnd - GROUP BY ic.id, it.id, bs.dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk - SET it.netSale = sub.netSale; + INSERT INTO salesByItemTypeDay (itemTypeFk, dated, trash, faults) + SELECT it.id itemTypeFk, + DATE(t.shipped) dated, + SUM(IF(c.name = 'FALTAS', i.stems * s.quantity, 0)) trash, + SUM(IF(c.name = 'BASURA', IFNULL(i.stems, 1) * s.quantity, 0)) faults + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.client c ON c.id = t.clientFk + WHERE c.name IN ('BASURA', 'FALTAS') + AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) + GROUP BY it.id, dated + ON DUPLICATE KEY UPDATE + trash = VALUES(trash), + faults = VALUES(faults); - UPDATE bs.salesByItemTypeDay it - JOIN (SELECT ic.id AS itemCategoryFk, - it.id AS itemTypeFk, + INSERT INTO salesByItemTypeDay (itemTypeFk, dated, accepted, claimed) + SELECT it.id itemTypeFk, + DATE(t.shipped) dated, + SUM( + (cb.quantity * s.price * (100 - s.discount) / 100) * + ((cc.maxResponsibility - c.responsibility ) / 4 ) + ) accepted, + SUM(cb.quantity * s.price * (100 - s.discount) / 100) claimed + FROM vn.claim c + JOIN vn.claimBeginning cb ON cb.claimFk = c.id + JOIN vn.sale s ON s.id = cb.saleFk + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.claimConfig cc + WHERE ic.merchandise + AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) + GROUP BY it.id, dated + ON DUPLICATE KEY UPDATE + accepted = VALUES(accepted), + claimed = VALUES(claimed); + + INSERT INTO salesByItemTypeDay (itemTypeFk, dated, sale, buy) + SELECT itemTypeFk, + dated, + CAST(SUM(sale) AS DECIMAL(10,2)) sale, + CAST(SUM(buy) AS DECIMAL(10,2)) buy + FROM ( + SELECT it.id itemTypeFk, bs.dated, - SUM(i.stems * s.quantity) stems - FROM bs.sale bs + SUM(amount) sale, + 0 buy + FROM sale bs JOIN vn.itemType it ON it.id = bs.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.client c ON c.id = bs.clientFk JOIN vn.sale s ON s.id = bs.saleFk JOIN vn.ticket t ON t.id = s.ticketFk JOIN vn.item i ON i.id = s.itemFk - JOIN vn.`time` tm ON tm.dated = bs.dated WHERE ic.merchandise - AND bs.dated BETWEEN vDateStart AND vDateEnd - GROUP BY ic.id, it.id, bs.dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk - SET it.stems = sub.stems; - - - UPDATE bs.salesByItemTypeDay it - JOIN (SELECT ic.id AS itemCategoryFk, - it.id AS itemTypeFk, - DATE(t.shipped) dated, - COUNT(DISTINCT(i.id)) `references` - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk + AND t.shipped BETWEEN vDateStart AND vDateEnd + GROUP BY it.id, bs.dated + UNION ALL + SELECT it.id, + t.landed, + 0, + SUM(b.buyingValue * b.quantity) + FROM vn.entry e + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.buy b ON b.entryFk = e.id + JOIN vn.item i ON i.id = b.itemFk JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk WHERE ic.merchandise - AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) - GROUP BY ic.id, it.id, dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk - SET it.`references` = sub.`references`; + AND t.landed BETWEEN vDateStart AND vDateEnd + GROUP BY it.id, t.landed + ) sub + GROUP BY itemTypeFk, dated + ON DUPLICATE KEY UPDATE + sale = VALUES(sale), + buy = VALUES(buy); - UPDATE bs.salesByItemTypeDay it - JOIN (SELECT ic.id AS itemCategoryFk, - it.id AS itemTypeFk, - DATE(t.shipped) dated, - SUM(i.stems*s.quantity) AS trash - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.client c ON c.id = t.clientFk - WHERE c.name = 'BASURA' - AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) - GROUP BY ic.id, it.id, dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk - SET it.trash = sub.trash; - - UPDATE bs.salesByItemTypeDay it - JOIN (SELECT ic.id AS itemCategoryFk, - it.id AS itemTypeFk, - DATE(t.shipped) dated, - SUM(IFNULL(i.stems, 1) * s.quantity) AS faults - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.client c ON c.id = t.clientFk - WHERE c.name = 'FALTAS' - AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) - GROUP BY ic.id, it.id, dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk - SET it.`faults` = sub.`faults`; - - UPDATE bs.salesByItemTypeDay it - JOIN (SELECT ic.id AS itemCategoryFk, - it.id AS itemTypeFk, - DATE(t.shipped) dated, - SUM((cb.quantity * s.price * (100 - s.discount) / 100) * ((cc.maxResponsibility - c.responsibility )/4 )) accepted, - SUM(cb.quantity * s.price * (100 - s.discount) / 100) claimed - FROM vn.claim c - JOIN vn.claimBeginning cb ON cb.claimFk = c.id - JOIN vn.sale s ON s.id = cb.saleFk - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.claimConfig cc - WHERE ic.merchandise - AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) - GROUP BY ic.id, it.id, dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk - SET it.accepted = sub.accepted, - it.claimed = sub.claimed; - - UPDATE bs.salesByItemTypeDay it - JOIN(SELECT itemCategoryFk, - itemTypeFk, - dated, - CAST(SUM(sale) AS DECIMAL(10,2)) sale, - CAST(SUM(buy) AS DECIMAL(10,2))buy - FROM(SELECT ic.id itemCategoryFk, - it.id itemTypeFk, - bs.dated, - SUM(bs.amount) sale, - 0 buy - FROM bs.sale bs - JOIN vn.itemType it ON it.id = bs.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.client c on c.id = bs.clientFk - JOIN vn.`time` tm ON tm.dated = bs.dated - JOIN vn.sale s ON s.id = bs.saleFk - JOIN vn.item i ON i.id = s.itemFk - WHERE ic.merchandise - AND bs.dated BETWEEN vDateStart AND vDateEnd - GROUP BY ic.id, it.id, bs.dated - UNION ALL - SELECT ic.id, - it.id, - t.landed, - 0 , - SUM(b.buyingValue * b.quantity) - FROM vn.entry e - JOIN vn.travel t ON t.id = e.travelFk - JOIN vn.buy b ON b.entryFk = e.id - JOIN vn.item i ON i.id = b.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE ic.merchandise - AND t.landed BETWEEN vDateStart AND vDateEnd - GROUP BY ic.id, it.id, t.landed) sub - GROUP BY itemCategoryFk, itemTypeFk, dated) sub2 ON sub2.dated = it.dated AND sub2.itemCategoryFk = it.itemCategoryFk AND sub2.itemTypeFk = it.itemTypeFk - SET it.sale = sub2.sale, - it.buy = sub2.buy; - - DROP TEMPORARY TABLE IF EXISTS tmp.`component`; - CREATE TEMPORARY TABLE tmp.`component` - (PRIMARY KEY (`itemTypeFk`,`dated`), - KEY `salesByItemTypeDay_itemCategoryFk_idx` (`itemCategoryFk`), - KEY `salesByItemTypeDay_dated_idx` (`dated`)) - ENGINE = MEMORY - SELECT DATE(t.shipped) dated, - ic.id itemCategoryFk, - it.id itemTypeFk, - SUM(s.quantity * IF(c.code = 'purchaseValue', sc.value,0)) costComponent, - SUM(s.quantity * IF(ct.isMargin, sc.value,0)) marginComponent + INSERT INTO salesByItemTypeDay (itemTypeFk, dated, costComponent, marginComponent) + SELECT it.id itemTypeFk, + DATE(t.shipped) dated, + SUM(s.quantity * IF(c.code = 'purchaseValue', sc.value, 0)) costComponent, + SUM(s.quantity * IF(ct.isMargin, sc.value, 0)) marginComponent FROM vn.ticket t JOIN vn.sale s ON t.id = s.ticketFk JOIN vn.item i ON i.id = s.itemFk @@ -4959,21 +5135,18 @@ BEGIN STRAIGHT_JOIN vn.component c ON c.id = sc.componentFk JOIN vn.componentType ct ON ct.id = c.typeFk WHERE t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) - GROUP BY ic.id, it.id, dated; - - UPDATE bs.salesByItemTypeDay it - JOIN tmp.`component` c ON c.dated = it.dated AND c.itemCategoryFk = it.itemCategoryFk AND c.itemTypeFk = it.itemTypeFk - SET it.costComponent = c.costComponent, - it.marginComponent = c.marginComponent, - it.saleComponent = c.costComponent + c.marginComponent; - - DROP TEMPORARY TABLE tmp.`component`; + GROUP BY it.id, dated + ON DUPLICATE KEY UPDATE + costComponent = VALUES(costComponent), + marginComponent = VALUES(marginComponent); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `salesByItemTypeDay_addLauncher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4981,21 +5154,18 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `salesByItemTypeDay_addLauncher`() -BEGIN - DECLARE vDateStart,vDateEnd INT; - - SELECT DATE_SUB(util.VN_CURDATE(), INTERVAL 30 DAY), util.VN_CURDATE() INTO vDateStart,vDateEnd; - CALL bs.salesByItemTypeDay_add(vDateStart, vDateEnd); +BEGIN + CALL bs.salesByItemTypeDay_add(util.VN_CURDATE() - INTERVAL 30 DAY, util.VN_CURDATE()); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `salesPersonEvolution_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5003,41 +5173,39 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `salesPersonEvolution_add`() BEGIN /** - * Calcula los datos para los gráficos de evolución agrupado por salesPersonFk y día. + * Calcula los datos para los gráficos de evolución agrupado por salesPersonFk y día. * Recalcula automáticamente los 3 últimos meses para comprobar si hay algún cambio. */ DECLARE vDated DATE; DECLARE vCont INT DEFAULT 1; - SELECT MAX(dated) - INTERVAL 3 MONTH INTO vDated + SELECT MAX(dated) - INTERVAL 3 MONTH INTO vDated FROM salesPersonEvolution; - DELETE FROM salesPersonEvolution + DELETE FROM salesPersonEvolution WHERE dated >= vDated; IF ISNULL(vDated) THEN - SELECT MIN(dated) INTO vDated + SELECT MIN(dated) INTO vDated FROM salesByclientSalesPerson; - + INSERT INTO salesPersonEvolution( - salesPersonFk, - dated, - amount, - equalizationTax, + salesPersonFk, + dated, + amount, + equalizationTax, amountNewBorn ) - SELECT salesPersonFk, - dated, - amount, - equalizationTax, + SELECT salesPersonFk, + dated, + amount, + equalizationTax, amountNewBorn - FROM salesByclientSalesPerson + FROM salesByclientSalesPerson WHERE dated = vDated GROUP BY salesPersonFk; @@ -5045,21 +5213,21 @@ BEGIN END IF; WHILE vDated < util.VN_CURDATE() DO - + SET vCont = vCont + 1; REPLACE salesPersonEvolution(salesPersonFk, dated, amount) SELECT salesPersonFk, vDated, amount FROM(SELECT salesPersonFk, SUM(amount) amount FROM(SELECT salesPersonFk, amount - FROM salesPersonEvolution + FROM salesPersonEvolution WHERE dated = vDated - INTERVAL 1 DAY UNION ALL - SELECT salesPersonFk, amount - FROM salesByclientSalesPerson + SELECT salesPersonFk, amount + FROM salesByclientSalesPerson WHERE dated = vDated UNION ALL SELECT salesPersonFk, - amount - FROM salesByclientSalesPerson + FROM salesByclientSalesPerson WHERE dated = vDated - INTERVAL 1 YEAR )sub GROUP BY salesPersonFk @@ -5074,6 +5242,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `vendedores_add_launcher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5081,20 +5251,20 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `vendedores_add_launcher`() BEGIN CALL bs.salesByclientSalesPerson_add(util.VN_CURDATE()- INTERVAL 45 DAY); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ventas_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5102,8 +5272,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_add`( IN vStarted DATETIME, @@ -5112,7 +5280,7 @@ BEGIN /** * Añade las ventas que se realizaron entre * vStarted y vEnded -* +* * @param vStarted Fecha de inicio * @param vEnded Fecha de finalizacion * @@ -5120,7 +5288,7 @@ BEGIN DECLARE vStartingDate DATETIME; DECLARE vEndingDate DATETIME; - IF vStarted < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) + IF vStarted < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) OR vEnded < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) THEN CALL util.throw('fechaDemasiadoAntigua'); END IF; @@ -5129,8 +5297,8 @@ BEGIN SET vStartingDate = vStarted ; SET vEndingDate = util.dayEnd(vStartingDate); - DELETE - FROM sale + DELETE + FROM sale WHERE dated BETWEEN vStartingDate AND vEnded; WHILE vEndingDate <= vEnded DO @@ -5151,28 +5319,28 @@ BEGIN JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.address a ON a.id = t.addressFk + JOIN vn.address a ON a.id = t.addressFk JOIN vn.client cl ON cl.id = a.clientFk WHERE t.shipped BETWEEN vStartingDate AND vEndingDate AND s.quantity <> 0 AND s.discount <> 100 - AND ic.merchandise + AND ic.merchandise GROUP BY sc.saleFk HAVING IFNULL(importe,0) <> 0 OR IFNULL(recargo,0) <> 0; UPDATE sale s JOIN ( - SELECT s.id, + SELECT s.id, SUM(s.quantity * sc.value ) margen, s.quantity * s.price * (100 - s.discount ) / 100 pvp FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.ticket t ON t.id = s.ticketFk JOIN vn.saleComponent sc ON sc.saleFk = s.id - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk WHERE t.shipped BETWEEN vStartingDate AND vEndingDate AND ct.isMargin = TRUE - GROUP BY s.id) sub ON sub.id = s.saleFk + GROUP BY s.id) sub ON sub.id = s.saleFk SET s.margin = sub.margen + s.amount + s.surcharge - sub.pvp; SET vStartingDate = TIMESTAMPADD(DAY,1, vStartingDate); @@ -5186,6 +5354,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ventas_add_launcher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5193,14 +5363,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_add_launcher`() BEGIN /** * Añade las ventas a la tabla bs.sale que se realizaron desde hace un mes hasta hoy - * + * */ DECLARE vCurDate DATE DEFAULT util.VN_CURDATE(); @@ -5212,6 +5380,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5219,12 +5389,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_contables_add`(IN vYear INT, IN vMonth INT) BEGIN - + /** * Reemplaza las ventas contables del último año. * Es el origen de datos para el balance de Entradas @@ -5236,8 +5404,8 @@ BEGIN DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; - DELETE FROM bs.ventas_contables - WHERE year = vYear + DELETE FROM bs.ventas_contables + WHERE year = vYear AND month = vMonth; DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; @@ -5248,7 +5416,7 @@ BEGIN FROM vn2008.Tickets t JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; + AND month(f.Fecha) = vMonth; INSERT INTO bs.ventas_contables(year , month @@ -5258,7 +5426,7 @@ BEGIN , tipo_id , empresa_id , gasto) - + SELECT vYear , vMonth , round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) @@ -5270,13 +5438,13 @@ BEGIN , tp.reino_id , a.tipo_id , t.empresa_id - , 7000000000 + , 7000000000 + IF(e.empresa_grupo = e2.empresa_grupo ,1 ,IF(e2.empresa_grupo,2,0) - ) * 1000000 + ) * 1000000 + tp.reino_id * 10000 as Gasto - FROM vn2008.Movimientos m + FROM vn2008.Movimientos m JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente @@ -5290,7 +5458,7 @@ BEGIN AND m.Descuento <> 100 AND a.tipo_id != TIPO_PATRIMONIAL GROUP BY grupo, reino_id, tipo_id, empresa_id, Gasto; - + INSERT INTO bs.ventas_contables(year , month , venta @@ -5309,17 +5477,17 @@ BEGIN ) as grupo , NULL , NULL - , t.companyFk + , t.companyFk , 7050000000 - FROM vn.ticketService ts + FROM vn.ticketService ts JOIN vn.ticket t ON ts.ticketFk = t.id - JOIN vn.address a on a.id = t.addressFk - JOIN vn.client cl on cl.id = a.clientFk + JOIN vn.address a on a.id = t.addressFk + JOIN vn.client cl on cl.id = a.clientFk JOIN tmp.ticket_list tt on tt.Id_Ticket = t.id - JOIN vn.company c on c.id = t.companyFk + JOIN vn.company c on c.id = t.companyFk LEFT JOIN vn.company c2 on c2.clientFk = cl.id - GROUP BY grupo, t.companyFk ; - + GROUP BY grupo, t.companyFk ; + DROP TEMPORARY TABLE tmp.ticket_list; END ;; DELIMITER ; @@ -5327,6 +5495,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_add_launcher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5334,18 +5504,16 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_contables_add_launcher`() BEGIN - + /** * Reemplaza las ventas contables del último año. * Es el origen de datos para el balance de Entradas * **/ - + CALL bs.ventas_contables_add(YEAR(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())), MONTH(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()))); END ;; @@ -5354,6 +5522,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_por_cliente` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5361,17 +5531,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_contables_por_cliente`(IN vYear INT, IN vMonth INT) BEGIN - + /** * Muestra las ventas (€) de cada cliente * dependiendo del año */ - + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; CREATE TEMPORARY TABLE tmp.ticket_list @@ -5380,8 +5548,8 @@ BEGIN FROM vn2008.Tickets t JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; - + AND month(f.Fecha) = vMonth; + SELECT vYear Año, vMonth Mes, t.Id_Cliente, @@ -5391,7 +5559,7 @@ BEGIN IF(e2.empresa_grupo,2,0)) AS grupo, t.empresa_id empresa - FROM vn2008.Movimientos m + FROM vn2008.Movimientos m JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna JOIN vn2008.Clientes c ON c.Id_Cliente = cs.Id_Cliente @@ -5405,15 +5573,17 @@ BEGIN AND m.Descuento <> 100 AND a.tipo_id != 188 GROUP BY t.Id_Cliente, grupo,t.empresa_id; - + DROP TEMPORARY TABLE tmp.ticket_list; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `vivosMuertos` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5421,12 +5591,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `vivosMuertos`() BEGIN - + /** * Devuelve el número de clientes nuevos y muertos, * dependiendo de la fecha actual. @@ -5437,9 +5605,9 @@ BEGIN SET @datSTART = TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); SET @datEND = TIMESTAMPADD(DAY,-DAY(util.VN_CURDATE()),util.VN_CURDATE()); - + DROP TEMPORARY TABLE IF EXISTS tmp.VivosMuertos; - + CREATE TEMPORARY TABLE tmp.VivosMuertos SELECT c.Id_Cliente, tm.yearMonth, f.Compra, 0 as Nuevo, 0 as Muerto FROM vn2008.Clientes c @@ -5455,10 +5623,10 @@ BEGIN WHERE Fecha BETWEEN @datSTART AND @datEND) f ON f.yearMonth = tm.yearMonth AND f.Id_Cliente = c.Id_Cliente; - + UPDATE tmp.VivosMuertos vm JOIN - (SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente + (SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente FROM vn2008.Facturas f JOIN vn2008.time tm ON tm.date = f.Fecha WHERE Fecha BETWEEN @datSTART AND @datEND @@ -5466,9 +5634,9 @@ BEGIN AND fm.Id_Cliente = vm.Id_Cliente SET Nuevo = 1; - + SELECT max(yearMonth) INTO @lastYearMonth FROM tmp.VivosMuertos; - + UPDATE tmp.VivosMuertos vm JOIN ( SELECT MAX(tm.yearMonth) firstMonth, f.Id_Cliente @@ -5490,6 +5658,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `waste_addSales` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5497,8 +5667,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `waste_addSales`() BEGIN @@ -5509,23 +5677,23 @@ BEGIN INTO vWeek, vYear FROM vn.time WHERE dated = util.VN_CURDATE(); - + REPLACE bs.waste SELECT *, 100 * mermas / total as porcentaje FROM ( - SELECT buyer, - year, + SELECT buyer, + year, week, family, itemFk, itemTypeFk, - floor(sum(value)) as total, + floor(sum(value)) as total, floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas - FROM vn.saleValue + FROM vn.saleValue where year = vYear and week = vWeek - + GROUP BY family, itemFk - + ) sub ORDER BY mermas DESC; END ;; @@ -5534,6 +5702,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerLabour_getData` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5541,8 +5711,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerLabour_getData`() BEGIN @@ -5557,56 +5725,56 @@ BEGIN DECLARE vDateEnded DATE; DECLARE vCursor CURSOR FOR - SELECT util.firstDayOfMonth(t.dated), LAST_DAY(t.dated) + SELECT util.firstDayOfMonth(t.dated), LAST_DAY(t.dated) FROM vn.time t WHERE t.dated BETWEEN vDateStarted AND vDateEnded - GROUP BY year,month; + GROUP BY year,month; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + IF DAY(util.VN_CURDATE()) = 21 THEN - + SELECT util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(), INTERVAL 12 MONTH)), LAST_DAY(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - INTO vDateStarted, + INTO vDateStarted, vDateEnded; - - DELETE FROM workerLabourDataByMonth + + DELETE FROM workerLabourDataByMonth WHERE CONCAT(`year`, '-',`month`, '-01') BETWEEN vDateStarted AND vDateEnded; OPEN vCursor; l: LOOP SET vDone = FALSE; - + FETCH vCursor INTO vFristDay, vLastDay; - + IF vDone THEN LEAVE l; END IF; - + -- Altas periodo - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'hiring', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) + INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) + SELECT 'hiring', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) FROM vn.business b JOIN vn.workCenter wc ON wc.id = b.workCenterFk JOIN vn.worker w ON w.id = b.workerFk LEFT JOIN vn.workerBusinessType wbt ON wbt.id = b.workerBusinessTypeFk LEFT JOIN (SELECT b.id, b.workerFk FROM vn.business b - LEFT JOIN (SELECT ended, workerFk FROM vn.business) wl + LEFT JOIN (SELECT ended, workerFk FROM vn.business) wl ON wl.ended = DATE_SUB(b.started, INTERVAL 1 DAY) AND wl.workerFk = b.workerFk - WHERE b.started BETWEEN vFristDay AND vLastDay AND wl.ended + WHERE b.started BETWEEN vFristDay AND vLastDay AND wl.ended )sub ON sub.workerFk = b.workerFk WHERE wc.payrollCenterFk IS NOT NULL AND b.workCenterFk IS NOT NULL AND b.started BETWEEN vFristDay AND vLastDay AND sub.workerFk IS NULL - AND NOT w.isFreelance; + AND NOT w.isFreelance; -- Bajas periodo - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'layoffs', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) + INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) + SELECT 'layoffs', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) FROM vn.business b JOIN vn.worker w ON w.id = b.workerFk JOIN vn.workCenter wc ON wc.id = b.workCenterFk @@ -5617,12 +5785,12 @@ BEGIN AND b.ended BETWEEN vFristDay AND vLastDay AND wl.started IS NULL AND NOT w.isFreelance; - + -- Anterior al periodo SET vLastDay = LAST_DAY(DATE_SUB(vFristDay, INTERVAL 1 DAY)); - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'staff', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) + INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) + SELECT 'staff', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) FROM vn.business b JOIN vn.worker w ON w.id = b.workerFk JOIN vn.workCenter wc ON wc.id = b.workCenterFk @@ -5632,8 +5800,8 @@ BEGIN AND NOT w.isFreelance; -- Discapacidad - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'disabled', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) + INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) + SELECT 'disabled', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) FROM vn.business b JOIN vn.worker w ON w.id = b.workerFk JOIN vn.workCenter wc ON wc.id = b.workCenterFk @@ -5653,6 +5821,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerProductivity_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5660,8 +5830,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerProductivity_add`() BEGIN @@ -6029,6 +6197,8 @@ DELIMITER ; -- -- Dumping routines for database 'cache' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `addressFriendship_Update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6036,13 +6206,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `addressFriendship_Update`() BEGIN - REPLACE cache.addressFriendship + REPLACE cache.addressFriendship SELECT addressFk1, addressFk2, count(*) friendship FROM ( @@ -6053,7 +6221,7 @@ BEGIN AND t2.shipped >= TIMESTAMPADD(MONTH,-3,util.VN_CURDATE()) AND t.addressFk != t2.addressFk) sub GROUP BY addressFk1, addressFk2; - + REPLACE cache.zoneAgencyFriendship SELECT r.agencyModeFk, t.zoneFk, count(*) friendship FROM vn.route r @@ -6069,6 +6237,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `availableNoRaids_refresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6076,8 +6246,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `availableNoRaids_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE) proc: BEGIN @@ -6098,7 +6266,7 @@ proc: BEGIN END IF; SET vParams = CONCAT_WS('/', vWarehouse, vDated); - CALL vn.itemStock (vWarehouse, vDated, NULL); + CALL vn.item_getStock (vWarehouse, vDated, NULL); CALL cache_calc_start (vCalc, vRefresh, 'availableNoRaids', vParams); IF !vRefresh THEN @@ -6205,6 +6373,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `available_clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6212,8 +6382,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `available_clean`() BEGIN @@ -6227,12 +6395,12 @@ BEGIN FROM available a LEFT JOIN tCalc c ON c.id = a.calc_id WHERE c.id IS NULL; - + DELETE a FROM availableNoRaids a LEFT JOIN tCalc c ON c.id = a.calc_id WHERE c.id IS NULL; - + DROP TEMPORARY TABLE tCalc; END ;; DELIMITER ; @@ -6240,6 +6408,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `available_refresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6247,8 +6417,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE) proc: BEGIN @@ -6268,7 +6436,7 @@ proc: BEGIN LEAVE proc; END IF; - CALL vn.itemStock(vWarehouse, vDated, NULL); + CALL vn.item_getStock(vWarehouse, vDated, NULL); SET vParams = CONCAT_WS('/', vWarehouse, vDated); CALL cache_calc_start (vCalc, vRefresh, 'available', vParams); @@ -6380,6 +6548,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `cacheCalc_clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6387,8 +6557,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cacheCalc_clean`() BEGIN @@ -6400,6 +6568,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `cache_calc_end` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6407,37 +6577,37 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cache_calc_end`(IN `v_calc` INT) -BEGIN - DECLARE v_cache_name VARCHAR(255); - DECLARE v_params VARCHAR(255); - - -- Libera el bloqueo y actualiza la fecha de ultimo refresco. - - UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id - SET - cc.last_refresh = NOW(), - cc.expires = ADDTIME(NOW(), c.lifetime), - cc.connection_id = NULL - WHERE cc.id = v_calc; - - SELECT c.name, ca.params INTO v_cache_name, v_params - FROM cache c - JOIN cache_calc ca ON c.id = ca.cache_id - WHERE ca.id = v_calc; - - IF v_cache_name IS NOT NULL THEN - DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); - END IF; +BEGIN + DECLARE v_cache_name VARCHAR(255); + DECLARE v_params VARCHAR(255); + + -- Libera el bloqueo y actualiza la fecha de ultimo refresco. + + UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id + SET + cc.last_refresh = NOW(), + cc.expires = ADDTIME(NOW(), c.lifetime), + cc.connection_id = NULL + WHERE cc.id = v_calc; + + SELECT c.name, ca.params INTO v_cache_name, v_params + FROM cache c + JOIN cache_calc ca ON c.id = ca.cache_id + WHERE ca.id = v_calc; + + IF v_cache_name IS NOT NULL THEN + DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `cache_calc_start` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6445,99 +6615,99 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cache_calc_start`(OUT `v_calc` INT, INOUT `v_refresh` INT, IN `v_cache_name` VARCHAR(50), IN `v_params` VARCHAR(100)) -proc: BEGIN - DECLARE v_valid BOOL; - DECLARE v_lock_id VARCHAR(100); - DECLARE v_cache_id INT; - DECLARE v_expires DATETIME; - DECLARE v_clean_time DATETIME; - DECLARE vLastRefresh DATETIME; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - IF v_lock_id IS NOT NULL THEN - DO RELEASE_LOCK(v_lock_id); - END IF; - - RESIGNAL; - END; - - SET v_params = IFNULL(v_params, ''); - - -- Si el servidor se ha reiniciado invalida todos los calculos. - - SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid; - - IF !v_valid - THEN - DELETE FROM cache_calc; - INSERT INTO cache_valid (valid) VALUES (TRUE); - END IF; - - -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia. - - SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params); - - IF !GET_LOCK(v_lock_id, 30) - THEN - SET v_calc = NULL; - SET v_refresh = FALSE; - LEAVE proc; - END IF; - - -- Comprueba si el calculo solicitado existe y esta actualizado. - - SELECT c.id, ca.id, ca.expires, ca.last_refresh - INTO v_cache_id, v_calc, v_expires, vLastRefresh - FROM cache c - LEFT JOIN cache_calc ca - ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci' - WHERE c.name = v_cache_name COLLATE 'utf8_general_ci'; - - -- Si existe una calculo valido libera el bloqueo y devuelve su identificador. - - IF !v_refresh AND NOW() < v_expires AND vLastRefresh >= CURDATE() - THEN - DO RELEASE_LOCK(v_lock_id); - SET v_refresh = FALSE; - LEAVE proc; - END IF; - - -- Si el calculo no existe le crea una entrada en la tabla de calculos. - - IF v_calc IS NULL - THEN - INSERT INTO cache_calc SET - cache_id = v_cache_id, - cacheName = v_cache_name, - params = v_params, - last_refresh = NULL, - expires = NULL, - connection_id = CONNECTION_ID(); - - SET v_calc = LAST_INSERT_ID(); - ELSE - UPDATE cache_calc - SET - last_refresh = NULL, - expires = NULL, - connection_id = CONNECTION_ID() - WHERE id = v_calc; - END IF; - - -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador. - - SET v_refresh = TRUE; +proc: BEGIN + DECLARE v_valid BOOL; + DECLARE v_lock_id VARCHAR(100); + DECLARE v_cache_id INT; + DECLARE v_expires DATETIME; + DECLARE v_clean_time DATETIME; + DECLARE vLastRefresh DATETIME; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + IF v_lock_id IS NOT NULL THEN + DO RELEASE_LOCK(v_lock_id); + END IF; + + RESIGNAL; + END; + + SET v_params = IFNULL(v_params, ''); + + -- Si el servidor se ha reiniciado invalida todos los calculos. + + SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid; + + IF !v_valid + THEN + DELETE FROM cache_calc; + INSERT INTO cache_valid (valid) VALUES (TRUE); + END IF; + + -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia. + + SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params); + + IF !GET_LOCK(v_lock_id, 30) + THEN + SET v_calc = NULL; + SET v_refresh = FALSE; + LEAVE proc; + END IF; + + -- Comprueba si el calculo solicitado existe y esta actualizado. + + SELECT c.id, ca.id, ca.expires, ca.last_refresh + INTO v_cache_id, v_calc, v_expires, vLastRefresh + FROM cache c + LEFT JOIN cache_calc ca + ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci' + WHERE c.name = v_cache_name COLLATE 'utf8_general_ci'; + + -- Si existe una calculo valido libera el bloqueo y devuelve su identificador. + + IF !v_refresh AND NOW() < v_expires AND vLastRefresh >= CURDATE() + THEN + DO RELEASE_LOCK(v_lock_id); + SET v_refresh = FALSE; + LEAVE proc; + END IF; + + -- Si el calculo no existe le crea una entrada en la tabla de calculos. + + IF v_calc IS NULL + THEN + INSERT INTO cache_calc SET + cache_id = v_cache_id, + cacheName = v_cache_name, + params = v_params, + last_refresh = NULL, + expires = NULL, + connection_id = CONNECTION_ID(); + + SET v_calc = LAST_INSERT_ID(); + ELSE + UPDATE cache_calc + SET + last_refresh = NULL, + expires = NULL, + connection_id = CONNECTION_ID() + WHERE id = v_calc; + END IF; + + -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador. + + SET v_refresh = TRUE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `cache_calc_unlock` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6545,8 +6715,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cache_calc_unlock`(IN `v_calc` INT) proc: BEGIN @@ -6561,7 +6729,7 @@ proc: BEGIN FROM cache c JOIN cache_calc ca ON c.id = ca.cache_id WHERE ca.id = v_calc; - + DELETE FROM cache_calc WHERE id = v_calc; IF v_cache_name IS NOT NULL THEN @@ -6573,6 +6741,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `cache_clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6580,8 +6750,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cache_clean`() NO SQL @@ -6594,6 +6762,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6601,8 +6771,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() BEGIN @@ -6617,6 +6785,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `departure_timing` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6624,8 +6794,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `departure_timing`(vWarehouseId INT) BEGIN @@ -6657,7 +6825,7 @@ DECLARE rs CURSOR FOR DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - SET myTime = HOUR(util.VN_NOW()) + MINUTE(util.VN_NOW()) / 60; + SET myTime = HOUR(util.VN_NOW()) + MINUTE(util.VN_NOW()) / 60; OPEN rs; @@ -6666,23 +6834,23 @@ DECLARE rs CURSOR FOR WHILE NOT done DO SET resto = IF(inicioProd < rsDeparture, rsDeparture - inicioProd,0); - + SET inicioProd = rsDeparture - rsHoras; - + IF inicioProd - resto < myTime THEN - + SET done = TRUE; - + ELSE - + SET departureLimit = rsDeparture; - + FETCH rs INTO rsDeparture, rsHoras , rsInicio; - + -- SELECT rsDeparture, rsHoras , rsInicio; - + END IF; - + END WHILE; SET departureLimit = IFNULL(departureLimit,24); @@ -6704,6 +6872,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `last_buy_refresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6711,8 +6881,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `last_buy_refresh`(vRefresh BOOL) proc: BEGIN @@ -6727,7 +6895,7 @@ proc: BEGIN DECLARE started DATE; DECLARE ended DATE; DECLARE vLastRefresh DATE; - + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN CALL cache_calc_unlock (vCalc); @@ -6762,6 +6930,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `prod_graphic_refresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6769,22 +6939,20 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `prod_graphic_refresh`(v_refresh BOOL, wh_id INT) proc: BEGIN DECLARE datEQ DATETIME; DECLARE timDIF TIME; DECLARE v_calc INT; - + CALL cache_calc_start (v_calc, v_refresh, 'prod_graphic', wh_id); - + IF !v_refresh THEN LEAVE proc; END IF; - + CALL vn2008.production_control_source(wh_id, 0); DELETE FROM prod_graphic_source; @@ -6802,8 +6970,8 @@ proc: BEGIN WHERE Fecha = util.VN_CURDATE() GROUP BY wh_id, graphCategory ; - - + + CALL cache_calc_end (v_calc); END ;; DELIMITER ; @@ -6811,6 +6979,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `stock_refresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6818,13 +6988,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `stock_refresh`(v_refresh BOOL) proc: BEGIN /** - * Crea o actualiza la cache con el disponible hasta el día de + * Crea o actualiza la cache con el disponible hasta el día de * ayer. Esta cache es usada como base para otros procedimientos * como el cáculo del visible o del ATP. * @@ -6850,21 +7018,21 @@ proc: BEGIN SET v_date_inv = (SELECT inventoried FROM vn.config LIMIT 1); SET vCURDATE = util.VN_CURDATE(); - + DELETE FROM stock; - + INSERT INTO stock (item_id, warehouse_id, amount) SELECT item_id, warehouse_id, SUM(amount) amount FROM ( - SELECT itemFk AS item_id, warehouseFk AS warehouse_id, quantity AS amount + SELECT itemFk AS item_id, warehouseFk AS warehouse_id, quantity AS amount FROM vn.itemTicketOut WHERE shipped >= v_date_inv AND shipped < vCURDATE UNION ALL - SELECT itemFk ASitem_id, warehouseInFk AS warehouse_id, quantity AS amount + SELECT itemFk ASitem_id, warehouseInFk AS warehouse_id, quantity AS amount FROM vn.itemEntryIn WHERE landed >= v_date_inv AND landed < vCURDATE AND isVirtualStock is FALSE UNION ALL - SELECT itemFk AS item_id ,warehouseOutFk AS warehouse_id, quantity AS amount + SELECT itemFk AS item_id ,warehouseOutFk AS warehouse_id, quantity AS amount FROM vn.itemEntryOut WHERE shipped >= v_date_inv AND shipped < vCURDATE ) t @@ -6877,6 +7045,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `visible_clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6884,8 +7054,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `visible_clean`() BEGIN @@ -6894,12 +7062,12 @@ BEGIN (INDEX (id)) ENGINE = MEMORY SELECT id FROM cache_calc; - + DELETE v FROM visible v LEFT JOIN tCalc c ON c.id = v.calc_id WHERE c.id IS NULL; - + DROP TEMPORARY TABLE tCalc; END ;; DELIMITER ; @@ -6907,6 +7075,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `visible_refresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6914,8 +7084,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `visible_refresh`(OUT v_calc INT, v_refresh BOOL, v_warehouse INT) proc: BEGIN @@ -7226,56 +7394,55 @@ DROP TABLE IF EXISTS `ektRecent`; /*!50001 DROP VIEW IF EXISTS `ektRecent`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ektRecent` ( - `id` tinyint NOT NULL, - `barcode` tinyint NOT NULL, - `entryYear` tinyint NOT NULL, - `batchNumber` tinyint NOT NULL, - `deliveryNumber` tinyint NOT NULL, - `vendorOrderNumber` tinyint NOT NULL, - `fec` tinyint NOT NULL, - `hor` tinyint NOT NULL, - `now` tinyint NOT NULL, - `ptj` tinyint NOT NULL, - `ref` tinyint NOT NULL, - `item` tinyint NOT NULL, - `pac` tinyint NOT NULL, - `qty` tinyint NOT NULL, - `ori` tinyint NOT NULL, - `cat` tinyint NOT NULL, - `agj` tinyint NOT NULL, - `kop` tinyint NOT NULL, - `ptd` tinyint NOT NULL, - `sub` tinyint NOT NULL, - `pro` tinyint NOT NULL, - `pri` tinyint NOT NULL, - `package` tinyint NOT NULL, - `auction` tinyint NOT NULL, - `klo` tinyint NOT NULL, - `k1` tinyint NOT NULL, - `k2` tinyint NOT NULL, - `k3` tinyint NOT NULL, - `k4` tinyint NOT NULL, - `s1` tinyint NOT NULL, - `s2` tinyint NOT NULL, - `s3` tinyint NOT NULL, - `s4` tinyint NOT NULL, - `s5` tinyint NOT NULL, - `s6` tinyint NOT NULL, - `ok` tinyint NOT NULL, - `trolleyFk` tinyint NOT NULL, - `putOrderFk` tinyint NOT NULL, - `scanned` tinyint NOT NULL, - `cps` tinyint NOT NULL, - `dp` tinyint NOT NULL, - `sender` tinyint NOT NULL, - `usefulAuctionLeftSegmentLength` tinyint NOT NULL, - `standardBarcodeLength` tinyint NOT NULL, - `floridayBarcodeLength` tinyint NOT NULL, - `floramondoBarcodeLength` tinyint NOT NULL, - `defaultKlo` tinyint NOT NULL, - `ektRecentScopeDays` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ektRecent` AS SELECT + 1 AS `id`, + 1 AS `barcode`, + 1 AS `entryYear`, + 1 AS `batchNumber`, + 1 AS `deliveryNumber`, + 1 AS `vendorOrderNumber`, + 1 AS `fec`, + 1 AS `hor`, + 1 AS `now`, + 1 AS `ptj`, + 1 AS `ref`, + 1 AS `item`, + 1 AS `pac`, + 1 AS `qty`, + 1 AS `ori`, + 1 AS `cat`, + 1 AS `agj`, + 1 AS `kop`, + 1 AS `ptd`, + 1 AS `sub`, + 1 AS `pro`, + 1 AS `pri`, + 1 AS `package`, + 1 AS `auction`, + 1 AS `klo`, + 1 AS `k1`, + 1 AS `k2`, + 1 AS `k3`, + 1 AS `k4`, + 1 AS `s1`, + 1 AS `s2`, + 1 AS `s3`, + 1 AS `s4`, + 1 AS `s5`, + 1 AS `s6`, + 1 AS `ok`, + 1 AS `trolleyFk`, + 1 AS `putOrderFk`, + 1 AS `scanned`, + 1 AS `cps`, + 1 AS `dp`, + 1 AS `sender`, + 1 AS `usefulAuctionLeftSegmentLength`, + 1 AS `standardBarcodeLength`, + 1 AS `floridayBarcodeLength`, + 1 AS `floramondoBarcodeLength`, + 1 AS `defaultKlo`, + 1 AS `ektRecentScopeDays` */; SET character_set_client = @saved_cs_client; -- @@ -7286,18 +7453,17 @@ DROP TABLE IF EXISTS `errorList`; /*!50001 DROP VIEW IF EXISTS `errorList`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `errorList` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `stock` tinyint NOT NULL, - `error` tinyint NOT NULL, - `deliveryInformationID` tinyint NOT NULL, - `supplyResponseID` tinyint NOT NULL, - `OrderTradeLineDateTime` tinyint NOT NULL, - `EndUserPartyGLN` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `errorList` AS SELECT + 1 AS `id`, + 1 AS `name`, + 1 AS `longName`, + 1 AS `quantity`, + 1 AS `stock`, + 1 AS `error`, + 1 AS `deliveryInformationID`, + 1 AS `supplyResponseID`, + 1 AS `OrderTradeLineDateTime`, + 1 AS `EndUserPartyGLN` */; SET character_set_client = @saved_cs_client; -- @@ -7825,9 +7991,9 @@ DELIMITER ;; BEGIN DECLARE nextID INT; - + SELECT 1 + MAX(id) INTO nextID FROM putOrder ; - + SET NEW.orderTradelineItemID = nextID; END */;; @@ -7849,36 +8015,36 @@ DELIMITER ;; BEFORE UPDATE ON `putOrder` FOR EACH ROW BEGIN - + DECLARE vError VARCHAR(100) DEFAULT 'Orderregel niet meer teruggevonden op basis van de orderps'; DECLARE vVmpIdError INT DEFAULT 7; DECLARE vVmpFk INT; DECLARE vSupplyResponseNumberOfUnits INT; - - SELECT sr.vmpID INTO vVmpFk - FROM edi.supplyResponse sr + + SELECT sr.vmpID INTO vVmpFk + FROM edi.supplyResponse sr WHERE sr.id = NEW.supplyResponseID; - - IF NEW.OrderStatus = 3 - AND NOT (NEW.OrderStatus <=> OLD.OrderStatus) - AND NEW.error = vError - AND vVmpFk = vVmpIdError - - THEN - + + IF NEW.OrderStatus = 3 + AND NOT (NEW.OrderStatus <=> OLD.OrderStatus) + AND NEW.error = vError + AND vVmpFk = vVmpIdError + + THEN + SET NEW.OrderStatus = 2; - + END IF; - + -- Error de disponible menor de lo solicitado IF NEW.error LIKE 'error2602%' THEN - + SELECT NumberOfUnits INTO vSupplyResponseNumberOfUnits - FROM edi.supplyResponse sr + FROM edi.supplyResponse sr WHERE sr.ID = NEW.supplyResponseID; - + SET NEW.error = CONCAT('(',vSupplyResponseNumberOfUnits,') ', NEW.error); - + END IF; END */;; DELIMITER ; @@ -7905,16 +8071,16 @@ BEGIN DECLARE vIsEktSender BOOLEAN; IF NEW.OrderStatus = vOrderStatusDenied AND NOT (NEW.OrderStatus <=> OLD.OrderStatus) THEN - + SELECT s.id INTO vSaleFk - FROM vn.sale s + FROM vn.sale s JOIN vn.ticket t ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk JOIN deliveryInformation di ON di.ID = NEW.deliveryInformationID WHERE t.clientFk = NEW.EndUserPartyGLN AND t.shipped >= util.VN_CURDATE() AND i.supplyResponseFk = NEW.supplyResponseID LIMIT 1; - + UPDATE vn.sale s JOIN vn.ticket t ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk @@ -7922,7 +8088,7 @@ BEGIN SET s.quantity = 0 WHERE t.clientFk = NEW.EndUserPartyGLN AND t.shipped >= util.VN_CURDATE() AND i.supplyResponseFk = NEW.supplyResponseID; - + INSERT INTO vn.mail (sender, `subject`, body) SELECT IF(u.id IS NOT NULL AND c.email IS NOT NULL, c.email, @@ -7934,26 +8100,26 @@ BEGIN IF (u.id IS NOT NULL AND c.email IS NOT NULL , CONCAT('https://shop.verdnatura.es/#!form=ecomerce%2Fticket&ticket=', t.id ), CONCAT('https://salix.verdnatura.es/#!/ticket/', t.id ,'/summary'))) - FROM vn.sale s + FROM vn.sale s JOIN vn.ticket t ON t.id = s.ticketFk JOIN vn.`client` c ON c.id = t.clientFk LEFT JOIN account.user u ON u.id= c.salesPersonFk AND u.name IN ('ruben', 'ismaelalcolea') WHERE s.id = vSaleFk; - + END IF; IF NEW.OrderStatus = vOrderStatusOK AND NOT (NEW.OrderStatus <=> OLD.OrderStatus) THEN - SELECT v.isEktSender INTO vIsEktSender + SELECT v.isEktSender INTO vIsEktSender FROM edi.VMPSettings v - JOIN edi.supplyResponse sr ON sr.vmpID = v.VMPID + JOIN edi.supplyResponse sr ON sr.vmpID = v.VMPID WHERE sr.id = NEW.supplyResponseID; - + IF NOT vIsEktSender THEN CALL edi.ekt_add(NEW.id); - + END IF; IF NEW.barcode THEN @@ -7962,7 +8128,7 @@ BEGIN SELECT i.id, NEW.barcode FROM vn.item i WHERE i.supplyResponseFk = NEW.supplyResponseID; - + END IF; END IF; @@ -8022,51 +8188,50 @@ DROP TABLE IF EXISTS `supplyOffer`; /*!50001 DROP VIEW IF EXISTS `supplyOffer`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `supplyOffer` ( - `vmpID` tinyint NOT NULL, - `diId` tinyint NOT NULL, - `srId` tinyint NOT NULL, - `Item_ArticleCode` tinyint NOT NULL, - `product_name` tinyint NOT NULL, - `company_name` tinyint NOT NULL, - `Price` tinyint NOT NULL, - `Quality` tinyint NOT NULL, - `s1` tinyint NOT NULL, - `s2` tinyint NOT NULL, - `s3` tinyint NOT NULL, - `s4` tinyint NOT NULL, - `s5` tinyint NOT NULL, - `s6` tinyint NOT NULL, - `NumberOfUnits` tinyint NOT NULL, - `EmbalageCode` tinyint NOT NULL, - `LatestDeliveryDateTime` tinyint NOT NULL, - `EarliestDespatchDateTime` tinyint NOT NULL, - `FirstOrderDateTime` tinyint NOT NULL, - `LatestOrderDateTime` tinyint NOT NULL, - `NumberOfItemsPerCask` tinyint NOT NULL, - `NumberOfLayersPerTrolley` tinyint NOT NULL, - `MinimumNumberToOrder` tinyint NOT NULL, - `MaximumNumberToOrder` tinyint NOT NULL, - `IncrementalOrderableQuantity` tinyint NOT NULL, - `PackingPrice` tinyint NOT NULL, - `MarketPlaceID` tinyint NOT NULL, - `PictureReference` tinyint NOT NULL, - `supplyResponseUpdated` tinyint NOT NULL, - `group_id` tinyint NOT NULL, - `marketPlace` tinyint NOT NULL, - `DeliveryPrice` tinyint NOT NULL, - `ChargeAmount` tinyint NOT NULL, - `MinimumQuantity` tinyint NOT NULL, - `MaximumQuantity` tinyint NOT NULL, - `OrderUnit` tinyint NOT NULL, - `IncrementalOrderUnit` tinyint NOT NULL, - `isEarlyBird` tinyint NOT NULL, - `isVNHSupplier` tinyint NOT NULL, - `expenseFk` tinyint NOT NULL, - `intrastatFk` tinyint NOT NULL, - `originFk` tinyint NOT NULL, - `itemTypeFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `supplyOffer` AS SELECT + 1 AS `vmpID`, + 1 AS `diId`, + 1 AS `srId`, + 1 AS `Item_ArticleCode`, + 1 AS `product_name`, + 1 AS `company_name`, + 1 AS `Price`, + 1 AS `Quality`, + 1 AS `s1`, + 1 AS `s2`, + 1 AS `s3`, + 1 AS `s4`, + 1 AS `s5`, + 1 AS `s6`, + 1 AS `NumberOfUnits`, + 1 AS `EmbalageCode`, + 1 AS `LatestDeliveryDateTime`, + 1 AS `EarliestDespatchDateTime`, + 1 AS `FirstOrderDateTime`, + 1 AS `LatestOrderDateTime`, + 1 AS `NumberOfItemsPerCask`, + 1 AS `NumberOfLayersPerTrolley`, + 1 AS `MinimumNumberToOrder`, + 1 AS `MaximumNumberToOrder`, + 1 AS `IncrementalOrderableQuantity`, + 1 AS `PackingPrice`, + 1 AS `MarketPlaceID`, + 1 AS `PictureReference`, + 1 AS `supplyResponseUpdated`, + 1 AS `group_id`, + 1 AS `marketPlace`, + 1 AS `DeliveryPrice`, + 1 AS `ChargeAmount`, + 1 AS `MinimumQuantity`, + 1 AS `MaximumQuantity`, + 1 AS `OrderUnit`, + 1 AS `IncrementalOrderUnit`, + 1 AS `isEarlyBird`, + 1 AS `isVNHSupplier`, + 1 AS `expenseFk`, + 1 AS `intrastatFk`, + 1 AS `originFk`, + 1 AS `itemTypeFk` */; SET character_set_client = @saved_cs_client; -- @@ -8161,8 +8326,8 @@ BEGIN UPDATE vn.buy b JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.agencyMode am ON am.id = tr.agencyModeFk + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.agencyMode am ON am.id = tr.agencyModeFk JOIN vn.item i ON i.id = b.itemFk JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits, @@ -8171,7 +8336,7 @@ BEGIN AND am.name = 'LOGIFLORA' AND e.isRaid AND tr.landed >= util.VN_CURDATE(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8300,6 +8465,8 @@ DELIMITER ; -- -- Dumping routines for database 'edi' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `imageName` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8307,13 +8474,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `imageName`(vPictureReference VARCHAR(255)) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC BEGIN - + SET vPictureReference = REPLACE(vPictureReference,'.',''); SET vPictureReference = REPLACE(vPictureReference,'/',''); @@ -8325,7 +8490,7 @@ BEGIN SET vPictureReference = REPLACE(vPictureReference,'?',''); SET vPictureReference = REPLACE(vPictureReference,'=',''); - + RETURN vPictureReference; END ;; @@ -8334,6 +8499,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8341,31 +8508,34 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() BEGIN + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; - DECLARE vFourYearsAgo DATE DEFAULT TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); - DECLARE vOneWeekAgo DATE DEFAULT TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); - - DELETE FROM ekt WHERE fec < vFourYearsAgo; + DELETE FROM ekt + WHERE fec < (util.VN_CURDATE() - INTERVAL 4 YEAR); DELETE IGNORE sr.* FROM supplyResponse sr - LEFT JOIN edi.deliveryInformation di ON sr.ID = di.supplyResponseID - WHERE di.LatestOrderDateTime < vOneWeekAgo OR di.ID IS NULL; + LEFT JOIN deliveryInformation di ON sr.ID = di.supplyResponseID + WHERE di.LatestOrderDateTime < (util.VN_CURDATE() - INTERVAL 1 WEEK) + OR di.ID IS NULL; DELETE FROM putOrder - WHERE created < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); - + WHERE created < (util.VN_CURDATE() - INTERVAL 1 MONTH); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `deliveryInformation_Delete` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8373,38 +8543,38 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `deliveryInformation_Delete`() BEGIN - + DECLARE vID INT; DECLARE vGap INT DEFAULT 100; DECLARE vTope INT; - - SELECT MIN(ID), MAX(ID) + + SELECT MIN(ID), MAX(ID) INTO vID, vTope FROM edi.deliveryInformation; - WHILE vID <= vTope DO - + WHILE vID <= vTope DO + SET vID = vID + vGap; - - DELETE - FROM edi.deliveryInformation + + DELETE + FROM edi.deliveryInformation WHERE ID < vID AND EarliestDespatchDateTime IS NULL; - + END WHILE; - - + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ekt_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8412,20 +8582,18 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_add`(vPutOrderFk INT) BEGIN - + /** * Añade ekt para las ordenes de compra de proveedores que no envian el ekt por email - * + * * @param vPutOrderFk PutOrderId de donde coger los datos **/ - - INSERT INTO edi.ekt(entryYear, - deliveryNumber, + + INSERT INTO edi.ekt(entryYear, + deliveryNumber, fec, hor, item, @@ -8465,23 +8633,25 @@ BEGIN i.value10 s6, p.id putOrderFk, sr.Item_ArticleCode, - sr.vmpID + sr.vmpID FROM edi.putOrder p - JOIN edi.supplyResponse sr ON sr.ID = p.supplyResponseID - JOIN edi.deliveryInformation di ON di.id = p.deliveryInformationID - JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID - JOIN vn.item i ON i.supplyResponseFk = sr.ID - JOIN vn.origin o ON o.id = i.originFk + JOIN edi.supplyResponse sr ON sr.ID = p.supplyResponseID + JOIN edi.deliveryInformation di ON di.id = p.deliveryInformationID + JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID + JOIN vn.item i ON i.supplyResponseFk = sr.ID + JOIN vn.origin o ON o.id = i.originFk WHERE p.id = vPutOrderFk; - + CALL edi.ekt_load(LAST_INSERT_ID()); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ekt_load` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8489,12 +8659,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_load`(IN `vSelf` INT) proc:BEGIN - + DECLARE vRef INT; DECLARE vBuy INT; DECLARE vItem INT; @@ -8519,51 +8687,51 @@ proc:BEGIN FROM edi.ekt e LEFT JOIN edi.item i ON e.ref = i.id LEFT JOIN edi.putOrder po ON po.id = e.putOrderFk - LEFT JOIN vn.item i2 ON i2.supplyResponseFk = po.supplyResponseID + LEFT JOIN vn.item i2 ON i2.supplyResponseFk = po.supplyResponseID LEFT JOIN vn.ektEntryAssign eea ON eea.sub = e.sub LEFT JOIN edi.item_groupToOffer igto ON igto.group_code = i.group_id WHERE e.id = vSelf LIMIT 1; - + IF NOT vHasItemGroup THEN - + CALL vn.mail_insert('logistica@verdnatura.es', 'nocontestar@verdnatura.es', 'Nuevo grupo en Floramondo', vDescription); - + CALL vn.mail_insert('pako@verdnatura.es', 'nocontestar@verdnatura.es', CONCAT('Nuevo grupo en Floramondo: ', vDescription), vDescription); - + LEAVE proc; - + END IF; - + -- Asigna la entrada SELECT vn.ekt_getEntry(vSelf) INTO vEntryFk; - + -- Inserta el cubo si no existe IF vPackage = 800 THEN - + SET vHasToChangePackagingFk = TRUE; - + IF vItem THEN - + SELECT vn.item_getPackage(vItem) INTO vPackage ; - + ELSE - + SET vPackage = 8000 + vQty; INSERT IGNORE INTO vn.packaging(id, width, `depth`) SELECT vPackage, vc.ccLength / vQty, vc.ccWidth FROM vn.volumeConfig vc; - + END IF; - + ELSE - + INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) FROM bucket WHERE bucket_id = vPackage; - + IF ROW_COUNT() > 0 THEN INSERT INTO vn2008.mail SET @@ -8572,27 +8740,27 @@ proc:BEGIN `to` = 'ekt@verdnatura.es'; END IF; END IF; - + -- Si es una compra de Logiflora obtiene el articulo IF vPutOrderFk THEN - + SELECT i.id INTO vItem FROM edi.putOrder po JOIN vn.item i ON i.supplyResponseFk = po.supplyResponseID WHERE po.id = vPutOrderFk LIMIT 1; - + END IF; INSERT IGNORE INTO item_track SET item_id = vRef; - + IF IFNULL(vItem,0) = 0 THEN - + -- Intenta obtener el artículo en base a los atributos holandeses - + SELECT b.id, IFNULL(b.itemOriginalFk ,b.itemFk) INTO vBuy, vItem - FROM edi.ekt e + FROM edi.ekt e JOIN edi.item_track t ON t.item_id = e.ref LEFT JOIN edi.ekt l ON l.ref = e.ref LEFT JOIN vn.buy b ON b.ektFk = l.id @@ -8613,19 +8781,19 @@ proc:BEGIN AND IF(t.pro, l.pro = e.pro, TRUE) AND IF(t.package, l.package = e.package, TRUE) AND IF(t.item, l.item = e.item, TRUE) - AND i.isFloramondo = vIsFloramondoDirect - ORDER BY l.now DESC, b.id ASC + AND i.isFloramondo = vIsFloramondoDirect + ORDER BY l.now DESC, b.id ASC LIMIT 1; END IF; - + -- Si no encuentra el articulo lo crea en el caso de las compras directas en Floramondo IF ISNULL(vItem) AND vIsFloramondoDirect THEN - + CALL edi.item_getNewByEkt(vSelf, vItem); - + END IF; - + INSERT INTO vn.buy ( entryFk @@ -8648,15 +8816,15 @@ proc:BEGIN ,e.qty stickers ,@pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing ,IFNULL(b.`grouping`, e.pac) - ,@pac * e.qty + ,@pac * e.qty ,vForceToPacking ,IF(vHasToChangePackagingFk OR ISNULL(b.packageFk), vPackage, b.packageFk) ,(IFNULL(i.weightByPiece,0) * @pac)/1000 - FROM edi.ekt e + FROM edi.ekt e LEFT JOIN vn.buy b ON b.id = vBuy LEFT JOIN vn.item i ON i.id = b.itemFk LEFT JOIN vn.supplier s ON e.pro = s.id - JOIN vn2008.config cfg + JOIN vn2008.config cfg WHERE e.id = vSelf LIMIT 1; @@ -8664,36 +8832,36 @@ proc:BEGIN CREATE TEMPORARY TABLE tmp.buyRecalc SELECT buy.id - FROM vn.buy + FROM vn.buy WHERE ektFk = vSelf; CALL vn.buy_recalcPrices(); -- Si es una compra de Logiflora hay que informar la tabla vn.saleBuy IF vPutOrderFk THEN - + REPLACE vn.saleBuy(saleFk, buyFk, workerFk) SELECT po.saleFk, b.id, account.myUser_getId() FROM edi.putOrder po JOIN vn.buy b ON b.ektFk = vSelf WHERE po.id = vPutOrderFk; - + END IF; - -- Si es una compra directa en Floramondo hay que añadirlo al ticket + -- Si es una compra directa en Floramondo hay que añadirlo al ticket IF vIsFloramondoDirect THEN SELECT t.id INTO vTicketFk FROM vn.ticket t - JOIN vn.ektEntryAssign eea - ON eea.addressFk = t.addressFk + JOIN vn.ektEntryAssign eea + ON eea.addressFk = t.addressFk AND t.warehouseFk = eea.warehouseInFk - JOIN edi.ekt e - ON e.sub = eea.sub + JOIN edi.ekt e + ON e.sub = eea.sub AND e.id = vSelf WHERE e.fec = t.shipped LIMIT 1; - + IF ISNULL(vTicketFk) THEN INSERT INTO vn.ticket ( @@ -8721,8 +8889,8 @@ proc:BEGIN z.id, z.price, z.bonus - FROM edi.ekt e - JOIN vn.ektEntryAssign eea ON eea.sub = e.sub + FROM edi.ekt e + JOIN vn.ektEntryAssign eea ON eea.sub = e.sub JOIN vn.address a ON a.id = eea.addressFk JOIN vn.company c ON c.code = 'VNL' JOIN vn.`zone` z ON z.code = 'FLORAMONDO' @@ -8730,11 +8898,11 @@ proc:BEGIN LIMIT 1; SET vTicketFk = LAST_INSERT_ID(); - + INSERT INTO vn.ticketLog - SET originFk = vTicketFk, - userFk = account.myUser_getId(), - `action` = 'insert', + SET originFk = vTicketFk, + userFk = account.myUser_getId(), + `action` = 'insert', description = CONCAT('EktLoad ha creado el ticket:', ' ', vTicketFk); END IF; @@ -8744,9 +8912,9 @@ proc:BEGIN FROM edi.ekt e JOIN edi.floraHollandConfig fhc WHERE e.id = vSelf; - + SELECT LAST_INSERT_ID() INTO vSaleFk; - + REPLACE vn.saleBuy(saleFk, buyFk, workerFk) SELECT vSaleFk, b.id, account.myUser_getId() FROM vn.buy b @@ -8757,9 +8925,9 @@ proc:BEGIN FROM edi.ekt e JOIN vn.component c ON c.code = 'purchaseValue' WHERE e.id = vSelf; - + INSERT INTO vn.saleComponent(saleFk, componentFk, value) - SELECT vSaleFk, c.id, e.pri * fhc.floramondoMargin + SELECT vSaleFk, c.id, e.pri * fhc.floramondoMargin FROM edi.ekt e JOIN edi.floraHollandConfig fhc JOIN vn.component c ON c.code = 'margin' @@ -8772,6 +8940,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ekt_loadNotBuy` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8779,8 +8949,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_loadNotBuy`() BEGIN @@ -8818,6 +8986,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ekt_refresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8825,8 +8995,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_refresh`( `vSelf` INT, vMailFk INT) @@ -8886,6 +9054,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ekt_scan` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8893,14 +9063,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_scan`(vBarcode VARCHAR(512)) BEGIN /** * Busca transaciones a partir de un código de barras, las marca como escaneadas - * y las devuelve. + * y las devuelve. * Ver https://wiki.verdnatura.es/index.php/Ekt#Algoritmos_de_lectura * * @param vBarcode Código de compra de una etiqueta de subasta @@ -8939,19 +9107,19 @@ BEGIN ENGINE = MEMORY SELECT id ektFk FROM ekt LIMIT 0; - CASE + CASE WHEN LENGTH(vBarcode) <= vFloridayBarcodeLength THEN INSERT INTO tmp.ekt - SELECT id + SELECT id FROM edi.ektRecent e WHERE e.cps = vBarcode OR e.batchNumber = vBarcode; WHEN LENGTH(vBarcode) = vFloramondoBarcodeLength THEN INSERT INTO tmp.ekt - SELECT e.id + SELECT e.id FROM edi.ektRecent e - WHERE e.pro = MID(vBarcode,2,6) + WHERE e.pro = MID(vBarcode,2,6) AND CAST(e.ptd AS SIGNED) = MID(vBarcode,8,5); ELSE @@ -8966,7 +9134,7 @@ BEGIN -- Clásico de subasta -- Trade standard -- Trade que construye como la subasta - -- Trade como el anterior pero sin trade code + -- Trade como el anterior pero sin trade code INSERT INTO tmp.ekt SELECT id FROM ekt @@ -8987,9 +9155,9 @@ BEGIN -- BatchNumber largo IF NOT vIsFound THEN INSERT INTO tmp.ekt - SELECT id + SELECT id FROM edi.ektRecent e - WHERE e.batchNumber + WHERE e.batchNumber = LEFT(vBarcode,vUsefulAuctionLeftSegmentLength) AND e.batchNumber > 0; @@ -8999,7 +9167,7 @@ BEGIN -- Order Number IF NOT vIsFound THEN INSERT INTO tmp.ekt - SELECT id + SELECT id FROM edi.ektRecent e WHERE e.putOrderFk = vBarcode; @@ -9009,7 +9177,7 @@ BEGIN -- deliveryNumber incrustado IF NOT vIsFound THEN INSERT INTO tmp.ekt - SELECT id + SELECT id FROM edi.ektRecent e WHERE e.deliveryNumber = MID(vBarcode, 4, 13) @@ -9020,7 +9188,7 @@ BEGIN END CASE; IF vIsFound THEN - UPDATE ekt e + UPDATE ekt e JOIN tmp.ekt t ON t.ektFk = e.id SET e.scanned = TRUE; END IF; @@ -9030,6 +9198,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `floramondo_offerRefresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9037,534 +9207,534 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `floramondo_offerRefresh`() -proc: BEGIN - DECLARE vLanded DATETIME; - DECLARE vDone INT DEFAULT FALSE; - DECLARE vFreeId INT; - DECLARE vSupplyResponseFk INT; - DECLARE vLastInserted DATETIME; - DECLARE vIsAuctionDay BOOLEAN; - DECLARE vMaxNewItems INT DEFAULT 10000; - DECLARE vStartingTime DATETIME; - DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043'; - DECLARE vDayRange INT; - - DECLARE cur1 CURSOR FOR - SELECT id - FROM edi.item_free; - - DECLARE cur2 CURSOR FOR - SELECT srId - FROM itemToInsert; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DECLARE EXIT HANDLER FOR SQLSTATE '45000' - BEGIN - ROLLBACK; - RESIGNAL; - END; - - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - BEGIN - DO RELEASE_LOCK('edi.floramondo_offerRefresh'); - SET @isTriggerDisabled = FALSE; - RESIGNAL; - END; - - IF 'test' = (SELECT environment FROM util.config) THEN - LEAVE proc; - END IF; - - IF !GET_LOCK('edi.floramondo_offerRefresh', 0) THEN - LEAVE proc; - END IF; - - SELECT dayRange INTO vDayRange - FROM offerRefreshConfig; - - IF vDayRange IS NULL THEN - CALL util.throw("Variable vDayRange not declared"); - END IF; - - SET vStartingTime = util.VN_NOW(); - - TRUNCATE edi.offerList; - - INSERT INTO edi.offerList(supplier, total) - SELECT v.name, COUNT(DISTINCT sr.ID) total - FROM edi.supplyResponse sr - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - WHERE sr.NumberOfUnits > 0 - AND sr.EmbalageCode != 999 - GROUP BY sr.vmpID; - - UPDATE edi.offerList o - JOIN (SELECT v.name, COUNT(*) total - FROM edi.supplyOffer sr - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - GROUP BY sr.vmpID) sub ON o.supplier = sub.name - SET o.`filter` = sub.total; - - -- Elimina de la lista de items libres aquellos que ya existen - DELETE itf.* - FROM edi.item_free itf - JOIN vn.item i ON i.id = itf.id; - - CREATE OR REPLACE TEMPORARY TABLE tmp - (INDEX (`Item_ArticleCode`)) - ENGINE = MEMORY - SELECT t.* - FROM ( - SELECT * - FROM edi.supplyOffer - ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC, - NumberOfUnits DESC LIMIT 10000000000000000000) t - GROUP BY t.srId; - - CREATE OR REPLACE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`), - INDEX (`ef1`), INDEX (`ef2`), INDEX (`ef3`), INDEX (`ef4`),INDEX (`ef5`), INDEX (`ef6`), - INDEX (`s1Value`), INDEX (`s2Value`), INDEX (`s3Value`), INDEX (`s4Value`),INDEX (`s5Value`), INDEX (`s6Value`)) - ENGINE = MEMORY - SELECT so.*, - ev1.type_description s1Value, - ev2.type_description s2Value, - ev3.type_description s3Value, - ev4.type_description s4Value, - ev5.type_description s5Value, - ev6.type_description s6Value, - eif1.feature ef1, - eif2.feature ef2, - eif3.feature ef3, - eif4.feature ef4, - eif5.feature ef5, - eif6.feature ef6 - FROM tmp so - LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode - AND eif1.presentation_order = 1 - AND eif1.expiry_date IS NULL - LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode - AND eif2.presentation_order = 2 - AND eif2.expiry_date IS NULL - LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode - AND eif3.presentation_order = 3 - AND eif3.expiry_date IS NULL - LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode - AND eif4.presentation_order = 4 - AND eif4.expiry_date IS NULL - LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode - AND eif5.presentation_order = 5 - AND eif5.expiry_date IS NULL - LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode - AND eif6.presentation_order = 6 - AND eif6.expiry_date IS NULL - LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature - AND so.s1 = ev1.type_value - LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature - AND so.s2 = ev2.type_value - LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature - AND so.s3 = ev3.type_value - LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature - AND so.s4 = ev4.type_value - LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature - AND so.s5 = ev5.type_value - LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature - AND so.s6 = ev6.type_value - ORDER BY Price; - - DROP TEMPORARY TABLE tmp; - - DELETE o - FROM edi.offer o - LEFT JOIN vn.tag t1 ON t1.ediTypeFk = o.ef1 AND t1.overwrite = 'size' - LEFT JOIN vn.tag t2 ON t2.ediTypeFk = o.ef2 AND t2.overwrite = 'size' - LEFT JOIN vn.tag t3 ON t3.ediTypeFk = o.ef3 AND t3.overwrite = 'size' - LEFT JOIN vn.tag t4 ON t4.ediTypeFk = o.ef4 AND t4.overwrite = 'size' - LEFT JOIN vn.tag t5 ON t5.ediTypeFk = o.ef5 AND t5.overwrite = 'size' - LEFT JOIN vn.tag t6 ON t6.ediTypeFk = o.ef6 AND t6.overwrite = 'size' - JOIN vn.floramondoConfig fc ON TRUE - WHERE (t1.id IS NOT NULL AND CONVERT(s1Value, UNSIGNED) > fc.itemMaxSize) - OR (t2.id IS NOT NULL AND CONVERT(s2Value, UNSIGNED) > fc.itemMaxSize) - OR (t3.id IS NOT NULL AND CONVERT(s3Value, UNSIGNED) > fc.itemMaxSize) - OR (t4.id IS NOT NULL AND CONVERT(s4Value, UNSIGNED) > fc.itemMaxSize) - OR (t5.id IS NOT NULL AND CONVERT(s5Value, UNSIGNED) > fc.itemMaxSize) - OR (t6.id IS NOT NULL AND CONVERT(s6Value, UNSIGNED) > fc.itemMaxSize); - - START TRANSACTION; - - -- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos - UPDATE IGNORE edi.offer o - JOIN vn.item i - ON i.name = o.product_name - AND i.subname <=> o.company_name - AND i.value5 <=> o.s1Value - AND i.value6 <=> o.s2Value - AND i.value7 <=> o.s3Value - AND i.value8 <=> o.s4Value - AND i.value9 <=> o.s5Value - AND i.value10 <=> o.s6Value - AND i.NumberOfItemsPerCask <=> o.NumberOfItemsPerCask - AND i.EmbalageCode <=> o.EmbalageCode - AND i.quality <=> o.Quality - JOIN vn.itemType it ON it.id = i.typeFk - LEFT JOIN vn.sale s ON s.itemFk = i.id - LEFT JOIN vn.ticket t ON t.id = s.ticketFk - AND t.shipped > (util.VN_CURDATE() - INTERVAL 1 WEEK) - LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID - LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk - AND po.OrderTradeLineDateTime > (util.VN_CURDATE() - INTERVAL 1 WEEK) - SET i.supplyResponseFk = o.srID - WHERE (sr.ID IS NULL - OR sr.NumberOfUnits = 0 - OR di.LatestOrderDateTime < util.VN_NOW() - OR di.ID IS NULL) - AND it.isInventory - AND t.id IS NULL - AND po.id IS NULL; - - CREATE OR REPLACE TEMPORARY TABLE itemToInsert - ENGINE = MEMORY - SELECT o.*, CAST(NULL AS DECIMAL(6,0)) itemFk - FROM edi.offer o - LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId - WHERE i.id IS NULL - LIMIT vMaxNewItems; - - -- Reciclado de nº de item - OPEN cur1; - OPEN cur2; - - read_loop: LOOP - - FETCH cur2 INTO vSupplyResponseFk; - FETCH cur1 INTO vFreeId; - - IF vDone THEN - LEAVE read_loop; - END IF; - - UPDATE itemToInsert - SET itemFk = vFreeId - WHERE srId = vSupplyResponseFk; - - END LOOP; - - CLOSE cur1; - CLOSE cur2; - - -- Insertamos todos los items en Articles de la oferta - INSERT INTO vn.item(id, - `name`, - longName, - subName, - expenceFk, - typeFk, - intrastatFk, - originFk, - supplyResponseFk, - numberOfItemsPerCask, - embalageCode, - quality, - isFloramondo) - SELECT iti.itemFk, - iti.product_name, - iti.product_name, - iti.company_name, - iti.expenseFk, - iti.itemTypeFk, - iti.intrastatFk, - iti.originFk, - iti.`srId`, - iti.NumberOfItemsPerCask, - iti.EmbalageCode, - iti.Quality, - TRUE - FROM itemToInsert iti; - - -- Inserta la foto de los articulos nuevos (prioridad alta) - INSERT IGNORE INTO vn.itemImageQueue(itemFk, url) - SELECT i.id, PictureReference - FROM itemToInsert ii - JOIN vn.item i ON i.supplyResponseFk = ii.srId - WHERE PictureReference IS NOT NULL - AND i.image IS NULL; - - INSERT INTO edi.`log`(tableName, fieldName,fieldValue) - SELECT 'itemImageQueue','NumImagenesPtes', COUNT(*) - FROM vn.itemImageQueue - WHERE attempts = 0; - - -- Inserta si se añadiesen tags nuevos - INSERT IGNORE INTO vn.tag (name, ediTypeFk) - SELECT description, type_id FROM edi.type; - - -- Desabilita el trigger para recalcular los tags al final - SET @isTriggerDisabled = TRUE; - - -- Inserta los tags sólo en los articulos nuevos - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.product_name, 1 - FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Producto' - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ii.product_name IS NULL; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.Quality, 3 - FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Calidad' - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ii.Quality IS NULL; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.company_name, 4 - FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Productor' - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ii.company_name IS NULL; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s1Value, 5 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef1 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT s1Value IS NULL; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s2Value, 6 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef2 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT s2Value IS NULL; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s3Value, 7 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef3 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT s3Value IS NULL; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s4Value, 8 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef4 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT s4Value IS NULL; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s5Value, 9 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef5 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT s5Value IS NULL; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s6Value, 10 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef6 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT s6Value IS NULL; - - INSERT IGNORE INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11 - FROM itemToInsert ii - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - JOIN vn.tag t ON t.`name` = 'Color' - LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode - LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id - AND tp.`description` = 'Hoofdkleur 1' - LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value - LEFT JOIN vn.itemInk ik ON ik.longName = i.longName - WHERE ink.name IS NOT NULL - OR ik.color IS NOT NULL; - - CREATE OR REPLACE TABLE tmp.item - (PRIMARY KEY (id)) - SELECT i.id FROM vn.item i - JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`; - - CALL vn.item_refreshTags(); - - DROP TABLE tmp.item; - - SELECT MIN(LatestDeliveryDateTime) INTO vLanded - FROM edi.supplyResponse sr - JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID - JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID - JOIN vn.floramondoConfig fc - WHERE mp.isLatestOrderDateTimeRelevant - AND di.LatestOrderDateTime > IF( - fc.MaxLatestOrderHour > HOUR(util.VN_NOW()), - util.VN_CURDATE(), - util.VN_CURDATE() + INTERVAL 1 DAY); - - UPDATE vn.floramondoConfig - SET nextLanded = vLanded - WHERE vLanded IS NOT NULL; - - -- Elimina la oferta obsoleta - UPDATE vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.agencyMode am ON am.id = tr.agencyModeFk - JOIN vn.item i ON i.id = b.itemFk - LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID - LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk - SET b.quantity = 0 - WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW() - OR i.supplyResponseFk IS NULL - OR sr.NumberOfUnits = 0) - AND am.name = 'LOGIFLORA' - AND e.isRaid; - - -- Localiza las entradas de cada almacen - UPDATE edi.warehouseFloramondo - SET entryFk = vn.entry_getForLogiflora(vLanded + INTERVAL travellingDays DAY, warehouseFk); - - IF vLanded IS NOT NULL THEN - -- Actualiza la oferta existente - UPDATE vn.buy b - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.item i ON i.id = b.itemFk - JOIN edi.offer o ON i.supplyResponseFk = o.`srId` - SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask, - b.buyingValue = o.price - WHERE (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask - OR b.buyingValue <> o.price); - - -- Inserta el resto - SET vLastInserted := util.VN_NOW(); - - -- Inserta la oferta - INSERT INTO vn.buy ( - entryFk, - itemFk, - quantity, - buyingValue, - stickers, - packing, - `grouping`, - groupingMode, - packageFk, - deliveryFk) - SELECT wf.entryFk, - i.id, - o.NumberOfUnits * o.NumberOfItemsPerCask quantity, - o.Price, - o.NumberOfUnits etiquetas, - o.NumberOfItemsPerCask packing, - GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask `grouping`, - 2, -- Obliga al Packing - o.embalageCode, - o.diId - FROM edi.offer o - JOIN vn.item i ON i.supplyResponseFk = o.srId - JOIN edi.warehouseFloramondo wf - JOIN vn.packaging p ON p.id - LIKE o.embalageCode - LEFT JOIN vn.buy b ON b.itemFk = i.id - AND b.entryFk = wf.entryFk - WHERE b.id IS NULL; -- Quitar esta linea y mirar de crear los packages a tiempo REAL - - INSERT INTO vn.itemCost( - itemFk, - warehouseFk, - cm3, - cm3delivery) - SELECT b.itemFk, - wf.warehouseFk, - @cm3 := vn.buy_getUnitVolume(b.id), - IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3) - FROM warehouseFloramondo wf - JOIN vn.volumeConfig vc - JOIN vn.buy b ON b.entryFk = wf.entryFk - JOIN vn.item i ON i.id = b.itemFk - LEFT JOIN vn.itemCost ic ON ic.itemFk = b.itemFk - AND ic.warehouseFk = wf.warehouseFk - WHERE (ic.cm3 IS NULL OR ic.cm3 = 0) - ON DUPLICATE KEY UPDATE cm3 = @cm3, cm3delivery = IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3); - - CREATE OR REPLACE TEMPORARY TABLE tmp.buyRecalc - SELECT b.id - FROM vn.buy b - JOIN warehouseFloramondo wf ON wf.entryFk = b.entryFk - WHERE b.created >= vLastInserted; - - CALL vn.buy_recalcPrices(); - - UPDATE edi.offerList o - JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total - FROM vn.buy b - JOIN vn.item i ON i.id = b.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.warehouse w ON w.id = wf.warehouseFk - WHERE w.name = 'VNH' - AND b.quantity > 0 - GROUP BY sr.vmpID) sub ON o.supplier = sub.name - SET o.vnh = sub.total; - - UPDATE edi.offerList o - JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total - FROM vn.buy b - JOIN vn.item i ON i.id = b.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.warehouse w ON w.id = wf.warehouseFk - WHERE w.name = 'ALGEMESI' - AND b.quantity > 0 - GROUP BY sr.vmpID) sub ON o.supplier = sub.name - SET o.algemesi = sub.total; - END IF; - - DROP TEMPORARY TABLE - edi.offer, - itemToInsert; - - SET @isTriggerDisabled = FALSE; - - COMMIT; - - -- Esto habria que pasarlo a procesos programados o trabajar con tags y dejar las familias - UPDATE vn.item i - SET typeFk = 121 - WHERE i.longName LIKE 'Rosa Garden %' - AND typeFk = 17; - - UPDATE vn.item i - SET typeFk = 156 - WHERE i.longName LIKE 'Rosa ec %' - AND typeFk = 17; - - -- Refresca las fotos de los items existentes que mostramos (prioridad baja) - INSERT IGNORE INTO vn.itemImageQueue(itemFk, url, priority) - SELECT i.id, sr.PictureReference, 100 - FROM edi.supplyResponse sr - JOIN vn.item i ON i.supplyResponseFk = sr.ID - JOIN edi.supplyOffer so ON so.srId = sr.ID - JOIN hedera.image i2 ON i2.name = i.image - AND i2.collectionFk = 'catalog' - WHERE i2.updated <= (UNIX_TIMESTAMP(util.VN_NOW()) - vDayRange) - AND sr.NumberOfUnits; - - INSERT INTO edi.`log` - SET tableName = 'floramondo_offerRefresh', - fieldName = 'Tiempo de proceso', - fieldValue = TIMEDIFF(util.VN_NOW(), vStartingTime); - - DO RELEASE_LOCK('edi.floramondo_offerRefresh'); +proc: BEGIN + DECLARE vLanded DATETIME; + DECLARE vDone INT DEFAULT FALSE; + DECLARE vFreeId INT; + DECLARE vSupplyResponseFk INT; + DECLARE vLastInserted DATETIME; + DECLARE vIsAuctionDay BOOLEAN; + DECLARE vMaxNewItems INT DEFAULT 10000; + DECLARE vStartingTime DATETIME; + DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043'; + DECLARE vDayRange INT; + + DECLARE cur1 CURSOR FOR + SELECT id + FROM edi.item_free; + + DECLARE cur2 CURSOR FOR + SELECT srId + FROM itemToInsert; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DECLARE EXIT HANDLER FOR SQLSTATE '45000' + BEGIN + ROLLBACK; + RESIGNAL; + END; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('edi.floramondo_offerRefresh'); + SET @isTriggerDisabled = FALSE; + RESIGNAL; + END; + + IF 'test' = (SELECT environment FROM util.config) THEN + LEAVE proc; + END IF; + + IF !GET_LOCK('edi.floramondo_offerRefresh', 0) THEN + LEAVE proc; + END IF; + + SELECT dayRange INTO vDayRange + FROM offerRefreshConfig; + + IF vDayRange IS NULL THEN + CALL util.throw("Variable vDayRange not declared"); + END IF; + + SET vStartingTime = util.VN_NOW(); + + TRUNCATE edi.offerList; + + INSERT INTO edi.offerList(supplier, total) + SELECT v.name, COUNT(DISTINCT sr.ID) total + FROM edi.supplyResponse sr + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + WHERE sr.NumberOfUnits > 0 + AND sr.EmbalageCode != 999 + GROUP BY sr.vmpID; + + UPDATE edi.offerList o + JOIN (SELECT v.name, COUNT(*) total + FROM edi.supplyOffer sr + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + GROUP BY sr.vmpID) sub ON o.supplier = sub.name + SET o.`filter` = sub.total; + + -- Elimina de la lista de items libres aquellos que ya existen + DELETE itf.* + FROM edi.item_free itf + JOIN vn.item i ON i.id = itf.id; + + CREATE OR REPLACE TEMPORARY TABLE tmp + (INDEX (`Item_ArticleCode`)) + ENGINE = MEMORY + SELECT t.* + FROM ( + SELECT * + FROM edi.supplyOffer + ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC, + NumberOfUnits DESC LIMIT 10000000000000000000) t + GROUP BY t.srId; + + CREATE OR REPLACE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`), + INDEX (`ef1`), INDEX (`ef2`), INDEX (`ef3`), INDEX (`ef4`),INDEX (`ef5`), INDEX (`ef6`), + INDEX (`s1Value`), INDEX (`s2Value`), INDEX (`s3Value`), INDEX (`s4Value`),INDEX (`s5Value`), INDEX (`s6Value`)) + ENGINE = MEMORY + SELECT so.*, + ev1.type_description s1Value, + ev2.type_description s2Value, + ev3.type_description s3Value, + ev4.type_description s4Value, + ev5.type_description s5Value, + ev6.type_description s6Value, + eif1.feature ef1, + eif2.feature ef2, + eif3.feature ef3, + eif4.feature ef4, + eif5.feature ef5, + eif6.feature ef6 + FROM tmp so + LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode + AND eif1.presentation_order = 1 + AND eif1.expiry_date IS NULL + LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode + AND eif2.presentation_order = 2 + AND eif2.expiry_date IS NULL + LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode + AND eif3.presentation_order = 3 + AND eif3.expiry_date IS NULL + LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode + AND eif4.presentation_order = 4 + AND eif4.expiry_date IS NULL + LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode + AND eif5.presentation_order = 5 + AND eif5.expiry_date IS NULL + LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode + AND eif6.presentation_order = 6 + AND eif6.expiry_date IS NULL + LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature + AND so.s1 = ev1.type_value + LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature + AND so.s2 = ev2.type_value + LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature + AND so.s3 = ev3.type_value + LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature + AND so.s4 = ev4.type_value + LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature + AND so.s5 = ev5.type_value + LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature + AND so.s6 = ev6.type_value + ORDER BY Price; + + DROP TEMPORARY TABLE tmp; + + DELETE o + FROM edi.offer o + LEFT JOIN vn.tag t1 ON t1.ediTypeFk = o.ef1 AND t1.overwrite = 'size' + LEFT JOIN vn.tag t2 ON t2.ediTypeFk = o.ef2 AND t2.overwrite = 'size' + LEFT JOIN vn.tag t3 ON t3.ediTypeFk = o.ef3 AND t3.overwrite = 'size' + LEFT JOIN vn.tag t4 ON t4.ediTypeFk = o.ef4 AND t4.overwrite = 'size' + LEFT JOIN vn.tag t5 ON t5.ediTypeFk = o.ef5 AND t5.overwrite = 'size' + LEFT JOIN vn.tag t6 ON t6.ediTypeFk = o.ef6 AND t6.overwrite = 'size' + JOIN vn.floramondoConfig fc ON TRUE + WHERE (t1.id IS NOT NULL AND CONVERT(s1Value, UNSIGNED) > fc.itemMaxSize) + OR (t2.id IS NOT NULL AND CONVERT(s2Value, UNSIGNED) > fc.itemMaxSize) + OR (t3.id IS NOT NULL AND CONVERT(s3Value, UNSIGNED) > fc.itemMaxSize) + OR (t4.id IS NOT NULL AND CONVERT(s4Value, UNSIGNED) > fc.itemMaxSize) + OR (t5.id IS NOT NULL AND CONVERT(s5Value, UNSIGNED) > fc.itemMaxSize) + OR (t6.id IS NOT NULL AND CONVERT(s6Value, UNSIGNED) > fc.itemMaxSize); + + START TRANSACTION; + + -- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos + UPDATE IGNORE edi.offer o + JOIN vn.item i + ON i.name = o.product_name + AND i.subname <=> o.company_name + AND i.value5 <=> o.s1Value + AND i.value6 <=> o.s2Value + AND i.value7 <=> o.s3Value + AND i.value8 <=> o.s4Value + AND i.value9 <=> o.s5Value + AND i.value10 <=> o.s6Value + AND i.NumberOfItemsPerCask <=> o.NumberOfItemsPerCask + AND i.EmbalageCode <=> o.EmbalageCode + AND i.quality <=> o.Quality + JOIN vn.itemType it ON it.id = i.typeFk + LEFT JOIN vn.sale s ON s.itemFk = i.id + LEFT JOIN vn.ticket t ON t.id = s.ticketFk + AND t.shipped > (util.VN_CURDATE() - INTERVAL 1 WEEK) + LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID + LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk + AND po.OrderTradeLineDateTime > (util.VN_CURDATE() - INTERVAL 1 WEEK) + SET i.supplyResponseFk = o.srID + WHERE (sr.ID IS NULL + OR sr.NumberOfUnits = 0 + OR di.LatestOrderDateTime < util.VN_NOW() + OR di.ID IS NULL) + AND it.isInventory + AND t.id IS NULL + AND po.id IS NULL; + + CREATE OR REPLACE TEMPORARY TABLE itemToInsert + ENGINE = MEMORY + SELECT o.*, CAST(NULL AS DECIMAL(6,0)) itemFk + FROM edi.offer o + LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId + WHERE i.id IS NULL + LIMIT vMaxNewItems; + + -- Reciclado de nº de item + OPEN cur1; + OPEN cur2; + + read_loop: LOOP + + FETCH cur2 INTO vSupplyResponseFk; + FETCH cur1 INTO vFreeId; + + IF vDone THEN + LEAVE read_loop; + END IF; + + UPDATE itemToInsert + SET itemFk = vFreeId + WHERE srId = vSupplyResponseFk; + + END LOOP; + + CLOSE cur1; + CLOSE cur2; + + -- Insertamos todos los items en Articles de la oferta + INSERT INTO vn.item(id, + `name`, + longName, + subName, + expenceFk, + typeFk, + intrastatFk, + originFk, + supplyResponseFk, + numberOfItemsPerCask, + embalageCode, + quality, + isFloramondo) + SELECT iti.itemFk, + iti.product_name, + iti.product_name, + iti.company_name, + iti.expenseFk, + iti.itemTypeFk, + iti.intrastatFk, + iti.originFk, + iti.`srId`, + iti.NumberOfItemsPerCask, + iti.EmbalageCode, + iti.Quality, + TRUE + FROM itemToInsert iti; + + -- Inserta la foto de los articulos nuevos (prioridad alta) + INSERT IGNORE INTO vn.itemImageQueue(itemFk, url) + SELECT i.id, PictureReference + FROM itemToInsert ii + JOIN vn.item i ON i.supplyResponseFk = ii.srId + WHERE PictureReference IS NOT NULL + AND i.image IS NULL; + + INSERT INTO edi.`log`(tableName, fieldName,fieldValue) + SELECT 'itemImageQueue','NumImagenesPtes', COUNT(*) + FROM vn.itemImageQueue + WHERE attempts = 0; + + -- Inserta si se añadiesen tags nuevos + INSERT IGNORE INTO vn.tag (name, ediTypeFk) + SELECT description, type_id FROM edi.type; + + -- Desabilita el trigger para recalcular los tags al final + SET @isTriggerDisabled = TRUE; + + -- Inserta los tags sólo en los articulos nuevos + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.product_name, 1 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Producto' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE NOT ii.product_name IS NULL; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.Quality, 3 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Calidad' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE NOT ii.Quality IS NULL; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , ii.company_name, 4 + FROM itemToInsert ii + JOIN vn.tag t ON t.`name` = 'Productor' + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE NOT ii.company_name IS NULL; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s1Value, 5 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef1 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE NOT s1Value IS NULL; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s2Value, 6 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef2 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE NOT s2Value IS NULL; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s3Value, 7 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef3 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE NOT s3Value IS NULL; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s4Value, 8 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef4 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE NOT s4Value IS NULL; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s5Value, 9 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef5 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE NOT s5Value IS NULL; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id , s6Value, 10 + FROM itemToInsert ii + JOIN vn.tag t ON t.ediTypeFk = ii.ef6 + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + WHERE NOT s6Value IS NULL; + + INSERT IGNORE INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11 + FROM itemToInsert ii + JOIN vn.item i ON i.supplyResponseFk = ii.`srId` + JOIN vn.tag t ON t.`name` = 'Color' + LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode + LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id + AND tp.`description` = 'Hoofdkleur 1' + LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value + LEFT JOIN vn.itemInk ik ON ik.longName = i.longName + WHERE ink.name IS NOT NULL + OR ik.color IS NOT NULL; + + CREATE OR REPLACE TABLE tmp.item + (PRIMARY KEY (id)) + SELECT i.id FROM vn.item i + JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`; + + CALL vn.item_refreshTags(); + + DROP TABLE tmp.item; + + SELECT MIN(LatestDeliveryDateTime) INTO vLanded + FROM edi.supplyResponse sr + JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID + JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID + JOIN vn.floramondoConfig fc + WHERE mp.isLatestOrderDateTimeRelevant + AND di.LatestOrderDateTime > IF( + fc.MaxLatestOrderHour > HOUR(util.VN_NOW()), + util.VN_CURDATE(), + util.VN_CURDATE() + INTERVAL 1 DAY); + + UPDATE vn.floramondoConfig + SET nextLanded = vLanded + WHERE vLanded IS NOT NULL; + + -- Elimina la oferta obsoleta + UPDATE vn.buy b + JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.agencyMode am ON am.id = tr.agencyModeFk + JOIN vn.item i ON i.id = b.itemFk + LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID + LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk + SET b.quantity = 0 + WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW() + OR i.supplyResponseFk IS NULL + OR sr.NumberOfUnits = 0) + AND am.name = 'LOGIFLORA' + AND e.isRaid; + + -- Localiza las entradas de cada almacen + UPDATE edi.warehouseFloramondo + SET entryFk = vn.entry_getForLogiflora(vLanded + INTERVAL travellingDays DAY, warehouseFk); + + IF vLanded IS NOT NULL THEN + -- Actualiza la oferta existente + UPDATE vn.buy b + JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk + JOIN vn.item i ON i.id = b.itemFk + JOIN edi.offer o ON i.supplyResponseFk = o.`srId` + SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask, + b.buyingValue = o.price + WHERE (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask + OR b.buyingValue <> o.price); + + -- Inserta el resto + SET vLastInserted := util.VN_NOW(); + + -- Inserta la oferta + INSERT INTO vn.buy ( + entryFk, + itemFk, + quantity, + buyingValue, + stickers, + packing, + `grouping`, + groupingMode, + packageFk, + deliveryFk) + SELECT wf.entryFk, + i.id, + o.NumberOfUnits * o.NumberOfItemsPerCask quantity, + o.Price, + o.NumberOfUnits etiquetas, + o.NumberOfItemsPerCask packing, + GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask `grouping`, + 2, -- Obliga al Packing + o.embalageCode, + o.diId + FROM edi.offer o + JOIN vn.item i ON i.supplyResponseFk = o.srId + JOIN edi.warehouseFloramondo wf + JOIN vn.packaging p ON p.id + LIKE o.embalageCode + LEFT JOIN vn.buy b ON b.itemFk = i.id + AND b.entryFk = wf.entryFk + WHERE b.id IS NULL; -- Quitar esta linea y mirar de crear los packages a tiempo REAL + + INSERT INTO vn.itemCost( + itemFk, + warehouseFk, + cm3, + cm3delivery) + SELECT b.itemFk, + wf.warehouseFk, + @cm3 := vn.buy_getUnitVolume(b.id), + IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3) + FROM warehouseFloramondo wf + JOIN vn.volumeConfig vc + JOIN vn.buy b ON b.entryFk = wf.entryFk + JOIN vn.item i ON i.id = b.itemFk + LEFT JOIN vn.itemCost ic ON ic.itemFk = b.itemFk + AND ic.warehouseFk = wf.warehouseFk + WHERE (ic.cm3 IS NULL OR ic.cm3 = 0) + ON DUPLICATE KEY UPDATE cm3 = @cm3, cm3delivery = IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3); + + CREATE OR REPLACE TEMPORARY TABLE tmp.buyRecalc + SELECT b.id + FROM vn.buy b + JOIN warehouseFloramondo wf ON wf.entryFk = b.entryFk + WHERE b.created >= vLastInserted; + + CALL vn.buy_recalcPrices(); + + UPDATE edi.offerList o + JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total + FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk + JOIN vn.warehouse w ON w.id = wf.warehouseFk + WHERE w.name = 'VNH' + AND b.quantity > 0 + GROUP BY sr.vmpID) sub ON o.supplier = sub.name + SET o.vnh = sub.total; + + UPDATE edi.offerList o + JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total + FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk + JOIN vn.warehouse w ON w.id = wf.warehouseFk + WHERE w.name = 'ALGEMESI' + AND b.quantity > 0 + GROUP BY sr.vmpID) sub ON o.supplier = sub.name + SET o.algemesi = sub.total; + END IF; + + DROP TEMPORARY TABLE + edi.offer, + itemToInsert; + + SET @isTriggerDisabled = FALSE; + + COMMIT; + + -- Esto habria que pasarlo a procesos programados o trabajar con tags y dejar las familias + UPDATE vn.item i + SET typeFk = 121 + WHERE i.longName LIKE 'Rosa Garden %' + AND typeFk = 17; + + UPDATE vn.item i + SET typeFk = 156 + WHERE i.longName LIKE 'Rosa ec %' + AND typeFk = 17; + + -- Refresca las fotos de los items existentes que mostramos (prioridad baja) + INSERT IGNORE INTO vn.itemImageQueue(itemFk, url, priority) + SELECT i.id, sr.PictureReference, 100 + FROM edi.supplyResponse sr + JOIN vn.item i ON i.supplyResponseFk = sr.ID + JOIN edi.supplyOffer so ON so.srId = sr.ID + JOIN hedera.image i2 ON i2.name = i.image + AND i2.collectionFk = 'catalog' + WHERE i2.updated <= (UNIX_TIMESTAMP(util.VN_NOW()) - vDayRange) + AND sr.NumberOfUnits; + + INSERT INTO edi.`log` + SET tableName = 'floramondo_offerRefresh', + fieldName = 'Tiempo de proceso', + fieldValue = TIMEDIFF(util.VN_NOW(), vStartingTime); + + DO RELEASE_LOCK('edi.floramondo_offerRefresh'); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_freeAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9572,8 +9742,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_freeAdd`() BEGIN @@ -9610,6 +9778,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_getNewByEkt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9617,15 +9787,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getNewByEkt`(vEktFk INT, OUT vItemFk INT) BEGIN /** * Devuelve un número nuevo de item a partir de un registro de la tabla edi.ekt - * + * * @param vEktFk Identificador de la tabla edi.ekt */ @@ -9634,17 +9802,17 @@ BEGIN SELECT MIN(id) id INTO vItemFk FROM edi.item_free; - DELETE FROM edi.item_free + DELETE FROM edi.item_free WHERE id = vItemFk; - + COMMIT; - + IF ISNULL(vItemFk) THEN SELECT MAX(i.id) + 1 INTO vItemFk FROM vn.item i; END IF; - + INSERT INTO vn.item(id, `name`, longName, @@ -9670,118 +9838,118 @@ BEGIN least(IF((e.package = 800),((e.package * 10) + e.pac), e.package), IFNULL(idt.bucket_id, '999')) packageFk, e.cat, TRUE - FROM edi.ekt e - JOIN edi.item i ON i.id = e.`ref` - JOIN edi.item_groupToOffer igto ON igto.group_code = i.group_id - LEFT JOIN edi.item_defaultType idt ON idt.item_id = e.`ref` + FROM edi.ekt e + JOIN edi.item i ON i.id = e.`ref` + JOIN edi.item_groupToOffer igto ON igto.group_code = i.group_id + LEFT JOIN edi.item_defaultType idt ON idt.item_id = e.`ref` WHERE e.id = vEktFk; SET @isTriggerDisabled = TRUE; - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.item , 1 - FROM edi.ekt e + SELECT vItemFk, t.id , e.item , 1 + FROM edi.ekt e JOIN vn.tag t ON t.`name` = 'Producto' WHERE e.id = vEktFk AND NOT ISNULL(e.item); INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.cat , 3 - FROM edi.ekt e + SELECT vItemFk, t.id , e.cat , 3 + FROM edi.ekt e JOIN vn.tag t ON t.`name` = 'Calidad' WHERE e.id = vEktFk AND NOT ISNULL(e.cat); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , s.company_name , 4 - FROM edi.ekt e + SELECT vItemFk, t.id , s.company_name , 4 + FROM edi.ekt e JOIN edi.supplier s ON s.supplier_id = e.pro JOIN vn.tag t ON t.`name` = 'Productor' WHERE e.id = vEktFk AND NOT ISNULL(s.company_name); INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s1, 5 + SELECT vItemFk, t.id , e.s1, 5 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` - AND eif.presentation_order = 1 + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + AND eif.presentation_order = 1 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s1 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s1); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s2, 6 + SELECT vItemFk, t.id , e.s2, 6 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` - AND eif.presentation_order = 2 + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + AND eif.presentation_order = 2 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s2 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s2); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s3, 7 + SELECT vItemFk, t.id , e.s3, 7 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` - AND eif.presentation_order = 3 + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + AND eif.presentation_order = 3 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s3 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s3); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s4, 8 + SELECT vItemFk, t.id , e.s4, 8 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` AND eif.presentation_order = 4 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s4 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s4); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s5, 9 + SELECT vItemFk, t.id , e.s5, 9 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` AND eif.presentation_order = 5 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s5 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s5); INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s6, 10 + SELECT vItemFk, t.id , e.s6, 10 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` AND eif.presentation_order = 6 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s6 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s6); INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id, IFNULL(ink.name, ik.color), 11 - FROM edi.ekt e + SELECT vItemFk, t.id, IFNULL(ink.name, ik.color), 11 + FROM edi.ekt e JOIN vn.tag t ON t.`name` = 'Color' - LEFT JOIN edi.feature f ON f.item_id = e.`ref` + LEFT JOIN edi.feature f ON f.item_id = e.`ref` LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value LEFT JOIN vn.itemInk ik ON ik.longName = e.item WHERE e.id = vEktFk - AND ( ink.name IS NOT NULL + AND ( ink.name IS NOT NULL OR ik.color IS NOT NULL) LIMIT 1; @@ -9809,6 +9977,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `mail_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9816,8 +9986,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `mail_new`( vMessageId VARCHAR(100) @@ -9848,7 +10016,7 @@ BEGIN sender = vSender, senderFk = vSenderId, messageId = vMessageId; - + IF vIsDuplicated THEN SELECT id INTO vSelf FROM mail @@ -10182,10 +10350,9 @@ DROP TABLE IF EXISTS `mainAccountBank`; /*!50001 DROP VIEW IF EXISTS `mainAccountBank`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `mainAccountBank` ( - `name` tinyint NOT NULL, - `iban` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `mainAccountBank` AS SELECT + 1 AS `name`, + 1 AS `iban` */; SET character_set_client = @saved_cs_client; -- @@ -10249,10 +10416,9 @@ DROP TABLE IF EXISTS `messageL10n`; /*!50001 DROP VIEW IF EXISTS `messageL10n`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `messageL10n` ( - `code` tinyint NOT NULL, - `description` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `messageL10n` AS SELECT + 1 AS `code`, + 1 AS `description` */; SET character_set_client = @saved_cs_client; -- @@ -10279,20 +10445,19 @@ DROP TABLE IF EXISTS `myAddress`; /*!50001 DROP VIEW IF EXISTS `myAddress`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myAddress` ( - `id` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `street` tinyint NOT NULL, - `city` tinyint NOT NULL, - `postalCode` tinyint NOT NULL, - `provinceFk` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `isDefaultAddress` tinyint NOT NULL, - `isActive` tinyint NOT NULL, - `longitude` tinyint NOT NULL, - `latitude` tinyint NOT NULL, - `agencyModeFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myAddress` AS SELECT + 1 AS `id`, + 1 AS `clientFk`, + 1 AS `street`, + 1 AS `city`, + 1 AS `postalCode`, + 1 AS `provinceFk`, + 1 AS `nickname`, + 1 AS `isDefaultAddress`, + 1 AS `isActive`, + 1 AS `longitude`, + 1 AS `latitude`, + 1 AS `agencyModeFk` */; SET character_set_client = @saved_cs_client; -- @@ -10303,12 +10468,11 @@ DROP TABLE IF EXISTS `myBasketDefaults`; /*!50001 DROP VIEW IF EXISTS `myBasketDefaults`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myBasketDefaults` ( - `deliveryMethod` tinyint NOT NULL, - `agencyModeFk` tinyint NOT NULL, - `addressFk` tinyint NOT NULL, - `defaultAgencyFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myBasketDefaults` AS SELECT + 1 AS `deliveryMethod`, + 1 AS `agencyModeFk`, + 1 AS `addressFk`, + 1 AS `defaultAgencyFk` */; SET character_set_client = @saved_cs_client; -- @@ -10319,12 +10483,11 @@ DROP TABLE IF EXISTS `myClient`; /*!50001 DROP VIEW IF EXISTS `myClient`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myClient` ( - `id` tinyint NOT NULL, - `isToBeMailed` tinyint NOT NULL, - `defaultAddressFk` tinyint NOT NULL, - `credit` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myClient` AS SELECT + 1 AS `id`, + 1 AS `isToBeMailed`, + 1 AS `defaultAddressFk`, + 1 AS `credit` */; SET character_set_client = @saved_cs_client; -- @@ -10335,13 +10498,12 @@ DROP TABLE IF EXISTS `myInvoice`; /*!50001 DROP VIEW IF EXISTS `myInvoice`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myInvoice` ( - `id` tinyint NOT NULL, - `ref` tinyint NOT NULL, - `issued` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `hasPdf` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myInvoice` AS SELECT + 1 AS `id`, + 1 AS `ref`, + 1 AS `issued`, + 1 AS `amount`, + 1 AS `hasPdf` */; SET character_set_client = @saved_cs_client; -- @@ -10352,12 +10514,11 @@ DROP TABLE IF EXISTS `myMenu`; /*!50001 DROP VIEW IF EXISTS `myMenu`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myMenu` ( - `id` tinyint NOT NULL, - `path` tinyint NOT NULL, - `description` tinyint NOT NULL, - `parentFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myMenu` AS SELECT + 1 AS `id`, + 1 AS `path`, + 1 AS `description`, + 1 AS `parentFk` */; SET character_set_client = @saved_cs_client; -- @@ -10368,24 +10529,23 @@ DROP TABLE IF EXISTS `myOrder`; /*!50001 DROP VIEW IF EXISTS `myOrder`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myOrder` ( - `id` tinyint NOT NULL, - `sent` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `deliveryMethodFk` tinyint NOT NULL, - `agencyModeFk` tinyint NOT NULL, - `addressFk` tinyint NOT NULL, - `companyFk` tinyint NOT NULL, - `notes` tinyint NOT NULL, - `sourceApp` tinyint NOT NULL, - `isConfirmed` tinyint NOT NULL, - `created` tinyint NOT NULL, - `firstRowStamp` tinyint NOT NULL, - `confirmed` tinyint NOT NULL, - `taxableBase` tinyint NOT NULL, - `tax` tinyint NOT NULL, - `total` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myOrder` AS SELECT + 1 AS `id`, + 1 AS `sent`, + 1 AS `clientFk`, + 1 AS `deliveryMethodFk`, + 1 AS `agencyModeFk`, + 1 AS `addressFk`, + 1 AS `companyFk`, + 1 AS `notes`, + 1 AS `sourceApp`, + 1 AS `isConfirmed`, + 1 AS `created`, + 1 AS `firstRowStamp`, + 1 AS `confirmed`, + 1 AS `taxableBase`, + 1 AS `tax`, + 1 AS `total` */; SET character_set_client = @saved_cs_client; -- @@ -10396,18 +10556,17 @@ DROP TABLE IF EXISTS `myOrderRow`; /*!50001 DROP VIEW IF EXISTS `myOrderRow`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myOrderRow` ( - `id` tinyint NOT NULL, - `orderFk` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `price` tinyint NOT NULL, - `rate` tinyint NOT NULL, - `created` tinyint NOT NULL, - `saleFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myOrderRow` AS SELECT + 1 AS `id`, + 1 AS `orderFk`, + 1 AS `itemFk`, + 1 AS `warehouseFk`, + 1 AS `shipped`, + 1 AS `amount`, + 1 AS `price`, + 1 AS `rate`, + 1 AS `created`, + 1 AS `saleFk` */; SET character_set_client = @saved_cs_client; -- @@ -10418,10 +10577,9 @@ DROP TABLE IF EXISTS `myOrderTicket`; /*!50001 DROP VIEW IF EXISTS `myOrderTicket`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myOrderTicket` ( - `orderFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myOrderTicket` AS SELECT + 1 AS `orderFk`, + 1 AS `ticketFk` */; SET character_set_client = @saved_cs_client; -- @@ -10432,19 +10590,18 @@ DROP TABLE IF EXISTS `myTicket`; /*!50001 DROP VIEW IF EXISTS `myTicket`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myTicket` ( - `id` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `agencyModeFk` tinyint NOT NULL, - `refFk` tinyint NOT NULL, - `addressFk` tinyint NOT NULL, - `location` tinyint NOT NULL, - `companyFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myTicket` AS SELECT + 1 AS `id`, + 1 AS `clientFk`, + 1 AS `warehouseFk`, + 1 AS `shipped`, + 1 AS `landed`, + 1 AS `nickname`, + 1 AS `agencyModeFk`, + 1 AS `refFk`, + 1 AS `addressFk`, + 1 AS `location`, + 1 AS `companyFk` */; SET character_set_client = @saved_cs_client; -- @@ -10455,17 +10612,16 @@ DROP TABLE IF EXISTS `myTicketRow`; /*!50001 DROP VIEW IF EXISTS `myTicketRow`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myTicketRow` ( - `id` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `price` tinyint NOT NULL, - `discount` tinyint NOT NULL, - `reserved` tinyint NOT NULL, - `isPicked` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myTicketRow` AS SELECT + 1 AS `id`, + 1 AS `itemFk`, + 1 AS `ticketFk`, + 1 AS `concept`, + 1 AS `quantity`, + 1 AS `price`, + 1 AS `discount`, + 1 AS `reserved`, + 1 AS `isPicked` */; SET character_set_client = @saved_cs_client; -- @@ -10476,15 +10632,14 @@ DROP TABLE IF EXISTS `myTicketService`; /*!50001 DROP VIEW IF EXISTS `myTicketService`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myTicketService` ( - `id` tinyint NOT NULL, - `description` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `price` tinyint NOT NULL, - `taxClassFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `ticketServiceTypeFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myTicketService` AS SELECT + 1 AS `id`, + 1 AS `description`, + 1 AS `quantity`, + 1 AS `price`, + 1 AS `taxClassFk`, + 1 AS `ticketFk`, + 1 AS `ticketServiceTypeFk` */; SET character_set_client = @saved_cs_client; -- @@ -10495,21 +10650,20 @@ DROP TABLE IF EXISTS `myTicketState`; /*!50001 DROP VIEW IF EXISTS `myTicketState`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myTicketState` ( - `id` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `agencyModeFk` tinyint NOT NULL, - `refFk` tinyint NOT NULL, - `addressFk` tinyint NOT NULL, - `location` tinyint NOT NULL, - `companyFk` tinyint NOT NULL, - `alertLevel` tinyint NOT NULL, - `code` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myTicketState` AS SELECT + 1 AS `id`, + 1 AS `clientFk`, + 1 AS `warehouseFk`, + 1 AS `shipped`, + 1 AS `landed`, + 1 AS `nickname`, + 1 AS `agencyModeFk`, + 1 AS `refFk`, + 1 AS `addressFk`, + 1 AS `location`, + 1 AS `companyFk`, + 1 AS `alertLevel`, + 1 AS `code` */; SET character_set_client = @saved_cs_client; -- @@ -10520,16 +10674,15 @@ DROP TABLE IF EXISTS `myTpvTransaction`; /*!50001 DROP VIEW IF EXISTS `myTpvTransaction`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `myTpvTransaction` ( - `id` tinyint NOT NULL, - `merchantFk` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `receiptFk` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `response` tinyint NOT NULL, - `status` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `myTpvTransaction` AS SELECT + 1 AS `id`, + 1 AS `merchantFk`, + 1 AS `clientFk`, + 1 AS `receiptFk`, + 1 AS `amount`, + 1 AS `response`, + 1 AS `status`, + 1 AS `created` */; SET character_set_client = @saved_cs_client; -- @@ -10685,7 +10838,7 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `hedera`.`order_afterInsert` AFTER INSERT ON `order` FOR EACH ROW -BEGIN +BEGIN IF NEW.address_id = 2850 THEN -- Fallo que se insertan no se sabe como tickets en este cliente CALL vn.mail_insert( @@ -10694,7 +10847,7 @@ BEGIN 'Creada order al address 2850', CONCAT(account.myUser_getName(), ' ha creado la order ',NEW.id) ); - + END IF; END */;; DELIMITER ; @@ -10711,27 +10864,27 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `hedera`.`order_afterUpdate` - AFTER UPDATE ON `order` - FOR EACH ROW -BEGIN - CALL stock.log_add('order', NEW.id, OLD.id); - - IF !(OLD.address_id <=> NEW.address_id) - OR !(OLD.company_id <=> NEW.company_id) - OR !(OLD.customer_id <=> NEW.customer_id) THEN - CALL order_requestRecalc(NEW.id); - END IF; - - IF !(OLD.address_id <=> NEW.address_id) AND NEW.address_id = 2850 THEN - -- Fallo que se actualiza no se sabe como tickets en este cliente - CALL vn.mail_insert( - 'jgallego@verdnatura.es', - 'noreply@verdnatura.es', - 'Actualizada order al address 2850', - CONCAT(account.myUser_getName(), ' ha creado la order ',NEW.id) - ); - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `hedera`.`order_afterUpdate` + AFTER UPDATE ON `order` + FOR EACH ROW +BEGIN + CALL stock.log_add('order', NEW.id, OLD.id); + + IF !(OLD.address_id <=> NEW.address_id) + OR !(OLD.company_id <=> NEW.company_id) + OR !(OLD.customer_id <=> NEW.customer_id) THEN + CALL order_requestRecalc(NEW.id); + END IF; + + IF !(OLD.address_id <=> NEW.address_id) AND NEW.address_id = 2850 THEN + -- Fallo que se actualiza no se sabe como tickets en este cliente + CALL vn.mail_insert( + 'jgallego@verdnatura.es', + 'noreply@verdnatura.es', + 'Actualizada order al address 2850', + CONCAT(account.myUser_getName(), ' ha creado la order ',NEW.id) + ); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10846,12 +10999,12 @@ DELIMITER ;; BEGIN DECLARE vIsFirst BOOL; - SELECT (first_row_stamp IS NULL) INTO vIsFirst - FROM `order` + SELECT (first_row_stamp IS NULL) INTO vIsFirst + FROM `order` WHERE id = NEW.orderFk; IF vIsFirst THEN - UPDATE `order` SET first_row_stamp = util.VN_NOW() + UPDATE `order` SET first_row_stamp = util.VN_NOW() WHERE id = NEW.orderFk; END IF; END */;; @@ -10950,10 +11103,9 @@ DROP TABLE IF EXISTS `orderTicket`; /*!50001 DROP VIEW IF EXISTS `orderTicket`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `orderTicket` ( - `orderFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `orderTicket` AS SELECT + 1 AS `orderFk`, + 1 AS `ticketFk` */; SET character_set_client = @saved_cs_client; -- @@ -10964,11 +11116,10 @@ DROP TABLE IF EXISTS `order_component`; /*!50001 DROP VIEW IF EXISTS `order_component`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `order_component` ( - `order_row_id` tinyint NOT NULL, - `component_id` tinyint NOT NULL, - `price` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `order_component` AS SELECT + 1 AS `order_row_id`, + 1 AS `component_id`, + 1 AS `price` */; SET character_set_client = @saved_cs_client; -- @@ -10979,18 +11130,17 @@ DROP TABLE IF EXISTS `order_row`; /*!50001 DROP VIEW IF EXISTS `order_row`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `order_row` ( - `id` tinyint NOT NULL, - `order_id` tinyint NOT NULL, - `item_id` tinyint NOT NULL, - `warehouse_id` tinyint NOT NULL, - `shipment` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `price` tinyint NOT NULL, - `rate` tinyint NOT NULL, - `created` tinyint NOT NULL, - `Id_Movimiento` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `order_row` AS SELECT + 1 AS `id`, + 1 AS `order_id`, + 1 AS `item_id`, + 1 AS `warehouse_id`, + 1 AS `shipment`, + 1 AS `amount`, + 1 AS `price`, + 1 AS `rate`, + 1 AS `created`, + 1 AS `Id_Movimiento` */; SET character_set_client = @saved_cs_client; -- @@ -11391,6 +11541,8 @@ DELIMITER ; -- -- Dumping routines for database 'hedera' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `myClient_getDebt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11398,8 +11550,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `myClient_getDebt`(vDate DATE) RETURNS decimal(10,2) DETERMINISTIC @@ -11416,6 +11566,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `myUser_checkRestPriv` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11423,8 +11575,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `myUser_checkRestPriv`(vMethodPath VARCHAR(255)) RETURNS tinyint(1) DETERMINISTIC @@ -11443,7 +11593,7 @@ BEGIN IF vCount = 0 THEN RETURN FALSE; - END IF; + END IF; SELECT COUNT(*) > 0 INTO vHasRole @@ -11459,6 +11609,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `order_getTotal` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11466,8 +11618,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `order_getTotal`(vSelf INT) RETURNS decimal(10,2) READS SQL DATA @@ -11502,6 +11652,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `catalog_calcFromMyAddress` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11509,8 +11661,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calcFromMyAddress`(vDelivery DATE, vAddress INT) BEGIN @@ -11524,14 +11674,14 @@ BEGIN * @return tmp.ticketComponent * @return tmp.ticketLot * @return tmp.zoneGetShipped - */ + */ DECLARE vAgencyMode INT; - + SELECT a.agencyModeFk INTO vAgencyMode FROM myClient c JOIN vn.address a ON a.clientFk = c.id - WHERE a.id = vAddress; + WHERE a.id = vAddress; CALL vn.available_calc(vDelivery, vAddress, vAgencyMode); @@ -11544,7 +11694,7 @@ BEGIN JOIN tmp.availableCalc a ON a.calcFk = c.calc_id WHERE c.available > 0 GROUP BY c.item_id; - + CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode); DROP TEMPORARY TABLE tmp.item; @@ -11554,6 +11704,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `image_ref` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11561,8 +11713,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `image_ref`( vCollection VARCHAR(255), @@ -11592,6 +11742,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `image_unref` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11599,8 +11751,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `image_unref`( vCollection VARCHAR(255), @@ -11622,6 +11772,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_calcCatalog` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11629,8 +11781,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_calcCatalog`( vSelf INT, @@ -11646,7 +11796,7 @@ BEGIN */ DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY + ENGINE = MEMORY SELECT vSelf itemFk; CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); @@ -11670,6 +11820,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_getVisible` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11677,8 +11829,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getVisible`( vWarehouse TINYINT, @@ -11686,7 +11836,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getVisible`( vType INT, vPrefix VARCHAR(255)) BEGIN - + /** * Gets visible items of the specified type at specified date. * @@ -11695,7 +11845,7 @@ BEGIN * @param vType The type id * @param vPrefix The article prefix to filter or %NULL for all * @return tmp.itemVisible Visible items - */ + */ DECLARE vPrefixLen SMALLINT; DECLARE vFilter VARCHAR(255) DEFAULT NULL; DECLARE vDateInv DATE DEFAULT vn2008.date_inv(); @@ -11704,13 +11854,13 @@ BEGIN GET DIAGNOSTICS CONDITION 1 @message = MESSAGE_TEXT; CALL vn.mail_insert( - 'cau@verdnatura.es', - NULL, + 'cau@verdnatura.es', + NULL, CONCAT('hedera.item_getVisible error: ', @message), CONCAT( - 'warehouse: ', IFNULL(vWarehouse, ''), - ', Fecha:', IFNULL(vDate, ''), - ', tipo: ', IFNULL(vType,''), + 'warehouse: ', IFNULL(vWarehouse, ''), + ', Fecha:', IFNULL(vDate, ''), + ', tipo: ', IFNULL(vType,''), ', prefijo: ', IFNULL(vPrefix,''))); RESIGNAL; END; @@ -11789,7 +11939,7 @@ BEGIN IF(p.depth > 0, p.depth, 0) depth, p.width, p.height, CEIL(s.quantity / t.packing) etiquetas FROM vn.item i - JOIN `filter` f ON f.itemFk = i.id + JOIN `filter` f ON f.itemFk = i.id JOIN currentStock s ON s.itemFk = i.id LEFT JOIN tmp t ON t.itemFk = i.id LEFT JOIN vn.packaging p ON p.id = t.packageFk @@ -11807,6 +11957,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_listAllocation` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11814,8 +11966,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_listAllocation`(IN `vWh` TINYINT, IN `vDate` DATE, IN `vType` INT, IN `vPrefix` VARCHAR(255), IN `vUseIds` BOOLEAN) BEGIN @@ -11848,6 +11998,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_addItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11855,8 +12007,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_addItem`( vSelf INT, @@ -11872,6 +12022,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_calcCatalogFromItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11879,8 +12031,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_calcCatalogFromItem`(vSelf INT, vItem INT) BEGIN @@ -11903,6 +12053,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_calcCatalogFull` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11910,8 +12062,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_calcCatalogFull`(vSelf INT) BEGIN @@ -11934,6 +12084,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_checkConfig` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11941,8 +12093,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_checkConfig`(vSelf INT) proc: BEGIN @@ -11961,6 +12111,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_checkMine` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11968,8 +12120,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_checkMine`(vSelf INT) proc: BEGIN @@ -11994,6 +12144,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_configure` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12001,8 +12153,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_configure`( vSelf INT, @@ -12041,6 +12191,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_configureForGuest` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12048,8 +12200,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_configureForGuest`(OUT vSelf INT) BEGIN @@ -12099,6 +12249,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_confirm` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12106,8 +12258,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_confirm`(vSelf INT) BEGIN @@ -12120,6 +12270,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_create` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12127,8 +12279,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_create`( OUT vSelf INT, @@ -12170,6 +12320,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_getAvailable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12177,8 +12329,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_getAvailable`(vSelf INT) BEGIN @@ -12196,6 +12346,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_getTax` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12203,8 +12355,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_getTax`(vSelf INT) READS SQL DATA @@ -12230,6 +12380,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_newWithAddress` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12237,8 +12389,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_newWithAddress`( OUT vSelf INT, @@ -12266,15 +12416,15 @@ BEGIN START TRANSACTION; - SELECT a.agencyModeFk, a.id + SELECT a.agencyModeFk, a.id INTO vAgencyMode, vAddressFk - FROM vn.address a + FROM vn.address a WHERE a.id = vAddressFk; - + SELECT deliveryMethodFk INTO vDeliveryMethodId FROM vn.agencyMode am WHERE am.id = vAgencyMode; - + IF vCompany IS NULL THEN SELECT defaultCompanyFk INTO vCompany @@ -12292,7 +12442,7 @@ BEGIN company_id = vCompany; SET vSelf = LAST_INSERT_ID(); - + CALL order_checkConfig(vSelf); COMMIT; @@ -12302,6 +12452,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myOrder_newWithDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12309,8 +12461,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_newWithDate`( OUT vSelf INT, @@ -12338,15 +12488,15 @@ BEGIN START TRANSACTION; - SELECT a.agencyModeFk, a.id + SELECT a.agencyModeFk, a.id INTO vAgencyMode, vAddress FROM myClient c JOIN vn.address a ON a.id = c.defaultAddressFk; - + SELECT deliveryMethodFk INTO vDeliveryMethodId FROM vn.agencyMode am WHERE am.id = vAgencyMode; - + IF vCompany IS NULL THEN SELECT defaultCompanyFk INTO vCompany @@ -12364,7 +12514,7 @@ BEGIN company_id = vCompany; SET vSelf = LAST_INSERT_ID(); - + CALL order_checkConfig(vSelf); COMMIT; @@ -12374,6 +12524,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myTicket_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12381,8 +12533,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myTicket_get`(vSelf INT) BEGIN @@ -12428,6 +12578,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myTicket_getPackages` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12435,8 +12587,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myTicket_getPackages`(vSelf INT) BEGIN @@ -12461,6 +12611,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myTicket_getRows` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12468,8 +12620,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myTicket_getRows`(vSelf INT) BEGIN @@ -12490,6 +12640,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myTicket_getServices` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12497,8 +12649,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myTicket_getServices`(vSelf INT) BEGIN @@ -12517,6 +12667,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myTicket_list` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12524,8 +12676,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myTicket_list`(vFrom DATE, vTo DATE) BEGIN @@ -12547,7 +12697,7 @@ BEGIN SELECT t.id ticketFk FROM myTicket t WHERE shipped BETWEEN TIMESTAMP(vFrom) AND TIMESTAMP(vTo, '23:59:59'); - + CALL vn.ticketGetTotal(NULL); SELECT v.id, IFNULL(v.landed, v.shipped) landed, @@ -12569,6 +12719,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myTicket_logAccess` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12576,8 +12728,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myTicket_logAccess`(vSelf INT) BEGIN @@ -12597,6 +12747,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myTpvTransaction_end` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12604,8 +12756,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myTpvTransaction_end`( vSelf INT, @@ -12633,6 +12783,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `myTpvTransaction_start` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12640,8 +12792,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myTpvTransaction_start`( vAmount INT, @@ -12660,6 +12810,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_addItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12667,8 +12819,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_addItem`( vSelf INT, @@ -12778,6 +12928,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_calcCatalog` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12785,8 +12937,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_calcCatalog`(vSelf INT) BEGIN @@ -12812,10 +12962,10 @@ BEGIN CREATE TEMPORARY TABLE tmp.item (PRIMARY KEY (itemFk)) ENGINE = MEMORY - SELECT itemFk FROM orderRow + SELECT itemFk FROM orderRow WHERE orderFk = vSelf GROUP BY itemFk; - + CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode); DROP TEMPORARY TABLE tmp.item; @@ -12825,6 +12975,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_calcCatalogFromItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12832,8 +12984,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_calcCatalogFromItem`(vSelf INT, vItem INT) BEGIN @@ -12865,6 +13015,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_calcCatalogFull` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12872,8 +13024,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_calcCatalogFull`(vSelf INT) BEGIN @@ -12914,6 +13064,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_checkConfig` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12921,8 +13073,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_checkConfig`(vSelf INT) BEGIN @@ -12991,6 +13141,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_checkEditable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12998,8 +13150,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_checkEditable`(vSelf INT) BEGIN @@ -13022,6 +13172,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_configure` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13029,8 +13181,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_configure`( vSelf INT, @@ -13091,6 +13241,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_confirm` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13098,8 +13250,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_confirm`(vSelf INT) BEGIN @@ -13117,6 +13267,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_confirmWithUser` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13124,8 +13276,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_confirmWithUser`(vSelf INT, vUserId INT) BEGIN @@ -13149,6 +13299,7 @@ BEGIN DECLARE vSale INT; DECLARE vRate INT; DECLARE vRowId INT; + DECLARE vPriceFixed DECIMAL(10,2); DECLARE vDelivery DATE; DECLARE vAddress INT; DECLARE vIsConfirmed BOOL; @@ -13189,7 +13340,7 @@ BEGIN END; -- Carga los datos del pedido - SELECT o.date_send, o.address_id, o.note, a.clientFk, + SELECT o.date_send, o.address_id, o.note, a.clientFk, o.company_id, o.agency_id, c.isTaxDataChecked INTO vDelivery, vAddress, vNotes, vClientId, vCompanyId, vAgencyModeId, vIsTaxDataChecked @@ -13301,11 +13452,8 @@ BEGIN OPEN cRows; - lRows: - LOOP - + lRows: LOOP SET vDone = FALSE; - FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate, vIsLogifloraItem; IF vDone THEN @@ -13330,34 +13478,39 @@ BEGIN SELECT s.quantity INTO vNewQuantity FROM vn.sale s WHERE id = vSale; - ELSE + -- Obtiene el coste + SELECT SUM(rc.`price`) valueSum INTO vPriceFixed + FROM orderRowComponent rc + JOIN vn.component c ON c.id = rc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase + WHERE rc.rowFk = vRowId; + INSERT INTO vn.sale - SET - itemFk = vItem, - ticketFk = vTicket, - concept = vConcept, - quantity = vAmount, - price = vPrice, - priceFixed = FALSE, - isPriceFixed = TRUE; + SET itemFk = vItem, + ticketFk = vTicket, + concept = vConcept, + quantity = vAmount, + price = vPrice, + priceFixed = vPriceFixed, + isPriceFixed = TRUE; SET vSale = LAST_INSERT_ID(); INSERT INTO vn.saleComponent (saleFk, componentFk, `value`) - SELECT vSale, cm.component_id, cm.price - FROM order_component cm - JOIN vn.component c ON c.id = cm.component_id - WHERE cm.order_row_id = vRowId - GROUP BY vSale, cm.component_id; + SELECT vSale, rc.componentFk, rc.price + FROM orderRowComponent rc + JOIN vn.component c ON c.id = rc.componentFk + WHERE rc.rowFk = vRowId + GROUP BY vSale, rc.componentFk; END IF; + UPDATE order_row SET Id_Movimiento = vSale WHERE id = vRowId; -- Inserta en putOrder si la compra es de Floramondo IF vIsLogifloraItem THEN - CALL cache.availableNoRaids_refresh(vCalc,FALSE,vWarehouse,vShipment); SET @available := 0; @@ -13372,13 +13525,15 @@ BEGIN WHERE item_id = vItem AND calc_id = vCalc; - INSERT INTO edi.putOrder (deliveryInformationID, + INSERT INTO edi.putOrder ( + deliveryInformationID, supplyResponseId, quantity , EndUserPartyId, EndUserPartyGLN, FHAdminNumber, - saleFk) + saleFk + ) SELECT di.ID, i.supplyResponseFk, CEIL((vAmount - @available)/ sr.NumberOfItemsPerCask), @@ -13396,31 +13551,10 @@ BEGIN AND di.LatestOrderDateTime > util.VN_NOW() AND vAmount > @available LIMIT 1; - END IF; - END LOOP; CLOSE cRows; - - -- Fija el coste - DROP TEMPORARY TABLE IF EXISTS tComponents; - CREATE TEMPORARY TABLE tComponents - (INDEX (saleFk)) - ENGINE = MEMORY - SELECT SUM(sc.`value`) valueSum, sc.saleFk - FROM vn.saleComponent sc - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase - JOIN vn.sale s ON s.id = sc.saleFk - WHERE s.ticketFk = vTicket - GROUP BY sc.saleFk; - - UPDATE vn.sale s - JOIN tComponents mc ON mc.saleFk = s.id - SET s.priceFixed = valueSum; - - DROP TEMPORARY TABLE tComponents; END LOOP; CLOSE cDates; @@ -13435,6 +13569,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_doRecalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13442,8 +13578,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_doRecalc`() proc: BEGIN @@ -13501,6 +13635,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_getAvailable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13508,8 +13644,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_getAvailable`(vSelf INT) BEGIN @@ -13527,7 +13661,7 @@ BEGIN INTO vDelivery, vAddress, vAgencyMode FROM `order` WHERE id = vSelf; - + CALL vn.available_calc(vDelivery, vAddress, vAgencyMode); DROP TEMPORARY TABLE IF EXISTS tmp.itemAvailable; @@ -13546,6 +13680,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_getTax` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13553,8 +13689,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_getTax`() READS SQL DATA @@ -13569,7 +13703,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; CREATE TEMPORARY TABLE tmp.addressCompany (INDEX (addressFk, companyFk)) - ENGINE = MEMORY + ENGINE = MEMORY SELECT DISTINCT o.address_id addressFk, o.company_id companyFk FROM tmp.`order` tmpOrder JOIN hedera.`order` o ON o.id = tmpOrder.orderFk; @@ -13604,7 +13738,7 @@ BEGIN JOIN vn.taxClass tc ON tc.id = bp.taxClassFk GROUP BY tmpOrder.orderFk, pgc.`code`, pgc.rate HAVING taxableBase != 0; - + DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount; CREATE TEMPORARY TABLE tmp.orderAmount (INDEX (orderFk)) @@ -13613,7 +13747,7 @@ BEGIN SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax FROM tmp.orderTax GROUP BY orderFk, `code`; - + DROP TEMPORARY TABLE tmp.addressTaxArea; END ;; DELIMITER ; @@ -13621,6 +13755,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_getTotal` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13628,8 +13764,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_getTotal`() BEGIN @@ -13659,6 +13793,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_recalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13666,8 +13802,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_recalc`(vSelf INT) BEGIN @@ -13683,7 +13817,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.`order` ENGINE = MEMORY SELECT vSelf orderFk; - + CALL order_getTax; SELECT IFNULL(SUM(taxableBase), 0.0), IFNULL(SUM(tax), 0.0) @@ -13705,6 +13839,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_requestRecalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13712,8 +13848,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_requestRecalc`(vSelf INT) proc: BEGIN @@ -13733,6 +13867,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `order_update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13740,8 +13876,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_update`(vSelf INT) proc: BEGIN @@ -13774,7 +13908,7 @@ proc: BEGIN FROM orderRow r JOIN orderRowComponent c ON c.rowFk = r.id WHERE r.orderFk = vSelf; - + UPDATE orderRow r LEFT JOIN tmp.ticketComponentPrice p ON p.warehouseFk = r.warehouseFk @@ -13799,7 +13933,7 @@ proc: BEGIN ON t.id = c.componentFk AND (t.classRate IS NULL OR t.classRate = r.rate) WHERE r.orderFk = vSelf; - + CALL vn.ticketCalculatePurge; END IF; @@ -13813,6 +13947,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `survey_vote` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13820,8 +13956,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `survey_vote`(vAnswer INT) BEGIN @@ -13845,6 +13979,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `tpvTransaction_confirm` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13852,8 +13988,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_confirm`( vAmount INT @@ -13970,6 +14104,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `tpvTransaction_confirmAll` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13977,8 +14113,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_confirmAll`(vDate DATE) BEGIN @@ -14021,6 +14155,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `tpvTransaction_confirmById` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -14028,8 +14164,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_confirmById`(vOrder INT) BEGIN @@ -14063,6 +14197,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `tpvTransaction_confirmFromExport` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -14070,8 +14206,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_confirmFromExport`() BEGIN @@ -14129,6 +14263,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `tpvTransaction_end` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -14136,8 +14272,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_end`( vSelf INT, @@ -14163,6 +14297,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `tpvTransaction_start` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -14170,8 +14306,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_start`( vAmount INT, @@ -14247,6 +14381,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `tpvTransaction_undo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -14254,8 +14390,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_undo`(vSelf INT) p: BEGIN @@ -14327,13 +14461,13 @@ p: BEGIN AND DATE(FECHA) = vDate AND EURODEBE = vAmount LIMIT 1; - + -- Actualiza la transaccion UPDATE tpvTransaction SET response = NULL, status = 'started' WHERE id = vSelf; - + COMMIT; END ;; DELIMITER ; @@ -14341,6 +14475,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `visitUser_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -14348,8 +14484,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `visitUser_new`( vAccess INT @@ -14366,7 +14500,7 @@ BEGIN UPDATE userSession SET userVisitFk = vUserVisit WHERE ssid = vSsid; - + DELETE FROM userSession WHERE lastUpdate < TIMESTAMPADD(HOUR, -1, util.VN_NOW()); END ;; @@ -14375,6 +14509,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `visit_listByBrowser` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -14382,8 +14518,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `visit_listByBrowser`(vFrom DATE, vTo DATE) BEGIN @@ -14412,6 +14546,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `visit_register` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -14419,8 +14555,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `visit_register`( vVisit INT @@ -14490,7 +14624,7 @@ BEGIN UPDATE visitAgent SET firstAccessFk = vAccessId WHERE id = vAgentId; END IF; - + -- Returns the visit info SELECT vVisit visit, vAccessId access; @@ -14605,24 +14739,23 @@ DROP TABLE IF EXISTS `cdrConf`; /*!50001 DROP VIEW IF EXISTS `cdrConf`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `cdrConf` ( - `calldate` tinyint NOT NULL, - `clid` tinyint NOT NULL, - `src` tinyint NOT NULL, - `dst` tinyint NOT NULL, - `dcontext` tinyint NOT NULL, - `channel` tinyint NOT NULL, - `dstchannel` tinyint NOT NULL, - `lastapp` tinyint NOT NULL, - `lastdata` tinyint NOT NULL, - `duration` tinyint NOT NULL, - `billsec` tinyint NOT NULL, - `disposition` tinyint NOT NULL, - `amaflags` tinyint NOT NULL, - `accountcode` tinyint NOT NULL, - `uniqueid` tinyint NOT NULL, - `userfield` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `cdrConf` AS SELECT + 1 AS `calldate`, + 1 AS `clid`, + 1 AS `src`, + 1 AS `dst`, + 1 AS `dcontext`, + 1 AS `channel`, + 1 AS `dstchannel`, + 1 AS `lastapp`, + 1 AS `lastdata`, + 1 AS `duration`, + 1 AS `billsec`, + 1 AS `disposition`, + 1 AS `amaflags`, + 1 AS `accountcode`, + 1 AS `uniqueid`, + 1 AS `userfield` */; SET character_set_client = @saved_cs_client; -- @@ -14703,13 +14836,12 @@ DROP TABLE IF EXISTS `followmeConf`; /*!50001 DROP VIEW IF EXISTS `followmeConf`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `followmeConf` ( - `name` tinyint NOT NULL, - `music` tinyint NOT NULL, - `context` tinyint NOT NULL, - `takecall` tinyint NOT NULL, - `declinecall` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `followmeConf` AS SELECT + 1 AS `name`, + 1 AS `music`, + 1 AS `context`, + 1 AS `takecall`, + 1 AS `declinecall` */; SET character_set_client = @saved_cs_client; -- @@ -14738,12 +14870,11 @@ DROP TABLE IF EXISTS `followmeNumberConf`; /*!50001 DROP VIEW IF EXISTS `followmeNumberConf`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `followmeNumberConf` ( - `name` tinyint NOT NULL, - `ordinal` tinyint NOT NULL, - `phonenumber` tinyint NOT NULL, - `timeout` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `followmeNumberConf` AS SELECT + 1 AS `name`, + 1 AS `ordinal`, + 1 AS `phonenumber`, + 1 AS `timeout` */; SET character_set_client = @saved_cs_client; -- @@ -14814,15 +14945,14 @@ DROP TABLE IF EXISTS `queueConf`; /*!50001 DROP VIEW IF EXISTS `queueConf`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `queueConf` ( - `name` tinyint NOT NULL, - `strategy` tinyint NOT NULL, - `timeout` tinyint NOT NULL, - `retry` tinyint NOT NULL, - `weight` tinyint NOT NULL, - `maxlen` tinyint NOT NULL, - `ringinuse` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `queueConf` AS SELECT + 1 AS `name`, + 1 AS `strategy`, + 1 AS `timeout`, + 1 AS `retry`, + 1 AS `weight`, + 1 AS `maxlen`, + 1 AS `ringinuse` */; SET character_set_client = @saved_cs_client; -- @@ -14871,12 +15001,11 @@ DROP TABLE IF EXISTS `queueMemberConf`; /*!50001 DROP VIEW IF EXISTS `queueMemberConf`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `queueMemberConf` ( - `uniqueid` tinyint NOT NULL, - `queue_name` tinyint NOT NULL, - `interface` tinyint NOT NULL, - `paused` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `queueMemberConf` AS SELECT + 1 AS `uniqueid`, + 1 AS `queue_name`, + 1 AS `interface`, + 1 AS `paused` */; SET character_set_client = @saved_cs_client; -- @@ -15072,32 +15201,31 @@ DROP TABLE IF EXISTS `sipConf`; /*!50001 DROP VIEW IF EXISTS `sipConf`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `sipConf` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `callbackextension` tinyint NOT NULL, - `md5secret` tinyint NOT NULL, - `callerid` tinyint NOT NULL, - `host` tinyint NOT NULL, - `deny` tinyint NOT NULL, - `permit` tinyint NOT NULL, - `type` tinyint NOT NULL, - `context` tinyint NOT NULL, - `incominglimit` tinyint NOT NULL, - `pickupgroup` tinyint NOT NULL, - `careinvite` tinyint NOT NULL, - `insecure` tinyint NOT NULL, - `transport` tinyint NOT NULL, - `nat` tinyint NOT NULL, - `ipaddr` tinyint NOT NULL, - `regseconds` tinyint NOT NULL, - `port` tinyint NOT NULL, - `defaultuser` tinyint NOT NULL, - `useragent` tinyint NOT NULL, - `lastms` tinyint NOT NULL, - `fullcontact` tinyint NOT NULL, - `regserver` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `sipConf` AS SELECT + 1 AS `id`, + 1 AS `name`, + 1 AS `callbackextension`, + 1 AS `md5secret`, + 1 AS `callerid`, + 1 AS `host`, + 1 AS `deny`, + 1 AS `permit`, + 1 AS `type`, + 1 AS `context`, + 1 AS `incominglimit`, + 1 AS `pickupgroup`, + 1 AS `careinvite`, + 1 AS `insecure`, + 1 AS `transport`, + 1 AS `nat`, + 1 AS `ipaddr`, + 1 AS `regseconds`, + 1 AS `port`, + 1 AS `defaultuser`, + 1 AS `useragent`, + 1 AS `lastms`, + 1 AS `fullcontact`, + 1 AS `regserver` */; SET character_set_client = @saved_cs_client; -- @@ -15161,6 +15289,8 @@ CREATE TABLE `sipReg` ( -- -- Dumping routines for database 'pbx' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `clientFromPhone` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -15168,8 +15298,6 @@ CREATE TABLE `sipReg` ( /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `clientFromPhone`(vPhone VARCHAR(255)) RETURNS int(11) DETERMINISTIC @@ -15184,6 +15312,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `phone_format` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -15191,8 +15321,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `phone_format`(vPhone VARCHAR(255)) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC @@ -15205,7 +15333,7 @@ BEGIN WHILE vI < vLen DO SET vChr = SUBSTR(vPhone, vI + 1, 1); - + IF vChr REGEXP '^[0-9]$' THEN SET vNewPhone = CONCAT(vNewPhone, vChr); @@ -15213,7 +15341,7 @@ BEGIN THEN SET vNewPhone = CONCAT(vNewPhone, '00'); END IF; - + SET vI = vI + 1; END WHILE; @@ -15232,6 +15360,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `phone_isValid` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -15239,8 +15369,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `phone_isValid`(vPhone VARCHAR(255)) BEGIN @@ -15267,6 +15395,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `queue_isValid` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -15274,8 +15404,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `queue_isValid`(vQueue VARCHAR(255)) BEGIN @@ -15300,6 +15428,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sip_getExtension` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -15307,29 +15437,29 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sip_getExtension`(vUserId INT(10)) BEGIN - + /* * Devuelve la extensión pbx del usuario - * - * @param vUserId Id del usuario - * + * + * @param vUserId Id del usuario + * */ SELECT extension - FROM sip s + FROM sip s WHERE s.user_id = vUserId; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sip_isValid` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -15337,8 +15467,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sip_isValid`(vExtension VARCHAR(255)) BEGIN @@ -15364,6 +15492,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sip_setPassword` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -15371,8 +15501,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sip_setPassword`( vUser VARCHAR(255), @@ -15389,141 +15517,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Current Database: `postgresql` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `postgresql` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; - -USE `postgresql`; - --- --- Table structure for table `incometype_employee__` --- - -DROP TABLE IF EXISTS `incometype_employee__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `incometype_employee__` ( - `id_incometype` int(11) NOT NULL, - `descripcion` varchar(255) DEFAULT NULL, - `nomina` smallint(6) DEFAULT 0, - `isExtraSalarial` tinyint(4) NOT NULL DEFAULT 0, - PRIMARY KEY (`id_incometype`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='@deprecated 2023-03-15'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `labour_agreement` --- - -DROP TABLE IF EXISTS `labour_agreement`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `labour_agreement` ( - `labour_agreement_id` int(11) NOT NULL AUTO_INCREMENT, - `month_hollidays` double DEFAULT NULL, - `year_hours` int(11) DEFAULT NULL, - `name` char(50) DEFAULT NULL, - `date_START` date DEFAULT NULL, - `date_END` date DEFAULT NULL, - PRIMARY KEY (`labour_agreement_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `media__` --- - -DROP TABLE IF EXISTS `media__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `media__` ( - `media_id` int(11) NOT NULL AUTO_INCREMENT, - `media_type_id` int(11) NOT NULL, - `value` varchar(55) NOT NULL, - `sort` int(11) DEFAULT NULL, - PRIMARY KEY (`media_id`), - KEY `media_media_type_id_idx` (`media_type_id`), - CONSTRAINT `media___ibfk_1` FOREIGN KEY (`media_type_id`) REFERENCES `media_type` (`media_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='@deprecated 2023-03-31'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `media_type` --- - -DROP TABLE IF EXISTS `media_type`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `media_type` ( - `media_type_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(15) NOT NULL, - PRIMARY KEY (`media_type_id`), - UNIQUE KEY `media_type_name_key` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `professional_category__` --- - -DROP TABLE IF EXISTS `professional_category__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `professional_category__` ( - `professional_category_id` int(11) NOT NULL AUTO_INCREMENT, - `category_name` varchar(50) NOT NULL, - `professional_levels_id` int(11) DEFAULT NULL, - `fichajes` tinyint(4) NOT NULL DEFAULT 1, - `holiday_days` decimal(3,1) DEFAULT NULL, - `dayBreak` int(11) DEFAULT NULL, - PRIMARY KEY (`professional_category_id`), - UNIQUE KEY `professional_category_name_category_key` (`category_name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='@deprecated 2023-03-24'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `profile_address` --- - -DROP TABLE IF EXISTS `profile_address`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `profile_address` ( - `profile_address_id` int(11) NOT NULL AUTO_INCREMENT, - `profile_id` int(11) NOT NULL, - `address_id` int(11) NOT NULL, - PRIMARY KEY (`profile_address_id`), - KEY `profile_address_address_id_idx` (`address_id`), - KEY `profile_address_profile_id_idx` (`profile_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `province__` --- - -DROP TABLE IF EXISTS `province__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `province__` ( - `province_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(15) NOT NULL, - `nation_id` int(11) NOT NULL, - PRIMARY KEY (`province_id`), - UNIQUE KEY `province_name_key` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='@deprecated 2023-03-21'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping events for database 'postgresql' --- - --- --- Dumping routines for database 'postgresql' --- - -- -- Current Database: `sage` -- @@ -15692,10 +15685,9 @@ DROP TABLE IF EXISTS `clientLastTwoMonths`; /*!50001 DROP VIEW IF EXISTS `clientLastTwoMonths`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `clientLastTwoMonths` ( - `clientFk` tinyint NOT NULL, - `companyFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `clientLastTwoMonths` AS SELECT + 1 AS `clientFk`, + 1 AS `companyFk` */; SET character_set_client = @saved_cs_client; -- @@ -15840,6 +15832,10 @@ DROP TABLE IF EXISTS `config`; CREATE TABLE `config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `pendingTaxAccount` varchar(100) DEFAULT NULL COMMENT 'Cuenta contable IVA pendiente', + `nontaxableTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Operaciones exentas', + `pendingServiceTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Import. bienes y serv. corrientes pdte. liquidar', + `definitiveExportTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Exportaciones definitivas', + `shipmentTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Envíos definitivos a Canarias, Ceuta y Melilla', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -16201,10 +16197,9 @@ DROP TABLE IF EXISTS `supplierLastThreeMonths`; /*!50001 DROP VIEW IF EXISTS `supplierLastThreeMonths`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `supplierLastThreeMonths` ( - `supplierFk` tinyint NOT NULL, - `companyFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `supplierLastThreeMonths` AS SELECT + 1 AS `supplierFk`, + 1 AS `companyFk` */; SET character_set_client = @saved_cs_client; -- @@ -16230,6 +16225,8 @@ CREATE TABLE `taxType` ( -- -- Dumping routines for database 'sage' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `company_getCode` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -16237,29 +16234,27 @@ CREATE TABLE `taxType` ( /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `company_getCode`(vCompanyFk INT) RETURNS int(2) READS SQL DATA BEGIN /** - * Devuelve la correspondencía del código de empresa de sage. + * Devuelve la correspondencía del código de empresa de sage. * Tiene en cuenta el entorno - * + * * @param vSelf Id de empresa de verdnatura * @return Código de empresa sage */ DECLARE vCompanySageFk INT(2); - - SELECT IF(c.environment = 'production', - co.companyCode, + + SELECT IF(c.environment = 'production', + co.companyCode, co.companyCodeTest ) INTO vCompanySageFk FROM util.config c JOIN vn.company co WHERE co.id = vCompanyFk; - + RETURN vCompanySageFk; END ;; DELIMITER ; @@ -16267,6 +16262,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `accountingMovements_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -16274,16 +16271,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `accountingMovements_add`( - vYear INT, + vYear INT, vCompanyFk INT ) BEGIN /** - * Traslada la info de contabilidad generada en base a vn.XDiario a la tabla sage.movConta + * Traslada la info de contabilidad generada en base a vn.XDiario a la tabla sage.movConta * para poder ejecutar posteriormente el proceso de importación de datos de SQL Server * Solo traladará los asientos marcados con el campo vn.XDiario.enlazadoSage = FALSE * @vYear Año contable del que se quiere trasladar la información @@ -16310,9 +16305,8 @@ BEGIN FROM Naciones WHERE Nacion ='CEUTA Y MELILLA'; - SELECT CodigoTransaccion INTO vDuaTransactionFk - FROM TiposTransacciones - WHERE Transaccion = 'Import. bienes y serv. corrientes pdte. liquidar'; + SELECT pendingServiceTransactionTypeFk INTO vDuaTransactionFk + FROM config; SELECT id INTO vTaxImportFk FROM taxType @@ -16326,13 +16320,11 @@ BEGIN FROM taxType WHERE code = 'import4'; - SELECT CodigoTransaccion INTO vTransactionExportFk - FROM TiposTransacciones - WHERE Transaccion = 'Exportaciones definitivas'; + SELECT definitiveExportTransactionTypeFk INTO vTransactionExportFk + FROM config; - SELECT CodigoTransaccion INTO vTransactionExportTaxFreeFk - FROM TiposTransacciones - WHERE Transaccion = 'Envíos definitivos a Canarias, Ceuta y Melilla'; + SELECT shipmentTransactionTypeFk INTO vTransactionExportTaxFreeFk + FROM config; SELECT codeSage INTO vInvoiceTypeInformativeCode FROM invoiceType WHERE code ='informative'; @@ -16602,8 +16594,8 @@ BEGIN mci.FechaFacturaOriginal = x.FECHA_EX, mci.SuFacturaNo = x.FACTURAEX, mci.FechaOperacion = x.FECHA_OP, - mci.ImporteFactura = mci.ImporteFactura + - x.BASEEURO + + mci.ImporteFactura = mci.ImporteFactura + + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) WHERE pm.description = 'HP Iva pendiente' AND mci.enlazadoSage = FALSE @@ -16622,7 +16614,7 @@ BEGIN mci.CodigoIva2 = vTaxImportFk, mci.IvaDeducible2 = TRUE, mci.ImporteFactura = mci.ImporteFactura + - x.BASEEURO + + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) WHERE pm.description = 'HP Iva pendiente' AND mci.enlazadoSage = FALSE @@ -16640,8 +16632,8 @@ BEGIN mci.CodigoTransaccion3 = vDuaTransactionFk , mci.CodigoIva3 = vTaxImportSuperReducedFk, mci.IvaDeducible3 = TRUE, - mci.ImporteFactura = mci.ImporteFactura + - x.BASEEURO + + mci.ImporteFactura = mci.ImporteFactura + + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) WHERE pm.description = 'HP Iva pendiente' AND mci.enlazadoSage = FALSE @@ -16675,14 +16667,14 @@ BEGIN OR CodigoTransaccion2 = vTransactionExportFk OR CodigoTransaccion3 = vTransactionExportFk OR CodigoTransaccion4 = vTransactionExportFk) - AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8mb3_unicode_ci, + AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8mb3_unicode_ci, vCountryCeutaMelillaCode COLLATE utf8mb3_unicode_ci); UPDATE movConta mc SET CodigoDivisa = 'USD', FactorCambio = TRUE, - ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio = 0, - ImporteAsiento / ImporteDivisa, + ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio = 0, + ImporteAsiento / ImporteDivisa, ImporteCambio) AS DECIMAL( 10, 2))) WHERE enlazadoSage = FALSE AND (ImporteCambio <> 0 OR ImporteDivisa <> 0 OR FactorCambio); @@ -16724,8 +16716,8 @@ BEGIN AND sub.amountTaxableBase/2 <> sub2.amountTaxableBase) sub; IF vBookEntries IS NOT NULL THEN - SELECT util.notification_send ("book-entries-imported-incorrectly", - CONCAT('{"bookEntries":"', vBookEntries,'"}'), + SELECT util.notification_send ("book-entries-imported-incorrectly", + CONCAT('{"bookEntries":"', vBookEntries,'"}'), null); END IF; END ;; @@ -16734,6 +16726,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clientSupplier_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -16741,8 +16735,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientSupplier_add`(vCompanyFk INT) BEGIN @@ -16806,8 +16798,8 @@ BEGIN IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla := IF(pr.Provincia IN ('CEUTA', 'MELILLA'), TRUE, FALSE), vCountryCeutaMelillaFk, IF (@isCanarias, vCountryCanariasCode, n.CodigoNacion)), n.CodigoNacion), IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla, vCountryCeutaMelillaCode, IF (@isCanarias, vCountryCanariasCode, n.SiglaNacion)), n.SiglaNacion), IF((c.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F'), - IF(cu.code = 'ES', - 1, + IF(cu.code = 'ES', + 1, IF((cu.isUeeMember AND c.isVies), 2, 4)), IFNULL(c.taxTypeSageFk,0), IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, @@ -16871,6 +16863,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceIn_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -16878,17 +16872,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_add`(vInvoiceInFk INT, vXDiarioFk INT) BEGIN /** * Traslada la info de contabilidad relacionada con las facturas recibidas - * + * * @vInvoiceInFk Factura recibida * @vXDiarioFk Id tabla XDiario - */ + */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vBase DOUBLE; DECLARE vVat DOUBLE; @@ -16905,25 +16897,25 @@ BEGIN DECLARE vInvoiceTypeInformative VARCHAR(1); DECLARE vIsInformativeExportation BOOL DEFAULT FALSE; - DECLARE vCursor CURSOR FOR + DECLARE vCursor CURSOR FOR SELECT it.taxableBase, CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)), t.PorcentajeIva, it.transactionTypeSageFk, it.taxTypeSageFk, tty.isIntracommunity, - tt.ClaveOperacionDefecto + tt.ClaveOperacionDefecto FROM vn.invoiceIn i JOIN vn.invoiceInTax it ON it.InvoiceInFk = i.id JOIN TiposIva t ON t.CodigoIva = it.taxTypeSageFk JOIN taxType tty ON tty.id = t.CodigoIva JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk LEFT JOIN vn.dua d ON d.id = vInvoiceInFk - WHERE i.id = vInvoiceInFk + WHERE i.id = vInvoiceInFk AND d.id IS NULL; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + DELETE FROM movContaIVA WHERE id = vXDiarioFk; @@ -16946,22 +16938,22 @@ BEGIN vTaxCode, vIsIntracommunity, vOperationCode; - - IF vDone THEN + + IF vDone THEN LEAVE l; END IF; - SET vTransactionCodeOld = vTransactionCode; - SET vTaxCodeOld = vTaxCode; + SET vTransactionCodeOld = vTransactionCode; + SET vTaxCodeOld = vTaxCode; - IF vOperationCode IS NOT NULL THEN + IF vOperationCode IS NOT NULL THEN UPDATE movContaIVA SET ClaveOperacionFactura = vOperationCode WHERE id = vXDiarioFk; END IF; - + SET vCounter = vCounter + 1; - CASE vCounter + CASE vCounter WHEN 1 THEN UPDATE movContaIVA SET BaseIva1 = vBase, @@ -16997,31 +16989,31 @@ BEGIN WHERE id = vXDiarioFk; ELSE SELECT vXDiarioFk INTO vXDiarioFk; - END CASE; + END CASE; IF vIsIntracommunity THEN UPDATE movContaIVA SET Intracomunitaria = TRUE WHERE id = vXDiarioFk; END IF; - - SET vTransactionCodeOld = vTransactionCode; - SET vTaxCodeOld = vTaxCode; - + + SET vTransactionCodeOld = vTransactionCode; + SET vTaxCodeOld = vTaxCode; + END LOOP; CLOSE vCursor; SELECT d.ASIEN AND x.ASIEN IS NULL INTO vIsInformativeExportation FROM vn.dua d - LEFT JOIN vn.XDiario x ON x.ASIEN = d.ASIEN + LEFT JOIN vn.XDiario x ON x.ASIEN = d.ASIEN AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci WHERE d.ASIEN = ( SELECT ASIEN - FROM vn.XDiario + FROM vn.XDiario WHERE id = vXDiarioFk) LIMIT 1; - + UPDATE movContaIVA mci JOIN tmp.invoiceIn ii ON ii.id = vInvoiceInFk JOIN vn.XDiario x ON x.id = mci.id @@ -17033,13 +17025,13 @@ BEGIN mci.Serie = ii.serial, mci.Factura = ii.id, mci.FechaFactura = ii.issued, - mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) + - IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) + - IFNULL(mci.BaseIva3, 0) + IFNULL(mci.CuotaIva3, 0) + + mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) + + IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) + + IFNULL(mci.BaseIva3, 0) + IFNULL(mci.CuotaIva3, 0) + IFNULL(mci.BaseIva4, 0) + IFNULL(mci.CuotaIva4, 0), - mci.TipoFactura = IF(id.id, - IF( ii.serial = vSerialDua COLLATE utf8mb3_unicode_ci, vInvoiceTypeReceived, vInvoiceTypeInformative), - IF(vIsInformativeExportation,vInvoiceTypeInformative, vInvoiceTypeReceived)), + mci.TipoFactura = IF(id.id, + IF( ii.serial = vSerialDua COLLATE utf8mb3_unicode_ci, vInvoiceTypeReceived, vInvoiceTypeInformative), + IF(vIsInformativeExportation,vInvoiceTypeInformative, vInvoiceTypeReceived)), mci.CodigoCuentaFactura = x.SUBCTA, mci.CifDni = IF(LEFT(TRIM(s.nif), 2) = n.SiglaNacion, SUBSTRING(TRIM(s.nif), 3), s.nif), mci.Nombre = s.name, @@ -17067,7 +17059,7 @@ BEGIN JOIN (SELECT SUM(x2.BASEEURO) taxableBase, SUM(x2.EURODEBE) taxBase FROM vn.XDiario x1 JOIN vn.XDiario x2 ON x1.ASIEN = x2.ASIEN - WHERE x2.BASEEURO <> 0 + WHERE x2.BASEEURO <> 0 AND x1.id = vXDiarioFk )sub JOIN ClavesOperacion co ON co.Descripcion = 'Arrendamiento de locales de negocio' @@ -17075,8 +17067,8 @@ BEGIN mci.ClaveOperacionFactura = IF( t.Retencion = 'ARRENDAMIENTO Y SUBARRENDAMIENTO', co.ClaveOperacionFactura_, mci.ClaveOperacionFactura), mci.BaseRetencion = IF (t.Retencion = 'ACTIVIDADES AGRICOLAS O GANADERAS', sub.taxableBase + sub.taxBase, sub.taxableBase), mci.PorRetencion = t.PorcentajeRetencion, - mci.ImporteRetencion = iit.taxableBase * - 1 - WHERE mci.id = vXDiarioFk + mci.ImporteRetencion = iit.taxableBase * - 1 + WHERE mci.id = vXDiarioFk AND e.name = 'Retenciones' AND id.id IS NULL; @@ -17086,6 +17078,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceIn_manager` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -17093,16 +17087,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_manager`(vYear INT, vCompanyFk INT) BEGIN /** - * Traslada la info de contabilidad relacionada con las facturas recibidas - * + * Traslada la info de contabilidad relacionada con las facturas recibidas + * * @vYear Año contable del que se quiere trasladar la información - * @vCompany Empresa de la que se quiere trasladar datos + * @vCompany Empresa de la que se quiere trasladar datos */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceFk INT; @@ -17114,22 +17106,22 @@ BEGIN DECLARE vAccountTaxOutstanding VARCHAR(10); DECLARE vInvoiceTypeSended VARCHAR(1); DECLARE vCursor CURSOR FOR - SELECT IFNULL(x.CLAVE, x.FACTURA) invoiceInFk, + SELECT IFNULL(x.CLAVE, x.FACTURA) invoiceInFk, x.id XDiarioFk - FROM vn.XDiario x + FROM vn.XDiario x JOIN(SELECT DISTINCT(x.ASIEN) FROM vn.XDiario x LEFT JOIN vn.invoiceIn ii ON x.CLAVE = ii.id LEFT JOIN vn.invoiceInTax it ON it.invoiceInFk = ii.id - WHERE(it.taxTypeSageFk IS NOT NULL OR x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci) - AND x.enlazadoSage = FALSE + WHERE(it.taxTypeSageFk IS NOT NULL OR x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci) + AND x.enlazadoSage = FALSE AND x.FECHA BETWEEN vDatedFrom AND vDatedTo - AND x.empresa_id = vCompanyFk + AND x.empresa_id = vCompanyFk ) sub ON sub.ASIEN = x.ASIEN WHERE x.CLAVE IS NOT NULL; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SELECT CAST(CONCAT(vYear, '-01-01') AS DATETIME), util.dayEnd(CAST(CONCAT(vYear, '-12-31') AS DATE)) INTO vDatedFrom, vDatedTo; @@ -17143,15 +17135,15 @@ BEGIN SELECT codeSage INTO vInvoiceTypeSended FROM invoiceType WHERE `code` ='sended'; - + DROP TEMPORARY TABLE IF EXISTS tmp.invoiceDua; CREATE TEMPORARY TABLE tmp.invoiceDua - SELECT x.id + SELECT x.id FROM vn.XDiario x JOIN vn.company c ON c.id = x.empresa_id JOIN (SELECT ASIEN - FROM vn.XDiario x - WHERE x.enlazadoSage = FALSE + FROM vn.XDiario x + WHERE x.enlazadoSage = FALSE AND x.SUBCTA = vAccountTaxOutstanding COLLATE utf8mb3_unicode_ci AND x.FECHA BETWEEN vDatedFrom AND vDatedTo )sub ON sub.ASIEN = x.ASIEN @@ -17169,7 +17161,7 @@ BEGIN FROM vn.invoiceIn i JOIN vn.currency c ON c.id = i.currencyFk WHERE i.bookEntried BETWEEN vDatedFrom AND vDatedTo - UNION ALL + UNION ALL SELECT d.id, d.code, vSerialDua COLLATE utf8mb3_unicode_ci, @@ -17177,8 +17169,8 @@ BEGIN d.issued, FALSE, '' -- EUROS - FROM vn.dua d - WHERE d.issued IS NOT NULL + FROM vn.dua d + WHERE d.issued IS NOT NULL AND code IS NOT NULL; OPEN vCursor; @@ -17186,7 +17178,7 @@ BEGIN l: LOOP FETCH vCursor INTO vInvoiceFk, vXDiarioFk; - IF vDone THEN + IF vDone THEN LEAVE l; END IF; CALL invoiceIn_add(vInvoiceFk, vXDiarioFk); @@ -17274,21 +17266,21 @@ BEGIN JOIN (SELECT x.ASIEN, x.id FROM vn.XDiario x JOIN(SELECT DISTINCT(x.ASIEN) ASIEN - FROM vn.XDiario x + FROM vn.XDiario x JOIN (SELECT DISTINCT(ASIEN) FROM vn.XDiario x - WHERE SUBCTA LIKE '472%' + WHERE SUBCTA LIKE '472%' AND x.enlazadoSage = FALSE AND x.empresa_id = vCompanyFk AND x.FECHA BETWEEN vDatedFrom AND vDatedTo ) sub ON sub.ASIEN = x.ASIEN WHERE x.SUBCTA LIKE '477%' )sub2 ON sub2.ASIEN = x.ASIEN - WHERE x.CONTRA IS NOT NULL + WHERE x.CONTRA IS NOT NULL AND x.SUBCTA LIKE '477%' GROUP BY x.ASIEN )sub3 ON sub3.ASIEN = x.ASIEN; - + INSERT INTO movContaIVA (`id`, `CodigoDivisa`, @@ -17359,9 +17351,9 @@ BEGIN `FechaGrabacion`, `Intracomunitaria`, `moveData`) - SELECT * + SELECT * FROM tmp.movContaIVA; - + DROP TEMPORARY TABLE tmp.movContaIVA; END ;; @@ -17370,6 +17362,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOut_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -17377,16 +17371,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_add`(IN vInvoiceOutFk INT, IN vXDiarioFk INT) BEGIN /** - * Traslada la info de contabilidad relacionada con las facturas emitidas - * + * Traslada la info de contabilidad relacionada con las facturas emitidas + * * @vYear Año contable del que se quiere trasladar la información - * @vCompany Empresa de la que se quiere trasladar datos + * @vCompany Empresa de la que se quiere trasladar datos */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vMaxLengthName INT DEFAULT 35; @@ -17406,12 +17398,12 @@ BEGIN DECLARE vHasCustomsAccountingNote BOOL; DECLARE vCursor CURSOR FOR - SELECT oit.taxableBase, - oit.vat, - pgc.rate, - pgc.mod347, - pgcRE.rate, - oitRE.vat, + SELECT oit.taxableBase, + oit.vat, + pgc.rate, + pgc.mod347, + pgcRE.rate, + oitRE.vat, tc.transactionCode, tc.taxCode, tc.isIntracommunity, @@ -17420,7 +17412,7 @@ BEGIN JOIN vn.pgc ON pgc.code = oit.pgcFk LEFT JOIN vn.pgcEqu e ON e.vatFk = oit.pgcFk LEFT JOIN vn.pgcEqu eRE ON eRE.equFk = oit.pgcFk - LEFT JOIN vn.invoiceOutTax oitRE ON oitRE.invoiceOutFk = oit.invoiceOutFk + LEFT JOIN vn.invoiceOutTax oitRE ON oitRE.invoiceOutFk = oit.invoiceOutFk AND oitRE.pgcFk = e.equFk LEFT JOIN vn.pgc pgcRE ON pgcRE.code = oitRE.pgcFk LEFT JOIN vn.taxCode tc ON tc.code = pgc.code COLLATE 'utf8mb3_unicode_ci' @@ -17436,12 +17428,12 @@ BEGIN WHERE ASIEN = (SELECT ASIEN FROM vn.XDiario WHERE id = vXDiarioFk); SELECT codeSage INTO vInvoiceTypeSended - FROM invoiceType + FROM invoiceType WHERE code = IF(vHasCustomsAccountingNote, 'informative', 'sended'); - + DELETE FROM movContaIVA WHERE id = vXDiarioFk; - + INSERT INTO movContaIVA(id) VALUES (vXDiarioFk); OPEN vCursor; @@ -17458,13 +17450,13 @@ BEGIN vIsIntracommunity, vOperationCode; - IF vDone THEN + IF vDone THEN LEAVE l; END IF; SET vCounter = vCounter + 1; - - CASE vCounter + + CASE vCounter WHEN 1 THEN UPDATE movContaIVA SET BaseIva1 = vBase, @@ -17505,7 +17497,7 @@ BEGIN CodigoTransaccion4 = vTransactionCode, CodigoIva4 = vTaxCode WHERE id = vXDiarioFk; - END CASE; + END CASE; UPDATE movContaIVA SET Exclusion347 = NOT vMod347, @@ -17516,7 +17508,7 @@ BEGIN END LOOP; CLOSE vCursor; - + UPDATE movContaIVA mci JOIN vn.invoiceOut i ON i.id = vInvoiceOutFk LEFT JOIN vn.invoiceCorrection ic ON ic.correctedFk = vInvoiceOutFk @@ -17541,25 +17533,25 @@ BEGIN mci.MantenerAsiento = TRUE, mci.FechaFacturaOriginal = x.FECHA_EX WHERE mci.id = vXDiarioFk; - + SELECT correctedFk INTO vInvoiceOutCorrectedFk FROM vn.invoiceCorrection WHERE correctingFk = vInvoiceOutFk; - - IF vInvoiceOutCorrectedFk THEN + + IF vInvoiceOutCorrectedFk THEN UPDATE movContaIVA mci JOIN vn.invoiceOut i ON i.id = vInvoiceOutCorrectedFk JOIN vn.invoiceCorrection ic ON ic.correctedFk = vInvoiceOutCorrectedFk - JOIN (SELECT SUM(IF(IFNULL(e.vatFk, TRUE), iot.taxableBase, 0)) taxableBase, + JOIN (SELECT SUM(IF(IFNULL(e.vatFk, TRUE), iot.taxableBase, 0)) taxableBase, SUM(IF(IFNULL(e.vatFk, TRUE), iot.vat, 0)) vat, SUM(IF(IFNULL(e.vatFk, TRUE), 0, iot.vat)) equ FROM vn.invoiceOutTax iot - LEFT JOIN vn.pgcEqu e ON e.vatFk = iot.pgcFk + LEFT JOIN vn.pgcEqu e ON e.vatFk = iot.pgcFk WHERE iot.invoiceOutFk = vInvoiceOutCorrectedFk ) tax JOIN ClavesOperacion co ON co.Descripcion = 'Factura rectificativa' SET mci.TipoRectificativa = 2, - mci.ClaseAbonoRectificativas = 1, + mci.ClaseAbonoRectificativas = 1, mci.FechaFacturaOriginal = i.issued, mci.FechaOperacion = i.issued, mci.BaseImponibleOriginal = tax.taxableBase, @@ -17577,6 +17569,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOut_manager` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -17584,16 +17578,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_manager`(vYear INT, vCompanyFk INT) BEGIN /** - * Traslada la info de contabilidad relacionada con las facturas emitidas - * + * Traslada la info de contabilidad relacionada con las facturas emitidas + * * @vYear Año contable del que se quiere trasladar la información - * @vCompany Empresa de la que se quiere trasladar datos + * @vCompany Empresa de la que se quiere trasladar datos */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceFk INT; @@ -17610,7 +17602,7 @@ BEGIN JOIN (SELECT x.ASIEN, CONCAT(x.SERIE, x.FACTURA) refFk FROM vn.XDiario x WHERE x.enlazadoSage = FALSE - AND x.FACTURA + AND x.FACTURA AND x.empresa_id = vCompanyFk AND x.FECHA BETWEEN vDatedFrom AND vDatedTo GROUP BY refFk @@ -17619,19 +17611,19 @@ BEGIN )sub2 ON sub2.refFk = i.ref; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SELECT CAST(CONCAT(vYear, '-01-01') AS DATETIME), util.dayEnd(CAST(CONCAT(vYear, '-12-31') AS DATE)) INTO vDatedFrom, vDatedTo; - + OPEN vCursor; l: LOOP FETCH vCursor INTO vInvoiceFk, vXDiarioFk; - IF vDone THEN + IF vDone THEN LEAVE l; END IF; - + CALL invoiceOut_add(vInvoiceFk, vXDiarioFk); END LOOP; @@ -17644,6 +17636,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `pgc_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -17651,13 +17645,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `pgc_add`(vCompanyFk INT) BEGIN /** - * Añade cuentas del plan general contable para exportarlos a Sage + * Añade cuentas del plan general contable para exportarlos a Sage * @vCompanyFk Empresa de la que se quiere trasladar datos */ TRUNCATE TABLE planCuentasPGC; @@ -17667,25 +17659,25 @@ BEGIN CodigoCuenta, Cuenta, ClienteOProveedor) - SELECT * + SELECT * FROM (SELECT company_getCode(vCompanyFk) companyFk, e.id accountFk, UCASE(e.name), '' FROM vn.expence e - UNION + UNION SELECT company_getCode(vCompanyFk), - b.account, + b.account, UCASE(b.bank), - '' + '' FROM vn.bank b WHERE b.isActive AND b.`account` - UNION + UNION SELECT CodigoEmpresa, CodigoCuenta, Nombre, - ClienteOProveedor + ClienteOProveedor FROM clientesProveedores)sub GROUP BY companyFk, accountFk; END ;; @@ -17752,16 +17744,15 @@ DROP TABLE IF EXISTS `Account`; /*!50001 DROP VIEW IF EXISTS `Account`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `Account` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `password` tinyint NOT NULL, - `roleFk` tinyint NOT NULL, - `active` tinyint NOT NULL, - `email` tinyint NOT NULL, - `created` tinyint NOT NULL, - `updated` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `Account` AS SELECT + 1 AS `id`, + 1 AS `name`, + 1 AS `password`, + 1 AS `roleFk`, + 1 AS `active`, + 1 AS `email`, + 1 AS `created`, + 1 AS `updated` */; SET character_set_client = @saved_cs_client; -- @@ -17772,13 +17763,12 @@ DROP TABLE IF EXISTS `Role`; /*!50001 DROP VIEW IF EXISTS `Role`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `Role` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `description` tinyint NOT NULL, - `created` tinyint NOT NULL, - `modified` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `Role` AS SELECT + 1 AS `id`, + 1 AS `name`, + 1 AS `description`, + 1 AS `created`, + 1 AS `modified` */; SET character_set_client = @saved_cs_client; -- @@ -17789,12 +17779,11 @@ DROP TABLE IF EXISTS `RoleMapping`; /*!50001 DROP VIEW IF EXISTS `RoleMapping`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `RoleMapping` ( - `id` tinyint NOT NULL, - `principalType` tinyint NOT NULL, - `principalId` tinyint NOT NULL, - `roleId` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `RoleMapping` AS SELECT + 1 AS `id`, + 1 AS `principalType`, + 1 AS `principalId`, + 1 AS `roleId` */; SET character_set_client = @saved_cs_client; -- @@ -17805,17 +17794,49 @@ DROP TABLE IF EXISTS `User`; /*!50001 DROP VIEW IF EXISTS `User`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `User` ( - `id` tinyint NOT NULL, - `realm` tinyint NOT NULL, - `username` tinyint NOT NULL, - `password` tinyint NOT NULL, - `email` tinyint NOT NULL, - `emailVerified` tinyint NOT NULL, - `verificationToken` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `User` AS SELECT + 1 AS `id`, + 1 AS `realm`, + 1 AS `username`, + 1 AS `password`, + 1 AS `email`, + 1 AS `emailVerified`, + 1 AS `verificationToken` */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `accessTokenConfig` +-- + +DROP TABLE IF EXISTS `accessTokenConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accessTokenConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `renewPeriod` int(10) unsigned DEFAULT NULL, + `courtesyTime` int(10) unsigned DEFAULT NULL, + `renewInterval` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `authCode` +-- + +DROP TABLE IF EXISTS `authCode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `authCode` ( + `userFk` int(10) unsigned NOT NULL, + `code` int(11) NOT NULL, + `expires` bigint(20) NOT NULL, + PRIMARY KEY (`userFk`), + UNIQUE KEY `authCode_unique` (`code`), + CONSTRAINT `authCode_user_id_fk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `defaultViewConfig` -- @@ -17915,9 +17936,9 @@ DELIMITER ;; /*!50003 SET @saved_cs_client = @@character_set_client */ ;; /*!50003 SET @saved_cs_results = @@character_set_results */ ;; /*!50003 SET @saved_col_connection = @@collation_connection */ ;; -/*!50003 SET character_set_client = utf8mb4 */ ;; -/*!50003 SET character_set_results = utf8mb4 */ ;; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; +/*!50003 SET character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; @@ -17934,6 +17955,8 @@ DELIMITER ; -- -- Dumping routines for database 'salix' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `accessToken_prune` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -17941,8 +17964,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `accessToken_prune`() BEGIN @@ -18005,7 +18026,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.isPicked = NEW.isPicked OR NEW.dated < util.VN_CURDATE(); - + CALL visible_log( NEW.isPicked, NEW.warehouseFk, @@ -18129,7 +18150,7 @@ DELIMITER ;; BEGIN SET NEW.lack = NEW.quantity; SET NEW.isPicked = NEW.isPicked OR NEW.dated < util.VN_CURDATE(); - + CALL visible_log( NEW.isPicked, NEW.warehouseFk, @@ -18238,6 +18259,8 @@ DELIMITER ; -- -- Dumping routines for database 'stock' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `inbound_addPick` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18245,8 +18268,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inbound_addPick`( vSelf INT, @@ -18267,6 +18288,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `inbound_removePick` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18274,8 +18297,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inbound_removePick`( vSelf INT, @@ -18300,6 +18321,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `inbound_requestQuantity` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18307,8 +18330,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inbound_requestQuantity`( vSelf INT, @@ -18340,7 +18361,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SET vSupplied = 0; OPEN vPicks; @@ -18356,7 +18377,7 @@ BEGIN SET vPickGranted = LEAST(vRequested - vSupplied, vPickQuantity); SET vSupplied = vSupplied + vPickGranted; CALL inbound_removePick(vSelf, vOutboundFk, vPickGranted, vPickQuantity); - + UPDATE outbound SET isSync = FALSE, lack = lack + vPickGranted @@ -18374,6 +18395,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `inbound_sync` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18381,8 +18404,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inbound_sync`(vSelf INT) BEGIN @@ -18436,7 +18457,7 @@ BEGIN END IF; SET vSupplied = LEAST(vAvailable, vLack); - + IF vSupplied > 0 THEN SET vAvailable = vAvailable - vSupplied; UPDATE outbound @@ -18449,7 +18470,7 @@ BEGIN SET vSupplied = vSupplied + vSuppliedFromRequest; SET vAvailable = vAvailable - vSuppliedFromRequest; END IF; - + IF vSupplied > 0 THEN CALL inbound_addPick(vSelf, vOutboundFk, vSupplied); END IF; @@ -18471,6 +18492,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18478,8 +18501,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_add`(IN `vTableName` VARCHAR(255), IN `vNewId` VARCHAR(255), IN `vOldId` VARCHAR(255)) proc: BEGIN @@ -18505,6 +18526,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18512,8 +18535,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_clean`() BEGIN @@ -18525,6 +18546,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_delete` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18532,8 +18555,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_delete`(vTableName VARCHAR(255), vTableId INT) proc: BEGIN @@ -18557,6 +18578,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_refreshAll` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18564,8 +18587,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_refreshAll`() BEGIN @@ -18578,7 +18599,7 @@ BEGIN DO RELEASE_LOCK('stock.log_sync'); RESIGNAL; END; - + IF !GET_LOCK('stock.log_sync', 30) THEN CALL util.throw('Lock timeout exceeded'); END IF; @@ -18603,6 +18624,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_refreshBuy` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18610,8 +18633,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_refreshBuy`( `vTableName` VARCHAR(255), @@ -18690,6 +18711,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_refreshOrder` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18697,8 +18720,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_refreshOrder`( `vTableName` VARCHAR(255), @@ -18750,6 +18771,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_refreshSale` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18757,8 +18780,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_refreshSale`( `vTableName` VARCHAR(255), @@ -18828,6 +18849,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_sync` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18835,8 +18858,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_sync`(vSync BOOL) proc: BEGIN @@ -18964,6 +18985,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_syncNoWait` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18971,8 +18994,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_syncNoWait`() BEGIN @@ -18993,6 +19014,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `outbound_requestQuantity` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19000,8 +19023,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `outbound_requestQuantity`( vSelf INT, @@ -19049,7 +19070,7 @@ BEGIN SET vPickGranted = LEAST(vRequested - vSupplied, vPickQuantity); SET vSupplied = vSupplied + vPickGranted; CALL inbound_removePick(vInboundFk, vSelf, vPickGranted, vPickQuantity); - + UPDATE inbound SET isSync = FALSE, available = available + vPickGranted @@ -19067,6 +19088,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `outbound_sync` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19074,8 +19097,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `outbound_sync`(vSelf INT) BEGIN @@ -19158,6 +19179,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `visible_log` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19165,8 +19188,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `visible_log`( vIsPicked BOOL, @@ -19280,12 +19301,11 @@ DROP TABLE IF EXISTS `eventLogGrouped`; /*!50001 DROP VIEW IF EXISTS `eventLogGrouped`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `eventLogGrouped` ( - `lastHappened` tinyint NOT NULL, - `nErrors` tinyint NOT NULL, - `event` tinyint NOT NULL, - `error` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `eventLogGrouped` AS SELECT + 1 AS `lastHappened`, + 1 AS `nErrors`, + 1 AS `event`, + 1 AS `error` */; SET character_set_client = @saved_cs_client; -- @@ -19442,6 +19462,8 @@ DELIMITER ; -- -- Dumping routines for database 'util' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `accountShortToStandard` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19449,8 +19471,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `accountShortToStandard`(vAccount VARCHAR(10)) RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC @@ -19462,6 +19482,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `capitalizeFirst` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19469,8 +19491,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `capitalizeFirst`(vString VARCHAR(255)) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_general_ci NO SQL @@ -19490,11 +19510,11 @@ BEGIN WHILE vI < vLen DO SET vSpaceIni = vI; - + WHILE MID(vString, vI, 1) REGEXP '[[:space:]]' DO SET vI = vI + 1; END WHILE; - + SET vWordIni = vI; SET vI = vWordIni + 1; @@ -19516,6 +19536,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `crypt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19523,25 +19545,25 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `crypt`(vText VARCHAR(255), vKey VARCHAR(255)) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_general_ci READS SQL DATA BEGIN DECLARE vResult VARCHAR(255); - + CALL vn.crypt(vText, vKey, vResult); RETURN vResult; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `cryptOff` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19549,25 +19571,25 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `cryptOff`(vText VARCHAR(255), vKey VARCHAR(255)) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_general_ci READS SQL DATA BEGIN DECLARE vResult VARCHAR(255); - + CALL vn.cryptOff(vText, vKey, vResult); RETURN vResult; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `dayEnd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19575,8 +19597,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `dayEnd`(vDated DATE) RETURNS datetime NO SQL @@ -19595,6 +19615,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `firstDayOfMonth` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19602,8 +19624,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `firstDayOfMonth`(vDate DATE) RETURNS date NO SQL @@ -19622,6 +19642,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `firstDayOfYear` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19629,8 +19651,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `firstDayOfYear`(vDate DATE) RETURNS date NO SQL @@ -19649,6 +19669,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `formatRow` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19656,8 +19678,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `formatRow`(vType CHAR(3), vValues VARCHAR(512)) RETURNS varchar(512) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC @@ -19682,6 +19702,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `formatTable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19689,8 +19711,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `formatTable`(vFields VARCHAR(512), vOldValues VARCHAR(512), vNewValues VARCHAR(512)) RETURNS text CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC @@ -19717,6 +19737,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `hasDateOverlapped` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19724,12 +19746,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `hasDateOverlapped`(vSarted1 DATE, vEnded1 DATE, vSarted2 DATE, vEnded2 DATE) RETURNS tinyint(1) DETERMINISTIC -BEGIN +BEGIN RETURN GREATEST(vSarted1, vSarted2) <= LEAST(vEnded1,vEnded2); @@ -19739,6 +19759,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `hmacSha2` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19746,8 +19768,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `hmacSha2`(`vAlg` SMALLINT, `vMsg` MEDIUMBLOB, `vKey` MEDIUMBLOB) RETURNS varchar(128) CHARSET utf8mb3 COLLATE utf8mb3_general_ci NO SQL @@ -19758,7 +19778,7 @@ BEGIN */ DECLARE vHashlen INT UNSIGNED; DECLARE vOpad, vIpad TINYBLOB; - + CASE vAlg WHEN 224 THEN SET vHashlen = 64; WHEN 256 THEN SET vHashlen = 64; @@ -19766,16 +19786,16 @@ BEGIN WHEN 512 THEN SET vHashlen = 128; ELSE CALL throw ('WRONG_ALGORYTHM_IDENTIFICATOR_USED'); END CASE; - + IF LENGTH(vKey) > vHashlen THEN SET vKey = UNHEX(SHA2(vKey, vAlg)); END IF; - + SET vKey = RPAD(vKey, vHashlen, 0x00); - + SET vIpad = stringXor(vKey, 0x36); SET vOpad = stringXor(vKey, 0x5C); - + RETURN SHA2(CONCAT(vOpad, UNHEX(SHA2(CONCAT(vIpad, vMsg), vAlg))), vAlg); END ;; DELIMITER ; @@ -19783,6 +19803,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `isLeapYear` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19790,21 +19812,21 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `isLeapYear`(vYear INT) RETURNS tinyint(1) DETERMINISTIC BEGIN RETURN (DAYOFYEAR(CONCAT(vYear, "-02-29")) IS NOT NULL); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `json_removeNulls` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19812,8 +19834,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `json_removeNulls`(vObject JSON) RETURNS longtext CHARSET utf8mb4 COLLATE utf8mb4_bin DETERMINISTIC @@ -19849,6 +19869,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `lang` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19856,8 +19878,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `lang`() RETURNS char(2) CHARSET utf8mb3 COLLATE utf8mb3_general_ci NO SQL @@ -19875,6 +19895,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `lastDayOfYear` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19882,8 +19904,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `lastDayOfYear`(vDate DATE) RETURNS date NO SQL @@ -19902,6 +19922,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `log_formatDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19909,8 +19931,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `log_formatDate`(vInstance JSON) RETURNS longtext CHARSET utf8mb4 COLLATE utf8mb4_bin DETERMINISTIC @@ -19944,6 +19964,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `midnight` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19951,13 +19973,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `midnight`() RETURNS datetime READS SQL DATA BEGIN - + RETURN TIMESTAMP(util.VN_CURDATE(), '23:59:59'); END ;; @@ -19966,6 +19986,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `mockTime` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19973,30 +19995,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `mockTime`() RETURNS datetime DETERMINISTIC BEGIN /** - * Returns the mockTime with predefined timezone or current dateTime - * depending of config.mockEnabled - * - * @return formatted datetime + * Returns current dateTime + * + * @return current datetime */ --- FIXME: #5041 Commented because there is slowness when querying a table -/* - DECLARE vMockEnabled BOOL; - - SELECT mockEnabled INTO vMockEnabled FROM config LIMIT 1; - - IF vMockEnabled THEN - RETURN mockTimeBase(FALSE); - ELSE - RETURN NOW(); - END IF; -*/ RETURN NOW(); END ;; DELIMITER ; @@ -20004,6 +20011,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `mockTimeBase` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20011,8 +20020,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `mockTimeBase`(vIsUtc BOOL) RETURNS datetime DETERMINISTIC @@ -20042,6 +20049,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `mockUtcTime` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20049,8 +20058,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `mockUtcTime`() RETURNS datetime DETERMINISTIC @@ -20079,6 +20086,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `nextWeek` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20086,8 +20095,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `nextWeek`(vYearWeek INT) RETURNS int(11) DETERMINISTIC @@ -20098,7 +20105,7 @@ BEGIN * modo 3. */ DECLARE vYear INT DEFAULT FLOOR(vYearWeek / 100); - + IF vYearWeek < YEARWEEK(CONCAT(vYear, '-12-31'), 3) THEN RETURN vYearWeek + 1; ELSE @@ -20110,6 +20117,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `notification_send` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20117,8 +20126,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `notification_send`(vNotificationName VARCHAR(255), vParams TEXT, vAuthorFk INT) RETURNS int(11) MODIFIES SQL DATA @@ -20144,6 +20151,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `quarterFirstDay` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20151,8 +20160,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `quarterFirstDay`(vYear INT, vQuarter INT) RETURNS date DETERMINISTIC @@ -20164,6 +20171,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `quoteIdentifier` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20171,8 +20180,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `quoteIdentifier`(vString TEXT) RETURNS text CHARSET utf8mb3 COLLATE utf8mb3_general_ci NO SQL @@ -20185,6 +20192,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `stringXor` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20192,8 +20201,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `stringXor`(vString MEDIUMBLOB, vConst TINYINT UNSIGNED) RETURNS mediumblob NO SQL @@ -20204,16 +20211,16 @@ BEGIN */ DECLARE vLen, vPos INT UNSIGNED; DECLARE vResult MEDIUMBLOB; - + SET vLen = LENGTH(vString); SET vPos = 1; SET vResult = ''; - + WHILE vPos <= vLen DO SET vResult = CONCAT(vResult, LPAD(HEX( ORD(SUBSTR(vString, vPos, 1)) ^ vConst), 2, '0')); SET vPos = vPos + 1; END WHILE; - + RETURN UNHEX(vResult); END ;; DELIMITER ; @@ -20221,6 +20228,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `today` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20228,8 +20237,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `today`() RETURNS date DETERMINISTIC @@ -20248,6 +20255,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `tomorrow` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20255,8 +20264,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `tomorrow`() RETURNS date DETERMINISTIC @@ -20273,6 +20280,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `twoDaysAgo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20280,8 +20289,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `twoDaysAgo`() RETURNS date DETERMINISTIC @@ -20298,6 +20305,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `VN_CURDATE` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20305,8 +20314,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `VN_CURDATE`() RETURNS date DETERMINISTIC @@ -20321,6 +20328,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `VN_CURTIME` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20328,8 +20337,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `VN_CURTIME`() RETURNS time DETERMINISTIC @@ -20344,6 +20351,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `VN_NOW` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20351,8 +20360,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `VN_NOW`() RETURNS datetime DETERMINISTIC @@ -20367,6 +20374,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `VN_UNIX_TIMESTAMP` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20374,8 +20383,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `VN_UNIX_TIMESTAMP`() RETURNS int(11) DETERMINISTIC @@ -20390,6 +20397,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `VN_UTC_DATE` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20397,8 +20406,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `VN_UTC_DATE`() RETURNS date DETERMINISTIC @@ -20413,6 +20420,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `VN_UTC_TIME` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20420,8 +20429,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `VN_UTC_TIME`() RETURNS time DETERMINISTIC @@ -20436,6 +20443,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `VN_UTC_TIMESTAMP` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20443,8 +20452,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `VN_UTC_TIMESTAMP`() RETURNS datetime DETERMINISTIC @@ -20459,6 +20466,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `yearRelativePosition` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20466,8 +20475,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `yearRelativePosition`(vYear INT) RETURNS varchar(20) CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC @@ -20484,11 +20491,11 @@ BEGIN IF vYear = vCurYear THEN RETURN 'curYear'; END IF; - + IF vYear = vCurYear - 1 THEN RETURN 'lastYear'; END IF; - + IF vYear = vCurYear - 2 THEN RETURN 'twoYearsAgo'; END IF; @@ -20500,6 +20507,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `yesterday` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20507,8 +20516,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `yesterday`() RETURNS date DETERMINISTIC @@ -20525,6 +20532,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `checkHex` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20532,8 +20541,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `checkHex`(vParam VARCHAR(255)) BEGIN @@ -20551,122 +20558,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `compareObjects` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `compareObjects`(vChain VARCHAR(45),vCompare VARCHAR(45)) - READS SQL DATA -BEGIN -/** - * Devuelve un listado de todos los procedimientos, funciones - * eventos, disparadores y vistas que estan incluidos en las dos cadenadas dadas. - * - * Es util para buscar una columna de una tabla en concreto - * @param vChain Cadena a buscar - * @param vCompare Cadena a buscar y comparar los resultados con la primera cadena - * @select Listado de objetos - */ - SET vChain = CONCAT('%', vChain, '%'); - SET vCompare = CONCAT('%', vCompare, '%'); - SELECT * FROM - ( - SELECT t1.* FROM - ( - SELECT - `db`, - `name`, - `type`, - `body`, - `created`, - `modified` - FROM `mysql`.`proc` - WHERE `body` LIKE vChain COLLATE utf8_general_ci - UNION ALL - SELECT - `db`, - `name`, - 'EVENT', - `body_utf8`, - `created`, - `modified` - FROM `mysql`.`event` - WHERE `body_utf8` LIKE vChain COLLATE utf8_general_ci - UNION ALL - SELECT - `EVENT_OBJECT_SCHEMA`, - `TRIGGER_NAME`, - 'TRIGGER', - `ACTION_STATEMENT`, - NULL, - NULL - FROM `information_schema`.`TRIGGERS` - WHERE `ACTION_STATEMENT` LIKE vChain COLLATE utf8_general_ci - UNION ALL - SELECT - `TABLE_SCHEMA`, - `TABLE_NAME`, - 'VIEW', - `VIEW_DEFINITION`, - NULL, - NULL - FROM `information_schema`.`VIEWS` - WHERE `VIEW_DEFINITION` LIKE vChain COLLATE utf8_general_ci - ) t1 - JOIN ( - SELECT - `db`, - `name`, - `type`, - `body`, - `created`, - `modified` - FROM `mysql`.`proc` - WHERE `body` LIKE vCompare COLLATE utf8_general_ci - UNION ALL - SELECT - `db`, - `name`, - 'EVENT', - `body_utf8`, - `created`, - `modified` - FROM `mysql`.`event` - WHERE `body_utf8` LIKE vCompare COLLATE utf8_general_ci - UNION ALL - SELECT - `EVENT_OBJECT_SCHEMA`, - `TRIGGER_NAME`, - 'TRIGGER', - `ACTION_STATEMENT`, - NULL, - NULL - FROM `information_schema`.`TRIGGERS` - WHERE `ACTION_STATEMENT` LIKE vCompare COLLATE utf8_general_ci - UNION ALL - SELECT - `TABLE_SCHEMA`, - `TABLE_NAME`, - 'VIEW', - `VIEW_DEFINITION`, - NULL, - NULL - FROM `information_schema`.`VIEWS` - WHERE `VIEW_DEFINITION` LIKE vCompare COLLATE utf8_general_ci) t2 ON t2.name = t1.name - ORDER BY t1.`db`, t1.`name` - ) t; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `debugAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20674,8 +20567,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `debugAdd`(vVariable VARCHAR(255), vValue VARCHAR(255)) MODIFIES SQL DATA @@ -20687,7 +20578,7 @@ BEGIN * @param vValue Valor de la variable */ DECLARE vIndex INT DEFAULT INSTR(USER(), '@'); - + INSERT INTO debug SET `connectionId` = CONNECTION_ID(), `user` = LEFT(USER(), vIndex - 1), @@ -20700,6 +20591,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `exec` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20707,8 +20600,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `exec`(vSqlQuery TEXT) SQL SECURITY INVOKER @@ -20731,77 +20622,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `findObject` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `findObject`(vChain VARCHAR(45)) - READS SQL DATA -BEGIN -/** - * Devuelve un listado de todos los procedimientos, funciones - * eventos, disparadores y vistas que inluyen una cadena dada. - * - * @param vChain Cadena a buscar - * @select Listado de objetos - */ - SET vChain = CONCAT('%', vChain, '%'); - - SELECT * FROM - ( - SELECT - `routine_schema` `schema`, - `routine_name` `name`, - `routine_type` `type`, - `routine_definition` `definition`, - `created`, - `last_altered` - FROM `information_schema`.`routines` - WHERE `routine_definition` LIKE vChain COLLATE utf8_general_ci - UNION ALL - SELECT - `event_schema`, - `event_name`, - 'EVENT', - `event_definition`, - `created`, - `last_altered` - FROM `information_schema`.`events` - WHERE `event_definition` LIKE vChain COLLATE utf8_general_ci - UNION ALL - SELECT - `EVENT_OBJECT_SCHEMA`, - `TRIGGER_NAME`, - 'TRIGGER', - `ACTION_STATEMENT`, - NULL, - NULL - FROM `information_schema`.`TRIGGERS` - WHERE `ACTION_STATEMENT` LIKE vChain COLLATE utf8_general_ci - UNION ALL - SELECT - `TABLE_SCHEMA`, - `TABLE_NAME`, - 'VIEW', - `VIEW_DEFINITION`, - NULL, - NULL - FROM `information_schema`.`VIEWS` - WHERE `VIEW_DEFINITION` LIKE vChain COLLATE utf8_general_ci - ) t - ORDER BY `schema`, `name`; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20809,8 +20631,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_add`( vSchema VARCHAR(45), @@ -20840,6 +20660,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_addWithUser` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20847,8 +20669,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_addWithUser`( vSchema VARCHAR(45), @@ -20890,6 +20710,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `log_cleanInstances` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20897,8 +20719,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `log_cleanInstances`( vActionCode VARCHAR(45), @@ -20958,6 +20778,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `procNoOverlap` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20965,8 +20787,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `procNoOverlap`(procName VARCHAR(255)) SQL SECURITY INVOKER @@ -20995,6 +20815,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `proc_changedPrivs` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21002,8 +20824,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_changedPrivs`() BEGIN @@ -21023,6 +20843,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `proc_restorePrivs` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21030,8 +20852,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_restorePrivs`() BEGIN @@ -21051,6 +20871,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `proc_savePrivs` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21058,8 +20880,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_savePrivs`() BEGIN @@ -21079,6 +20899,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `slowLog_prune` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21086,8 +20908,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `slowLog_prune`() BEGIN @@ -21115,6 +20935,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `throw` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21122,8 +20944,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `throw`(vMessage CHAR(55)) BEGIN @@ -21140,6 +20960,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `time_createTable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21147,8 +20969,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `time_createTable`(vStarted DATE, vEnded DATE) BEGIN @@ -21161,13 +20981,15 @@ BEGIN INSERT INTO tmp.time (dated) VALUES (vCurrentDate); SET vCurrentDate = DATE_ADD(vCurrentDate, INTERVAL 1 DAY); END WHILE; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `warn` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21175,8 +20997,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `warn`(vCode CHAR(35)) BEGIN @@ -21205,11 +21025,10 @@ DROP TABLE IF EXISTS `NewView`; /*!50001 DROP VIEW IF EXISTS `NewView`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `NewView` ( - `clientFk` tinyint NOT NULL, - `lastShipped` tinyint NOT NULL, - `notBuyingMonths` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `NewView` AS SELECT + 1 AS `clientFk`, + 1 AS `lastShipped`, + 1 AS `notBuyingMonths` */; SET character_set_client = @saved_cs_client; -- @@ -21376,11 +21195,10 @@ DROP TABLE IF EXISTS `__coolerPathDetail`; /*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `__coolerPathDetail` ( - `id` tinyint NOT NULL, - `coolerPathFk` tinyint NOT NULL, - `hallway` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `__coolerPathDetail` AS SELECT + 1 AS `id`, + 1 AS `coolerPathFk`, + 1 AS `hallway` */; SET character_set_client = @saved_cs_client; -- @@ -21557,11 +21375,11 @@ BEGIN END IF; IF NEW.isEqualizated IS NULL THEN - SELECT isEqualizated + SELECT isEqualizated INTO vIsEqualizated FROM client WHERE id = NEW.clientFk; - + SET NEW.isEqualizated = vIsEqualizated; END IF; END */;; @@ -21583,7 +21401,7 @@ DELIMITER ;; BEFORE UPDATE ON `address` FOR EACH ROW BEGIN - + SET NEW.editorFk = account.myUser_getId(); IF !(NEW.phone <=> OLD.phone) AND (NEW.phone <> '') THEN @@ -21615,16 +21433,16 @@ DELIMITER ;; BEGIN -- Recargos de equivalencia distintos implican facturacion por consignatario IF NEW.isEqualizated != OLD.isEqualizated THEN - IF + IF (SELECT COUNT(*) FROM ( SELECT DISTINCT (isEqualizated = FALSE) as Equ - FROM address + FROM address WHERE clientFk = NEW.clientFk ) t1 ) > 1 - THEN - UPDATE client + THEN + UPDATE client SET hasToInvoiceByAddress = TRUE WHERE id = NEW.clientFk; END IF; @@ -21632,10 +21450,10 @@ BEGIN IF NEW.isDefaultAddress AND NEW.isActive = FALSE THEN CALL util.throw ('Cannot desactivate the default address'); END IF; - + IF NOT (NEW.isEqualizated <=> OLD.isEqualizated) THEN INSERT IGNORE INTO ticketRecalc (ticketFk) - SELECT id FROM ticket t + SELECT id FROM ticket t WHERE t.addressFk = NEW.id AND t.refFk IS NULL; END IF; @@ -21860,16 +21678,15 @@ DROP TABLE IF EXISTS `agencyTerm`; /*!50001 DROP VIEW IF EXISTS `agencyTerm`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `agencyTerm` ( - `agencyFk` tinyint NOT NULL, - `minimumPackages` tinyint NOT NULL, - `kmPrice` tinyint NOT NULL, - `packagePrice` tinyint NOT NULL, - `routePrice` tinyint NOT NULL, - `minimumKm` tinyint NOT NULL, - `minimumM3` tinyint NOT NULL, - `m3Price` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `agencyTerm` AS SELECT + 1 AS `agencyFk`, + 1 AS `minimumPackages`, + 1 AS `kmPrice`, + 1 AS `packagePrice`, + 1 AS `routePrice`, + 1 AS `minimumKm`, + 1 AS `minimumM3`, + 1 AS `m3Price` */; SET character_set_client = @saved_cs_client; -- @@ -21924,10 +21741,9 @@ DROP TABLE IF EXISTS `annualAverageInvoiced`; /*!50001 DROP VIEW IF EXISTS `annualAverageInvoiced`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `annualAverageInvoiced` ( - `clientFk` tinyint NOT NULL, - `invoiced` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `annualAverageInvoiced` AS SELECT + 1 AS `clientFk`, + 1 AS `invoiced` */; SET character_set_client = @saved_cs_client; -- @@ -22054,8 +21870,8 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_BI` BEFORE INSERT ON `autonomy` FOR EACH ROW -BEGIN - +BEGIN + SET NEW.geoFk = zoneGeo_new('autonomy', NEW.`name`, (SELECT geoFk FROM country WHERE id = NEW.countryFk)); END */;; @@ -22105,7 +21921,7 @@ DELIMITER ;; AFTER DELETE ON `autonomy` FOR EACH ROW BEGIN - CALL zoneGeo_delete(OLD.geoFk); + CALL zoneGeo_delete(OLD.geoFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -22180,7 +21996,7 @@ DELIMITER ;; BEFORE INSERT ON `awb` FOR EACH ROW BEGIN - + SET NEW.year= year(util.VN_CURDATE()); @@ -22199,11 +22015,10 @@ DROP TABLE IF EXISTS `awbVolume`; /*!50001 DROP VIEW IF EXISTS `awbVolume`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `awbVolume` ( - `awbFk` tinyint NOT NULL, - `volume` tinyint NOT NULL, - `buyFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `awbVolume` AS SELECT + 1 AS `awbFk`, + 1 AS `volume`, + 1 AS `buyFk` */; SET character_set_client = @saved_cs_client; -- @@ -22214,16 +22029,15 @@ DROP TABLE IF EXISTS `bank`; /*!50001 DROP VIEW IF EXISTS `bank`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `bank` ( - `id` tinyint NOT NULL, - `bank` tinyint NOT NULL, - `account` tinyint NOT NULL, - `cash` tinyint NOT NULL, - `entityFk` tinyint NOT NULL, - `isActive` tinyint NOT NULL, - `currencyFk` tinyint NOT NULL, - `code` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `bank` AS SELECT + 1 AS `id`, + 1 AS `bank`, + 1 AS `account`, + 1 AS `cash`, + 1 AS `entityFk`, + 1 AS `isActive`, + 1 AS `currencyFk`, + 1 AS `code` */; SET character_set_client = @saved_cs_client; -- @@ -22301,6 +22115,20 @@ CREATE TABLE `bankEntityConfig` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `bankErrorCode` +-- + +DROP TABLE IF EXISTS `bankErrorCode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bankErrorCode` ( + `code` char(5) NOT NULL, + `description` varchar(255) NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla de códigos de error bancario'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `bankPolicy` -- @@ -22309,27 +22137,26 @@ DROP TABLE IF EXISTS `bankPolicy`; /*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `bankPolicy` ( - `id` tinyint NOT NULL, - `ref` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `balanceInterestDrawn` tinyint NOT NULL, - `commissionAvailableBalances` tinyint NOT NULL, - `openingCommission` tinyint NOT NULL, - `started` tinyint NOT NULL, - `ended` tinyint NOT NULL, - `bankFk` tinyint NOT NULL, - `companyFk` tinyint NOT NULL, - `supplierFk` tinyint NOT NULL, - `description` tinyint NOT NULL, - `hasGuarantee` tinyint NOT NULL, - `dmsFk` tinyint NOT NULL, - `notaryFk` tinyint NOT NULL, - `currencyFk` tinyint NOT NULL, - `amortizationTypeFk` tinyint NOT NULL, - `periodicityTypeFk` tinyint NOT NULL, - `insuranceExpired` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `bankPolicy` AS SELECT + 1 AS `id`, + 1 AS `ref`, + 1 AS `amount`, + 1 AS `balanceInterestDrawn`, + 1 AS `commissionAvailableBalances`, + 1 AS `openingCommission`, + 1 AS `started`, + 1 AS `ended`, + 1 AS `bankFk`, + 1 AS `companyFk`, + 1 AS `supplierFk`, + 1 AS `description`, + 1 AS `hasGuarantee`, + 1 AS `dmsFk`, + 1 AS `notaryFk`, + 1 AS `currencyFk`, + 1 AS `amortizationTypeFk`, + 1 AS `periodicityTypeFk`, + 1 AS `insuranceExpired` */; SET character_set_client = @saved_cs_client; -- @@ -22455,11 +22282,14 @@ CREATE TABLE `budget` ( `photo` blob DEFAULT NULL, `amount` decimal(10,2) DEFAULT NULL, `projectFk` int(11) NOT NULL, + `budgetStateFk` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `budget_FK` (`projectFk`), KEY `budget_FK_1` (`userFk`), KEY `budget_FK_2` (`departmentFk`), KEY `budget_supplierFk` (`supplierFk`), + KEY `budgetStateFk` (`budgetStateFk`), + CONSTRAINT `budgetStateFk` FOREIGN KEY (`budgetStateFk`) REFERENCES `budgetState` (`code`) ON UPDATE CASCADE, CONSTRAINT `budget_FK` FOREIGN KEY (`projectFk`) REFERENCES `project` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budget_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budget_FK_2` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, @@ -22540,11 +22370,11 @@ DELIMITER ;; BEFORE INSERT ON `budgetNotes` FOR EACH ROW BEGIN - + IF ISNULL(NEW.userFk) THEN - + SET NEW.userFk = account.myUser_getId(); - + END IF; END */;; @@ -22554,6 +22384,22 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `budgetState` +-- + +DROP TABLE IF EXISTS `budgetState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `budgetState` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(45) NOT NULL, + `description` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `budgetState_UN` (`code`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `business` -- @@ -22602,7 +22448,7 @@ CREATE TABLE `business` ( CONSTRAINT `business_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), CONSTRAINT `business_occupationCodeFk` FOREIGN KEY (`occupationCodeFk`) REFERENCES `occupationCode` (`code`) ON UPDATE CASCADE, CONSTRAINT `business_workcenterFk` FOREIGN KEY (`workcenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE, - CONSTRAINT `business_workerBusinessAgreementFk` FOREIGN KEY (`workerBusinessAgreementFk`) REFERENCES `postgresql`.`labour_agreement` (`labour_agreement_id`) ON UPDATE CASCADE, + CONSTRAINT `business_workerBusinessAgreementFk` FOREIGN KEY (`workerBusinessAgreementFk`) REFERENCES `workerBusinessAgreement` (`id`) ON UPDATE CASCADE, CONSTRAINT `business_workerBusinessCategoryFk` FOREIGN KEY (`workerBusinessCategoryFk`) REFERENCES `payrollCategories` (`id`) ON UPDATE CASCADE, CONSTRAINT `business_workerBusinessTypeFk` FOREIGN KEY (`workerBusinessTypeFk`) REFERENCES `workerBusinessType` (`id`) ON UPDATE CASCADE, CONSTRAINT `business_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE @@ -22622,7 +22468,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); - + IF NEW.ended IS NULL THEN SET NEW.payedHolidays = 0; END IF; @@ -22668,25 +22514,25 @@ BEGIN DECLARE isOverlapping BOOL; SET NEW.editorFk = account.myUser_getId(); - + IF NEW.ended IS NULL THEN SET NEW.payedHolidays = 0; END IF; IF !(OLD.started <=> NEW.started AND OLD.ended <=> NEW.ended) THEN - + SELECT COUNT(*) > 0 INTO isOverlapping FROM business b WHERE (util.hasDateOverlapped( - NEW.started, + NEW.started, IFNULL(NEW.ended, b.started), b.started, IFNULL(b.ended, NEW.started)) OR (NEW.ended <=> NULL AND b.ended <=> NULL)) AND b.id <> OLD.id AND workerFk = OLD.workerFk; - - IF isOverlapping THEN + + IF isOverlapping THEN CALL util.throw ('IS_OVERLAPPING'); END IF; @@ -22757,12 +22603,11 @@ DROP TABLE IF EXISTS `businessCalendar`; /*!50001 DROP VIEW IF EXISTS `businessCalendar`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `businessCalendar` ( - `id` tinyint NOT NULL, - `businessFk` tinyint NOT NULL, - `absenceTypeFk` tinyint NOT NULL, - `dated` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `businessCalendar` AS SELECT + 1 AS `id`, + 1 AS `businessFk`, + 1 AS `absenceTypeFk`, + 1 AS `dated` */; SET character_set_client = @saved_cs_client; -- @@ -22842,7 +22687,7 @@ CREATE TABLE `buy` ( `price2` decimal(10,2) DEFAULT 0.00, `price3` decimal(10,2) DEFAULT 0.00, `minPrice` decimal(10,2) DEFAULT 0.00, - `printedStickers` int(11) NOT NULL DEFAULT 0, + `printedStickers` int(10) unsigned NOT NULL DEFAULT 0, `workerFk` int(11) DEFAULT 0, `isChecked` tinyint(1) NOT NULL DEFAULT 0, `isPickedOff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Esta mercancia no va a la zona de picking.', @@ -22899,13 +22744,19 @@ trig: BEGIN LEAVE trig; END IF; + IF NEW.printedStickers <> 0 THEN + CALL util.throw('it is not possible to create buy lines with printedstickers other than 0'); + END IF; + SET NEW.editorFk = account.myUser_getId(); CALL buy_checkGrouping(NEW.`grouping`); + SELECT t.warehouseInFk, t.landed INTO vWarehouse, vLanding FROM entry e JOIN travel t ON t.id = e.travelFk WHERE e.id = NEW.entryFk; + SELECT b.`grouping`, b.groupingMode INTO vGrouping, vGroupingMode FROM buy b JOIN entry e ON e.id = b.entryFk @@ -22915,23 +22766,24 @@ trig: BEGIN AND !b.isIgnored ORDER BY t.warehouseInFk = vWarehouse DESC, t.landed DESC, b.id DESC LIMIT 1; + IF NEW.`grouping` IS NULL THEN SET NEW.`grouping` = vGrouping; END IF; + IF NEW.groupingMode IS NULL THEN SET NEW.groupingMode = vGroupingMode; END IF; -- Generics SELECT i.genericFk INTO vGenericFk - FROM vn.item i + FROM item i WHERE i.id = NEW.itemFk; IF vGenericFk THEN - SELECT COUNT(*) INTO vGenericInDate - FROM vn.genericAllocation ga - JOIN vn.entry e ON e.id = NEW.entryFk - JOIN vn.travel tr on tr.id = e.travelFk + FROM genericAllocation ga + JOIN entry e ON e.id = NEW.entryFk + JOIN travel tr on tr.id = e.travelFk WHERE ga.itemFk = vGenericFk AND tr.landed BETWEEN ga.startDated AND ga.endDated; IF vGenericInDate THEN @@ -22941,7 +22793,7 @@ trig: BEGIN END IF; END IF; IF NEW.quantity < 0 THEN - SET NEW.isIgnored = TRUE; + SET NEW.isIgnored = TRUE; END IF; END */;; DELIMITER ; @@ -22991,25 +22843,41 @@ trig:BEGIN DECLARE vGenericFk INT; DECLARE vGenericInDate BOOL; DECLARE vIsInventory BOOL; + DECLARE vDefaultEntry INT; + IF @isTriggerDisabled THEN LEAVE trig; END IF; SET NEW.editorFk = account.myUser_getId(); - IF !(NEW.`grouping` <=> OLD.`grouping`) THEN + SELECT defaultEntry INTO vDefaultEntry + FROM entryConfig; + + IF (NOT OLD.entryFk <=> NEW.entryFk OR NOT OLD.printedStickers <=> NEW.printedStickers) + AND NEW.printedStickers <> 0 THEN + SELECT defaultEntry INTO vDefaultEntry + FROM entryConfig; + + IF NEW.entryFk = vDefaultEntry THEN + CALL util.throw('There can be no lines with printed labels on the default entry'); + END IF; + END IF; + + IF NOT NEW.`grouping` <=> OLD.`grouping` THEN CALL buy_checkGrouping(NEW.`grouping`); END IF; + -- Generics SELECT i.genericFk INTO vGenericFk - FROM vn.item i + FROM item i WHERE i.id = NEW.itemFk; IF vGenericFk THEN SELECT COUNT(*) INTO vGenericInDate - FROM vn.genericAllocation ga - JOIN vn.entry e ON e.id = NEW.entryFk - JOIN vn.travel tr on tr.id = e.travelFk + FROM genericAllocation ga + JOIN entry e ON e.id = NEW.entryFk + JOIN travel tr on tr.id = e.travelFk WHERE ga.itemFk = vGenericFk AND tr.landed BETWEEN ga.startDated AND ga.endDated; IF vGenericInDate THEN @@ -23017,10 +22885,11 @@ trig:BEGIN SET NEW.itemFk = vGenericFk; END IF; END IF; + SELECT COUNT(*) INTO vIsInventory - FROM vn.entry e - JOIN vn.supplier s ON s.id = e.supplierFk - JOIN vn.entryConfig ec ON ec.inventorySupplierFk = e.supplierFk + FROM entry e + JOIN supplier s ON s.id = e.supplierFk + JOIN entryConfig ec ON ec.inventorySupplierFk = e.supplierFk WHERE e.id = NEW.entryFk; IF vIsInventory THEN @@ -23119,7 +22988,7 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeDelete` BEFORE DELETE ON buy FOR EACH ROW -BEGIN +BEGIN IF OLD.printedStickers <> 0 THEN CALL util.throw("it is not possible to delete buys with printed labels "); END IF; @@ -23202,10 +23071,9 @@ DROP TABLE IF EXISTS `buyer`; /*!50001 DROP VIEW IF EXISTS `buyer`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `buyer` ( - `userFk` tinyint NOT NULL, - `nickname` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `buyer` AS SELECT + 1 AS `userFk`, + 1 AS `nickname` */; SET character_set_client = @saved_cs_client; -- @@ -23216,12 +23084,11 @@ DROP TABLE IF EXISTS `buyerSales`; /*!50001 DROP VIEW IF EXISTS `buyerSales`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `buyerSales` ( - `importe` tinyint NOT NULL, - `comprador` tinyint NOT NULL, - `año` tinyint NOT NULL, - `semana` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `buyerSales` AS SELECT + 1 AS `importe`, + 1 AS `comprador`, + 1 AS `año`, + 1 AS `semana` */; SET character_set_client = @saved_cs_client; -- @@ -23407,83 +23274,6 @@ CREATE TABLE `chatConfig` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `chronopostConfig` --- - -DROP TABLE IF EXISTS `chronopostConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `chronopostConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `accountNumber` int(11) NOT NULL, - `password` varchar(20) NOT NULL, - `idEmit` varchar(20) NOT NULL DEFAULT 'CHRFR' COMMENT 'Valor fijo de chronopost', - `urlShipping` varchar(100) NOT NULL DEFAULT 'https://ws.chronopost.fr/shipping-cxf/ShippingServiceWS/', - `urlTracking` varchar(100) NOT NULL DEFAULT 'https://ws.chronopost.fr/tracking-cxf/TrackingServiceWS/', - `cxfShipping` varchar(100) NOT NULL DEFAULT 'http://cxf.shipping.soap.chronopost.fr/', - `cxfTracking` varchar(100) NOT NULL DEFAULT 'http://cxf.tracking.soap.chronopost.fr/', - `evtCode` varchar(2) NOT NULL DEFAULT 'DC' COMMENT 'Valor fijo de chronopost', - `objectType` varchar(3) NOT NULL DEFAULT 'MAR' COMMENT 'MAR: mercancia, DOC: documentación', - `productCode` varchar(2) NOT NULL DEFAULT '1S', - `weightUnit` varchar(3) NOT NULL DEFAULT 'KGM', - `stickerMode` varchar(6) NOT NULL DEFAULT 'THE' COMMENT 'THE: vertical, THEPSG: horizontal, PDF, ...', - `defaultWeight` int(11) NOT NULL DEFAULT 10, - `defaultSevice` int(11) NOT NULL DEFAULT 0, - `numberOfParcel` int(11) NOT NULL DEFAULT 1, - `civility` varchar(1) NOT NULL DEFAULT 'M', - `modeRetour` varchar(1) NOT NULL DEFAULT '2', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `chronopostExpedition` --- - -DROP TABLE IF EXISTS `chronopostExpedition`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `chronopostExpedition` ( - `expeditionFk` int(11) NOT NULL, - `skybillNumber` varchar(20) NOT NULL COMMENT 'Código devuelto por chronopost', - PRIMARY KEY (`expeditionFk`), - CONSTRAINT `chronopostExpedition_FK` FOREIGN KEY (`expeditionFk`) REFERENCES `expedition` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `chronopostSenderAddress` --- - -DROP TABLE IF EXISTS `chronopostSenderAddress`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `chronopostSenderAddress` ( - `warehouseFk` smallint(6) unsigned NOT NULL, - `addressFk` int(11) NOT NULL, - PRIMARY KEY (`warehouseFk`), - KEY `chronopostSenderAddress_FK_1` (`addressFk`), - CONSTRAINT `chronopostSenderAddress_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `chronopostSenderAddress_FK_1` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `chronopostServiceWeekday` --- - -DROP TABLE IF EXISTS `chronopostServiceWeekday`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `chronopostServiceWeekday` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `weekdays` set('mon','tue','wed','thu','fri','sat','sun') NOT NULL, - `serviceType` int(11) unsigned NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `claim` -- @@ -24402,7 +24192,7 @@ BEGIN END IF; SET NEW.accountingAccount = 4300000000 + NEW.id; - + SET NEW.lastSalesPersonFk = NEW.salesPersonFk; END */;; DELIMITER ; @@ -24427,7 +24217,7 @@ BEGIN DECLARE vPayMethodFk INT; SET NEW.editorFk = account.myUser_getId(); - + -- Comprueba que el formato de los teléfonos es válido IF !(NEW.phone <=> OLD.phone) AND (NEW.phone <> '') THEN @@ -24465,7 +24255,7 @@ BEGIN CONCAT('Cliente ', NEW.id), CONCAT('Recibida la documentación: ', vText) FROM worker w - LEFT JOIN account.user u ON w.userFk = u.id AND u.active + LEFT JOIN account.user u ON w.id = u.id AND u.active LEFT JOIN account.account ac ON ac.id = u.id WHERE w.id = NEW.salesPersonFk; END IF; @@ -24509,18 +24299,18 @@ BEGIN IF !(NEW.defaultAddressFk <=> OLD.defaultAddressFk) THEN UPDATE `address` SET isDefaultAddress = 0 WHERE clientFk = NEW.id; - + UPDATE `address` SET isDefaultAddress = 1 - WHERE id = NEW.defaultAddressFk; + WHERE id = NEW.defaultAddressFk; END IF; IF NOT (NEW.provinceFk <=> OLD.provinceFk) OR NOT (NEW.isVies <=> OLD.isVies) THEN INSERT IGNORE INTO ticketRecalc (ticketFk) - SELECT id FROM ticket t + SELECT id FROM ticket t WHERE t.clientFk = NEW.id AND t.refFk IS NULL; END IF; - + IF NOT NEW.isActive THEN UPDATE account.`user` SET active = FALSE @@ -24589,7 +24379,17 @@ CREATE TABLE `clientConfig` ( `maxCreditRows` int(11) DEFAULT NULL COMMENT 'Máximo número de registros a mantener en la tabla clientCredit', `maxPriceIncreasingRatio` decimal(2,2) NOT NULL DEFAULT 0.25 COMMENT 'máximo recobro permitido', `riskScope` int(11) NOT NULL DEFAULT 2 COMMENT 'Time range in months to calculating a customer''s risk', - PRIMARY KEY (`id`) + `defaultPayMethodFk` tinyint(3) unsigned DEFAULT NULL, + `defaultDueDay` int(10) unsigned DEFAULT NULL, + `defaultCredit` decimal(10,2) DEFAULT NULL, + `defaultIsTaxDataChecked` tinyint(1) DEFAULT NULL, + `defaultHasCoreVnl` tinyint(1) DEFAULT NULL, + `defaultMandateTypeFk` smallint(5) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `clientNewConfigPayMethod_FK` (`defaultPayMethodFk`), + KEY `clientNewConfigMandateType_FK` (`defaultMandateTypeFk`), + CONSTRAINT `clientNewConfigMandateType_FK` FOREIGN KEY (`defaultMandateTypeFk`) REFERENCES `mandateType` (`id`), + CONSTRAINT `clientNewConfigPayMethod_FK` FOREIGN KEY (`defaultPayMethodFk`) REFERENCES `payMethod` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -24706,15 +24506,15 @@ DELIMITER ;; AFTER INSERT ON clientCredit FOR EACH ROW BEGIN - + DECLARE vSender VARCHAR(50); SELECT u.name INTO vSender FROM account.`user` u WHERE u.id = NEW.workerFk; - + IF vSender IN ('juanvi','pepe') THEN - + CALL `vn`.`mail_insert`('pako@verdnatura.es', NULL, CONCAT('ClientCredit ',vSender, ' ', NEW.clientFk, ' ' , NEW.amount, ' €'), @@ -24909,11 +24709,10 @@ DROP TABLE IF EXISTS `clientLost`; /*!50001 DROP VIEW IF EXISTS `clientLost`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `clientLost` ( - `clientFk` tinyint NOT NULL, - `lastShipped` tinyint NOT NULL, - `notBuyingMonths` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `clientLost` AS SELECT + 1 AS `clientFk`, + 1 AS `lastShipped`, + 1 AS `notBuyingMonths` */; SET character_set_client = @saved_cs_client; -- @@ -25048,10 +24847,9 @@ DROP TABLE IF EXISTS `clientPhoneBook`; /*!50001 DROP VIEW IF EXISTS `clientPhoneBook`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `clientPhoneBook` ( - `clientFk` tinyint NOT NULL, - `phone` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `clientPhoneBook` AS SELECT + 1 AS `clientFk`, + 1 AS `phone` */; SET character_set_client = @saved_cs_client; -- @@ -25178,6 +24976,25 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `clientSms` +-- + +DROP TABLE IF EXISTS `clientSms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clientSms` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `clientFk` int(11) NOT NULL, + `smsFk` mediumint(8) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `clientSms_FK` (`clientFk`), + KEY `clientSms_FK_1` (`smsFk`), + CONSTRAINT `clientSms_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, + CONSTRAINT `clientSms_FK_1` FOREIGN KEY (`smsFk`) REFERENCES `sms` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `clientType` -- @@ -25237,11 +25054,11 @@ DROP TABLE IF EXISTS `cmr`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cmr` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `ticketFk` int(11) DEFAULT NULL, + `ticketFk` int(11) DEFAULT NULL COMMENT 'refs #6092 @toDeprecate 2023-08-02', `truckPlate` varchar(30) DEFAULT NULL, `observations` varchar(255) DEFAULT NULL, - `senderInstruccions` varchar(255) DEFAULT 'Flowers 4º C. Plants 14º C', - `paymentInstruccions` varchar(255) DEFAULT 'Carriage paid', + `senderInstruccions` varchar(255) DEFAULT NULL, + `paymentInstruccions` varchar(255) DEFAULT NULL, `specialAgreements` varchar(255) DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), `companyFk` int(10) unsigned DEFAULT NULL, @@ -25261,7 +25078,7 @@ CREATE TABLE `cmr` ( KEY `cmr_FK` (`addressFromFk`), CONSTRAINT `cmrCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `cmr_FK` FOREIGN KEY (`addressFromFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, - CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`), CONSTRAINT `cmr_fk3` FOREIGN KEY (`addressToFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `cmr_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -25275,52 +25092,10 @@ CREATE TABLE `cmr` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`cmr_BEFORE_INSERT` - BEFORE INSERT ON `cmr` - FOR EACH ROW -BEGIN - - DECLARE vLastSenderInstructions VARCHAR(255); - DECLARE vLastId INT; - DECLARE vCurrentAgency INT; - - SELECT am.agencyFk INTO vCurrentAgency - FROM vn.agencyMode am - JOIN vn.ticket t ON t.agencyModeFk = am.id - WHERE t.id = NEW.ticketFk; - - SELECT MAX(cmr.id) INTO vLastId - FROM cmr - JOIN vn.ticket t ON t.id = cmr.ticketFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - WHERE am.agencyFk = vCurrentAgency - ; - - SELECT senderInstruccions INTO vLastSenderInstructions - FROM cmr - WHERE id = vLastId; - - SET NEW.senderInstruccions = vLastSenderInstructions; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`cmr_beforeDelete` BEFORE DELETE ON `cmr` FOR EACH ROW -BEGIN +BEGIN IF NOT (OLD.companyFk <=> NULL AND OLD.addressFromFk <=> NULL AND OLD.packagesList <=> NULL) THEN CALL util.throw("Can not delete cmr, fields required not empty"); END IF; @@ -25372,42 +25147,41 @@ DROP TABLE IF EXISTS `cmr_list`; /*!50001 DROP VIEW IF EXISTS `cmr_list`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `cmr_list` ( - `cmrFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `truckPlate` tinyint NOT NULL, - `observations` tinyint NOT NULL, - `senderInstruccions` tinyint NOT NULL, - `paymentInstruccions` tinyint NOT NULL, - `specialAgreements` tinyint NOT NULL, - `created` tinyint NOT NULL, - `packagesList` tinyint NOT NULL, - `clientName` tinyint NOT NULL, - `clientPostalCode` tinyint NOT NULL, - `clientStreet` tinyint NOT NULL, - `clientCity` tinyint NOT NULL, - `clientProvince` tinyint NOT NULL, - `clientCountry` tinyint NOT NULL, - `companyName` tinyint NOT NULL, - `companyStreet` tinyint NOT NULL, - `companyPostCode` tinyint NOT NULL, - `companyCity` tinyint NOT NULL, - `companyCountry` tinyint NOT NULL, - `warehouseAddress` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `clientOficialName` tinyint NOT NULL, - `supplierFk` tinyint NOT NULL, - `carrierName` tinyint NOT NULL, - `carrierStreet` tinyint NOT NULL, - `carrierPostCode` tinyint NOT NULL, - `carrierCity` tinyint NOT NULL, - `carrierCountry` tinyint NOT NULL, - `phone` tinyint NOT NULL, - `mobile` tinyint NOT NULL, - `addressFk` tinyint NOT NULL, - `stamp` tinyint NOT NULL, - `merchandiseDetail` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `cmr_list` AS SELECT + 1 AS `cmrFk`, + 1 AS `ticketFk`, + 1 AS `truckPlate`, + 1 AS `observations`, + 1 AS `senderInstruccions`, + 1 AS `paymentInstruccions`, + 1 AS `specialAgreements`, + 1 AS `created`, + 1 AS `packagesList`, + 1 AS `clientName`, + 1 AS `clientPostalCode`, + 1 AS `clientStreet`, + 1 AS `clientCity`, + 1 AS `clientProvince`, + 1 AS `clientCountry`, + 1 AS `companyName`, + 1 AS `companyStreet`, + 1 AS `companyPostCode`, + 1 AS `companyCity`, + 1 AS `companyCountry`, + 1 AS `warehouseAddress`, + 1 AS `shipped`, + 1 AS `clientOficialName`, + 1 AS `supplierFk`, + 1 AS `carrierName`, + 1 AS `carrierStreet`, + 1 AS `carrierPostCode`, + 1 AS `carrierCity`, + 1 AS `carrierCountry`, + 1 AS `phone`, + 1 AS `mobile`, + 1 AS `addressFk`, + 1 AS `stamp`, + 1 AS `merchandiseDetail` */; SET character_set_client = @saved_cs_client; -- @@ -25452,39 +25226,39 @@ CREATE TABLE `collection` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_BEFORE_UPDATE` - BEFORE UPDATE ON `collection` - FOR EACH ROW -BEGIN - - DECLARE vStateFk INT; - DECLARE vTotalLines INT; - DECLARE vPickedLines INT; - - IF NEW.saleTotalCount <= NEW.salePickedCount - AND (NEW.saleTotalCount != OLD.saleTotalCount - OR NEW.salePickedCount != OLD.salePickedCount) - THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE code = 'PREPARED'; - - SET NEW.stateFk = vStateFk; - - END IF; - - IF NEW.saleTotalCount > NEW.salePickedCount - AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE code = 'ON_PREPARATION'; - - SET NEW.stateFk = vStateFk; - - END IF; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_BEFORE_UPDATE` + BEFORE UPDATE ON `collection` + FOR EACH ROW +BEGIN + + DECLARE vStateFk INT; + DECLARE vTotalLines INT; + DECLARE vPickedLines INT; + + IF NEW.saleTotalCount <= NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount + OR NEW.salePickedCount != OLD.salePickedCount) + THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE code = 'PREPARED'; + + SET NEW.stateFk = vStateFk; + + END IF; + + IF NEW.saleTotalCount > NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE code = 'ON_PREPARATION'; + + SET NEW.stateFk = vStateFk; + + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25680,7 +25454,7 @@ CREATE TABLE `company` ( `hasCyc` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, `rgb` varchar(6) NOT NULL, `email` varchar(30) NOT NULL, - `stamp` blob DEFAULT NULL, + `stamp` longblob DEFAULT NULL, `created` timestamp NOT NULL ON UPDATE current_timestamp(), `clientFk` int(11) DEFAULT NULL, `sage200Company` int(2) DEFAULT NULL, @@ -25746,10 +25520,9 @@ DROP TABLE IF EXISTS `companyL10n`; /*!50001 DROP VIEW IF EXISTS `companyL10n`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `companyL10n` ( - `id` tinyint NOT NULL, - `footnotes` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `companyL10n` AS SELECT + 1 AS `id`, + 1 AS `footnotes` */; SET character_set_client = @saved_cs_client; -- @@ -26061,6 +25834,7 @@ CREATE TABLE `country` ( `ibanLength` tinyint(4) DEFAULT NULL, `continentFk` tinyint(4) DEFAULT NULL, `a3Code` int(11) DEFAULT NULL COMMENT 'Código país para a3', + `isSocialNameUnique` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `Id_Paisreal` (`politicalCountryFk__`), KEY `currency_id_fk_idx` (`currencyFk`), @@ -26420,7 +26194,7 @@ BEGIN UPDATE `client` c JOIN vn.creditClassification cc ON cc.client = c.id SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -26489,15 +26263,14 @@ DROP TABLE IF EXISTS `defaulter`; /*!50001 DROP VIEW IF EXISTS `defaulter`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `defaulter` ( - `clientFk` tinyint NOT NULL, - `created` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `defaulterSinced` tinyint NOT NULL, - `hasChanged` tinyint NOT NULL, - `country` tinyint NOT NULL, - `payMethod` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `defaulter` AS SELECT + 1 AS `clientFk`, + 1 AS `created`, + 1 AS `amount`, + 1 AS `defaulterSinced`, + 1 AS `hasChanged`, + 1 AS `country`, + 1 AS `payMethod` */; SET character_set_client = @saved_cs_client; -- @@ -26516,7 +26289,7 @@ CREATE TABLE `delivery` ( `ticketFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `delivery_ticketFk_FK` (`ticketFk`), - CONSTRAINT `delivery_ticketFk_FK` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) + CONSTRAINT `delivery_ticketFk_FK` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Informa de los datos geográficos y temporales de las entregas de los repartidores'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -26610,6 +26383,7 @@ CREATE TABLE `department` ( `hasToCheckLogin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Para comprobar en el login de la app', `hasToMistake` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Indica si al departamento pueden serles puestos errores', `clientFk` int(11) DEFAULT NULL COMMENT 'Cuenta de cliente que se utiliza para los compras de consumo departamental', + `twoFactor` enum('email') DEFAULT NULL COMMENT 'Default user two-factor auth type', PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`), KEY `fk_department_Trabajadores1_idx` (`workerFk`), @@ -26658,6 +26432,13 @@ BEGIN IF !(OLD.parentFk <=> NEW.parentFk) THEN UPDATE vn.department_recalc SET isChanged = TRUE; END IF; + + IF !(OLD.twoFactor <=> NEW.twoFactor) THEN + UPDATE account.user u + JOIN vn.workerDepartment wd ON wd.workerFk = u.id + SET u.twoFactor = NEW.twoFactor + WHERE wd.departmentFk = NEW.id; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -26682,7 +26463,7 @@ BEGIN JOIN vn.department d ON d.id = b.departmentFk SET b.departmentFk = d.parentFk WHERE b.departmentFk = OLD.id; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -26702,9 +26483,9 @@ DELIMITER ;; AFTER DELETE ON `department` FOR EACH ROW BEGIN - + UPDATE vn.department_recalc SET isChanged = TRUE; - + UPDATE vn.business b JOIN vn.department d ON d.id = b.departmentFk SET b.departmentFk = d.parentFk @@ -26724,10 +26505,9 @@ DROP TABLE IF EXISTS `departmentTree`; /*!50001 DROP VIEW IF EXISTS `departmentTree`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `departmentTree` ( - `id` tinyint NOT NULL, - `dep` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `departmentTree` AS SELECT + 1 AS `id`, + 1 AS `dep` */; SET character_set_client = @saved_cs_client; -- @@ -26771,41 +26551,16 @@ DROP TABLE IF EXISTS `deviceLog`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `android_id` varchar(100) NOT NULL, + `android_id` varchar(64) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), `nameApp` varchar(45) DEFAULT NULL, `versionApp` varchar(45) DEFAULT NULL, - `deviceProductionFk` int(10) DEFAULT NULL, PRIMARY KEY (`id`), KEY `deviceLog_FK` (`userFk`), CONSTRAINT `deviceLog_FK` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceLog_beforeInsert` -BEFORE INSERT -ON deviceLog FOR EACH ROW -BEGIN - DECLARE vDeviceProductionFk INTEGER; - SELECT dp.id INTO vDeviceProductionFk - FROM deviceProduction dp - WHERE dp.android_id = NEW.android_id; - SET NEW.deviceProductionFk = vDeviceProductionFk; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `deviceProduction` @@ -26820,21 +26575,90 @@ CREATE TABLE `deviceProduction` ( `modelFk` varchar(50) NOT NULL, `macWifi` varchar(45) DEFAULT NULL, `serialNumber` varchar(45) DEFAULT NULL, - `android_id` varchar(50) DEFAULT NULL, + `android_id` varchar(64) DEFAULT NULL, `purchased` date NOT NULL DEFAULT '1900-01-01' COMMENT 'Fecha de compra', `stateFk` varchar(50) DEFAULT 'idle', `isInScalefusion` tinyint(1) DEFAULT 0 COMMENT 'Para saber si esta en Scalefusion', `description` varchar(100) DEFAULT NULL, + `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `device_id_UNIQUE` (`id`), UNIQUE KEY `sn_UNIQUE` (`imei`), UNIQUE KEY `serial_number_UN` (`serialNumber`), + UNIQUE KEY `deviceProduction_UN` (`android_id`), KEY `deviceProductionModelsFgn` (`modelFk`), KEY `deviceProduction_FK` (`stateFk`), + KEY `deviceProduction_fk_editor` (`editorFk`), CONSTRAINT `deviceProductionModelsFgn` FOREIGN KEY (`modelFk`) REFERENCES `deviceProductionModels` (`code`) ON UPDATE CASCADE, - CONSTRAINT `deviceProduction_FK` FOREIGN KEY (`stateFk`) REFERENCES `deviceProductionState` (`code`) + CONSTRAINT `deviceProduction_FK` FOREIGN KEY (`stateFk`) REFERENCES `deviceProductionState` (`code`), + CONSTRAINT `deviceProduction_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), + CONSTRAINT `deviceProduction_CHECK` CHECK (`android_id` regexp '[A-Za-z0-9]{16,}' or `android_id` is null) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProduction_beforeInsert` + BEFORE INSERT ON `deviceProduction` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProduction_beforeUpdate` + BEFORE UPDATE ON `deviceProduction` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProduction_afterDelete` + AFTER DELETE ON `deviceProduction` + FOR EACH ROW +BEGIN + INSERT INTO deviceProductionLog + SET `action` = 'delete', + `changedModel` = 'DeviceProduction', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `deviceProductionConfig` @@ -26885,16 +26709,22 @@ DROP TABLE IF EXISTS `deviceProductionLog`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceProductionLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` int(11) NOT NULL, + `originFk` int(11) DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, - `deviceProduction` int(10) unsigned NOT NULL, - `action` set('insert','update','delete','retired') NOT NULL, - `created` timestamp NULL DEFAULT current_timestamp(), - `oldInstance` varchar(50) DEFAULT NULL, - `newInstance` varchar(50) DEFAULT NULL, - `changedModel` varchar(50) DEFAULT NULL, - `changedModelId` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) + `action` set('insert','update','delete') NOT NULL, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` enum('DeviceProduction','DeviceProductionModels','DeviceProductionState','DeviceProductionUser') NOT NULL DEFAULT 'DeviceProduction', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, + `changedModelValue` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `userFk` (`userFk`), + KEY `deviceProductionLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `deviceProductionLog_deviceProductionLog` (`originFk`,`creationDate`), + CONSTRAINT `deviceProductionOriginFk` FOREIGN KEY (`originFk`) REFERENCES `deviceProduction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `deviceProductionUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -26907,9 +26737,52 @@ DROP TABLE IF EXISTS `deviceProductionModels`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceProductionModels` ( `code` varchar(50) NOT NULL, - PRIMARY KEY (`code`) + `editorFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`code`), + KEY `deviceProductionModels_fk_editor` (`editorFk`), + CONSTRAINT `deviceProductionModels_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionModels_beforeInsert` + BEFORE INSERT ON `deviceProductionModels` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionModels_beforeUpdate` + BEFORE UPDATE ON `deviceProductionModels` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `deviceProductionState` @@ -26921,9 +26794,52 @@ DROP TABLE IF EXISTS `deviceProductionState`; CREATE TABLE `deviceProductionState` ( `code` varchar(50) NOT NULL, `description` varchar(50) NOT NULL, - PRIMARY KEY (`code`) + `editorFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`code`), + KEY `deviceProductionState_fk_editor` (`editorFk`), + CONSTRAINT `deviceProductionState_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionState_beforeInsert` + BEFORE INSERT ON `deviceProductionState` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionState_beforeUpdate` + BEFORE UPDATE ON `deviceProductionState` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `deviceProductionUser` @@ -26936,13 +26852,80 @@ CREATE TABLE `deviceProductionUser` ( `deviceProductionFk` int(11) NOT NULL, `userFk` int(10) unsigned NOT NULL, `created` timestamp NULL DEFAULT current_timestamp(), + `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`deviceProductionFk`), UNIQUE KEY `deviceProductionUser_UN` (`userFk`), KEY `userFgn_idx` (`userFk`), + KEY `deviceProductionUser_fk_editor` (`editorFk`), CONSTRAINT `deviceProductionUser_FK` FOREIGN KEY (`deviceProductionFk`) REFERENCES `deviceProduction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `deviceProductionUser_PK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `deviceProductionUser_PK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `deviceProductionUser_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_beforeInsert` + BEFORE INSERT ON `deviceProductionUser` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_beforeUpdate` + BEFORE UPDATE ON `deviceProductionUser` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_afterDelete` + AFTER DELETE ON `deviceProductionUser` + FOR EACH ROW +BEGIN + INSERT INTO deviceProductionLog + SET `action` = 'delete', + `changedModel` = 'DeviceProductionUser', + `changedModelId` = OLD.deviceProductionFk, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `disabilityGrade` @@ -27005,20 +26988,20 @@ DELIMITER ;; BEGIN DECLARE vHardCopyNumber INT; DECLARE vDmsTypeCode INT; - + IF (SELECT NOT hasDms FROM warehouse WHERE id = NEW.warehouseFk) THEN CALL util.throw('this warehouse has not dms'); END IF; IF NEW.hasFile THEN - SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber - FROM dms + SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber + FROM dms WHERE warehouseFk = NEW.warehouseFk; - + SET NEW.hardCopyNumber = IFNULL(vHardCopyNumber,1); END IF; - - SELECT code INTO vDmsTypeCode + + SELECT code INTO vDmsTypeCode FROM dmsType WHERE NEW.dmsTypeFk = id; IF (vDmsTypeCode ='ticket') THEN UPDATE ticket SET isSigned = 1 WHERE id = NEW.reference; @@ -27038,31 +27021,31 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeUpdate` - BEFORE UPDATE ON `dms` - FOR EACH ROW -BEGIN - DECLARE vHardCopyNumber INT; - - IF (NEW.hasFile <> 0) AND (OLD.hasFile = 0) AND (NEW.hardCopyNumber IS NULL) - OR - (NEW.hardCopyNumber = OLD.hardCopyNumber AND OLD.warehouseFk <> NEW.warehouseFk) THEN - - IF (SELECT NOT hasDms FROM warehouse WHERE id = NEW.warehouseFk) THEN - SET NEW.warehouseFk = (SELECT id FROM warehouse WHERE name = 'Algemesi'); - END IF; - - SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber - FROM dms - WHERE warehouseFk = NEW.warehouseFk; - - SET NEW.hardCopyNumber = IFNULL(vHardCopyNumber,1); - END IF; - - IF ((NEW.hardCopyNumber = 0) OR NEW.hardCopyNumber IS NULL) AND (OLD.hardCopyNumber <> 0) THEN - - SET NEW.hasFile = 0; - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeUpdate` + BEFORE UPDATE ON `dms` + FOR EACH ROW +BEGIN + DECLARE vHardCopyNumber INT; + + IF (NEW.hasFile <> 0) AND (OLD.hasFile = 0) AND (NEW.hardCopyNumber IS NULL) + OR + (NEW.hardCopyNumber = OLD.hardCopyNumber AND OLD.warehouseFk <> NEW.warehouseFk) THEN + + IF (SELECT NOT hasDms FROM warehouse WHERE id = NEW.warehouseFk) THEN + SET NEW.warehouseFk = (SELECT id FROM warehouse WHERE name = 'Algemesi'); + END IF; + + SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber + FROM dms + WHERE warehouseFk = NEW.warehouseFk; + + SET NEW.hardCopyNumber = IFNULL(vHardCopyNumber,1); + END IF; + + IF ((NEW.hardCopyNumber = 0) OR NEW.hardCopyNumber IS NULL) AND (OLD.hardCopyNumber <> 0) THEN + + SET NEW.hasFile = 0; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27081,14 +27064,14 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeDelete` BEFORE DELETE ON `dms` FOR EACH ROW -BEGIN +BEGIN DECLARE vCanNotBeDeleted INT; - SELECT COUNT(*) INTO vCanNotBeDeleted - FROM dmsType dt - WHERE NOT (code <=> 'trash') + SELECT COUNT(*) INTO vCanNotBeDeleted + FROM dmsType dt + WHERE NOT (code <=> 'trash') AND dt.id = OLD.dmsTypeFk; - - IF vCanNotBeDeleted THEN + + IF vCanNotBeDeleted THEN CALL util.throw('A dms can not be deleted'); END IF; END */;; @@ -27149,7 +27132,10 @@ CREATE TABLE `docuware` ( `action` varchar(255) NOT NULL, `dialogName` varchar(100) NOT NULL, `findById` varchar(50) DEFAULT NULL, - PRIMARY KEY (`id`) + `dmsTypeFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `docuware_FK` (`dmsTypeFk`), + CONSTRAINT `docuware_FK` FOREIGN KEY (`dmsTypeFk`) REFERENCES `dmsType` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -27334,13 +27320,12 @@ DROP TABLE IF EXISTS `ediGenus`; /*!50001 DROP VIEW IF EXISTS `ediGenus`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ediGenus` ( - `id` tinyint NOT NULL, - `latinGenusName` tinyint NOT NULL, - `entried` tinyint NOT NULL, - `dued` tinyint NOT NULL, - `modified` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ediGenus` AS SELECT + 1 AS `id`, + 1 AS `latinGenusName`, + 1 AS `entried`, + 1 AS `dued`, + 1 AS `modified` */; SET character_set_client = @saved_cs_client; -- @@ -27351,14 +27336,13 @@ DROP TABLE IF EXISTS `ediSpecie`; /*!50001 DROP VIEW IF EXISTS `ediSpecie`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ediSpecie` ( - `id` tinyint NOT NULL, - `genusFk` tinyint NOT NULL, - `latinSpeciesName` tinyint NOT NULL, - `entried` tinyint NOT NULL, - `dued` tinyint NOT NULL, - `modified` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ediSpecie` AS SELECT + 1 AS `id`, + 1 AS `genusFk`, + 1 AS `latinSpeciesName`, + 1 AS `entried`, + 1 AS `dued`, + 1 AS `modified` */; SET character_set_client = @saved_cs_client; -- @@ -27451,12 +27435,11 @@ DROP TABLE IF EXISTS `ektSubAddress`; /*!50001 DROP VIEW IF EXISTS `ektSubAddress`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ektSubAddress` ( - `sub` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `addressFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ektSubAddress` AS SELECT + 1 AS `sub`, + 1 AS `clientFk`, + 1 AS `nickname`, + 1 AS `addressFk` */; SET character_set_client = @saved_cs_client; -- @@ -27543,6 +27526,8 @@ CREATE TABLE `entry` ( `observationEditorFk` int(10) unsigned DEFAULT NULL COMMENT 'Último usuario que ha modificado el campo evaNotes', `clonedFrom` int(11) DEFAULT NULL, `editorFk` int(10) unsigned DEFAULT NULL, + `lockerUserFk` int(10) unsigned DEFAULT NULL, + `locked` datetime DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `Id_Proveedor` (`supplierFk`), KEY `Fecha` (`dated`), @@ -27554,7 +27539,9 @@ CREATE TABLE `entry` ( KEY `entry_FK_1` (`typeFk`), KEY `entry_observationEditorFk` (`observationEditorFk`), KEY `entry_fk_editor` (`editorFk`), + KEY `entryAccountFk` (`lockerUserFk`), CONSTRAINT `Entradas_fk8` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `entryAccountFk` FOREIGN KEY (`lockerUserFk`) REFERENCES `account`.`user` (`id`), CONSTRAINT `entryCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_FK` FOREIGN KEY (`buyerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `entryType` (`code`) ON UPDATE CASCADE, @@ -27662,7 +27649,7 @@ BEGIN END IF; IF NOT (NEW.travelFk <=> OLD.travelFk) - OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN + OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); END IF; END */;; @@ -27758,6 +27745,8 @@ CREATE TABLE `entryConfig` ( `defaultEntry` int(11) NOT NULL, `mailToNotify` varchar(255) DEFAULT NULL, `inventorySupplierFk` int(11) DEFAULT 4, + `maxLockTime` int(10) unsigned DEFAULT NULL COMMENT 'Tiempo máximo que puede estar una entrada bloqueada en segundos', + `defaultSupplierFk` int(11) DEFAULT 13, PRIMARY KEY (`defaultEntry`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28032,11 +28021,10 @@ DROP TABLE IF EXISTS `exchangeInsuranceEntry`; /*!50001 DROP VIEW IF EXISTS `exchangeInsuranceEntry`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `exchangeInsuranceEntry` ( - `dated` tinyint NOT NULL, - `Dolares` tinyint NOT NULL, - `rate` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `exchangeInsuranceEntry` AS SELECT + 1 AS `dated`, + 1 AS `Dolares`, + 1 AS `rate` */; SET character_set_client = @saved_cs_client; -- @@ -28047,11 +28035,10 @@ DROP TABLE IF EXISTS `exchangeInsuranceIn`; /*!50001 DROP VIEW IF EXISTS `exchangeInsuranceIn`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `exchangeInsuranceIn` ( - `dated` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `rate` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `exchangeInsuranceIn` AS SELECT + 1 AS `dated`, + 1 AS `amount`, + 1 AS `rate` */; SET character_set_client = @saved_cs_client; -- @@ -28062,11 +28049,10 @@ DROP TABLE IF EXISTS `exchangeInsuranceOut`; /*!50001 DROP VIEW IF EXISTS `exchangeInsuranceOut`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `exchangeInsuranceOut` ( - `received` tinyint NOT NULL, - `divisa` tinyint NOT NULL, - `rate` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `exchangeInsuranceOut` AS SELECT + 1 AS `received`, + 1 AS `divisa`, + 1 AS `rate` */; SET character_set_client = @saved_cs_client; -- @@ -28077,15 +28063,14 @@ DROP TABLE IF EXISTS `exchangeReportSourcePrevious`; /*!50001 DROP VIEW IF EXISTS `exchangeReportSourcePrevious`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `exchangeReportSourcePrevious` ( - `dated` tinyint NOT NULL, - `amountIn` tinyint NOT NULL, - `rateIn` tinyint NOT NULL, - `amountOut` tinyint NOT NULL, - `rateOut` tinyint NOT NULL, - `amountEntry` tinyint NOT NULL, - `rateEntry` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `exchangeReportSourcePrevious` AS SELECT + 1 AS `dated`, + 1 AS `amountIn`, + 1 AS `rateIn`, + 1 AS `amountOut`, + 1 AS `rateOut`, + 1 AS `amountEntry`, + 1 AS `rateEntry` */; SET character_set_client = @saved_cs_client; -- @@ -28164,17 +28149,17 @@ BEGIN SET NEW.editorFk = account.myUser_getId(); - IF NEW.freightItemFk IS NOT NULL THEN + IF NEW.freightItemFk IS NOT NULL THEN UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk; - SELECT IFNULL(MAX(counter),0) +1 INTO intcounter - FROM expedition e - INNER JOIN ticket t1 ON e.ticketFk = t1.id + SELECT IFNULL(MAX(counter),0) +1 INTO intcounter + FROM expedition e + INNER JOIN ticket t1 ON e.ticketFk = t1.id LEFT JOIN ticketState ts ON ts.ticket = t1.id - INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) + INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) AND t1.warehouseFk = t2.warehouseFk - WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk + WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk AND t1.agencyModeFk = t2.agencyModeFk; SET NEW.`counter` = intcounter; @@ -28201,9 +28186,9 @@ BEGIN SET NEW.editorFk = account.myUser_getId(); IF NEW.counter <> OLD.counter THEN - IF (SELECT COUNT(*) FROM expedition e + IF (SELECT COUNT(*) FROM expedition e INNER JOIN ticket t1 ON e.ticketFk = t1.id - INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) + INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) WHERE t1.id = NEW.ticketFk AND counter = NEW.counter) > 0 THEN SET NEW.id = NULL; END IF; @@ -28227,11 +28212,11 @@ DELIMITER ;; BEFORE DELETE ON `expedition` FOR EACH ROW BEGIN - UPDATE ticket t - SET packages = (SELECT COUNT(counter)-1 + UPDATE ticket t + SET packages = (SELECT COUNT(counter)-1 FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.freightItemFk) - WHERE t.id = OLD.ticketFk; - + WHERE t.id = OLD.ticketFk; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28274,6 +28259,7 @@ CREATE TABLE `expeditionBoxVol` ( `boxFk` int(11) NOT NULL, `m3` double NOT NULL, `ratio` double NOT NULL, + `code` varchar(45) DEFAULT NULL, PRIMARY KEY (`boxFk`), CONSTRAINT `expeditionBoxVol_FK` FOREIGN KEY (`boxFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Establece el volumen de cada servicio para poder comparar el teorico y el real en el control de portes'; @@ -28287,19 +28273,18 @@ DROP TABLE IF EXISTS `expeditionCommon`; /*!50001 DROP VIEW IF EXISTS `expeditionCommon`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionCommon` ( - `truckFk` tinyint NOT NULL, - `eta` tinyint NOT NULL, - `description` tinyint NOT NULL, - `palletFk` tinyint NOT NULL, - `routeFk` tinyint NOT NULL, - `scanFk` tinyint NOT NULL, - `expeditionFk` tinyint NOT NULL, - `expeditionTruckFk` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `lastPacked` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionCommon` AS SELECT + 1 AS `truckFk`, + 1 AS `eta`, + 1 AS `description`, + 1 AS `palletFk`, + 1 AS `routeFk`, + 1 AS `scanFk`, + 1 AS `expeditionFk`, + 1 AS `expeditionTruckFk`, + 1 AS `warehouseFk`, + 1 AS `lastPacked`, + 1 AS `ticketFk` */; SET character_set_client = @saved_cs_client; -- @@ -28370,13 +28355,13 @@ DELIMITER ;; BEGIN DECLARE vNewPosition INT; - + SELECT MAX(position) + 1 INTO vNewPosition FROM vn.expeditionPallet WHERE truckFk = NEW.truckFk; - + SET NEW.position = IFNULL(vNewPosition,1); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28392,16 +28377,15 @@ DROP TABLE IF EXISTS `expeditionPallet_Print`; /*!50001 DROP VIEW IF EXISTS `expeditionPallet_Print`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionPallet_Print` ( - `truck` tinyint NOT NULL, - `routeFk` tinyint NOT NULL, - `zone` tinyint NOT NULL, - `eti` tinyint NOT NULL, - `palletFk` tinyint NOT NULL, - `isMatch` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `nombreDia` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionPallet_Print` AS SELECT + 1 AS `truck`, + 1 AS `routeFk`, + 1 AS `zone`, + 1 AS `eti`, + 1 AS `palletFk`, + 1 AS `isMatch`, + 1 AS `warehouseFk`, + 1 AS `nombreDia` */; SET character_set_client = @saved_cs_client; -- @@ -28412,14 +28396,13 @@ DROP TABLE IF EXISTS `expeditionRoute_Monitor`; /*!50001 DROP VIEW IF EXISTS `expeditionRoute_Monitor`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionRoute_Monitor` ( - `routeFk` tinyint NOT NULL, - `tickets` tinyint NOT NULL, - `expeditions` tinyint NOT NULL, - `scanned` tinyint NOT NULL, - `lastPacked` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionRoute_Monitor` AS SELECT + 1 AS `routeFk`, + 1 AS `tickets`, + 1 AS `expeditions`, + 1 AS `scanned`, + 1 AS `lastPacked`, + 1 AS `created` */; SET character_set_client = @saved_cs_client; -- @@ -28430,14 +28413,13 @@ DROP TABLE IF EXISTS `expeditionRoute_freeTickets`; /*!50001 DROP VIEW IF EXISTS `expeditionRoute_freeTickets`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionRoute_freeTickets` ( - `routeFk` tinyint NOT NULL, - `ticket` tinyint NOT NULL, - `code` tinyint NOT NULL, - `almacen` tinyint NOT NULL, - `updated` tinyint NOT NULL, - `parkingCode` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionRoute_freeTickets` AS SELECT + 1 AS `routeFk`, + 1 AS `ticket`, + 1 AS `code`, + 1 AS `almacen`, + 1 AS `updated`, + 1 AS `parkingCode` */; SET character_set_client = @saved_cs_client; -- @@ -28478,7 +28460,7 @@ DELIMITER ;; BEGIN SET NEW.workerFk = vn.getUser(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28494,17 +28476,16 @@ DROP TABLE IF EXISTS `expeditionScan_Monitor`; /*!50001 DROP VIEW IF EXISTS `expeditionScan_Monitor`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionScan_Monitor` ( - `truckFk` tinyint NOT NULL, - `ETD` tinyint NOT NULL, - `description` tinyint NOT NULL, - `palletFk` tinyint NOT NULL, - `position` tinyint NOT NULL, - `built` tinyint NOT NULL, - `scanFk` tinyint NOT NULL, - `expeditionFk` tinyint NOT NULL, - `scanned` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionScan_Monitor` AS SELECT + 1 AS `truckFk`, + 1 AS `ETD`, + 1 AS `description`, + 1 AS `palletFk`, + 1 AS `position`, + 1 AS `built`, + 1 AS `scanFk`, + 1 AS `expeditionFk`, + 1 AS `scanned` */; SET character_set_client = @saved_cs_client; -- @@ -28540,9 +28521,9 @@ DELIMITER ;; BEFORE INSERT ON expeditionState FOR EACH ROW BEGIN - + SET NEW.userFk = account.myUser_getId(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28566,7 +28547,7 @@ BEGIN UPDATE vn.expedition e SET e.stateTypeFk = NEW.typeFk WHERE e.id = NEW.expeditionFk; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28597,22 +28578,21 @@ DROP TABLE IF EXISTS `expeditionSticker`; /*!50001 DROP VIEW IF EXISTS `expeditionSticker`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionSticker` ( - `expeditionFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `addressFk` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `street` tinyint NOT NULL, - `postalCode` tinyint NOT NULL, - `city` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `routeFk` tinyint NOT NULL, - `beachFk` tinyint NOT NULL, - `zona` tinyint NOT NULL, - `province` tinyint NOT NULL, - `phone` tinyint NOT NULL, - `workerCode` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionSticker` AS SELECT + 1 AS `expeditionFk`, + 1 AS `ticketFk`, + 1 AS `addressFk`, + 1 AS `clientFk`, + 1 AS `street`, + 1 AS `postalCode`, + 1 AS `city`, + 1 AS `nickname`, + 1 AS `routeFk`, + 1 AS `beachFk`, + 1 AS `zona`, + 1 AS `province`, + 1 AS `phone`, + 1 AS `workerCode` */; SET character_set_client = @saved_cs_client; -- @@ -28623,12 +28603,11 @@ DROP TABLE IF EXISTS `expeditionTicket_NoBoxes`; /*!50001 DROP VIEW IF EXISTS `expeditionTicket_NoBoxes`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionTicket_NoBoxes` ( - `ticketFk` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `routeFk` tinyint NOT NULL, - `description` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionTicket_NoBoxes` AS SELECT + 1 AS `ticketFk`, + 1 AS `warehouseFk`, + 1 AS `routeFk`, + 1 AS `description` */; SET character_set_client = @saved_cs_client; -- @@ -28639,14 +28618,13 @@ DROP TABLE IF EXISTS `expeditionTimeExpended`; /*!50001 DROP VIEW IF EXISTS `expeditionTimeExpended`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionTimeExpended` ( - `ticketFk` tinyint NOT NULL, - `started` tinyint NOT NULL, - `finished` tinyint NOT NULL, - `cajas` tinyint NOT NULL, - `code` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionTimeExpended` AS SELECT + 1 AS `ticketFk`, + 1 AS `started`, + 1 AS `finished`, + 1 AS `cajas`, + 1 AS `code`, + 1 AS `warehouseFk` */; SET character_set_client = @saved_cs_client; -- @@ -28675,7 +28653,7 @@ CREATE TABLE `expeditionTruck` ( CONSTRAINT `expeditionTruck_FK_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `expeditionTruck_FK_2` FOREIGN KEY (`roadmapFk`) REFERENCES `roadmap` (`id`) ON UPDATE CASCADE, CONSTRAINT `expeditionTruck_FK_3` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Distintas paradas que hacen los trocales'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -28730,18 +28708,17 @@ DROP TABLE IF EXISTS `expeditionTruck_Control`; /*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionTruck_Control` ( - `id` tinyint NOT NULL, - `ETD` tinyint NOT NULL, - `description` tinyint NOT NULL, - `ticketsSinBultos` tinyint NOT NULL, - `pallets` tinyint NOT NULL, - `routes` tinyint NOT NULL, - `scans` tinyint NOT NULL, - `expeditions` tinyint NOT NULL, - `fallos` tinyint NOT NULL, - `lastPacked` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionTruck_Control` AS SELECT + 1 AS `id`, + 1 AS `ETD`, + 1 AS `description`, + 1 AS `ticketsSinBultos`, + 1 AS `pallets`, + 1 AS `routes`, + 1 AS `scans`, + 1 AS `expeditions`, + 1 AS `fallos`, + 1 AS `lastPacked` */; SET character_set_client = @saved_cs_client; -- @@ -28752,17 +28729,16 @@ DROP TABLE IF EXISTS `expeditionTruck_Control_Detail`; /*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control_Detail`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionTruck_Control_Detail` ( - `id` tinyint NOT NULL, - `eta` tinyint NOT NULL, - `destino` tinyint NOT NULL, - `pallet` tinyint NOT NULL, - `routes` tinyint NOT NULL, - `scans` tinyint NOT NULL, - `destinos` tinyint NOT NULL, - `fallos` tinyint NOT NULL, - `lastPacked` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionTruck_Control_Detail` AS SELECT + 1 AS `id`, + 1 AS `eta`, + 1 AS `destino`, + 1 AS `pallet`, + 1 AS `routes`, + 1 AS `scans`, + 1 AS `destinos`, + 1 AS `fallos`, + 1 AS `lastPacked` */; SET character_set_client = @saved_cs_client; -- @@ -28773,18 +28749,17 @@ DROP TABLE IF EXISTS `expeditionTruck_Control_Detail_Pallet`; /*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control_Detail_Pallet`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionTruck_Control_Detail_Pallet` ( - `id` tinyint NOT NULL, - `eta` tinyint NOT NULL, - `destino` tinyint NOT NULL, - `pallet` tinyint NOT NULL, - `route` tinyint NOT NULL, - `scans` tinyint NOT NULL, - `destinos` tinyint NOT NULL, - `fallos` tinyint NOT NULL, - `expeditionTruckFk` tinyint NOT NULL, - `lastPacked` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `expeditionTruck_Control_Detail_Pallet` AS SELECT + 1 AS `id`, + 1 AS `eta`, + 1 AS `destino`, + 1 AS `pallet`, + 1 AS `route`, + 1 AS `scans`, + 1 AS `destinos`, + 1 AS `fallos`, + 1 AS `expeditionTruckFk`, + 1 AS `lastPacked` */; SET character_set_client = @saved_cs_client; -- @@ -28896,10 +28871,9 @@ DROP TABLE IF EXISTS `firstTicketShipped`; /*!50001 DROP VIEW IF EXISTS `firstTicketShipped`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `firstTicketShipped` ( - `shipped` tinyint NOT NULL, - `clientFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `firstTicketShipped` AS SELECT + 1 AS `shipped`, + 1 AS `clientFk` */; SET character_set_client = @saved_cs_client; -- @@ -28910,14 +28884,13 @@ DROP TABLE IF EXISTS `floraHollandBuyedItems`; /*!50001 DROP VIEW IF EXISTS `floraHollandBuyedItems`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `floraHollandBuyedItems` ( - `itemFk` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `buyingValue` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `companyFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `floraHollandBuyedItems` AS SELECT + 1 AS `itemFk`, + 1 AS `longName`, + 1 AS `quantity`, + 1 AS `buyingValue`, + 1 AS `landed`, + 1 AS `companyFk` */; SET character_set_client = @saved_cs_client; -- @@ -28935,6 +28908,7 @@ CREATE TABLE `floramondoConfig` ( `MaxLatestOrderHour` int(11) DEFAULT 12 COMMENT 'Hora máxima para aceptar pedidos hoy', `LastUpdated` datetime DEFAULT NULL, `itemMaxSize` int(11) DEFAULT NULL COMMENT 'tamaño maximo de los articulos a mostrar', + `daysToKeepItem` int(4) DEFAULT NULL COMMENT 'Número de dias para mantener artículos', PRIMARY KEY (`id`), KEY `floramondoConfigWarehouseIn_idx` (`warehouseInFk`), CONSTRAINT `floramondoConfigWarehouseInFk` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE @@ -29395,10 +29369,9 @@ DROP TABLE IF EXISTS `inkL10n`; /*!50001 DROP VIEW IF EXISTS `inkL10n`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `inkL10n` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `inkL10n` AS SELECT + 1 AS `id`, + 1 AS `name` */; SET character_set_client = @saved_cs_client; -- @@ -29499,16 +29472,15 @@ DROP TABLE IF EXISTS `invoiceCorrectionDataSource`; /*!50001 DROP VIEW IF EXISTS `invoiceCorrectionDataSource`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `invoiceCorrectionDataSource` ( - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `price` tinyint NOT NULL, - `discount` tinyint NOT NULL, - `refFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `invoiceCorrectionDataSource` AS SELECT + 1 AS `itemFk`, + 1 AS `quantity`, + 1 AS `concept`, + 1 AS `price`, + 1 AS `discount`, + 1 AS `refFk`, + 1 AS `saleFk`, + 1 AS `shipped` */; SET character_set_client = @saved_cs_client; -- @@ -29572,7 +29544,9 @@ CREATE TABLE `invoiceIn` ( KEY `invoiceIn_withholdingFk_idx` (`withholdingSageFk`), KEY `invoiceIn_expenceFkDeductible_idx` (`expenceFkDeductible`), KEY `invoiceIn_fk_editor` (`editorFk`), + KEY `invoiceIn_FK` (`currencyFk`), CONSTRAINT `invoiceInCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `invoiceIn_FK` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_expenceFkDeductible` FOREIGN KEY (`expenceFkDeductible`) REFERENCES `expence` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), CONSTRAINT `invoiceIn_ibfk_3` FOREIGN KEY (`cplusSubjectOpFk`) REFERENCES `cplusSubjectOp` (`id`) ON UPDATE CASCADE, @@ -29604,42 +29578,42 @@ BEGIN DECLARE vWithholdingSageFk INT; SET NEW.editorFk = account.myUser_getId(); - - SELECT withholdingSageFk INTO vWithholdingSageFk - FROM vn.supplier + + SELECT withholdingSageFk INTO vWithholdingSageFk + FROM vn.supplier WHERE id = NEW.supplierFk; - SET NEW.withholdingSageFk = vWithholdingSageFk; - - SELECT countryFk, isActive INTO vIssuingCountry, vActive - FROM vn.supplier + SET NEW.withholdingSageFk = vWithholdingSageFk; + + SELECT countryFk, isActive INTO vIssuingCountry, vActive + FROM vn.supplier WHERE id = NEW.supplierFk; - - SELECT countryFk INTO vhostCountry - FROM vn.supplier + + SELECT countryFk INTO vhostCountry + FROM vn.supplier WHERE id = NEW.companyFk; IF vActive = 0 THEN CALL util.throw('INACTIVE_PROVIDER'); END IF; - - IF (SELECT COUNT(*) FROM vn.invoiceIn - WHERE supplierRef = NEW.supplierRef - AND supplierFk = NEW.supplierFk + + IF (SELECT COUNT(*) FROM vn.invoiceIn + WHERE supplierRef = NEW.supplierRef + AND supplierFk = NEW.supplierFk AND YEAR(issued) = YEAR(NEW.issued) ) THEN CALL util.throw('reference duplicated'); END IF; - + SELECT CASE WHEN (SELECT account FROM vn.supplier where id = NEW.supplierFk) LIKE '___3______' THEN 'C' - WHEN (SELECT vIssuingCountry=vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry + WHEN (SELECT vIssuingCountry=vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry where p1.CEE < 2 and p2.CEE < 2) = 1 THEN 'R' - WHEN (SELECT vIssuingCountry <> vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry - where p1.CEE < 2 and p2.CEE < 2) = 1 THEN 'E' + WHEN (SELECT vIssuingCountry <> vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry + where p1.CEE < 2 and p2.CEE < 2) = 1 THEN 'E' WHEN (SELECT vIssuingCountry<>vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry - where NOT p1.CEE < 2 AND not p1.id = 1) = 1 THEN 'W' + where NOT p1.CEE < 2 AND not p1.id = 1) = 1 THEN 'W' END INTO vSerie; - + SET NEW.serial = IFNULL(vSerie,'R'); END */;; @@ -29666,9 +29640,9 @@ BEGIN SET NEW.editorFk = account.myUser_getId(); - IF (SELECT COUNT(*) FROM vn.invoiceIn - WHERE supplierRef = NEW.supplierRef - AND supplierFk = NEW.supplierFk + IF (SELECT COUNT(*) FROM vn.invoiceIn + WHERE supplierRef = NEW.supplierRef + AND supplierFk = NEW.supplierFk AND YEAR(issued) = YEAR(NEW.issued) AND id <> NEW.id ) THEN @@ -29678,7 +29652,7 @@ BEGIN IF NEW.supplierFk != OLD.supplierFk THEN CALL supplier_checkIsActive(NEW.supplierFk); SELECT withholdingSageFk INTO vWithholdingSageFk - FROM vn.supplier + FROM vn.supplier WHERE id = NEW.supplierFk; SET NEW.withholdingSageFk = vWithholdingSageFk; END IF; @@ -29703,23 +29677,23 @@ DELIMITER ;; FOR EACH ROW BEGIN - IF NEW.issued != OLD.issued + IF NEW.issued != OLD.issued OR NEW.currencyFk != OLD.currencyFk THEN UPDATE invoiceInTax iit JOIN invoiceIn ii ON ii.id = iit.invoiceInFk LEFT JOIN referenceRate rr ON rr.dated = ii.issued - AND rr.currencyFk = ii.currencyFk + AND rr.currencyFk = ii.currencyFk SET iit.taxableBase = IF(iit.foreignValue IS NULL, iit.taxableBase, iit.foreignValue / rr.value) WHERE ii.id = NEW.id; - + UPDATE invoiceInDueDay iidd JOIN invoiceIn ii ON ii.id = iidd.invoiceInFk LEFT JOIN referenceRate rr ON rr.dated = ii.issued - AND rr.currencyFk = ii.currencyFk + AND rr.currencyFk = ii.currencyFk SET iidd.amount = IF(iidd.foreignValue IS NULL, iidd.amount, iidd.foreignValue / rr.value) - WHERE ii.id = NEW.id; - + WHERE ii.id = NEW.id; + END IF; END */;; @@ -29787,9 +29761,12 @@ CREATE TABLE `invoiceInDueDay` ( `amount` decimal(10,2) NOT NULL DEFAULT 0.00, `foreignValue` decimal(10,2) DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), + `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `recibida_id` (`invoiceInFk`), KEY `banco_id` (`bankFk`), + KEY `invoiceInDueDay_fk_editor` (`editorFk`), + CONSTRAINT `invoiceInDueDay_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), CONSTRAINT `invoiceInDueDay_ibfk_6` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceInDueDay_ibfk_7` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -29809,12 +29786,14 @@ DELIMITER ;; BEGIN DECLARE vIsNotified BOOLEAN; - SELECT isNotified INTO vIsNotified - FROM vn.invoiceIn ii + SET NEW.editorFk = account.myUser_getId(); + + SELECT isNotified INTO vIsNotified + FROM vn.invoiceIn ii JOIN vn.supplier s ON s.id = ii.supplierFk JOIN vn.payMethod pm ON pm.id = s.payMethodFk WHERE ii.id = NEW.invoiceInFk; - + IF (NEW.dueDated <= util.VN_CURDATE() AND vIsNotified) THEN CALL mail_insert( @@ -29822,12 +29801,12 @@ BEGIN 'begonya@verdnatura.es', 'Añadido vencimiento en el pasado', CONCAT( - account.myUser_getName(), ' ha añadido un vencimiento de ', + account.myUser_getName(), ' ha añadido un vencimiento de ', NEW.amount, '€ en una fecha pasada en la recibida ', NEW.invoiceInFk ) ); END IF; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -29849,12 +29828,14 @@ DELIMITER ;; BEGIN DECLARE vIsNotified BOOLEAN; - SELECT isNotified INTO vIsNotified - FROM vn.invoiceIn ii + SET NEW.editorFk = account.myUser_getId(); + + SELECT isNotified INTO vIsNotified + FROM vn.invoiceIn ii JOIN vn.supplier s ON s.id = ii.supplierFk JOIN vn.payMethod pm ON pm.id = s.payMethodFk WHERE ii.id = NEW.invoiceInFk; - + IF (NEW.dueDated <= util.VN_CURDATE() AND vIsNotified) THEN CALL mail_insert( @@ -29862,12 +29843,36 @@ BEGIN 'begonya@verdnatura.es', 'Añadido vencimiento en el pasado', CONCAT( - account.myUser_getName(), ' ha añadido un vencimiento de ', + account.myUser_getName(), ' ha añadido un vencimiento de ', NEW.amount,'€ en una fecha pasada en la recibida ',NEW.invoiceInFk ) ); END IF; - + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInDueDay_afterDelete` + AFTER DELETE ON `invoiceInDueDay` + FOR EACH ROW +BEGIN + INSERT INTO invoiceInLog + SET `action` = 'delete', + `changedModel` = 'InvoiceInDueDay', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -29914,7 +29919,7 @@ CREATE TABLE `invoiceInLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `changedModel` enum('InvoiceIn','invoiceInTax') NOT NULL DEFAULT 'InvoiceIn', + `changedModel` enum('InvoiceIn','InvoiceInTax','InvoiceInDueDay') NOT NULL DEFAULT 'InvoiceIn', `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), `changedModelId` int(11) NOT NULL, @@ -30254,6 +30259,20 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `invoiceOutConfig` +-- + +DROP TABLE IF EXISTS `invoiceOutConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoiceOutConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `parallelism` int(10) unsigned NOT NULL DEFAULT 1, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `invoiceOutExpence` -- @@ -30412,6 +30431,8 @@ CREATE TABLE `item` ( `lastUsed` datetime DEFAULT current_timestamp(), `weightByPiece` int(10) unsigned DEFAULT NULL COMMENT 'peso por defecto para un articulo por tallo/unidad', `editorFk` int(10) unsigned DEFAULT NULL, + `recycledPlastic` int(11) DEFAULT NULL, + `nonRecycledPlastic` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `item_supplyResponseFk_idx` (`supplyResponseFk`), KEY `Color` (`inkFk`), @@ -30764,10 +30785,9 @@ DROP TABLE IF EXISTS `itemBotanicalWithGenus`; /*!50001 DROP VIEW IF EXISTS `itemBotanicalWithGenus`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemBotanicalWithGenus` ( - `itemFk` tinyint NOT NULL, - `ediBotanic` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemBotanicalWithGenus` AS SELECT + 1 AS `itemFk`, + 1 AS `ediBotanic` */; SET character_set_client = @saved_cs_client; -- @@ -30844,10 +30864,9 @@ DROP TABLE IF EXISTS `itemCategoryL10n`; /*!50001 DROP VIEW IF EXISTS `itemCategoryL10n`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemCategoryL10n` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemCategoryL10n` AS SELECT + 1 AS `id`, + 1 AS `name` */; SET character_set_client = @saved_cs_client; -- @@ -30873,10 +30892,9 @@ DROP TABLE IF EXISTS `itemColor`; /*!50001 DROP VIEW IF EXISTS `itemColor`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemColor` ( - `itemFk` tinyint NOT NULL, - `color` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemColor` AS SELECT + 1 AS `itemFk`, + 1 AS `color` */; SET character_set_client = @saved_cs_client; -- @@ -30966,15 +30984,15 @@ BEGIN IF NEW.itemFk IN (95, 98) THEN SET NEW.cm3 = 0; END IF; - + IF !(NEW.cm3delivery <=> OLD.cm3delivery) THEN INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id + SELECT r.id FROM vn.itemCost ic JOIN vn.sale s ON s.itemFk = ic.itemFk - JOIN vn.ticket t ON t.id = s.ticketFk AND t.warehouseFk = ic.warehouseFk + JOIN vn.ticket t ON t.id = s.ticketFk AND t.warehouseFk = ic.warehouseFk JOIN vn.route r ON r.id = t.routeFk - WHERE r.isOk = FALSE + WHERE r.isOk = FALSE AND ic.itemFk = NEW.itemFk AND r.created >= util.VN_CURDATE() GROUP BY r.id; @@ -31001,15 +31019,14 @@ DROP TABLE IF EXISTS `itemEntryIn`; /*!50001 DROP VIEW IF EXISTS `itemEntryIn`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemEntryIn` ( - `warehouseInFk` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `isReceived` tinyint NOT NULL, - `isVirtualStock` tinyint NOT NULL, - `entryFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemEntryIn` AS SELECT + 1 AS `warehouseInFk`, + 1 AS `landed`, + 1 AS `itemFk`, + 1 AS `quantity`, + 1 AS `isReceived`, + 1 AS `isVirtualStock`, + 1 AS `entryFk` */; SET character_set_client = @saved_cs_client; -- @@ -31020,14 +31037,13 @@ DROP TABLE IF EXISTS `itemEntryOut`; /*!50001 DROP VIEW IF EXISTS `itemEntryOut`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemEntryOut` ( - `warehouseOutFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `isDelivered` tinyint NOT NULL, - `entryFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemEntryOut` AS SELECT + 1 AS `warehouseOutFk`, + 1 AS `shipped`, + 1 AS `itemFk`, + 1 AS `quantity`, + 1 AS `isDelivered`, + 1 AS `entryFk` */; SET character_set_client = @saved_cs_client; -- @@ -31072,11 +31088,10 @@ DROP TABLE IF EXISTS `itemInk`; /*!50001 DROP VIEW IF EXISTS `itemInk`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemInk` ( - `longName` tinyint NOT NULL, - `inkFk` tinyint NOT NULL, - `color` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemInk` AS SELECT + 1 AS `longName`, + 1 AS `inkFk`, + 1 AS `color` */; SET character_set_client = @saved_cs_client; -- @@ -31192,22 +31207,21 @@ DROP TABLE IF EXISTS `itemPlacementSupplyList`; /*!50001 DROP VIEW IF EXISTS `itemPlacementSupplyList`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemPlacementSupplyList` ( - `id` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `priority` tinyint NOT NULL, - `created` tinyint NOT NULL, - `userFk` tinyint NOT NULL, - `repoUserFk` tinyint NOT NULL, - `saldo` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `subName` tinyint NOT NULL, - `size` tinyint NOT NULL, - `workerCode` tinyint NOT NULL, - `repoCode` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemPlacementSupplyList` AS SELECT + 1 AS `id`, + 1 AS `itemFk`, + 1 AS `quantity`, + 1 AS `priority`, + 1 AS `created`, + 1 AS `userFk`, + 1 AS `repoUserFk`, + 1 AS `saldo`, + 1 AS `longName`, + 1 AS `subName`, + 1 AS `size`, + 1 AS `workerCode`, + 1 AS `repoCode`, + 1 AS `sectorFk` */; SET character_set_client = @saved_cs_client; -- @@ -31218,10 +31232,9 @@ DROP TABLE IF EXISTS `itemProductor`; /*!50001 DROP VIEW IF EXISTS `itemProductor`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemProductor` ( - `itemFk` tinyint NOT NULL, - `productor` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemProductor` AS SELECT + 1 AS `itemFk`, + 1 AS `productor` */; SET character_set_client = @saved_cs_client; -- @@ -31250,13 +31263,12 @@ DROP TABLE IF EXISTS `itemSearch`; /*!50001 DROP VIEW IF EXISTS `itemSearch`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemSearch` ( - `itemFk` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `shipped` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemSearch` AS SELECT + 1 AS `itemFk`, + 1 AS `concept`, + 1 AS `quantity`, + 1 AS `nickname`, + 1 AS `shipped` */; SET character_set_client = @saved_cs_client; -- @@ -31300,10 +31312,10 @@ DELIMITER ;; BEFORE INSERT ON `itemShelving` FOR EACH ROW BEGIN - + SET NEW.userFk = account.myUser_getId(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31357,7 +31369,9 @@ DELIMITER ;; BEFORE UPDATE ON `itemShelving` FOR EACH ROW BEGIN - SET NEW.userFk = account.myUser_getId(); + IF NEW.userFk IS NULL THEN + SET NEW.userFk = account.myUser_getId(); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31410,8 +31424,8 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_DELETE` BEFORE DELETE ON `itemShelving` FOR EACH ROW -INSERT INTO vn.itemShelvingLog(itemShelvingFk, - workerFk, +INSERT INTO vn.itemShelvingLog(itemShelvingFk, + workerFk, accion, shelvingFk, itemFk) @@ -31434,31 +31448,30 @@ DROP TABLE IF EXISTS `itemShelvingAvailable`; /*!50001 DROP VIEW IF EXISTS `itemShelvingAvailable`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingAvailable` ( - `saleFk` tinyint NOT NULL, - `Modificado` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `isPicked` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `size` tinyint NOT NULL, - `Estado` tinyint NOT NULL, - `sectorProdPriority` tinyint NOT NULL, - `available` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL, - `matricula` tinyint NOT NULL, - `parking` tinyint NOT NULL, - `itemShelving` tinyint NOT NULL, - `Agency` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `grouping` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `hour` tinyint NOT NULL, - `isPreviousPreparable` tinyint NOT NULL, - `physicalVolume` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemShelvingAvailable` AS SELECT + 1 AS `saleFk`, + 1 AS `Modificado`, + 1 AS `ticketFk`, + 1 AS `isPicked`, + 1 AS `itemFk`, + 1 AS `quantity`, + 1 AS `concept`, + 1 AS `size`, + 1 AS `Estado`, + 1 AS `sectorProdPriority`, + 1 AS `available`, + 1 AS `sectorFk`, + 1 AS `matricula`, + 1 AS `parking`, + 1 AS `itemShelving`, + 1 AS `Agency`, + 1 AS `shipped`, + 1 AS `grouping`, + 1 AS `packing`, + 1 AS `hour`, + 1 AS `isPreviousPreparable`, + 1 AS `physicalVolume`, + 1 AS `warehouseFk` */; SET character_set_client = @saved_cs_client; -- @@ -31469,18 +31482,17 @@ DROP TABLE IF EXISTS `itemShelvingList`; /*!50001 DROP VIEW IF EXISTS `itemShelvingList`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingList` ( - `shelvingFk` tinyint NOT NULL, - `visible` tinyint NOT NULL, - `created` tinyint NOT NULL, - `parking` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `size` tinyint NOT NULL, - `subName` tinyint NOT NULL, - `parked` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemShelvingList` AS SELECT + 1 AS `shelvingFk`, + 1 AS `visible`, + 1 AS `created`, + 1 AS `parking`, + 1 AS `itemFk`, + 1 AS `longName`, + 1 AS `size`, + 1 AS `subName`, + 1 AS `parked`, + 1 AS `sectorFk` */; SET character_set_client = @saved_cs_client; -- @@ -31505,7 +31517,9 @@ CREATE TABLE `itemShelvingLog` ( `packing` int(11) DEFAULT NULL, `stars` int(11) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `itemShelving_Log_FK` (`itemShelvingFk`) + KEY `itemShelving_Log_FK` (`itemShelvingFk`), + KEY `itemShelvingLog_itemFk_IDX` (`itemFk`) USING BTREE, + KEY `itemShelvingLog_shelvingFk_IDX` (`shelvingFk`) USING BTREE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -31541,21 +31555,20 @@ DROP TABLE IF EXISTS `itemShelvingPlacementSupplyStock`; /*!50001 DROP VIEW IF EXISTS `itemShelvingPlacementSupplyStock`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingPlacementSupplyStock` ( - `itemShelvingFk` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `stock` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `size` tinyint NOT NULL, - `subName` tinyint NOT NULL, - `shelving` tinyint NOT NULL, - `parking` tinyint NOT NULL, - `created` tinyint NOT NULL, - `priority` tinyint NOT NULL, - `parkingFk` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemShelvingPlacementSupplyStock` AS SELECT + 1 AS `itemShelvingFk`, + 1 AS `itemFk`, + 1 AS `packing`, + 1 AS `stock`, + 1 AS `longName`, + 1 AS `size`, + 1 AS `subName`, + 1 AS `shelving`, + 1 AS `parking`, + 1 AS `created`, + 1 AS `priority`, + 1 AS `parkingFk`, + 1 AS `sectorFk` */; SET character_set_client = @saved_cs_client; -- @@ -31596,7 +31609,7 @@ DELIMITER ;; BEGIN UPDATE vn.sale - SET isPicked = TRUE + SET isPicked = TRUE WHERE id = NEW.saleFk; END */;; @@ -31614,14 +31627,13 @@ DROP TABLE IF EXISTS `itemShelvingSaleSum`; /*!50001 DROP VIEW IF EXISTS `itemShelvingSaleSum`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingSaleSum` ( - `id` tinyint NOT NULL, - `itemShelvingFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `created` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemShelvingSaleSum` AS SELECT + 1 AS `id`, + 1 AS `itemShelvingFk`, + 1 AS `saleFk`, + 1 AS `quantity`, + 1 AS `created`, + 1 AS `sectorFk` */; SET character_set_client = @saved_cs_client; -- @@ -31632,23 +31644,22 @@ DROP TABLE IF EXISTS `itemShelvingStock`; /*!50001 DROP VIEW IF EXISTS `itemShelvingStock`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingStock` ( - `itemFk` tinyint NOT NULL, - `visible` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `grouping` tinyint NOT NULL, - `sector` tinyint NOT NULL, - `visibleOriginal` tinyint NOT NULL, - `removed` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `shelvingFk` tinyint NOT NULL, - `parkingCode` tinyint NOT NULL, - `parkingFk` tinyint NOT NULL, - `itemShelvingFk` tinyint NOT NULL, - `created` tinyint NOT NULL, - `isPreviousPrepared` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemShelvingStock` AS SELECT + 1 AS `itemFk`, + 1 AS `visible`, + 1 AS `packing`, + 1 AS `grouping`, + 1 AS `sector`, + 1 AS `visibleOriginal`, + 1 AS `removed`, + 1 AS `sectorFk`, + 1 AS `warehouseFk`, + 1 AS `shelvingFk`, + 1 AS `parkingCode`, + 1 AS `parkingFk`, + 1 AS `itemShelvingFk`, + 1 AS `created`, + 1 AS `isPreviousPrepared` */; SET character_set_client = @saved_cs_client; -- @@ -31659,21 +31670,20 @@ DROP TABLE IF EXISTS `itemShelvingStockFull`; /*!50001 DROP VIEW IF EXISTS `itemShelvingStockFull`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingStockFull` ( - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `grouping` tinyint NOT NULL, - `sector` tinyint NOT NULL, - `removed` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `shelvingFk` tinyint NOT NULL, - `parkingCode` tinyint NOT NULL, - `parkingFk` tinyint NOT NULL, - `itemShelvingFk` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemShelvingStockFull` AS SELECT + 1 AS `itemFk`, + 1 AS `quantity`, + 1 AS `packing`, + 1 AS `grouping`, + 1 AS `sector`, + 1 AS `removed`, + 1 AS `sectorFk`, + 1 AS `warehouseFk`, + 1 AS `shelvingFk`, + 1 AS `parkingCode`, + 1 AS `parkingFk`, + 1 AS `itemShelvingFk`, + 1 AS `created` */; SET character_set_client = @saved_cs_client; -- @@ -31684,11 +31694,10 @@ DROP TABLE IF EXISTS `itemShelvingStockRemoved`; /*!50001 DROP VIEW IF EXISTS `itemShelvingStockRemoved`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingStockRemoved` ( - `itemShelvingFk` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `removed` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemShelvingStockRemoved` AS SELECT + 1 AS `itemShelvingFk`, + 1 AS `itemFk`, + 1 AS `removed` */; SET character_set_client = @saved_cs_client; -- @@ -31699,11 +31708,10 @@ DROP TABLE IF EXISTS `itemShelvingStock_byWarehouse`; /*!50001 DROP VIEW IF EXISTS `itemShelvingStock_byWarehouse`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingStock_byWarehouse` ( - `itemFk` tinyint NOT NULL, - `visible` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemShelvingStock_byWarehouse` AS SELECT + 1 AS `itemFk`, + 1 AS `visible`, + 1 AS `warehouseFk` */; SET character_set_client = @saved_cs_client; -- @@ -31717,7 +31725,7 @@ CREATE TABLE `itemTag` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, `tagFk` int(11) NOT NULL, - `value` varchar(50) NOT NULL, + `value` varchar(50) DEFAULT NULL, `intValue` int(11) DEFAULT NULL, `priority` int(2) NOT NULL DEFAULT 0, `editorFk` int(10) unsigned DEFAULT NULL, @@ -31764,26 +31772,15 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterInsert` AFTER INSERT ON `itemTag` FOR EACH ROW trig: BEGIN - DECLARE vItemFk INT; - DECLARE visTriggerDisabled BOOL; - - SELECT isItemTagTriggerDisabled INTO visTriggerDisabled - FROM vn.itemConfig; - - IF @isTriggerDisabled OR visTriggerDisabled THEN + IF @isTriggerDisabled THEN LEAVE trig; END IF; - SET vItemFk = NEW.itemFk; - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - SELECT vItemFk id; - CALL item_refreshTags(); - DROP TEMPORARY TABLE tmp.item; + CALL item_refreshFromTags(NEW.itemFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31802,9 +31799,9 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeUpdate` BEFORE UPDATE ON `itemTag` FOR EACH ROW -BEGIN +BEGIN SET NEW.editorFk = account.myUser_getId(); - + IF !(OLD.`value` <=> NEW.`value`) OR !(OLD.intValue <=> NEW.intValue) THEN SET NEW.intValue = itemTag_getIntValue(NEW.`value`); @@ -31837,7 +31834,7 @@ trig: BEGIN IF @isTriggerDisabled OR visTriggerDisabled THEN LEAVE trig; END IF; - + SET vItemFk = NEW.itemFk; DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item @@ -31864,28 +31861,17 @@ DELIMITER ;; AFTER DELETE ON `itemTag` FOR EACH ROW trig: BEGIN - DECLARE vItemFk INT; - DECLARE visTriggerDisabled BOOL; - INSERT INTO itemLog SET `action` = 'delete', `changedModel` = 'ItemTag', `changedModelId` = OLD.id, `userFk` = account.myUser_getId(); - SELECT isItemTagTriggerDisabled INTO visTriggerDisabled - FROM vn.itemConfig; - - IF @isTriggerDisabled OR visTriggerDisabled THEN + IF @isTriggerDisabled THEN LEAVE trig; END IF; - SET vItemFk = OLD.itemFk; - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - SELECT vItemFk id; - CALL item_refreshTags(); - DROP TEMPORARY TABLE tmp.item; + CALL item_refreshFromTags(OLD.itemFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31901,9 +31887,8 @@ DROP TABLE IF EXISTS `itemTagged`; /*!50001 DROP VIEW IF EXISTS `itemTagged`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemTagged` ( - `itemFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemTagged` AS SELECT + 1 AS `itemFk` */; SET character_set_client = @saved_cs_client; -- @@ -32004,17 +31989,16 @@ DROP TABLE IF EXISTS `itemTicketOut`; /*!50001 DROP VIEW IF EXISTS `itemTicketOut`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemTicketOut` ( - `warehouseFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `isPicked` tinyint NOT NULL, - `reserved` tinyint NOT NULL, - `refFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemTicketOut` AS SELECT + 1 AS `warehouseFk`, + 1 AS `shipped`, + 1 AS `itemFk`, + 1 AS `quantity`, + 1 AS `isPicked`, + 1 AS `reserved`, + 1 AS `refFk`, + 1 AS `saleFk`, + 1 AS `ticketFk` */; SET character_set_client = @saved_cs_client; -- @@ -32124,10 +32108,9 @@ DROP TABLE IF EXISTS `itemTypeL10n`; /*!50001 DROP VIEW IF EXISTS `itemTypeL10n`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemTypeL10n` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `itemTypeL10n` AS SELECT + 1 AS `id`, + 1 AS `name` */; SET character_set_client = @saved_cs_client; -- @@ -32178,9 +32161,8 @@ DROP TABLE IF EXISTS `item_Free_Id`; /*!50001 DROP VIEW IF EXISTS `item_Free_Id`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `item_Free_Id` ( - `newId` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `item_Free_Id` AS SELECT + 1 AS `newId` */; SET character_set_client = @saved_cs_client; -- @@ -32191,24 +32173,23 @@ DROP TABLE IF EXISTS `labelInfo`; /*!50001 DROP VIEW IF EXISTS `labelInfo`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `labelInfo` ( - `itemId` tinyint NOT NULL, - `itemName` tinyint NOT NULL, - `stickers` tinyint NOT NULL, - `life` tinyint NOT NULL, - `colorCode` tinyint NOT NULL, - `stems` tinyint NOT NULL, - `category` tinyint NOT NULL, - `productor` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `warehouse_id` tinyint NOT NULL, - `size` tinyint NOT NULL, - `isPickedOff` tinyint NOT NULL, - `notes` tinyint NOT NULL, - `wh_in` tinyint NOT NULL, - `entryId` tinyint NOT NULL, - `buyId` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `labelInfo` AS SELECT + 1 AS `itemId`, + 1 AS `itemName`, + 1 AS `stickers`, + 1 AS `life`, + 1 AS `colorCode`, + 1 AS `stems`, + 1 AS `category`, + 1 AS `productor`, + 1 AS `packing`, + 1 AS `warehouse_id`, + 1 AS `size`, + 1 AS `isPickedOff`, + 1 AS `notes`, + 1 AS `wh_in`, + 1 AS `entryId`, + 1 AS `buyId` */; SET character_set_client = @saved_cs_client; -- @@ -32237,10 +32218,9 @@ DROP TABLE IF EXISTS `lastHourProduction`; /*!50001 DROP VIEW IF EXISTS `lastHourProduction`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `lastHourProduction` ( - `warehouseFk` tinyint NOT NULL, - `m3` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `lastHourProduction` AS SELECT + 1 AS `warehouseFk`, + 1 AS `m3` */; SET character_set_client = @saved_cs_client; -- @@ -32251,21 +32231,20 @@ DROP TABLE IF EXISTS `lastPurchases`; /*!50001 DROP VIEW IF EXISTS `lastPurchases`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `lastPurchases` ( - `landed` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `warehouse` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `subName` tinyint NOT NULL, - `entryFk` tinyint NOT NULL, - `stickers` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `ref` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `pro` tinyint NOT NULL, - `ektRef` tinyint NOT NULL, - `agj` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `lastPurchases` AS SELECT + 1 AS `landed`, + 1 AS `warehouseFk`, + 1 AS `warehouse`, + 1 AS `longName`, + 1 AS `subName`, + 1 AS `entryFk`, + 1 AS `stickers`, + 1 AS `packing`, + 1 AS `ref`, + 1 AS `itemFk`, + 1 AS `pro`, + 1 AS `ektRef`, + 1 AS `agj` */; SET character_set_client = @saved_cs_client; -- @@ -32276,14 +32255,13 @@ DROP TABLE IF EXISTS `lastTopClaims`; /*!50001 DROP VIEW IF EXISTS `lastTopClaims`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `lastTopClaims` ( - `itemFk` tinyint NOT NULL, - `itemName` tinyint NOT NULL, - `itemTypeName` tinyint NOT NULL, - `claimsNumber` tinyint NOT NULL, - `claimedAmount` tinyint NOT NULL, - `totalAmount` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `lastTopClaims` AS SELECT + 1 AS `itemFk`, + 1 AS `itemName`, + 1 AS `itemTypeName`, + 1 AS `claimsNumber`, + 1 AS `claimedAmount`, + 1 AS `totalAmount` */; SET character_set_client = @saved_cs_client; -- @@ -32363,7 +32341,7 @@ DELIMITER ;; BEFORE INSERT ON `machine` FOR EACH ROW BEGIN - + SET NEW.workerFk = vn.getUser(); END */;; @@ -32497,9 +32475,9 @@ DELIMITER ;; BEGIN IF NEW.sender IS NOT NULL THEN - + SET NEW.receiver = NEW.sender; - + END IF; END */;; @@ -32562,8 +32540,8 @@ DELIMITER ;; FOR EACH ROW BEGIN IF (NEW.code IS NULL) THEN - SET NEW.code=CONCAT(NEW.clientFk,'-',(SELECT AUTO_INCREMENT - FROM information_schema.TABLES + SET NEW.code=CONCAT(NEW.clientFk,'-',(SELECT AUTO_INCREMENT + FROM information_schema.TABLES WHERE TABLE_SCHEMA='vn' and TABLE_NAME='mandate')); END IF; END */;; @@ -32784,16 +32762,15 @@ DROP TABLE IF EXISTS `mistake`; /*!50001 DROP VIEW IF EXISTS `mistake`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `mistake` ( - `revisador` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `sacador` tinyint NOT NULL, - `firstName` tinyint NOT NULL, - `lastName` tinyint NOT NULL, - `description` tinyint NOT NULL, - `created` tinyint NOT NULL, - `workerFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `mistake` AS SELECT + 1 AS `revisador`, + 1 AS `concept`, + 1 AS `sacador`, + 1 AS `firstName`, + 1 AS `lastName`, + 1 AS `description`, + 1 AS `created`, + 1 AS `workerFk` */; SET character_set_client = @saved_cs_client; -- @@ -32804,16 +32781,15 @@ DROP TABLE IF EXISTS `mistakeRatio`; /*!50001 DROP VIEW IF EXISTS `mistakeRatio`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `mistakeRatio` ( - `revisador` tinyint NOT NULL, - `sacador` tinyint NOT NULL, - `firstName` tinyint NOT NULL, - `lastName` tinyint NOT NULL, - `description` tinyint NOT NULL, - `created` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `mistakeRatio` AS SELECT + 1 AS `revisador`, + 1 AS `sacador`, + 1 AS `firstName`, + 1 AS `lastName`, + 1 AS `description`, + 1 AS `created`, + 1 AS `workerFk`, + 1 AS `saleFk` */; SET character_set_client = @saved_cs_client; -- @@ -32909,13 +32885,12 @@ DROP TABLE IF EXISTS `newBornSales`; /*!50001 DROP VIEW IF EXISTS `newBornSales`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `newBornSales` ( - `amount` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `userFk` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `firstShipped` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `newBornSales` AS SELECT + 1 AS `amount`, + 1 AS `clientFk`, + 1 AS `userFk`, + 1 AS `dated`, + 1 AS `firstShipped` */; SET character_set_client = @saved_cs_client; -- @@ -33064,12 +33039,11 @@ DROP TABLE IF EXISTS `operatorWorkerCode`; /*!50001 DROP VIEW IF EXISTS `operatorWorkerCode`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `operatorWorkerCode` ( - `workerFk` tinyint NOT NULL, - `fullName` tinyint NOT NULL, - `code` tinyint NOT NULL, - `numberOfWagons` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `operatorWorkerCode` AS SELECT + 1 AS `workerFk`, + 1 AS `fullName`, + 1 AS `code`, + 1 AS `numberOfWagons` */; SET character_set_client = @saved_cs_client; -- @@ -33133,10 +33107,9 @@ DROP TABLE IF EXISTS `originL10n`; /*!50001 DROP VIEW IF EXISTS `originL10n`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `originL10n` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `originL10n` AS SELECT + 1 AS `id`, + 1 AS `name` */; SET character_set_client = @saved_cs_client; -- @@ -33223,10 +33196,9 @@ DROP TABLE IF EXISTS `packageEquivalentItem`; /*!50001 DROP VIEW IF EXISTS `packageEquivalentItem`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `packageEquivalentItem` ( - `itemFk` tinyint NOT NULL, - `equivalentFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `packageEquivalentItem` AS SELECT + 1 AS `itemFk`, + 1 AS `equivalentFk` */; SET character_set_client = @saved_cs_client; -- @@ -33414,6 +33386,23 @@ CREATE TABLE `packingSite` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `packingSiteAdvanced` +-- + +DROP TABLE IF EXISTS `packingSiteAdvanced`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packingSiteAdvanced` ( + `ticketFk` int(11) NOT NULL, + `workerFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`ticketFk`), + KEY `packingSiteAdvanced_FK_1` (`workerFk`), + CONSTRAINT `packingSiteAdvanced_FK` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `packingSiteAdvanced_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `packingSiteConfig` -- @@ -33546,7 +33535,7 @@ DELIMITER ;; BEGIN -- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -33671,13 +33660,13 @@ BEGIN SELECT account INTO cuenta_banco FROM bank WHERE id = NEW.bankFk; - + SELECT account INTO cuenta_proveedor FROM supplier WHERE id = NEW.supplierFk; - + CALL vn.ledger_next(vNewBookEntry); - + INSERT INTO XDiario ( ASIEN, FECHA, SUBCTA, @@ -33703,7 +33692,7 @@ BEGIN cuenta_banco CONTRA, NEW.amount EURODEBE, 0 EUROHABER) gf; - + IF NEW.bankingFees <> 0 THEN INSERT INTO XDiario ( ASIEN, FECHA, @@ -33725,7 +33714,7 @@ BEGIN FROM supplier s JOIN country c ON s.countryFk = c.id WHERE s.id = NEW.supplierFk; - END IF; + END IF; END IF; SET NEW.dueDated = IFNULL(NEW.dueDated, NEW.received); @@ -33733,15 +33722,15 @@ BEGIN SELECT isActive INTO isSupplierActive FROM supplier WHERE id = NEW.supplierFk; - + IF isSupplierActive = FALSE THEN CALL util.throw('SUPPLIER_INACTIVE'); END IF; - + IF ISNULL(NEW.workerFk) THEN SET NEW.workerFk = account.myUser_getId(); END IF; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -33763,12 +33752,12 @@ DELIMITER ;; BEGIN DECLARE vIsPayMethodChecked BOOLEAN; DECLARE vEmail VARCHAR(150); - + SELECT isPayMethodChecked INTO vIsPayMethodChecked FROM supplier WHERE id = NEW.supplierFk; - - + + IF vIsPayMethodChecked = FALSE THEN SELECT notificationEmail INTO vEmail @@ -33906,10 +33895,9 @@ DROP TABLE IF EXISTS `personMedia`; /*!50001 DROP VIEW IF EXISTS `personMedia`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `personMedia` ( - `workerFk` tinyint NOT NULL, - `mediaValue` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `personMedia` AS SELECT + 1 AS `workerFk`, + 1 AS `mediaValue` */; SET character_set_client = @saved_cs_client; -- @@ -33989,12 +33977,11 @@ DROP TABLE IF EXISTS `phoneBook`; /*!50001 DROP VIEW IF EXISTS `phoneBook`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `phoneBook` ( - `Tipo` tinyint NOT NULL, - `Id` tinyint NOT NULL, - `Cliente` tinyint NOT NULL, - `Telefono` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `phoneBook` AS SELECT + 1 AS `Tipo`, + 1 AS `Id`, + 1 AS `Cliente`, + 1 AS `Telefono` */; SET character_set_client = @saved_cs_client; -- @@ -34535,13 +34522,12 @@ DROP TABLE IF EXISTS `productionVolume`; /*!50001 DROP VIEW IF EXISTS `productionVolume`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `productionVolume` ( - `hora` tinyint NOT NULL, - `minuto` tinyint NOT NULL, - `cm3` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `productionVolume` AS SELECT + 1 AS `hora`, + 1 AS `minuto`, + 1 AS `cm3`, + 1 AS `warehouseFk`, + 1 AS `created` */; SET character_set_client = @saved_cs_client; -- @@ -34552,10 +34538,9 @@ DROP TABLE IF EXISTS `productionVolume_LastHour`; /*!50001 DROP VIEW IF EXISTS `productionVolume_LastHour`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `productionVolume_LastHour` ( - `m3` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `productionVolume_LastHour` AS SELECT + 1 AS `m3`, + 1 AS `warehouseFk` */; SET character_set_client = @saved_cs_client; -- @@ -34654,11 +34639,11 @@ DELIMITER ;; BEFORE INSERT ON projectNotes FOR EACH ROW BEGIN - + IF ISNULL(NEW.userFk) THEN - + SET NEW.userFk = account.myUser_getId(); - + END IF; END */;; @@ -34713,11 +34698,14 @@ CREATE TABLE `property` ( `protocol` varchar(100) DEFAULT NULL COMMENT 'numero de protocolo notarial de la escritura de compra venta', `purchased` date NOT NULL DEFAULT curdate() COMMENT 'date of purchase of the property', `booked` date DEFAULT NULL COMMENT 'date of completion of property registration', + `supplierFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `property_FK` (`propertyGroupFk`), KEY `property_FK_1` (`townFk`), KEY `property_company` (`companyFk`), + KEY `propertySupplierFk` (`supplierFk`), CONSTRAINT `propertyCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `propertySupplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `property_FK` FOREIGN KEY (`propertyGroupFk`) REFERENCES `propertyGroup` (`id`) ON UPDATE CASCADE, CONSTRAINT `property_FK_1` FOREIGN KEY (`townFk`) REFERENCES `town` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -34816,10 +34804,10 @@ DELIMITER ;; BEFORE INSERT ON `province` FOR EACH ROW BEGIN - + SET NEW.geoFk = zoneGeo_new('province', NEW.`name`, (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); - + SET NEW.countryFk = (SELECT a.countryFk FROM vn.autonomy a WHERE a.id = NEW.autonomyFk); END */;; @@ -34840,14 +34828,14 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeUpdate` BEFORE UPDATE ON `province` FOR EACH ROW -BEGIN - +BEGIN + IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN - + SET NEW.countryFk = (SELECT a.countryFk FROM vn.autonomy a WHERE a.id = NEW.autonomyFk); END IF; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -34863,19 +34851,19 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterUpdate` - AFTER UPDATE ON `province` - FOR EACH ROW -BEGIN - IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN - CALL zoneGeo_setParent(NEW.geoFk, - (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); - END IF; - - IF !(OLD.`name` <=> NEW.`name`) THEN - UPDATE zoneGeo SET `name` = NEW.`name` - WHERE id = NEW.geoFk; - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterUpdate` + AFTER UPDATE ON `province` + FOR EACH ROW +BEGIN + IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN + CALL zoneGeo_setParent(NEW.geoFk, + (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); + END IF; + + IF !(OLD.`name` <=> NEW.`name`) THEN + UPDATE zoneGeo SET `name` = NEW.`name` + WHERE id = NEW.geoFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -34895,7 +34883,7 @@ DELIMITER ;; AFTER DELETE ON `province` FOR EACH ROW BEGIN - CALL zoneGeo_delete(OLD.geoFk); + CALL zoneGeo_delete(OLD.geoFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -34961,11 +34949,78 @@ CREATE TABLE `rate` ( `rate1` double NOT NULL, `rate2` double NOT NULL, `rate3` double NOT NULL, + `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `tarifa_warehouse` (`warehouseFk`), + KEY `rate_fk_editor` (`editorFk`), + CONSTRAINT `rate_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), CONSTRAINT `tarifa_warehouse` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`rate_beforeInsert` + BEFORE INSERT ON `rate` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`rate_beforeUpdate` + BEFORE UPDATE ON `rate` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`rate_afterDelete` + AFTER DELETE ON `rate` + FOR EACH ROW +BEGIN + INSERT INTO rateLog + SET `action` = 'delete', + `changedModel` = 'Rate', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `rateConfig` @@ -34984,6 +35039,34 @@ CREATE TABLE `rateConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `rateLog` +-- + +DROP TABLE IF EXISTS `rateLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `rateLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) DEFAULT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete','select') NOT NULL, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` enum('Rate') NOT NULL DEFAULT 'Rate', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, + `changedModelValue` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `logRateuserFk` (`userFk`), + KEY `rateLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `rateLog_originFk` (`originFk`,`creationDate`), + CONSTRAINT `rateOriginFk` FOREIGN KEY (`originFk`) REFERENCES `rate` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `rateUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `receipt` -- @@ -35024,20 +35107,20 @@ CREATE TABLE `receipt` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeInsert` - BEFORE INSERT ON `receipt` - FOR EACH ROW -BEGIN - DECLARE vIsAutoConciliated BOOLEAN; - - IF NEW.isConciliate = FALSE THEN - SELECT isAutoConciliated INTO vIsAutoConciliated - FROM accounting a - JOIN accountingType at2 ON at2.id = a.accountingTypeFk - WHERE a.id = NEW.bankFk; - - SET NEW.isConciliate = vIsAutoConciliated; - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeInsert` + BEFORE INSERT ON `receipt` + FOR EACH ROW +BEGIN + DECLARE vIsAutoConciliated BOOLEAN; + + IF NEW.isConciliate = FALSE THEN + SELECT isAutoConciliated INTO vIsAutoConciliated + FROM accounting a + JOIN accountingType at2 ON at2.id = a.accountingTypeFk + WHERE a.id = NEW.bankFk; + + SET NEW.isConciliate = vIsAutoConciliated; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35093,18 +35176,18 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterUpdate` - AFTER UPDATE ON `receipt` - FOR EACH ROW -BEGIN - IF NEW.isConciliate = FALSE AND NEW.payed > OLD.payed THEN - CALL mail_insert( - 'finanzas@verdnatura.es', - NULL, - CONCAT('Cambios de recibos del cliente: ', NEW.clientFk), - CONCAT('Se ha cambiado el recibo: ', NEW.Id, ' de ', OLD.payed, ' a ', NEW.payed) - ); - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterUpdate` + AFTER UPDATE ON `receipt` + FOR EACH ROW +BEGIN + IF NEW.isConciliate = FALSE AND NEW.payed > OLD.payed THEN + CALL mail_insert( + 'finanzas@verdnatura.es', + NULL, + CONCAT('Cambios de recibos del cliente: ', NEW.clientFk), + CONCAT('Se ha cambiado el recibo: ', NEW.Id, ' de ', OLD.payed, ' a ', NEW.payed) + ); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35354,20 +35437,23 @@ DROP TABLE IF EXISTS `roadmap`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `roadmap` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(45) NOT NULL, `tractorPlate` varchar(10) DEFAULT NULL, `trailerPlate` varchar(12) DEFAULT NULL, `phone` varchar(15) DEFAULT NULL, `supplierFk` int(10) unsigned DEFAULT NULL, - `etd` datetime DEFAULT NULL, + `etd` datetime NOT NULL, `observations` varchar(255) DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), `userFk` int(10) unsigned DEFAULT NULL, + `price` decimal(10,2) DEFAULT NULL, + `driverName` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `userFk` (`userFk`), KEY `roadmap_supplierFk` (`supplierFk`), CONSTRAINT `roadmap_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, CONSTRAINT `roadmap_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Troncales diarios que se contratan'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35378,12 +35464,11 @@ DROP TABLE IF EXISTS `role`; /*!50001 DROP VIEW IF EXISTS `role`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `role` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `description` tinyint NOT NULL, - `hasLogin` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `role` AS SELECT + 1 AS `id`, + 1 AS `name`, + 1 AS `description`, + 1 AS `hasLogin` */; SET character_set_client = @saved_cs_client; -- @@ -35447,13 +35532,25 @@ DELIMITER ;; BEFORE INSERT ON `route` FOR EACH ROW BEGIN - SET NEW.editorFk = account.myUser_getId(); + DECLARE vDefaultAgencyModeFk INT; + SET NEW.editorFk = account.myUser_getId(); + SET NEW.commissionWorkCenterFk = ( SELECT IFNULL(b.workCenterFK, r.defaultWorkCenterFk) FROM vn.routeConfig r LEFT JOIN vn.business b ON b.workerFk = account.myUser_getId() AND NEW.created BETWEEN b.started AND IFNULL(b.ended, NEW.created)); + + IF ISNULL(NEW.agencyModeFk) THEN + SELECT r.agencyModeFk INTO vDefaultAgencyModeFk + FROM routeDefaultAgencyMode r + JOIN business b ON b.workCenterFk = r.workCenterFK + JOIN worker w ON w.businessFk = b.id + WHERE b.workerFk = account.myUser_getId(); + + SET NEW.agencyModeFk = vDefaultAgencyModeFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35472,7 +35569,7 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterInsert` AFTER INSERT ON `route` FOR EACH ROW -BEGIN +BEGIN CALL route_calcCommission(NEW.id); END */;; DELIMITER ; @@ -35494,16 +35591,16 @@ DELIMITER ;; FOR EACH ROW BEGIN DECLARE vKmMax INT; - + SET NEW.editorFk = account.myUser_getId(); - + IF NEW.isOk <> FALSE AND OLD.isOk = FALSE THEN - SET NEW.m3 = ( SELECT SUM(litros)/1000 - FROM vn.saleVolume s - JOIN vn.ticket t ON s.ticketFk = t.id + SET NEW.m3 = ( SELECT SUM(litros)/1000 + FROM vn.saleVolume s + JOIN vn.ticket t ON s.ticketFk = t.id WHERE t.routeFk = NEW.id); END IF; - + IF NEW.kmEnd < NEW.kmStart AND NEW.kmEnd <> 0 THEN CALL util.throw ('KmEnd menor que kmStart'); END IF; @@ -35533,18 +35630,18 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterUpdate` AFTER UPDATE ON `route` FOR EACH ROW -BEGIN +BEGIN IF IFNULL(NEW.gestdocFk,0) <> IFNULL(OLD.gestdocFk,0) AND NEW.gestdocFk > 0 THEN -- JGF 09/09/14 cuando se añade un gestdoc a una ruta, se le asigna automagicamente a todos sus Tickets - + -- Inserta el gestdoc en todos los tickets de la ruta INSERT INTO ticketDms(ticketFk,dmsFk) SELECT id, NEW.gestdocFk FROM ticket WHERE routeFk = NEW.id ON DUPLICATE KEY UPDATE dmsFk = NEW.gestdocFk; - -- Update del firmado - UPDATE ticket t - JOIN ticketDms tg ON t.id = tg.ticketFk + -- Update del firmado + UPDATE ticket t + JOIN ticketDms tg ON t.id = tg.ticketFk SET isSigned = 1 WHERE t.routeFk = NEW.id; END IF; @@ -35707,6 +35804,25 @@ CREATE TABLE `routeConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `routeDefaultAgencyMode` +-- + +DROP TABLE IF EXISTS `routeDefaultAgencyMode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeDefaultAgencyMode` ( + `id` int(11) NOT NULL DEFAULT 0, + `workcenterFk` int(11) DEFAULT NULL, + `agencyModeFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `workcenterFk` (`workcenterFk`), + KEY `routeDefaultAgencyMode_FK` (`agencyModeFk`), + CONSTRAINT `routeDefaultAgencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`), + CONSTRAINT `routeDefaultAgencyMode_FK_1` FOREIGN KEY (`workcenterFk`) REFERENCES `workCenter` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `routeLoadWorker__` -- @@ -35759,7 +35875,7 @@ DROP TABLE IF EXISTS `routeMaster`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `routeMaster` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `warehoseFk` smallint(6) unsigned DEFAULT NULL, + `warehouseFk` smallint(6) unsigned DEFAULT NULL, `km` int(11) NOT NULL DEFAULT 0, `packages` int(11) NOT NULL DEFAULT 0, `vehicleCost` decimal(10,2) NOT NULL DEFAULT 0.00, @@ -35769,7 +35885,7 @@ CREATE TABLE `routeMaster` ( `fuel` int(11) NOT NULL DEFAULT 0, `freelancers` decimal(10,2) NOT NULL DEFAULT 0.00, `year` int(11) NOT NULL DEFAULT 0, - `mounth` int(11) NOT NULL DEFAULT 0, + `month` int(11) NOT NULL DEFAULT 0, `expense` decimal(10,2) NOT NULL DEFAULT 0.00, `freelancersPackages` int(11) NOT NULL DEFAULT 0, `kmCost` decimal(10,2) NOT NULL DEFAULT 0.00, @@ -35777,8 +35893,8 @@ CREATE TABLE `routeMaster` ( `freelancerPackageCost` decimal(10,2) NOT NULL DEFAULT 0.00, `created` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), - KEY `fk_rutas_warehouse_id_idx` (`warehoseFk`), - CONSTRAINT `routeMaster_FK` FOREIGN KEY (`warehoseFk`) REFERENCES `warehouse` (`id`) + KEY `fk_rutas_warehouse_id_idx` (`warehouseFk`), + CONSTRAINT `routeMaster_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35856,15 +35972,14 @@ DROP TABLE IF EXISTS `routesReduced`; /*!50001 DROP VIEW IF EXISTS `routesReduced`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `routesReduced` ( - `description` tinyint NOT NULL, - `name` tinyint NOT NULL, - `routeFk` tinyint NOT NULL, - `eta` tinyint NOT NULL, - `bufferFk` tinyint NOT NULL, - `beachFk` tinyint NOT NULL, - `itempackingTypeFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `routesReduced` AS SELECT + 1 AS `description`, + 1 AS `name`, + 1 AS `routeFk`, + 1 AS `eta`, + 1 AS `bufferFk`, + 1 AS `beachFk`, + 1 AS `itempackingTypeFk` */; SET character_set_client = @saved_cs_client; -- @@ -35984,20 +36099,20 @@ DELIMITER ;; BEFORE UPDATE ON `sale` FOR EACH ROW BEGIN -/* +/* IF (SELECT COUNT(*) from item i WHERE id = NEW.itemFk AND family = 'SER') THEN CALL util.throw('Cannot insert a service item into a ticket'); END IF; */ SET NEW.editorFk = account.myUser_getId(); - + IF NEW.discount > 100 THEN SET NEW.discount = 0; END IF; IF old.discount > 0 AND NEW.discount = 0 THEN INSERT INTO ticketLog - SET originFk = NEW.ticketFk, userFk = account.myUser_getId(), `action` = 'insert', + SET originFk = NEW.ticketFk, userFk = account.myUser_getId(), `action` = 'insert', description = CONCAT('Cambio de descuento del item :', ' ', new.itemFk, ' de ', old.discount ,' a 0 '); END IF; END */;; @@ -36129,11 +36244,11 @@ DELIMITER ;; BEGIN IF OLD.quantity > 0 THEN INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id + SELECT r.id FROM vn.sale s JOIN vn.ticket t ON t.id = s.ticketFk JOIN vn.route r ON r.id = t.routeFk - WHERE r.isOk = FALSE + WHERE r.isOk = FALSE AND s.id = OLD.id AND r.created >= util.VN_CURDATE() GROUP BY r.id; @@ -36235,10 +36350,10 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`BEFORE_INSERT` BEFORE INSERT ON `saleBuy` FOR EACH ROW -BEGIN - +BEGIN + SET NEW.workerFk = vn.getUser(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -36257,13 +36372,13 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_AI` AFTER INSERT ON `saleBuy` FOR EACH ROW -BEGIN +BEGIN /* Activar de nuevo cuando volvamos a vender fruta y verdura - * + * UPDATE vn.sale s SET s.concept = CONCAT(s.concept, ' Lote: ', NEW.buyFk) WHERE s.id = NEW.saleFk; -*/ +*/ END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -36316,16 +36431,15 @@ DROP TABLE IF EXISTS `saleCost`; /*!50001 DROP VIEW IF EXISTS `saleCost`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleCost` ( - `itemFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `discount` tinyint NOT NULL, - `price` tinyint NOT NULL, - `component` tinyint NOT NULL, - `coste` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `saleCost` AS SELECT + 1 AS `itemFk`, + 1 AS `ticketFk`, + 1 AS `concept`, + 1 AS `quantity`, + 1 AS `discount`, + 1 AS `price`, + 1 AS `component`, + 1 AS `coste` */; SET character_set_client = @saved_cs_client; -- @@ -36392,12 +36506,11 @@ DROP TABLE IF EXISTS `saleLabel`; /*!50001 DROP VIEW IF EXISTS `saleLabel`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleLabel` ( - `saleFk` tinyint NOT NULL, - `label` tinyint NOT NULL, - `stem` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `saleLabel` AS SELECT + 1 AS `saleFk`, + 1 AS `label`, + 1 AS `stem`, + 1 AS `created` */; SET character_set_client = @saved_cs_client; -- @@ -36431,15 +36544,14 @@ DROP TABLE IF EXISTS `saleMistakeList`; /*!50001 DROP VIEW IF EXISTS `saleMistakeList`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleMistakeList` ( - `saleFk` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `sacador` tinyint NOT NULL, - `created` tinyint NOT NULL, - `revisador` tinyint NOT NULL, - `description` tinyint NOT NULL, - `controlled` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `saleMistakeList` AS SELECT + 1 AS `saleFk`, + 1 AS `workerFk`, + 1 AS `sacador`, + 1 AS `created`, + 1 AS `revisador`, + 1 AS `description`, + 1 AS `controlled` */; SET character_set_client = @saved_cs_client; -- @@ -36450,15 +36562,14 @@ DROP TABLE IF EXISTS `saleMistake_list__2`; /*!50001 DROP VIEW IF EXISTS `saleMistake_list__2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleMistake_list__2` ( - `saleFk` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `sacador` tinyint NOT NULL, - `created` tinyint NOT NULL, - `revisador` tinyint NOT NULL, - `description` tinyint NOT NULL, - `controlled` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `saleMistake_list__2` AS SELECT + 1 AS `saleFk`, + 1 AS `workerFk`, + 1 AS `sacador`, + 1 AS `created`, + 1 AS `revisador`, + 1 AS `description`, + 1 AS `controlled` */; SET character_set_client = @saved_cs_client; -- @@ -36469,9 +36580,8 @@ DROP TABLE IF EXISTS `saleSaleTracking`; /*!50001 DROP VIEW IF EXISTS `saleSaleTracking`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleSaleTracking` ( - `saleFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `saleSaleTracking` AS SELECT + 1 AS `saleFk` */; SET character_set_client = @saved_cs_client; -- @@ -36534,14 +36644,14 @@ DELIMITER ;; AFTER INSERT ON `saleTracking` FOR EACH ROW BEGIN - - IF NEW.isChecked THEN - + + IF NEW.isChecked THEN + UPDATE vn.sale s - SET s.isPicked = TRUE + SET s.isPicked = TRUE WHERE s.id = NEW.saleFk AND s.isPicked = 0; - + END IF; END */;; @@ -36559,21 +36669,20 @@ DROP TABLE IF EXISTS `saleValue`; /*!50001 DROP VIEW IF EXISTS `saleValue`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleValue` ( - `warehouse` tinyint NOT NULL, - `client` tinyint NOT NULL, - `clientTypeFk` tinyint NOT NULL, - `buyer` tinyint NOT NULL, - `itemTypeFk` tinyint NOT NULL, - `family` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `cost` tinyint NOT NULL, - `value` tinyint NOT NULL, - `year` tinyint NOT NULL, - `week` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `saleValue` AS SELECT + 1 AS `warehouse`, + 1 AS `client`, + 1 AS `clientTypeFk`, + 1 AS `buyer`, + 1 AS `itemTypeFk`, + 1 AS `family`, + 1 AS `itemFk`, + 1 AS `concept`, + 1 AS `quantity`, + 1 AS `cost`, + 1 AS `value`, + 1 AS `year`, + 1 AS `week` */; SET character_set_client = @saved_cs_client; -- @@ -36584,24 +36693,23 @@ DROP TABLE IF EXISTS `saleVolume`; /*!50001 DROP VIEW IF EXISTS `saleVolume`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleVolume` ( - `ticketFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL, - `litros` tinyint NOT NULL, - `routeFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `volume` tinyint NOT NULL, - `physicalWeight` tinyint NOT NULL, - `weight` tinyint NOT NULL, - `physicalVolume` tinyint NOT NULL, - `freight` tinyint NOT NULL, - `zoneFk` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `isPicked` tinyint NOT NULL, - `eurosValue` tinyint NOT NULL, - `itemPackingTypeFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `saleVolume` AS SELECT + 1 AS `ticketFk`, + 1 AS `saleFk`, + 1 AS `litros`, + 1 AS `routeFk`, + 1 AS `shipped`, + 1 AS `landed`, + 1 AS `volume`, + 1 AS `physicalWeight`, + 1 AS `weight`, + 1 AS `physicalVolume`, + 1 AS `freight`, + 1 AS `zoneFk`, + 1 AS `clientFk`, + 1 AS `isPicked`, + 1 AS `eurosValue`, + 1 AS `itemPackingTypeFk` */; SET character_set_client = @saved_cs_client; -- @@ -36612,12 +36720,11 @@ DROP TABLE IF EXISTS `saleVolume_Today_VNH`; /*!50001 DROP VIEW IF EXISTS `saleVolume_Today_VNH`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleVolume_Today_VNH` ( - `Cliente` tinyint NOT NULL, - `Provincia` tinyint NOT NULL, - `Pais` tinyint NOT NULL, - `volume` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `saleVolume_Today_VNH` AS SELECT + 1 AS `Cliente`, + 1 AS `Provincia`, + 1 AS `Pais`, + 1 AS `volume` */; SET character_set_client = @saved_cs_client; -- @@ -36628,11 +36735,10 @@ DROP TABLE IF EXISTS `sale_freightComponent`; /*!50001 DROP VIEW IF EXISTS `sale_freightComponent`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `sale_freightComponent` ( - `ticketFk` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `shipped` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `sale_freightComponent` AS SELECT + 1 AS `ticketFk`, + 1 AS `amount`, + 1 AS `shipped` */; SET character_set_client = @saved_cs_client; -- @@ -36651,6 +36757,20 @@ CREATE TABLE `salesPersonGoal` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `salesPersonProtected` +-- + +DROP TABLE IF EXISTS `salesPersonProtected`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `salesPersonProtected` ( + `salesPersonFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`salesPersonFk`), + CONSTRAINT `salesPersonProtected_FK` FOREIGN KEY (`salesPersonFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lista de comerciales que no se desasignarán automáticamente los clientes'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `salesPersonSince` -- @@ -36659,10 +36779,9 @@ DROP TABLE IF EXISTS `salesPersonSince`; /*!50001 DROP VIEW IF EXISTS `salesPersonSince`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `salesPersonSince` ( - `workerFk` tinyint NOT NULL, - `started` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `salesPersonSince` AS SELECT + 1 AS `workerFk`, + 1 AS `started` */; SET character_set_client = @saved_cs_client; -- @@ -36673,20 +36792,19 @@ DROP TABLE IF EXISTS `salesPreparedLastHour`; /*!50001 DROP VIEW IF EXISTS `salesPreparedLastHour`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `salesPreparedLastHour` ( - `warehouseFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL, - `isChecked` tinyint NOT NULL, - `originalQuantity` tinyint NOT NULL, - `created` tinyint NOT NULL, - `code` tinyint NOT NULL, - `firstname` tinyint NOT NULL, - `lastName` tinyint NOT NULL, - `workerCode` tinyint NOT NULL, - `litros` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `departmentName` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `salesPreparedLastHour` AS SELECT + 1 AS `warehouseFk`, + 1 AS `saleFk`, + 1 AS `isChecked`, + 1 AS `originalQuantity`, + 1 AS `created`, + 1 AS `code`, + 1 AS `firstname`, + 1 AS `lastName`, + 1 AS `workerCode`, + 1 AS `litros`, + 1 AS `concept`, + 1 AS `departmentName` */; SET character_set_client = @saved_cs_client; -- @@ -36697,9 +36815,8 @@ DROP TABLE IF EXISTS `salesPreviousPreparated`; /*!50001 DROP VIEW IF EXISTS `salesPreviousPreparated`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `salesPreviousPreparated` ( - `saleFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `salesPreviousPreparated` AS SELECT + 1 AS `saleFk` */; SET character_set_client = @saved_cs_client; -- @@ -36920,9 +37037,9 @@ BEGIN IF NEW.workerFk = NEW.workerSubstitute THEN CALL util.throw ('worker and workerSubstitute must be different'); ELSE - INSERT IGNORE INTO sharingCartDaily (ownerFk, substituteFk, dated) - SELECT NEW.workerFk, NEW.workerSubstitute, dated - FROM time + INSERT IGNORE INTO sharingCartDaily (ownerFk, substituteFk, dated) + SELECT NEW.workerFk, NEW.workerSubstitute, dated + FROM time WHERE dated BETWEEN NEW.started AND NEW.ended; END IF; END */;; @@ -36947,14 +37064,14 @@ BEGIN IF NEW.workerFk = NEW.workerSubstitute THEN CALL util.throw ('worker and workerSubstitute must be different'); ELSE - DELETE sc FROM sharingCartDaily sc - WHERE sc.dated BETWEEN OLD.started AND OLD.ended AND - sc.ownerFk = OLD.workerFk AND + DELETE sc FROM sharingCartDaily sc + WHERE sc.dated BETWEEN OLD.started AND OLD.ended AND + sc.ownerFk = OLD.workerFk AND sc.substituteFk = OLD.workerSubstitute; - - INSERT IGNORE INTO sharingCartDaily (ownerFk, substituteFk, dated) - SELECT NEW.workerFk, NEW.workerSubstitute, dated - FROM time + + INSERT IGNORE INTO sharingCartDaily (ownerFk, substituteFk, dated) + SELECT NEW.workerFk, NEW.workerSubstitute, dated + FROM time WHERE dated BETWEEN NEW.started AND NEW.ended; END IF; @@ -36977,9 +37094,9 @@ DELIMITER ;; BEFORE DELETE ON `sharingCart` FOR EACH ROW BEGIN - DELETE sc FROM sharingCartDaily sc - WHERE sc.dated BETWEEN OLD.started AND OLD.ended AND - sc.ownerFk = OLD.workerFk AND + DELETE sc FROM sharingCartDaily sc + WHERE sc.dated BETWEEN OLD.started AND OLD.ended AND + sc.ownerFk = OLD.workerFk AND sc.substituteFk = OLD.workerSubstitute; END */;; DELIMITER ; @@ -37361,7 +37478,7 @@ DELIMITER ;; FOR EACH ROW BEGIN UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client + JOIN creditClassification cc ON c.Id_Cliente = cc.client JOIN creditInsurance ci ON ci.creditClassification = cc.id SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance; END */;; @@ -37385,12 +37502,12 @@ DELIMITER ;; BEGIN IF NEW.dateLeaving IS NOT NULL THEN UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client + JOIN creditClassification cc ON c.Id_Cliente = cc.client JOIN creditInsurance ci ON ci.creditClassification = cc.id SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; ELSE UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client + JOIN creditClassification cc ON c.Id_Cliente = cc.client JOIN creditInsurance ci ON ci.creditClassification = cc.id SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance; END IF; @@ -37414,7 +37531,7 @@ DELIMITER ;; FOR EACH ROW BEGIN UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client + JOIN creditClassification cc ON c.Id_Cliente = cc.client JOIN creditInsurance ci ON ci.creditClassification = cc.id SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; END */;; @@ -37668,16 +37785,16 @@ DROP TABLE IF EXISTS `stockBuyed`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `stockBuyed` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `user` int(10) unsigned DEFAULT NULL, + `userFk` int(10) unsigned DEFAULT NULL, `buyed` decimal(10,2) DEFAULT NULL, - `date` date DEFAULT NULL, + `dated` date DEFAULT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `reserved` decimal(10,2) DEFAULT NULL, `requested` decimal(10,2) DEFAULT NULL, `description` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `stockBuyed_user_idx` (`user`), - CONSTRAINT `stockBuyedUserFk` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + KEY `stockBuyed_user_idx` (`userFk`), + CONSTRAINT `stockBuyedUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37736,6 +37853,7 @@ CREATE TABLE `supplier` ( `healthRegister` varchar(45) DEFAULT NULL, `isPayMethodChecked` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Se ha validado la forma de pago', `isVies` tinyint(4) NOT NULL DEFAULT 0, + `stamp` longblob DEFAULT NULL, `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `cuenta` (`account`), @@ -38256,18 +38374,17 @@ DROP TABLE IF EXISTS `supplierPackaging`; /*!50001 DROP VIEW IF EXISTS `supplierPackaging`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `supplierPackaging` ( - `supplierFk` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `supplier` tinyint NOT NULL, - `entryFk` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `out` tinyint NOT NULL, - `in` tinyint NOT NULL, - `warehouse` tinyint NOT NULL, - `buyingValue` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `supplierPackaging` AS SELECT + 1 AS `supplierFk`, + 1 AS `itemFk`, + 1 AS `longName`, + 1 AS `supplier`, + 1 AS `entryFk`, + 1 AS `landed`, + 1 AS `out`, + 1 AS `in`, + 1 AS `warehouse`, + 1 AS `buyingValue` */; SET character_set_client = @saved_cs_client; -- @@ -38388,10 +38505,9 @@ DROP TABLE IF EXISTS `tagL10n`; /*!50001 DROP VIEW IF EXISTS `tagL10n`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `tagL10n` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `tagL10n` AS SELECT + 1 AS `id`, + 1 AS `name` */; SET character_set_client = @saved_cs_client; -- @@ -38566,6 +38682,7 @@ CREATE TABLE `ticket` ( `totalWithoutVat` decimal(10,2) DEFAULT NULL COMMENT 'cache calculada del total sin iva', `weight` decimal(10,2) DEFAULT NULL COMMENT 'En caso de informar, se utilizará su valor para calcular el peso de la factura', `clonedFrom` int(11) DEFAULT NULL, + `cmrFk` int(11) DEFAULT NULL, `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `Id_Cliente` (`clientFk`), @@ -38580,8 +38697,10 @@ CREATE TABLE `ticket` ( KEY `Fecha` (`shipped`,`clientFk`), KEY `tickets_zone_fk_idx` (`zoneFk`), KEY `ticket_fk_editor` (`editorFk`), + KEY `ticket_cmrFk` (`cmrFk`), CONSTRAINT `ticketCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticket_FK` FOREIGN KEY (`refFk`) REFERENCES `invoiceOut` (`ref`) ON UPDATE CASCADE, + CONSTRAINT `ticket_cmrFk` FOREIGN KEY (`cmrFk`) REFERENCES `cmr` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticket_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticket_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), CONSTRAINT `ticket_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, @@ -38624,7 +38743,7 @@ DELIMITER ;; AFTER INSERT ON `ticket` FOR EACH ROW BEGIN - + DECLARE vClientType VARCHAR(255); DECLARE vStateCode VARCHAR(255); DECLARE vTransferorFirstShipped DATE; @@ -38652,7 +38771,7 @@ BEGIN INSERT INTO bs.clientNewBorn(clientFk, firstShipped, lastShipped) VALUES(NEW.clientFk, IFNULL(vTransferorFirstShipped, util.VN_CURDATE()), util.VN_CURDATE()) ON DUPLICATE KEY UPDATE lastShipped = util.VN_CURDATE(); - + END IF; END */;; @@ -38679,10 +38798,10 @@ BEGIN SET NEW.editorFk = account.myUser_getId(); IF !(NEW.routeFk <=> OLD.routeFk) THEN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id FROM vn.route r - WHERE r.isOk = FALSE + WHERE r.isOk = FALSE AND r.id IN (OLD.routeFk,NEW.routeFk) AND r.created >= util.VN_CURDATE() GROUP BY r.id; @@ -38699,13 +38818,13 @@ BEGIN END IF; END IF; - + IF !(NEW.isDeleted <=> OLD.isDeleted) AND NEW.isDeleted THEN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id FROM vn.ticket t JOIN vn.route r ON r.id = t.routeFk - WHERE r.isOk = FALSE + WHERE r.isOk = FALSE AND t.id = NEW.id AND r.created >= util.VN_CURDATE() GROUP BY r.id; @@ -38715,7 +38834,7 @@ BEGIN SET NEW.zoneFk = NULL; END IF; - IF NEW.routeFk AND NEW.isDeleted THEN + IF NEW.routeFk AND NEW.isDeleted THEN CALL util.throw ('This ticket is deleted'); END IF; @@ -38724,12 +38843,12 @@ BEGIN FROM vn.ticket WHERE routeFk = NEW.routeFk HAVING MAX(TIME(shipped)) > TIME(NEW.shipped); - + IF vNewTime THEN SET NEW.shipped = TIMESTAMP(DATE(NEW.shipped), vNewTime); END IF; INSERT IGNORE INTO zoneAgencyMode (agencyModeFk,zoneFk) - SELECT r.agencyModeFk, NEW.zoneFk FROM route r + SELECT r.agencyModeFk, NEW.zoneFk FROM route r WHERE r.id = NEW.routeFk; CALL vn.routeUpdateM3(NEW.routeFk); @@ -38767,7 +38886,7 @@ BEGIN END IF; IF NEW.routeFk <> OLD.routeFk THEN - UPDATE expedition + UPDATE expedition SET hasNewRoute = TRUE WHERE ticketFk = NEW.id; END IF; @@ -38790,11 +38909,11 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeDelete` BEFORE DELETE ON `ticket` FOR EACH ROW -BEGIN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id +BEGIN + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id FROM vn.route r - WHERE r.isOk = FALSE + WHERE r.isOk = FALSE AND r.id = OLD.routeFk AND r.created >= util.VN_CURDATE() GROUP BY r.id; @@ -38852,7 +38971,7 @@ CREATE TABLE `ticketCollection` ( `itemCount` int(11) DEFAULT NULL COMMENT 'número de productos distintos en el pedido', `liters` int(11) DEFAULT NULL COMMENT 'volumen del pedido en litros', PRIMARY KEY (`id`), - UNIQUE KEY `ticketCollection_UN` (`ticketFk`,`collectionFk`), + UNIQUE KEY `ticketCollection_UN` (`ticketFk`), KEY `ticketCollection_fk1_idx` (`collectionFk`), KEY `ticketCollection_fk2_idx` (`ticketFk`), KEY `ticketCollection_smartTagFk_IDX` (`smartTagFk`) USING BTREE, @@ -38871,31 +38990,31 @@ CREATE TABLE `ticketCollection` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER ticketCollection_afterDelete -AFTER DELETE -ON ticketCollection FOR EACH ROW -BEGIN - - DECLARE vSalesRemaining INT; - - SELECT count(*) INTO vSalesRemaining - FROM vn.ticketCollection tc - JOIN sale s ON s.ticketFk = tc.ticketFk - WHERE collectionFk = OLD.collectionFk - AND tc.id != OLD.id; - - IF NOT vSalesRemaining THEN - - DELETE FROM vn.collection WHERE id = OLD.collectionFk; - - ELSE - - UPDATE vn.collection - SET saleTotalCount = vSalesRemaining - WHERE id = OLD.collectionFk; - - END IF; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER ticketCollection_afterDelete +AFTER DELETE +ON ticketCollection FOR EACH ROW +BEGIN + + DECLARE vSalesRemaining INT; + + SELECT count(*) INTO vSalesRemaining + FROM vn.ticketCollection tc + JOIN sale s ON s.ticketFk = tc.ticketFk + WHERE collectionFk = OLD.collectionFk + AND tc.id != OLD.id; + + IF NOT vSalesRemaining THEN + + DELETE FROM vn.collection WHERE id = OLD.collectionFk; + + ELSE + + UPDATE vn.collection + SET saleTotalCount = vSalesRemaining + WHERE id = OLD.collectionFk; + + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38993,13 +39112,13 @@ DELIMITER ;; BEFORE DELETE ON `ticketDms` FOR EACH ROW BEGIN - UPDATE dms - SET dmsTypeFk = (SELECT id - FROM dmsType + UPDATE dms + SET dmsTypeFk = (SELECT id + FROM dmsType WHERE `code` = 'trash' ) - WHERE id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE) - FROM ticketDms + WHERE id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE) + FROM ticketDms WHERE dmsFk = OLD.dmsFk ) ; END */;; @@ -39109,10 +39228,9 @@ DROP TABLE IF EXISTS `ticketLastUpdated`; /*!50001 DROP VIEW IF EXISTS `ticketLastUpdated`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketLastUpdated` ( - `ticketFk` tinyint NOT NULL, - `lastUpdated` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ticketLastUpdated` AS SELECT + 1 AS `ticketFk`, + 1 AS `lastUpdated` */; SET character_set_client = @saved_cs_client; -- @@ -39123,10 +39241,9 @@ DROP TABLE IF EXISTS `ticketLastUpdatedList`; /*!50001 DROP VIEW IF EXISTS `ticketLastUpdatedList`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketLastUpdatedList` ( - `ticketFk` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ticketLastUpdatedList` AS SELECT + 1 AS `ticketFk`, + 1 AS `created` */; SET character_set_client = @saved_cs_client; -- @@ -39165,24 +39282,23 @@ DROP TABLE IF EXISTS `ticketMRW`; /*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketMRW` ( - `id_Agencia` tinyint NOT NULL, - `empresa_id` tinyint NOT NULL, - `Consignatario` tinyint NOT NULL, - `DOMICILIO` tinyint NOT NULL, - `POBLACION` tinyint NOT NULL, - `CODPOSTAL` tinyint NOT NULL, - `telefono` tinyint NOT NULL, - `movil` tinyint NOT NULL, - `IF` tinyint NOT NULL, - `Id_Ticket` tinyint NOT NULL, - `warehouse_id` tinyint NOT NULL, - `Id_Consigna` tinyint NOT NULL, - `CodigoPais` tinyint NOT NULL, - `Fecha` tinyint NOT NULL, - `province_id` tinyint NOT NULL, - `landing` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ticketMRW` AS SELECT + 1 AS `id_Agencia`, + 1 AS `empresa_id`, + 1 AS `Consignatario`, + 1 AS `DOMICILIO`, + 1 AS `POBLACION`, + 1 AS `CODPOSTAL`, + 1 AS `telefono`, + 1 AS `movil`, + 1 AS `IF`, + 1 AS `Id_Ticket`, + 1 AS `warehouse_id`, + 1 AS `Id_Consigna`, + 1 AS `CodigoPais`, + 1 AS `Fecha`, + 1 AS `province_id`, + 1 AS `landing` */; SET character_set_client = @saved_cs_client; -- @@ -39193,14 +39309,13 @@ DROP TABLE IF EXISTS `ticketNotInvoiced`; /*!50001 DROP VIEW IF EXISTS `ticketNotInvoiced`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketNotInvoiced` ( - `companyFk` tinyint NOT NULL, - `companyCode` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `clientName` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `value` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ticketNotInvoiced` AS SELECT + 1 AS `companyFk`, + 1 AS `companyCode`, + 1 AS `clientFk`, + 1 AS `clientName`, + 1 AS `shipped`, + 1 AS `value` */; SET character_set_client = @saved_cs_client; -- @@ -39430,18 +39545,17 @@ DROP TABLE IF EXISTS `ticketPackingList`; /*!50001 DROP VIEW IF EXISTS `ticketPackingList`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketPackingList` ( - `nickname` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `agencyMode` tinyint NOT NULL, - `flag` tinyint NOT NULL, - `province` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `litros` tinyint NOT NULL, - `observaciones` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ticketPackingList` AS SELECT + 1 AS `nickname`, + 1 AS `ticketFk`, + 1 AS `agencyMode`, + 1 AS `flag`, + 1 AS `province`, + 1 AS `itemFk`, + 1 AS `concept`, + 1 AS `quantity`, + 1 AS `litros`, + 1 AS `observaciones` */; SET character_set_client = @saved_cs_client; -- @@ -39480,7 +39594,7 @@ DELIMITER ;; BEGIN SET NEW.workerFk = vn.getUser(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -39496,17 +39610,16 @@ DROP TABLE IF EXISTS `ticketPreviousPreparingList`; /*!50001 DROP VIEW IF EXISTS `ticketPreviousPreparingList`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketPreviousPreparingList` ( - `ticketFk` tinyint NOT NULL, - `code` tinyint NOT NULL, - `saleLines` tinyint NOT NULL, - `alreadyMadeSaleLines` tinyint NOT NULL, - `madeRate` tinyint NOT NULL, - `created` tinyint NOT NULL, - `parking` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL, - `alertCode` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ticketPreviousPreparingList` AS SELECT + 1 AS `ticketFk`, + 1 AS `code`, + 1 AS `saleLines`, + 1 AS `alreadyMadeSaleLines`, + 1 AS `madeRate`, + 1 AS `created`, + 1 AS `parking`, + 1 AS `sectorFk`, + 1 AS `alertCode` */; SET character_set_client = @saved_cs_client; -- @@ -39809,7 +39922,7 @@ DELIMITER ;; BEGIN CALL ticket_requestRecalc(NEW.ticketFk); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -39879,7 +39992,7 @@ BEGIN `changedModel` = 'TicketService', `changedModelId` = OLD.id, `userFk` = account.myUser_getId(); - + CALL ticket_requestRecalc(OLD.ticketFk); END */;; @@ -39931,20 +40044,19 @@ DROP TABLE IF EXISTS `ticketState`; /*!50001 DROP VIEW IF EXISTS `ticketState`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketState` ( - `updated` tinyint NOT NULL, - `stateFk` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `state` tinyint NOT NULL, - `productionOrder` tinyint NOT NULL, - `alertLevel` tinyint NOT NULL, - `code` tinyint NOT NULL, - `ticket` tinyint NOT NULL, - `worker` tinyint NOT NULL, - `isPreviousPreparable` tinyint NOT NULL, - `isPicked` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ticketState` AS SELECT + 1 AS `updated`, + 1 AS `stateFk`, + 1 AS `workerFk`, + 1 AS `ticketFk`, + 1 AS `state`, + 1 AS `productionOrder`, + 1 AS `alertLevel`, + 1 AS `code`, + 1 AS `ticket`, + 1 AS `worker`, + 1 AS `isPreviousPreparable`, + 1 AS `isPicked` */; SET character_set_client = @saved_cs_client; -- @@ -39955,16 +40067,15 @@ DROP TABLE IF EXISTS `ticketStateToday`; /*!50001 DROP VIEW IF EXISTS `ticketStateToday`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketStateToday` ( - `ticket` tinyint NOT NULL, - `state` tinyint NOT NULL, - `productionOrder` tinyint NOT NULL, - `alertLevel` tinyint NOT NULL, - `worker` tinyint NOT NULL, - `code` tinyint NOT NULL, - `updated` tinyint NOT NULL, - `isPicked` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `ticketStateToday` AS SELECT + 1 AS `ticket`, + 1 AS `state`, + 1 AS `productionOrder`, + 1 AS `alertLevel`, + 1 AS `worker`, + 1 AS `code`, + 1 AS `updated`, + 1 AS `isPicked` */; SET character_set_client = @saved_cs_client; -- @@ -40032,11 +40143,11 @@ DELIMITER ;; FOR EACH ROW BEGIN DECLARE vNumTicketsPrepared INT; - + REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) SELECT NEW.ticketFk, NEW.id, `name` FROM state - WHERE id = NEW.stateFk; + WHERE id = NEW.stateFk; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -40079,21 +40190,21 @@ BEGIN DECLARE vTicketFk INT; DECLARE vTicketTrackingFk INT; DECLARE vStateName VARCHAR(15); - + IF NEW.stateFk <> OLD.stateFk THEN REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) SELECT NEW.ticketFk, NEW.id, `name` FROM state WHERE id = NEW.stateFk; END IF; - + IF NEW.ticketFk <> OLD.ticketFk THEN SELECT i.ticketFk, i.id, s.`name` - INTO vTicketFk, vTicketTrackingFk, vStateName - FROM ticketTracking i - JOIN state s ON i.stateFk = s.id - WHERE ticketFk = NEW.ticketFk - ORDER BY created DESC + INTO vTicketFk, vTicketTrackingFk, vStateName + FROM ticketTracking i + JOIN state s ON i.stateFk = s.id + WHERE ticketFk = NEW.ticketFk + ORDER BY created DESC LIMIT 1; IF vTicketFk > 0 THEN @@ -40135,18 +40246,18 @@ BEGIN `changedModel` = 'TicketTracking', `changedModelId` = OLD.id, `userFk` = account.myUser_getId(); - + CALL util.debugAdd('deletedState', CONCAT('interFk: ', OLD.id, ' ticketFk: ', OLD.ticketFk, ' stateFk: ', OLD.stateFk)); SELECT i.ticketFk, i.id, s.`name` - INTO vTicketFk, vTicketTrackingFk, vStateName - FROM ticketTracking i - JOIN state s ON i.stateFk = s.id - WHERE ticketFk = OLD.ticketFk - ORDER BY created DESC + INTO vTicketFk, vTicketTrackingFk, vStateName + FROM ticketTracking i + JOIN state s ON i.stateFk = s.id + WHERE ticketFk = OLD.ticketFk + ORDER BY created DESC LIMIT 1; IF vTicketFk > 0 THEN @@ -40338,13 +40449,13 @@ CREATE TABLE `till` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`till_beforeInsert` - BEFORE INSERT ON `till` - FOR EACH ROW -BEGIN - IF IFNULL(NEW.concept,"") = "" THEN - CALL util.throw ('Error. El concepto esta vacío'); - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`till_beforeInsert` + BEFORE INSERT ON `till` + FOR EACH ROW +BEGIN + IF NEW.concept IS NULL OR NEW.concept REGEXP '^[[:space:]]*$' THEN + SET NEW.concept = 'SIN DETALLE'; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -40552,23 +40663,22 @@ DROP TABLE IF EXISTS `tr2`; /*!50001 DROP VIEW IF EXISTS `tr2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `tr2` ( - `id` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `shipmentHour` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `landingHour` tinyint NOT NULL, - `warehouseInFk` tinyint NOT NULL, - `warehouseOutFk` tinyint NOT NULL, - `agencyFk` tinyint NOT NULL, - `ref` tinyint NOT NULL, - `isDelivered` tinyint NOT NULL, - `isReceived` tinyint NOT NULL, - `m3` tinyint NOT NULL, - `kg` tinyint NOT NULL, - `cargoSupplierFk` tinyint NOT NULL, - `totalEntries` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `tr2` AS SELECT + 1 AS `id`, + 1 AS `shipped`, + 1 AS `shipmentHour`, + 1 AS `landed`, + 1 AS `landingHour`, + 1 AS `warehouseInFk`, + 1 AS `warehouseOutFk`, + 1 AS `agencyFk`, + 1 AS `ref`, + 1 AS `isDelivered`, + 1 AS `isReceived`, + 1 AS `m3`, + 1 AS `kg`, + 1 AS `cargoSupplierFk`, + 1 AS `totalEntries` */; SET character_set_client = @saved_cs_client; -- @@ -40579,15 +40689,14 @@ DROP TABLE IF EXISTS `traceabilityBuy`; /*!50001 DROP VIEW IF EXISTS `traceabilityBuy`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `traceabilityBuy` ( - `buyFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `warehouseName` tinyint NOT NULL, - `entryFk` tinyint NOT NULL, - `supplierName` tinyint NOT NULL, - `itemFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `traceabilityBuy` AS SELECT + 1 AS `buyFk`, + 1 AS `quantity`, + 1 AS `landed`, + 1 AS `warehouseName`, + 1 AS `entryFk`, + 1 AS `supplierName`, + 1 AS `itemFk` */; SET character_set_client = @saved_cs_client; -- @@ -40598,14 +40707,13 @@ DROP TABLE IF EXISTS `traceabilitySale`; /*!50001 DROP VIEW IF EXISTS `traceabilitySale`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `traceabilitySale` ( - `ticketFk` tinyint NOT NULL, - `buyFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `worker` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `traceabilitySale` AS SELECT + 1 AS `ticketFk`, + 1 AS `buyFk`, + 1 AS `shipped`, + 1 AS `nickname`, + 1 AS `quantity`, + 1 AS `worker` */; SET character_set_client = @saved_cs_client; -- @@ -40770,7 +40878,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); - + IF NOT (NEW.landed <=> OLD.landed) OR NOT (NEW.shipped <=> OLD.shipped) THEN CALL travel_checkDates(NEW.shipped, NEW.landed); @@ -40812,7 +40920,7 @@ BEGIN CALL stock.log_add('travel', NEW.id, OLD.id); IF !(NEW.shipped <=> OLD.shipped) THEN - UPDATE entry + UPDATE entry SET commission = entry_getCommission(travelFk, currencyFk,supplierFk) WHERE travelFk = NEW.id; END IF; @@ -40881,6 +40989,31 @@ CREATE TABLE `travelClonedWeekly` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `travelConfig` +-- + +DROP TABLE IF EXISTS `travelConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `travelConfig` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `warehouseInFk` smallint(6) unsigned NOT NULL DEFAULT 8 COMMENT 'Warehouse de origen', + `warehouseOutFk` smallint(6) unsigned NOT NULL DEFAULT 60 COMMENT 'Warehouse destino', + `agencyFk` int(11) NOT NULL DEFAULT 1378 COMMENT 'Agencia por defecto', + `companyFk` int(10) unsigned NOT NULL DEFAULT 442 COMMENT 'Compañía por defecto', + PRIMARY KEY (`id`), + KEY `travelConfig_FK` (`warehouseInFk`), + KEY `travelConfig_FK_1` (`warehouseOutFk`), + KEY `travelConfig_FK_2` (`agencyFk`), + KEY `travelConfig_FK_3` (`companyFk`), + CONSTRAINT `travelConfig_FK` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `travelConfig_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `travelConfig_FK_2` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `travelConfig_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `travelLog` -- @@ -41158,6 +41291,7 @@ CREATE TABLE `vehicle` ( `countryCodeFk` varchar(2) DEFAULT 'ES', `leasing` varchar(50) DEFAULT NULL COMMENT 'Id de arrendamiento', PRIMARY KEY (`id`), + UNIQUE KEY `vehicle_UN` (`numberPlate`), KEY `empresa_id` (`companyFk`), KEY `provinceFk_idx` (`warehouseFk`), KEY `vehicle_deliveryPointFk_idx` (`deliveryPointFk`), @@ -41336,6 +41470,25 @@ CREATE TABLE `vehicleState` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `viaexpressConfig` +-- + +DROP TABLE IF EXISTS `viaexpressConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `viaexpressConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `url` varchar(100) NOT NULL, + `client` varchar(100) NOT NULL, + `user` varchar(100) NOT NULL, + `password` varchar(100) NOT NULL, + `defaultWeight` decimal(10,2) NOT NULL, + `deliveryType` varchar(5) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `volumeConfig` -- @@ -41556,7 +41709,7 @@ DELIMITER ;; AFTER UPDATE ON `warehouse` FOR EACH ROW BEGIN - IF NEW.isFeedStock IS TRUE and OLD.isFeedStock IS FALSE then + IF NEW.isFeedStock IS TRUE AND OLD.isFeedStock IS FALSE THEN INSERT IGNORE INTO warehouseAlias(`name`) VALUES(NEW.`name`); INSERT IGNORE INTO warehouseJoined(warehouseFk, warehouseAliasFk) VALUES(NEW.id,LAST_INSERT_ID()); @@ -41643,9 +41796,9 @@ CREATE TABLE `worker` ( `seniority` date DEFAULT NULL, `isTodayRelative` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Para el F11. Calcula los problemas de visiblidad en funcion del dia actual', `isF11Allowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Usuario autorizado para abrir el F11', - `sectorFk` int(11) DEFAULT NULL COMMENT 'Sector que tiene asociado el trabajador.', + `sectorFk__` int(11) DEFAULT NULL COMMENT '@deprecated 2023-06-26', `maritalStatus` enum('S','M') NOT NULL, - `labelerFk` tinyint(3) unsigned DEFAULT NULL, + `labelerFk__` tinyint(3) unsigned DEFAULT NULL COMMENT '@deprecated 2023-06-26', `originCountryFk` mediumint(8) unsigned DEFAULT NULL COMMENT 'País de origen', `educationLevelFk` smallint(6) DEFAULT NULL, `SSN` varchar(15) DEFAULT NULL, @@ -41666,11 +41819,11 @@ CREATE TABLE `worker` ( UNIQUE KEY `locker` (`locker`), KEY `sub` (`sub`), KEY `boss_idx` (`bossFk`), - KEY `worker_FK` (`labelerFk`), + KEY `worker_FK` (`labelerFk__`), KEY `worker_FK_2` (`educationLevelFk`), KEY `worker_FK_1` (`originCountryFk`), KEY `worker_fk_editor` (`editorFk`), - CONSTRAINT `worker_FK` FOREIGN KEY (`labelerFk`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `worker_FK` FOREIGN KEY (`labelerFk__`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `worker_FK_1` FOREIGN KEY (`originCountryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, CONSTRAINT `worker_FK_2` FOREIGN KEY (`educationLevelFk`) REFERENCES `educationLevel` (`id`) ON UPDATE CASCADE, CONSTRAINT `worker_businessFk` FOREIGN KEY (`businessFk`) REFERENCES `business` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, @@ -41692,7 +41845,6 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); - CALL vn.printer_checkSector(NEW.labelerFk, NEW.sectorFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41713,18 +41865,6 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); - - IF NOT (NEW.labelerFk <=> OLD.labelerFk AND NEW.sectorFk <=> OLD.sectorFk) THEN - CALL vn.printer_checkSector(NEW.labelerFk, NEW.sectorFk); - - INSERT IGNORE INTO vn.operator (workerFk) - VALUES (NEW.id); - - UPDATE operator - SET labelerFk = NEW.labelerFk, - sectorFk = NEW.sectorFk - WHERE workerFk = NEW.id; - END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41791,6 +41931,24 @@ CREATE TABLE `workerBosses` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `workerBusinessAgreement` +-- + +DROP TABLE IF EXISTS `workerBusinessAgreement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerBusinessAgreement` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) DEFAULT NULL, + `monthHolidays` double DEFAULT NULL, + `yearHours` int(11) DEFAULT NULL, + `started` date DEFAULT NULL, + `ended` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `workerBusinessDated` -- @@ -41799,11 +41957,10 @@ DROP TABLE IF EXISTS `workerBusinessDated`; /*!50001 DROP VIEW IF EXISTS `workerBusinessDated`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerBusinessDated` ( - `dated` tinyint NOT NULL, - `businessFk` tinyint NOT NULL, - `workerFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerBusinessDated` AS SELECT + 1 AS `dated`, + 1 AS `businessFk`, + 1 AS `workerFk` */; SET character_set_client = @saved_cs_client; -- @@ -41872,10 +42029,9 @@ DROP TABLE IF EXISTS `workerDepartment`; /*!50001 DROP VIEW IF EXISTS `workerDepartment`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerDepartment` ( - `workerFk` tinyint NOT NULL, - `departmentFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerDepartment` AS SELECT + 1 AS `workerFk`, + 1 AS `departmentFk` */; SET character_set_client = @saved_cs_client; -- @@ -41927,8 +42083,8 @@ CREATE TABLE `workerDocument` ( KEY `workerDocument_ibfk_1` (`worker`), KEY `workerDocument_ibfk_2` (`document`), KEY `workerDocument_fk_editor` (`editorFk`), + CONSTRAINT `workerDocument_FK` FOREIGN KEY (`worker`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerDocument_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), - CONSTRAINT `workerDocument_ibfk_1` FOREIGN KEY (`worker`) REFERENCES `worker` (`userFk`) ON UPDATE CASCADE, CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -42185,15 +42341,14 @@ DROP TABLE IF EXISTS `workerLabour`; /*!50001 DROP VIEW IF EXISTS `workerLabour`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerLabour` ( - `businessFk` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `workCenterFk` tinyint NOT NULL, - `started` tinyint NOT NULL, - `ended` tinyint NOT NULL, - `departmentFk` tinyint NOT NULL, - `payedHolidays` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerLabour` AS SELECT + 1 AS `businessFk`, + 1 AS `workerFk`, + 1 AS `workCenterFk`, + 1 AS `started`, + 1 AS `ended`, + 1 AS `departmentFk`, + 1 AS `payedHolidays` */; SET character_set_client = @saved_cs_client; -- @@ -42265,10 +42420,9 @@ DROP TABLE IF EXISTS `workerMedia`; /*!50001 DROP VIEW IF EXISTS `workerMedia`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerMedia` ( - `workerFk` tinyint NOT NULL, - `mediaValue` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerMedia` AS SELECT + 1 AS `workerFk`, + 1 AS `mediaValue` */; SET character_set_client = @saved_cs_client; -- @@ -42382,15 +42536,14 @@ DROP TABLE IF EXISTS `workerSpeedExpedition`; /*!50001 DROP VIEW IF EXISTS `workerSpeedExpedition`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerSpeedExpedition` ( - `ticketFk` tinyint NOT NULL, - `litros` tinyint NOT NULL, - `literLastHour` tinyint NOT NULL, - `litersByMinute` tinyint NOT NULL, - `workerCode` tinyint NOT NULL, - `cajas` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerSpeedExpedition` AS SELECT + 1 AS `ticketFk`, + 1 AS `litros`, + 1 AS `literLastHour`, + 1 AS `litersByMinute`, + 1 AS `workerCode`, + 1 AS `cajas`, + 1 AS `warehouseFk` */; SET character_set_client = @saved_cs_client; -- @@ -42401,17 +42554,16 @@ DROP TABLE IF EXISTS `workerSpeedSaleTracking`; /*!50001 DROP VIEW IF EXISTS `workerSpeedSaleTracking`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerSpeedSaleTracking` ( - `warehouseFk` tinyint NOT NULL, - `state` tinyint NOT NULL, - `workerCode` tinyint NOT NULL, - `sumaLitros` tinyint NOT NULL, - `started` tinyint NOT NULL, - `finished` tinyint NOT NULL, - `sumaLitrosLastHour` tinyint NOT NULL, - `litersByMinute` tinyint NOT NULL, - `departmentName` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerSpeedSaleTracking` AS SELECT + 1 AS `warehouseFk`, + 1 AS `state`, + 1 AS `workerCode`, + 1 AS `sumaLitros`, + 1 AS `started`, + 1 AS `finished`, + 1 AS `sumaLitrosLastHour`, + 1 AS `litersByMinute`, + 1 AS `departmentName` */; SET character_set_client = @saved_cs_client; -- @@ -42440,10 +42592,9 @@ DROP TABLE IF EXISTS `workerTeamCollegues`; /*!50001 DROP VIEW IF EXISTS `workerTeamCollegues`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerTeamCollegues` ( - `workerFk` tinyint NOT NULL, - `collegueFk` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerTeamCollegues` AS SELECT + 1 AS `workerFk`, + 1 AS `collegueFk` */; SET character_set_client = @saved_cs_client; -- @@ -42483,9 +42634,9 @@ DELIMITER ;; AFTER INSERT ON `workerTimeControl` FOR EACH ROW BEGIN - IF NEW.timed > DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY) THEN + IF NEW.timed > DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY) THEN CALL util.throw('date in the future'); - END IF; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -42632,15 +42783,14 @@ DROP TABLE IF EXISTS `workerTimeControlUserInfo`; /*!50001 DROP VIEW IF EXISTS `workerTimeControlUserInfo`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerTimeControlUserInfo` ( - `userFk` tinyint NOT NULL, - `name` tinyint NOT NULL, - `surname` tinyint NOT NULL, - `user` tinyint NOT NULL, - `password` tinyint NOT NULL, - `departmentFk` tinyint NOT NULL, - `dni` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerTimeControlUserInfo` AS SELECT + 1 AS `userFk`, + 1 AS `name`, + 1 AS `surname`, + 1 AS `user`, + 1 AS `password`, + 1 AS `departmentFk`, + 1 AS `dni` */; SET character_set_client = @saved_cs_client; -- @@ -42651,14 +42801,13 @@ DROP TABLE IF EXISTS `workerTimeJourneyNG`; /*!50001 DROP VIEW IF EXISTS `workerTimeJourneyNG`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerTimeJourneyNG` ( - `userFk` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `Journey` tinyint NOT NULL, - `dayName` tinyint NOT NULL, - `name` tinyint NOT NULL, - `firstname` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerTimeJourneyNG` AS SELECT + 1 AS `userFk`, + 1 AS `dated`, + 1 AS `Journey`, + 1 AS `dayName`, + 1 AS `name`, + 1 AS `firstname` */; SET character_set_client = @saved_cs_client; -- @@ -42669,12 +42818,11 @@ DROP TABLE IF EXISTS `workerWithoutTractor`; /*!50001 DROP VIEW IF EXISTS `workerWithoutTractor`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerWithoutTractor` ( - `workerFk` tinyint NOT NULL, - `Trabajador` tinyint NOT NULL, - `Colecciones` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `workerWithoutTractor` AS SELECT + 1 AS `workerFk`, + 1 AS `Trabajador`, + 1 AS `Colecciones`, + 1 AS `created` */; SET character_set_client = @saved_cs_client; -- @@ -42882,16 +43030,15 @@ DROP TABLE IF EXISTS `zoneEstimatedDelivery`; /*!50001 DROP VIEW IF EXISTS `zoneEstimatedDelivery`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `zoneEstimatedDelivery` ( - `zoneFk` tinyint NOT NULL, - `hourTheoretical` tinyint NOT NULL, - `totalVolume` tinyint NOT NULL, - `remainingVolume` tinyint NOT NULL, - `speed` tinyint NOT NULL, - `hourEffective` tinyint NOT NULL, - `minutesLess` tinyint NOT NULL, - `etc` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `zoneEstimatedDelivery` AS SELECT + 1 AS `zoneFk`, + 1 AS `hourTheoretical`, + 1 AS `totalVolume`, + 1 AS `remainingVolume`, + 1 AS `speed`, + 1 AS `hourEffective`, + 1 AS `minutesLess`, + 1 AS `etc` */; SET character_set_client = @saved_cs_client; -- @@ -43021,10 +43168,10 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BI` BEFORE INSERT ON `zoneExclusion` FOR EACH ROW -BEGIN +BEGIN SET NEW.editorFk = account.myUser_getId(); SET NEW.userFk = account.myUser_getId(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -43043,10 +43190,10 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BU` BEFORE UPDATE ON `zoneExclusion` FOR EACH ROW -BEGIN +BEGIN SET NEW.editorFk = account.myUser_getId(); SET NEW.userFk = account.myUser_getId(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -43420,7 +43567,57 @@ DELIMITER ; -- Dumping events for database 'vn' -- /*!50106 SET @save_time_zone= @@TIME_ZONE */ ; -/*!50106 DROP EVENT IF EXISTS `collection_make` */; +/*!50106 DROP EVENT IF EXISTS `clientsDisable` */; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `clientsDisable` ON SCHEDULE EVERY 1 MONTH STARTS '2023-06-01 00:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO BEGIN + UPDATE account.user u + JOIN client c ON c.id = u.id + JOIN clientType ct ON ct.id = c.typeFk + SET u.active = FALSE + WHERE ct.code = 'normal' + AND u.id NOT IN ( + SELECT DISTINCT c.id + FROM client c + LEFT JOIN ticket t ON t.clientFk = c.id + WHERE c.salesPersonFk IS NOT NULL + OR t.created > util.VN_CURDATE() - INTERVAL 2 MONTH + OR shipped > util.VN_CURDATE() - INTERVAL 2 MONTH + ); +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +/*!50106 DROP EVENT IF EXISTS `client_unassignSalesPerson` */;; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`jgallego`@`%`*/ /*!50106 EVENT `client_unassignSalesPerson` ON SCHEDULE EVERY 1 DAY STARTS '2023-06-01 03:30:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL client_unassignSalesPerson */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +/*!50106 DROP EVENT IF EXISTS `collection_make` */;; DELIMITER ;; /*!50003 SET @saved_cs_client = @@character_set_client */ ;; /*!50003 SET @saved_cs_results = @@character_set_results */ ;; @@ -43507,9 +43704,9 @@ DELIMITER ;; /*!50003 SET @saved_cs_client = @@character_set_client */ ;; /*!50003 SET @saved_cs_results = @@character_set_results */ ;; /*!50003 SET @saved_col_connection = @@collation_connection */ ;; -/*!50003 SET character_set_client = utf8mb4 */ ;; -/*!50003 SET character_set_results = utf8mb4 */ ;; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; +/*!50003 SET character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; @@ -43677,25 +43874,7 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `sale_checkWithoutComponents` ON SCHEDULE EVERY 10 MINUTE STARTS '2020-05-04 11:56:23' ON COMPLETION PRESERVE DISABLE DO call sale_checkNoComponents(DATE_ADD(util.VN_NOW(), INTERVAL -10 MINUTE),DATE_ADD(util.VN_NOW(), INTERVAL -1 MINUTE)) */ ;; -/*!50003 SET time_zone = @saved_time_zone */ ;; -/*!50003 SET sql_mode = @saved_sql_mode */ ;; -/*!50003 SET character_set_client = @saved_cs_client */ ;; -/*!50003 SET character_set_results = @saved_cs_results */ ;; -/*!50003 SET collation_connection = @saved_col_connection */ ;; -/*!50106 DROP EVENT IF EXISTS `ticketClosure` */;; -DELIMITER ;; -/*!50003 SET @saved_cs_client = @@character_set_client */ ;; -/*!50003 SET @saved_cs_results = @@character_set_results */ ;; -/*!50003 SET @saved_col_connection = @@collation_connection */ ;; -/*!50003 SET character_set_client = utf8mb4 */ ;; -/*!50003 SET character_set_results = utf8mb4 */ ;; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticketClosure` ON SCHEDULE EVERY 1 DAY STARTS '2017-09-18 00:30:00' ON COMPLETION NOT PRESERVE DISABLE COMMENT 'Realiza el cierre de todos los almacenes del dia actual' DO CALL ticketClosureMultiWarehouse(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 DAY)) */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `sale_checkWithoutComponents` ON SCHEDULE EVERY 10 MINUTE STARTS '2020-05-04 11:56:23' ON COMPLETION PRESERVE DISABLE ON SLAVE DO call sale_checkNoComponents(DATE_ADD(util.VN_NOW(), INTERVAL -10 MINUTE),DATE_ADD(util.VN_NOW(), INTERVAL -1 MINUTE)) */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -43755,6 +43934,24 @@ DELIMITER ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; /*!50003 SET character_set_results = @saved_cs_results */ ;; /*!50003 SET collation_connection = @saved_col_connection */ ;; +/*!50106 DROP EVENT IF EXISTS `workerJourney_doRecalc` */;; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `workerJourney_doRecalc` ON SCHEDULE EVERY 1 DAY STARTS '2023-07-22 04:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL workerJourney_replace(util.VN_CURDATE() - INTERVAL 1 WEEK, util.VN_CURDATE(), NULL) */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; /*!50106 DROP EVENT IF EXISTS `worker_updateChangedBusiness` */;; DELIMITER ;; /*!50003 SET @saved_cs_client = @@character_set_client */ ;; @@ -43797,6 +43994,8 @@ DELIMITER ; -- -- Dumping routines for database 'vn' -- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `addressTaxArea` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -43804,8 +44003,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `addressTaxArea`(vAddresId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC @@ -43838,6 +44035,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `address_getGeo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -43845,8 +44044,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `address_getGeo`(vSelf INT) RETURNS int(11) DETERMINISTIC @@ -43860,7 +44057,7 @@ BEGIN DECLARE vGeoFk INT; SELECT p.geoFk INTO vGeoFk - FROM address a + FROM address a JOIN town t ON t.provinceFk = a.provinceFk JOIN postCode p ON p.townFk = t.id AND p.`code` = a.postalCode WHERE a.id = vSelf @@ -43874,6 +44071,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `barcodeToItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -43881,18 +44080,16 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `barcodeToItem`(vBarcode VARCHAR(22)) RETURNS int(11) DETERMINISTIC BEGIN - + /** * Obtiene el id del artículo * * @param vBarcode código de barras - * + * * return id del item */ @@ -43902,41 +44099,43 @@ BEGIN FROM vn.item WHERE id = vBarcode OR comment = vBarcode LIMIT 1; - - IF vItemFk THEN + + IF vItemFk THEN RETURN vItemFk; END IF; - SELECT itemFk INTO vItemFk - FROM buy + SELECT itemFk INTO vItemFk + FROM buy WHERE id = vBarcode; - - IF vItemFk THEN + + IF vItemFk THEN RETURN vItemFk; END IF; - - SELECT itemFk INTO vItemFk - FROM itemBarcode + + SELECT itemFk INTO vItemFk + FROM itemBarcode WHERE code = vBarcode; - - IF vItemFk THEN + + IF vItemFk THEN RETURN vItemFk; END IF; - SELECT i.id INTO vItemFk + SELECT i.id INTO vItemFk FROM vn.item i WHERE i.name LIKE CONCAT('%',vBarcode,'%') ORDER BY i.id ASC LIMIT 1; - + RETURN vItemFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `botanicExport_isUpdatable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -43944,8 +44143,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `botanicExport_isUpdatable`(vEdiGenusFk MEDIUMINT, vEdiSpecieFk MEDIUMINT, @@ -43953,9 +44150,9 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `botanicExport_isUpdatable`(vEdiGenus DETERMINISTIC BEGIN DECLARE vIsUpdatable INTEGER; - SELECT COUNT(*) INTO vIsUpdatable - FROM botanicExport - WHERE ediGenusFk = vEdiGenusFk + SELECT COUNT(*) INTO vIsUpdatable + FROM botanicExport + WHERE ediGenusFk = vEdiGenusFk AND (vEdiSpecieFk = ediSpecieFk OR IFNULL(vEdiSpecieFk,ediSpecieFk) IS NULL) AND vRestriction = restriction; RETURN vIsUpdatable; @@ -43965,6 +44162,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `buy_getUnitVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -43972,8 +44171,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `buy_getUnitVolume`(vSelf INT) RETURNS int(11) DETERMINISTIC @@ -44000,6 +44197,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `buy_getVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44007,8 +44206,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `buy_getVolume`(vSelf INT) RETURNS int(11) DETERMINISTIC @@ -44033,6 +44230,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `catalog_componentReverse` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44040,8 +44239,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `catalog_componentReverse`(vWarehouse INT, vCost DECIMAL(10,3), @@ -44051,16 +44248,16 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `catalog_componentReverse`(vWarehouse DETERMINISTIC BEGIN /* Calcula los componentes para un cliente a partir de un coste y volumen - * @param vWarehouse + * @param vWarehouse * @param vCost Valor de coste del articulo * @param vM3 m3 del articulo - * @param vAddressFk + * @param vAddressFk * @param vZoneFk - * @return vRetailedPrice precio de venta sin iva + * @return vRetailedPrice precio de venta sin iva * @return tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) */ - - DECLARE vBoxVolume BIGINT; + + DECLARE vBoxVolume BIGINT; DECLARE vCustomer INT; DECLARE vComponentRecovery INT DEFAULT 17; DECLARE vComponentMana INT DEFAULT 39; @@ -44069,11 +44266,11 @@ BEGIN DECLARE vComponentCost INT DEFAULT 28; DECLARE vRetailedPrice DECIMAL(10,2); DECLARE vItem INT DEFAULT 98; - + SELECT volume INTO vBoxVolume FROM vn.packaging WHERE id = '94'; - + SELECT clientFk INTO vCustomer FROM address WHERE id = vAddressFk; DROP TEMPORARY TABLE IF EXISTS tmp.catalog_component; @@ -44097,7 +44294,7 @@ BEGIN -- Margen -- No se aplica margen, cau 12589 /* INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) - SELECT vWarehouse, vItem, vComponentMargin, (vCost / ((100 - rate2) / 100)) - vCost + SELECT vWarehouse, vItem, vComponentMargin, (vCost / ((100 - rate2) / 100)) - vCost FROM vn.rate WHERE dated <= util.VN_CURDATE() AND warehouseFk = vWarehouse @@ -44106,7 +44303,7 @@ BEGIN */ -- Recobro INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) - SELECT vWarehouse, vItem, vComponentRecovery, ROUND(LEAST(recobro,0.25), 3) + SELECT vWarehouse, vItem, vComponentRecovery, ROUND(LEAST(recobro,0.25), 3) FROM bi.claims_ratio WHERE Id_Cliente = vCustomer AND recobro > 0.009; @@ -44123,7 +44320,7 @@ BEGIN ROUND( vM3 * (z.price - z.bonus) - * z.inflation + * z.inflation / vBoxVolume, 4 ) FROM zone z @@ -44140,6 +44337,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `clientGetMana` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44147,8 +44346,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetMana`(vClient INT) RETURNS decimal(10,2) DETERMINISTIC @@ -44166,30 +44363,30 @@ BEGIN DECLARE vAutoManaComponent INT; DECLARE vManaBank INT; DECLARE vManaGreugeType INT; - + SELECT id INTO vManaGreugeType FROM greugeType WHERE code = 'mana'; SELECT id INTO vManaBank FROM bank WHERE code = 'mana'; SELECT id INTO vManaComponent FROM component WHERE code = 'mana'; SELECT id INTO vAutoManaComponent FROM component WHERE code = 'autoMana'; - + SELECT COUNT(*) INTO vHasMana FROM `client` c WHERE c.id = vClient AND c.typeFk = 'normal'; - + IF NOT vHasMana THEN RETURN 0; END IF; - + SELECT max(dated) INTO vFromDated FROM clientManaCache; SELECT sum(mana) INTO vMana - FROM + FROM ( SELECT mana FROM clientManaCache WHERE clientFk = vClient - AND dated = vFromDated + AND dated = vFromDated UNION ALL SELECT s.quantity * value FROM ticket t @@ -44197,7 +44394,7 @@ BEGIN JOIN sale s on s.ticketFk = t.id JOIN saleComponent sc on sc.saleFk = s.id WHERE sc.componentFk IN (vManaComponent, vAutoManaComponent) - AND t.shipped > vFromDated + AND t.shipped > vFromDated AND t.shipped < TIMESTAMPADD(DAY,1,util.VN_CURDATE()) AND a.clientFk = vClient UNION ALL @@ -44224,6 +44421,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `clientGetSalesPerson` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44231,8 +44430,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11) DETERMINISTIC @@ -44247,6 +44444,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `clientTaxArea` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44254,14 +44453,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `clientTaxArea`(vClientId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8mb3 COLLATE utf8mb3_general_ci READS SQL DATA BEGIN /** -* Devuelve el area de un cliente, +* Devuelve el area de un cliente, * intracomunitario, extracomunitario o nacional. * * @param vClient Id del cliente @@ -44282,6 +44479,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `client_getDebt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44289,8 +44488,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `client_getDebt`(`vClient` INT, `vDate` DATE) RETURNS decimal(10,2) READS SQL DATA @@ -44308,7 +44505,7 @@ BEGIN SELECT COUNT(*) INTO vHasDebt FROM `client` c WHERE c.id = vClient AND c.typeFk = 'normal'; - + IF NOT vHasDebt THEN RETURN 0; END IF; @@ -44327,6 +44524,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `client_getFromPhone` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44334,8 +44533,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `client_getFromPhone`(vPhone VARCHAR(255)) RETURNS int(11) DETERMINISTIC @@ -44382,6 +44579,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `client_getSalesPerson` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44389,15 +44588,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11) DETERMINISTIC BEGIN /** - * Dado un id cliente y una fecha, devuelve su comercial para ese dia, teniendo - * en cuenta la jerarquía de las tablas: 1º la de sharingclient, 2º la de + * Dado un id cliente y una fecha, devuelve su comercial para ese dia, teniendo + * en cuenta la jerarquía de las tablas: 1º la de sharingclient, 2º la de * sharingcart y tercero la de clientes. * * @param vClientFk El id del cliente @@ -44435,29 +44632,29 @@ BEGIN l: LOOP SELECT workerSubstitute INTO vWorkerSubstituteFk - FROM sharingCart + FROM sharingCart WHERE util.VN_CURDATE() BETWEEN started AND ended AND workerFk = vSalesPersonFk ORDER BY id LIMIT 1; - + IF vWorkerSubstituteFk IS NULL THEN LEAVE l; END IF; - + SELECT COUNT(*) > 0 INTO vLoop FROM tmp.stack WHERE substitute = vWorkerSubstituteFk; IF vLoop THEN LEAVE l; END IF; - + INSERT INTO tmp.stack SET substitute = vWorkerSubstituteFk; - + SET vSalesPersonFk = vWorkerSubstituteFk; END LOOP; - + DROP TEMPORARY TABLE tmp.stack; END IF; @@ -44468,6 +44665,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `client_getSalesPersonByTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44475,8 +44674,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonByTicket`(vTicketFk INT) RETURNS int(11) DETERMINISTIC @@ -44491,11 +44688,11 @@ BEGIN **/ DECLARE vClientFk INT; DECLARE vDated DATE; - + SELECT clientFk, shipped INTO vClientFk, vDated FROM ticket WHERE id = vTicketFk; - + RETURN client_getSalesPerson(vClientFk, vDated); END ;; DELIMITER ; @@ -44503,6 +44700,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `client_getSalesPersonCode` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44510,8 +44709,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonCode`(vClientFk INT, vDated DATE) RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC @@ -44526,12 +44723,12 @@ BEGIN **/ DECLARE vWorkerCode CHAR(3); DECLARE vSalesPersonFk INT; - + SET vSalesPersonFk = client_getSalesPerson(vClientFk, vDated); SELECT code INTO vWorkerCode - FROM worker + FROM worker WHERE id = vSalesPersonFk; RETURN vWorkerCode; @@ -44541,6 +44738,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `client_getSalesPersonCodeByTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44548,8 +44747,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonCodeByTicket`(vTicketFk INT) RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC @@ -44564,11 +44761,11 @@ BEGIN **/ DECLARE vClientFk INT; DECLARE vDated DATE; - + SELECT clientFk, shipped INTO vClientFk, vDated FROM ticket WHERE id = vTicketFk; - + RETURN client_getSalesPersonCode(vClientFk, vDated); END ;; DELIMITER ; @@ -44576,6 +44773,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `collection_isPacked` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44583,8 +44782,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `collection_isPacked`(vSelf INT) RETURNS tinyint(1) DETERMINISTIC @@ -44610,6 +44807,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `currency_getCommission` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44617,8 +44816,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `currency_getCommission`(vSelf INT) RETURNS int(11) DETERMINISTIC @@ -44645,6 +44842,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `currentRate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44652,15 +44851,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `currentRate`(vCurrencyFk INT, vDated DATE) RETURNS decimal(10,4) READS SQL DATA BEGIN DECLARE curRate DECIMAL(10,4); - + SELECT value INTO curRate FROM referenceRate WHERE dated <= vDated @@ -44676,6 +44873,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `deviceProductionUser_accessGranted` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44683,31 +44882,29 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `deviceProductionUser_accessGranted`(vUserFK INT(10) , android_id VARCHAR(50)) RETURNS tinyint(1) DETERMINISTIC BEGIN /* * Comprueba si el usuario puede entrar en la aplicacion de almacen con ese movil - * + * * */ - + /*DECLARE vIsGranted BOOLEAN; DECLARE vDeviceProductionFk INT(11) DEFAULT NULL; - SELECT dp.id INTO vDeviceProductionFk - FROM vn.deviceProduction dp + SELECT dp.id INTO vDeviceProductionFk + FROM vn.deviceProduction dp WHERE dp.android_id = android_id; IF vDeviceProductionFk THEN - - SELECT COUNT(*) INTO vIsGranted - FROM vn.deviceProductionUser dpu - WHERE dpu.userFk = vUserFK + + SELECT COUNT(*) INTO vIsGranted + FROM vn.deviceProductionUser dpu + WHERE dpu.userFk = vUserFK AND dpu.deviceProductionFk = vDeviceProductionFk; - + RETURN vIsGranted; END IF;*/ RETURN TRUE; @@ -44717,6 +44914,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `duaTax_getRate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44724,23 +44923,21 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `duaTax_getRate`(vDua INT, vTaxClass INT) RETURNS decimal(5,2) DETERMINISTIC BEGIN DECLARE vCountryFk INTEGER; - + SELECT s.countryFk INTO vCountryFk FROM dua d JOIN supplier s ON s.id = d.companyFk WHERE d.id = vDua; - + RETURN (SELECT rate FROM (SELECT taxClassFk, rate - FROM invoiceInTaxBookingAccount + FROM invoiceInTaxBookingAccount WHERE effectived <= util.VN_CURDATE() AND countryFk = vCountryFk AND taxClassFk = vTaxClass @@ -44754,6 +44951,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ekt_getEntry` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44761,31 +44960,29 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getEntry`(vEktFk INT) RETURNS int(11) READS SQL DATA BEGIN /** - * Devuelve el numero de entrada para el ekt - * + * Devuelve el numero de entrada para el ekt + * * @param vEktFk Identificador de edi.ekt - */ + */ DECLARE vTravelFk INT; DECLARE vEntryFk INT DEFAULT 0; DECLARE vEntryAssignFk INT; - SELECT ea.id + SELECT ea.id INTO vEntryAssignFk FROM edi.ekt e - JOIN vn.ektEntryAssign ea ON + JOIN vn.ektEntryAssign ea ON IFNULL(ea.sub, e.sub) <=> e.sub AND IFNULL(ea.kop, e.kop) <=> e.kop AND IFNULL(ea.pro, e.pro) <=> e.pro AND IFNULL(ea.auction, e.auction) <=> e.auction WHERE e.id = vEktFk - ORDER BY + ORDER BY IF(ea.sub,1,0) * 1000 + IF(ea.kop,1,0) * 100 + IF(ea.pro,1,0) * 10 + @@ -44796,7 +44993,7 @@ BEGIN IF vTravelFk THEN - SELECT MAX(e.id) + SELECT MAX(e.id) INTO vEntryFk FROM vn.entry e JOIN vn.ektEntryAssign ea ON ea.id = vEntryAssignFk @@ -44811,13 +45008,13 @@ BEGIN INSERT INTO vn.entry(travelFk, supplierFk, companyFk, currencyFk, kop, sub, reference, pro, auction) SELECT vTravelFk, ea.supplierFk, ea.companyFk, cu.id, ea.kop, ea.sub, ea.ref, ea.pro, ea.auction FROM vn.ektEntryAssign ea - JOIN vn.currency cu ON cu.code = 'EUR' + JOIN vn.currency cu ON cu.code = 'EUR' WHERE ea.id = vEntryAssignFk; SET vEntryFk = LAST_INSERT_ID(); END IF; - UPDATE vn.ektEntryAssign + UPDATE vn.ektEntryAssign SET entryFk = vEntryFk WHERE id = vEntryAssignFk; @@ -44836,6 +45033,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ekt_getTravel` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44843,15 +45042,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getTravel`(vEntryAssignFk INT, vEktFk INT) RETURNS int(11) READS SQL DATA BEGIN /** * Devuelve un vn.travel.id - * + * * @param vEntryAssignFk Identificador de vn.entryAssign */ DECLARE vTravelFk INT; @@ -44892,6 +45089,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `entry_getCommission` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44899,8 +45098,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission`(vTravelFk INT, vCurrencyFk INT, @@ -44912,36 +45109,36 @@ BEGIN DECLARE vCurrentCommission INT; DECLARE vIsCurrencyUsd INT; DECLARE vLastEntryFk INT; - + SELECT count(*) INTO vIsCurrencyUsd FROM currency c WHERE c.code = 'USD' AND id = vCurrencyFk; - + IF NOT vIsCurrencyUsd THEN - + SELECT e.id INTO vLastEntryFk FROM vn.entry e JOIN vn.travel tr ON tr.id = e.travelFk WHERE e.supplierFk = vSupplierFk ORDER BY tr.landed DESC LIMIT 1; - + IF vLastEntryFk THEN - + SELECT commission INTO vCurrentCommission FROM vn.entry WHERE id = vLastEntryFk; - + ELSE - + SELECT commission INTO vCurrentCommission FROM supplier s WHERE s.id = vSupplierFk; - + END IF; - + RETURN vCurrentCommission; - + ELSE SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission @@ -44950,17 +45147,19 @@ BEGIN WHERE t.id = vTravelFk ORDER BY r.`dated` DESC LIMIT 1; - + RETURN IFNULL(vCommission, 0); - + END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `entry_getCurrency` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44968,8 +45167,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCurrency`(vCurrency INT, vSupplierFk INT @@ -44992,6 +45189,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `entry_getForLogiflora` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44999,16 +45198,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11) READS SQL DATA BEGIN - + /** * Devuelve una entrada para Logiflora. Si no existe la crea. - * + * * @param vLanded Fecha de llegada al almacén * @param vWarehouseFk Identificador de vn.warehouse */ @@ -45016,57 +45213,59 @@ BEGIN DECLARE vTravelFk INT; DECLARE vEntryFk INT; DECLARE previousEntryFk INT; - + SET vTravelFk = vn.travel_getForLogiflora(vLanded, vWarehouseFk); - + IF vLanded THEN - - SELECT IFNULL(MAX(id),0) INTO vEntryFk + + SELECT IFNULL(MAX(id),0) INTO vEntryFk FROM vn.entry - WHERE travelFk = vTravelFk + WHERE travelFk = vTravelFk AND isRaid; IF NOT vEntryFk THEN - + INSERT INTO vn.entry(travelFk, supplierFk, commission, companyFk, currencyFk, isRaid) SELECT vTravelFk, s.id, 4, c.id, cu.id, TRUE FROM vn.supplier s JOIN vn.company c ON c.code = 'VNL' JOIN vn.currency cu ON cu.code = 'EUR' WHERE s.name = 'KONINKLIJE COOPERATIEVE BLOEMENVEILING FLORAHOLLAN'; - - SELECT MAX(id) INTO vEntryFk + + SELECT MAX(id) INTO vEntryFk FROM vn.entry WHERE travelFk = vTravelFk; - + END IF; + + END IF; - END IF; - - SELECT entryFk INTO previousEntryFk + SELECT entryFk INTO previousEntryFk FROM edi.warehouseFloramondo wf WHERE wf.warehouseFk = vWarehouseFk; - + IF IFNULL(previousEntryFk,0) != vEntryFk THEN - - UPDATE buy b - SET b.printedStickers = 0 + + UPDATE buy b + SET b.printedStickers = 0 WHERE entryFk = previousEntryFk; DELETE FROM buy WHERE entryFk = previousEntryFk; - + DELETE FROM entry WHERE id = previousEntryFk; - + END IF; - + RETURN vEntryFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `entry_isIntrastat` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45074,8 +45273,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `entry_isIntrastat`(vSelf INT) RETURNS int(11) READS SQL DATA @@ -45093,21 +45290,21 @@ BEGIN SELECT IFNULL(a.isUeeMember, c.isUeeMember), c.id INTO vIsUeeSupplier, vSupplierCountry - FROM entry e - JOIN supplier s ON s.id = e.supplierFk - JOIN country c ON c.id = s.countryFk + FROM entry e + JOIN supplier s ON s.id = e.supplierFk + JOIN country c ON c.id = s.countryFk LEFT JOIN province p ON p.id = s.provinceFk LEFT JOIN autonomy a ON a.id = p.autonomyFk WHERE e.id = vSelf; - + SELECT IFNULL(a.isUeeMember, c.isUeeMember), c.id INTO vIsUeeCompany, vCompanyCountry - FROM entry e - JOIN supplier s ON s.id = e.companyFk - JOIN country c ON c.id = s.countryFk + FROM entry e + JOIN supplier s ON s.id = e.companyFk + JOIN country c ON c.id = s.countryFk LEFT JOIN province p ON p.id = s.provinceFk LEFT JOIN autonomy a ON a.id = p.autonomyFk - WHERE e.id = vSelf; + WHERE e.id = vSelf; RETURN vIsUeeCompany AND vIsUeeSupplier AND (vSupplierCountry <> vCompanyCountry); @@ -45117,6 +45314,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `entry_isInventoryOrPrevious` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45124,8 +45323,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `entry_isInventoryOrPrevious`(vSelf INT) RETURNS int(11) DETERMINISTIC @@ -45147,6 +45344,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `expedition_checkRoute` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45154,8 +45353,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `expedition_checkRoute`(vPalletFk INT,vExpeditionFk INT) RETURNS tinyint(1) DETERMINISTIC @@ -45172,17 +45369,17 @@ BEGIN DECLARE vHasDistinctRoutes BOOL; SELECT t.routeFk INTO vRouteFk - FROM vn.expedition e + FROM vn.expedition e JOIN vn.ticket t ON e.ticketFk = t.id WHERE e.id = vExpeditionFk; - + SELECT COUNT(*) > 0 INTO vHasDistinctRoutes FROM vn.expeditionScan es JOIN vn.expedition e ON es.expeditionFk = e.id JOIN vn.ticket t ON e.ticketFk = t.id WHERE es.palletFk = vPalletFk AND t.routeFk <> vRouteFk; - + RETURN vHasDistinctRoutes; END ;; @@ -45191,6 +45388,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `firstDayOfWeek` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45198,8 +45397,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `firstDayOfWeek`(vYear INT, vWeek INT) RETURNS date DETERMINISTIC @@ -45227,6 +45424,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getAlert3State` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45234,8 +45433,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getAlert3State`(vTicket INT) RETURNS varchar(45) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci READS SQL DATA @@ -45243,27 +45440,27 @@ BEGIN DECLARE vDeliveryType INTEGER DEFAULT 0; DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; DECLARE vCode VARCHAR(45); - + SELECT am.deliveryMethodFk - INTO vDeliveryType + INTO vDeliveryType FROM ticket t JOIN agencyMode am ON am.id = t.agencyModeFk WHERE t.id = vTicket; - + CASE vDeliveryType WHEN 1 THEN -- AGENCIAS SET vCode = 'DELIVERED'; - + WHEN 2 THEN -- REPARTO SET vCode = 'ON_DELIVERY'; - + ELSE -- MERCADO, OTROS SELECT MIN(t.warehouseFk <> w.id) INTO isWaitingForPickUp - FROM ticket t + FROM ticket t LEFT JOIN warehouse w ON w.pickUpagencyModeFk = t.agencyModeFk WHERE t.id = vTicket; - + IF isWaitingForPickUp THEN SET vCode = 'WAITING_FOR_PICKUP'; ELSE @@ -45277,6 +45474,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getAlert3StateTest` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45284,8 +45483,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getAlert3StateTest`(vTicket INT) RETURNS varchar(45) CHARSET latin1 COLLATE latin1_swedish_ci READS SQL DATA @@ -45293,28 +45490,28 @@ BEGIN DECLARE vDeliveryType INTEGER DEFAULT 0; DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; DECLARE vCode VARCHAR(45); - - SELECT + + SELECT a.Vista - INTO vDeliveryType + INTO vDeliveryType FROM vn2008.Tickets t JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia WHERE Id_Ticket = vTicket; - + CASE vDeliveryType WHEN 1 THEN -- AGENCIAS SET vCode = 'DELIVERED'; - + WHEN 2 THEN -- REPARTO SET vCode = 'ON_DELIVERY'; - + ELSE -- MERCADO, OTROS SELECT t.warehouse_id <> w.warehouse_id INTO isWaitingForPickUp - FROM vn2008.Tickets t - LEFT JOIN vn2008.warehouse_pickup w + FROM vn2008.Tickets t + LEFT JOIN vn2008.warehouse_pickup w ON w.agency_id = t.Id_Agencia AND w.warehouse_id = t.warehouse_id WHERE t.Id_Ticket = vTicket; - + IF isWaitingForPickUp THEN SET vCode = 'WAITING_FOR_PICKUP'; ELSE @@ -45328,6 +45525,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getDueDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45335,8 +45534,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getDueDate`(vDated DATE, vDayToPay INT) RETURNS date NO SQL @@ -45356,6 +45553,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getInventoryDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45363,8 +45562,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getInventoryDate`() RETURNS date DETERMINISTIC @@ -45376,6 +45573,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getNewItemId` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45383,8 +45582,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getNewItemId`() RETURNS int(11) READS SQL DATA @@ -45405,6 +45602,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getNextDueDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45412,8 +45611,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getNextDueDate`(vDated DATE, vGapDays INT, vPayDay INT) RETURNS date NO SQL @@ -45422,16 +45619,16 @@ BEGIN DECLARE vReturn DATE; DECLARE vDuaDate DATE; DECLARE vDuaDateDay INT; - + SELECT TIMESTAMPADD(DAY, vGapDays, vDated) INTO vDuaDate; IF vDuaDate = CONCAT(YEAR(vDuaDate), '-03-01') THEN - SET vDuaDate = TIMESTAMPADD (DAY , -1, vDuaDate); + SET vDuaDate = TIMESTAMPADD (DAY , -1, vDuaDate); ELSEIF vDuaDate = CONCAT(YEAR(vDuaDate), '-02-29') THEN - SET vDuaDate = TIMESTAMPADD (DAY , -2, vDuaDate); + SET vDuaDate = TIMESTAMPADD (DAY , -2, vDuaDate); END IF; - IF MONTH(vDuaDate) = 2 AND vPayDay = 30 THEN + IF MONTH(vDuaDate) = 2 AND vPayDay = 30 THEN IF util.isLeapYear(YEAR(vDuaDate)) THEN SET vPayDay = 29; ELSE @@ -45439,7 +45636,7 @@ BEGIN END IF; END IF; - SELECT DAY(vDuaDate) INTO vDuaDateDay; + SELECT DAY(vDuaDate) INTO vDuaDateDay; RETURN TIMESTAMPADD(MONTH, (vDuaDateDay > vPayDay), DATE_FORMAT(vDuaDate, CONCAT('%y/%m/', vPayDay))); END ;; DELIMITER ; @@ -45447,6 +45644,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getShipmentHour` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45454,18 +45653,16 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getShipmentHour`(vTicket INT) RETURNS int(11) READS SQL DATA BEGIN DECLARE vShipmentHour INT; - + SELECT HOUR(shipped) INTO vShipmentHour FROM ticket WHERE id = vTicket; - + IF vShipmentHour = 0 THEN DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; @@ -45480,11 +45677,11 @@ BEGIN JOIN agencyMode am on am.id = t.agencyModeFk JOIN address a on a.id = t.addressFk WHERE t.id = vTicket; - - SELECT Hora INTO vShipmentHour + + SELECT Hora INTO vShipmentHour FROM tmp.production_buffer; END IF; - + RETURN vShipmentHour; END ;; DELIMITER ; @@ -45492,6 +45689,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getSpecialPrice` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45499,8 +45698,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getSpecialPrice`(vItemFk int(11),vClientFk int(11)) RETURNS decimal(10,2) READS SQL DATA @@ -45509,12 +45706,12 @@ BEGIN SELECT rate3 INTO price FROM vn.priceFixed - WHERE itemFk = vItemFk + WHERE itemFk = vItemFk AND util.VN_CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1; - SELECT `value` INTO price + SELECT `value` INTO price FROM vn.specialPrice - WHERE itemFk = vItemFk + WHERE itemFk = vItemFk AND clientFk = vClientFk ; RETURN price; END ;; @@ -45523,6 +45720,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getTicketTrolleyLabelCount` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45530,15 +45729,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getTicketTrolleyLabelCount`(vTicket INT) RETURNS int(11) READS SQL DATA BEGIN DECLARE vLabelCount INT DEFAULT 0; - SELECT labelCount INTO vLabelCount + SELECT labelCount INTO vLabelCount FROM ticketTrolley WHERE ticket = vTicket; @@ -45554,6 +45751,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getUser` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45561,8 +45760,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getUser`() RETURNS int(11) DETERMINISTIC @@ -45577,6 +45774,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `getUserId` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45584,8 +45783,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getUserId`(userName varchar(30)) RETURNS int(11) READS SQL DATA @@ -45604,32 +45801,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `getWorkerCode` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getWorkerCode`() RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci - READS SQL DATA -BEGIN - DECLARE vUserCode VARCHAR(3) CHARSET utf8 COLLATE utf8_unicode_ci; - - SELECT code INTO vUserCode - FROM worker - WHERE userFk = account.myUser_getId(); - - RETURN vUserCode; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `hasAnyNegativeBase` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45637,8 +45810,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `hasAnyNegativeBase`() RETURNS tinyint(1) DETERMINISTIC @@ -45679,6 +45850,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `hasItemsInSector` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45686,31 +45859,31 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `hasItemsInSector`(vTicketFk INT, vSectorFk INT) RETURNS tinyint(1) DETERMINISTIC BEGIN DECLARE vItemCount INT; - + SELECT count(*) INTO vItemCount - FROM vn.sale s + FROM vn.sale s JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk JOIN vn.shelving sh ON sh.code = ish.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk WHERE s.ticketFk = vTicketFk AND p.sectorFk = vSectorFk; - + RETURN vItemCount; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `hasSomeNegativeBase` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45718,8 +45891,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `hasSomeNegativeBase`(vTicket INT) RETURNS tinyint(1) READS SQL DATA @@ -45727,7 +45898,7 @@ BEGIN DECLARE vCountry INT; DECLARE hasSomeNegativeBase BOOLEAN; - SELECT s.countryFk + SELECT s.countryFk INTO vCountry FROM supplier s JOIN ticket t ON t.companyFk = s.id @@ -45736,9 +45907,9 @@ BEGIN SELECT COUNT(*) INTO hasSomeNegativeBase FROM ( SELECT SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2)) taxableBase - FROM sale s + FROM sale s JOIN item i ON i.id = s.itemFk - JOIN itemTaxCountry itc + JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = vCountry WHERE s.ticketFk = vTicket GROUP BY itc.taxClassFk @@ -45752,6 +45923,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `invoiceOutAmount` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45759,8 +45932,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOutAmount`(vInvoiceRef VARCHAR(15)) RETURNS decimal(10,2) READS SQL DATA @@ -45768,12 +45939,12 @@ BEGIN DECLARE totalAmount DECIMAL(10,2); SELECT SUM(vat) INTO totalAmount - FROM ( + FROM ( SELECT iot.vat FROM invoiceOutTax iot JOIN invoiceOut io ON io.id = iot.invoiceOutFk WHERE io.ref = vInvoiceRef - UNION ALL + UNION ALL SELECT ioe.amount FROM invoiceOutExpence ioe JOIN invoiceOut io ON io.id = ioe.invoiceOutFk @@ -45787,6 +45958,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `invoiceOut_getMaxIssued` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45794,8 +45967,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getMaxIssued`(vSerial VARCHAR(2), vCompanyFk INT, @@ -45804,23 +45975,23 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getMaxIssued`(vSerial VAR READS SQL DATA BEGIN /** - * Retorna la fecha a partir de la cual es válido emitir una factura + * Retorna la fecha a partir de la cual es válido emitir una factura * - * @param vSerial Serie de facturación + * @param vSerial Serie de facturación * @param vCompanyFk Empresa factura emitida * @param vYear Año contable * @return vInvoiceOutIssued fecha factura válida */ DECLARE vInvoiceOutIssued DATE; DECLARE vFirstDayOfYear DATE; - + SET vFirstDayOfYear := MAKEDATE(vYear, 1); - SELECT IFNULL(MAX(io.issued), vFirstDayOfYear) INTO vInvoiceOutIssued + SELECT IFNULL(MAX(io.issued), vFirstDayOfYear) INTO vInvoiceOutIssued FROM invoiceOut io WHERE io.serial = vSerial AND io.companyFk = vCompanyFk - AND io.issued BETWEEN vFirstDayOfYear + AND io.issued BETWEEN vFirstDayOfYear AND util.lastDayOfYear(vFirstDayOfYear); RETURN vInvoiceOutIssued; @@ -45830,6 +46001,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `invoiceOut_getPath` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45837,8 +46010,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getPath`(vSelf INT) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC @@ -45846,7 +46017,7 @@ BEGIN DECLARE vIssued DATE; DECLARE vSerial VARCHAR(15); - SELECT issued, ref + SELECT issued, ref INTO vIssued, vSerial FROM invoiceOut WHERE id = vSelf; @@ -45863,6 +46034,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `invoiceOut_getWeight` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45870,8 +46043,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getWeight`(vInvoiceRef VARCHAR(15) ) RETURNS decimal(10,2) @@ -45904,6 +46075,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `invoiceSerial` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45911,16 +46084,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerial`(vClientFk INT, vCompanyFk INT, vType CHAR(1)) RETURNS char(1) CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC BEGIN /** - * Obtiene la serie de de una factura + * Obtiene la serie de de una factura * dependiendo del area del cliente. - * + * * @param vClientFk Id del cliente * @param vCompanyFk Id de la empresa * @param vType Tipo de factura ["R", "M", "G"] @@ -45942,6 +46113,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `invoiceSerialArea` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45949,8 +46122,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerialArea`(vType CHAR(1), vTaxArea VARCHAR(25)) RETURNS char(1) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC @@ -45988,28 +46159,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `isIntrastatEntry` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `isIntrastatEntry`(vEntryFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - -- para retrocompatibilidad, eliminar en la siguiente version - - RETURN (SELECT entry_isIntrastat(vEntryFk)); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `isLogifloraDay` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46017,30 +46168,30 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `isLogifloraDay`(vShipped DATE, vWarehouse INT) RETURNS tinyint(1) DETERMINISTIC BEGIN - + DECLARE vIsLogifloraDay BOOLEAN; SELECT COUNT(*) INTO vIsLogifloraDay FROM edi.warehouseFloramondo wf - JOIN vn.floramondoConfig fc + JOIN vn.floramondoConfig fc WHERE wf.warehouseFk = vWarehouse AND vShipped BETWEEN DATE(TIMESTAMPADD(DAY, wf.travellingDays , fc.nextLanded)) AND DATE(TIMESTAMPADD(DAY, wf.travellingDays + wf.dayRange , fc.nextLanded)); - + RETURN vIsLogifloraDay; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `isPalletHomogeneus` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46048,8 +46199,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `isPalletHomogeneus`(vExpedition INT) RETURNS tinyint(1) READS SQL DATA @@ -46071,7 +46220,7 @@ BEGIN WHERE sl.scan_id = vScanId AND t.Id_Ruta ) t1; - + RETURN vDistinctRoutesInThePallet = 1; END ;; DELIMITER ; @@ -46079,6 +46228,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `itemPacking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46086,8 +46237,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `itemPacking`(vBarcode VARCHAR(22), vWarehouseFk INT) RETURNS int(11) DETERMINISTIC @@ -46095,20 +46244,20 @@ BEGIN DECLARE vPacking INTEGER DEFAULT 0; DECLARE vItemFk INTEGER; - + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - SELECT IFNULL(packing,0) INTO vPacking - FROM vn.buy + + SELECT IFNULL(packing,0) INTO vPacking + FROM vn.buy WHERE id = CAST(vBarcode AS DECIMAL(18,0)); - - - - + + + + IF NOT vPacking THEN CALL cache.last_buy_refresh(FALSE); SELECT IFNULL(packing,1) INTO vPacking - FROM + FROM (SELECT packing , created FROM vn.itemShelving WHERE itemFk = vItemFk @@ -46121,17 +46270,19 @@ BEGIN ) packings ORDER BY created desc LIMIT 1; - + END IF; - + RETURN vPacking; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `itemShelvingPlacementSupply_ClosestGet` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46139,8 +46290,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `itemShelvingPlacementSupply_ClosestGet`(vParkingFk INT) RETURNS int(11) READS SQL DATA @@ -46150,11 +46299,11 @@ BEGIN DECLARE vColumn INT; DECLARE vClosestParkingFk INT; DECLARE vSectorFk INT; - + SELECT p.column, sectorFk INTO vColumn, vSectorFk FROM vn.parking p WHERE p.id = vParkingFk; - + SELECT itemShelvingFk INTO vClosestParkingFk FROM ( @@ -46164,18 +46313,20 @@ BEGIN JOIN vn.itemPlacementSupplyList ipsl ON ipsl.sectorFk = ispss.sectorFk AND ipsl.itemFk = ispss.itemFk WHERE p.sectorFk = vSectorFk AND ipsl.saldo > 0 - ) sub + ) sub ORDER BY distance LIMIT 1; - + RETURN vClosestParkingFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `itemsInSector_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46183,31 +46334,31 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `itemsInSector_get`(vTicketFk INT, vSectorFk INT) RETURNS int(11) READS SQL DATA BEGIN DECLARE vItemCount INT; - + SELECT count(*) INTO vItemCount - FROM vn.sale s + FROM vn.sale s JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk JOIN vn.shelving sh ON sh.code = ish.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk WHERE s.ticketFk = vTicketFk AND p.sectorFk = vSectorFk; - + RETURN vItemCount; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `itemTag_getIntValue` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46215,8 +46366,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `itemTag_getIntValue`(vValue VARCHAR(255)) RETURNS int(11) DETERMINISTIC @@ -46232,6 +46381,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `item_getFhImage` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46239,8 +46390,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `item_getFhImage`(itemFk INT) RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC @@ -46261,6 +46410,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `item_getPackage` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46268,41 +46419,41 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `item_getPackage`(vItemFk INT) RETURNS varchar(50) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC BEGIN - + DECLARE vDiameter INT; DECLARE vPackageFk VARCHAR(50); DECLARE vCoeficient DOUBLE DEFAULT 1.08; - + SELECT MAX(LEFT(value,3)) INTO vDiameter - FROM vn.itemTag it + FROM vn.itemTag it JOIN vn.tag t ON t.id = it.tagFk WHERE it.itemFk = vItemFk AND t.overwrite = 'diameter'; - + SELECT 8000 + FLOOR(vc.ccLength * vc.ccWidth / (vCoeficient * PI() * (vDiameter / 2) * (vDiameter / 2))) INTO vPackageFk FROM vn.volumeConfig vc; - + INSERT IGNORE INTO vn.packaging(id, width, `depth`) - SELECT vPackageFk, - FLOOR(vc.ccWidth / FLOOR(vc.ccWidth / vDiameter)), + SELECT vPackageFk, + FLOOR(vc.ccWidth / FLOOR(vc.ccWidth / vDiameter)), FLOOR(vc.ccLength / FLOOR(vc.ccLength / vDiameter)) FROM vn.volumeConfig vc; - + RETURN vPackageFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `item_getVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46310,8 +46461,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `item_getVolume`(vSelf INT, vPackaging VARCHAR(10)) RETURNS int(11) DETERMINISTIC @@ -46333,7 +46482,7 @@ BEGIN FROM packaging p JOIN item i ON i.id = vSelf WHERE p.id = vPackaging; - + RETURN vVolume; END ;; @@ -46342,6 +46491,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `lastDayOfWeek` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46349,12 +46500,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `lastDayOfWeek`(vYear INT, vWeek INT) RETURNS date DETERMINISTIC -BEGIN +BEGIN /** * Returns the date of the last day of the week * @@ -46378,6 +46527,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `machine_checkPlate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46385,24 +46536,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `machine_checkPlate`(vPlate VARCHAR(10)) RETURNS tinyint(1) READS SQL DATA BEGIN /** * Comprueba si existe matrícula - * + * * @param vPlate matrícula del vehículo * @return Devuelve TRUE en caso de que exista - * + * */ - + IF (SELECT COUNT(*) - FROM machine m + FROM machine m WHERE m.plate = vPlate - ) THEN + ) THEN RETURN TRUE; ELSE RETURN FALSE; @@ -46413,6 +46562,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `messageSend` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46420,8 +46571,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `messageSend`(vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11) READS SQL DATA @@ -46429,9 +46578,9 @@ BEGIN DECLARE result INT; DECLARE vSenderFk INT; - SELECT id INTO vSenderFk + SELECT id INTO vSenderFk FROM account.user WHERE `name` = account.myUser_getName(); - + RETURN (SELECT messageSendWithUser(vSenderFk, vRecipient, vMessage)); END ;; DELIMITER ; @@ -46439,6 +46588,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `messageSendWithUser` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46446,8 +46597,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `messageSendWithUser`(vSenderFK INT, vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11) DETERMINISTIC @@ -46458,9 +46607,9 @@ BEGIN DECLARE vSendDate DATETIME DEFAULT util.VN_NOW(); DECLARE vSender VARCHAR(255) CHARSET utf8; - SELECT `name` INTO vSender + SELECT `name` INTO vSender FROM account.user WHERE id = vSenderFK; - + SET vRecipient = LOWER(vRecipient); DROP TEMPORARY TABLE IF EXISTS tRecipients; @@ -46481,7 +46630,7 @@ BEGIN IF vCount = 0 THEN RETURN vCount; - END IF; + END IF; SET vUuid = UUID(); @@ -46492,7 +46641,7 @@ BEGIN message = vMessage, sendDate = vSendDate; - INSERT INTO messageInbox (uuid, sender, recipient, finalRecipient, message, sendDate) + INSERT INTO messageInbox (uuid, sender, recipient, finalRecipient, message, sendDate) SELECT vUuid, vSender, vRecipient, finalRecipient, vMessage, vSendDate FROM tRecipients; @@ -46504,6 +46653,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `MIDNIGHT` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46511,8 +46662,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `MIDNIGHT`(vDate DATE) RETURNS datetime DETERMINISTIC @@ -46524,6 +46673,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `nz` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46531,8 +46682,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `nz`(vQuantity DOUBLE) RETURNS double DETERMINISTIC @@ -46550,6 +46699,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `orderTotalVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46557,8 +46708,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `orderTotalVolume`(vOrderId INT) RETURNS decimal(10,3) READS SQL DATA @@ -46566,7 +46715,7 @@ BEGIN -- Devuelte el volumen total de la orden sumada DECLARE vWarehouseId INTEGER; DECLARE vVolume DECIMAL(10,3); - + SELECT IFNULL(SUM(o.amount * ic.cm3delivery)/1000000,0) INTO vVolume FROM hedera.orderRow o JOIN item i ON i.id = o.itemFk @@ -46581,6 +46730,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `orderTotalVolumeBoxes` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46588,8 +46739,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `orderTotalVolumeBoxes`(vOrderId INT) RETURNS decimal(10,3) READS SQL DATA @@ -46617,6 +46766,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `packaging_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46624,8 +46775,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `packaging_calculate`(isPackageReturnable TINYINT(1), packagingReturnFk INT(11), @@ -46643,7 +46792,7 @@ BEGIN WHERE cb.id = packagingReturnFk; SET vValue = IF (vAmount IS NULL, - IFNULL(base,0), + IFNULL(base,0), vAmount / IFNULL(upload, 0) + IFNULL(base, 0)); ELSE SET vValue = IFNULL(price, 0) + IFNULL(base, 0); @@ -46656,6 +46805,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `phytoPassport` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46663,14 +46814,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `phytoPassport`(vRef VARCHAR(15)) RETURNS text CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC BEGIN DECLARE vPhyto TEXT CHARSET utf8 COLLATE utf8_unicode_ci; -SELECT +SELECT GROUP_CONCAT(i.id, ':', ppa.denomination, @@ -46711,6 +46860,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `priceFixed_getRate2` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46718,8 +46869,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `priceFixed_getRate2`(vFixedPriceFk INT, vRate3 DOUBLE) RETURNS double BEGIN @@ -46743,6 +46892,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `routeProposal` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46750,8 +46901,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal`(vTicketFk INT) RETURNS int(11) READS SQL DATA @@ -46759,20 +46908,20 @@ BEGIN DECLARE vRouteFk INT; DECLARE vAddressFk INT; - + DECLARE vLanded DATE; DECLARE vZoneFk INT; DECLARE vSignificativeFriendship INT DEFAULT 6; DECLARE vVolumeMax DECIMAL(5,1) DEFAULT 10; - + SELECT addressFk, zoneFk, landed INTO vAddressFk, vZoneFk, vLanded - FROM vn.ticket + FROM vn.ticket WHERE id = vTicketFk; - + -- Se inicia la selección de rutas posibles con aquellas cuyas agencias alguna vez han estado asociadas con nuestra zona DROP TEMPORARY TABLE IF EXISTS tmp.route; CREATE TEMPORARY TABLE tmp.route - SELECT r.id routeFk, + SELECT r.id routeFk, zf.friendship zoneFriendship FROM vn.route r JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk @@ -46780,16 +46929,16 @@ BEGIN AND zf.zoneFk = vZoneFk AND r.created = vLanded ORDER BY friendship; - + -- Se eliminan aquellas que superan el volumen máximo DELETE r.* - FROM tmp.route r + FROM tmp.route r JOIN (SELECT routeFk, sum(volume) volume FROM vn.saleVolume WHERE landed = vLanded GROUP BY routeFk) sub ON sub.routeFk = r.routeFk WHERE sub.volume > vVolumeMax; - + -- Se ordenan las que quedan en función con la afinidad del resto de consignatarios de cada ruta SELECT routeFk INTO vRouteFk FROM @@ -46801,7 +46950,7 @@ BEGIN ORDER BY zoneFriendship DESC, friendshipSum DESC ) sub LIMIT 1; - + RETURN vRouteFk; END ;; DELIMITER ; @@ -46809,6 +46958,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `routeProposal_` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46816,8 +46967,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal_`(vTicketFk INT) RETURNS int(11) READS SQL DATA @@ -46826,9 +46975,9 @@ BEGIN DECLARE vRouteFk INT; DECLARE vAddressFk INT; DECLARE vShipped DATETIME; - + SELECT addressFk, date(shipped) INTO vAddressFk, vShipped - FROM vn.ticket + FROM vn.ticket WHERE id = vTicketFk; SELECT routeFk INTO vRouteFk @@ -46842,7 +46991,7 @@ BEGIN ORDER BY friendshipSum DESC ) sub LIMIT 1; - + RETURN vRouteFk; END ;; DELIMITER ; @@ -46850,6 +46999,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `routeProposal_beta` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46857,8 +47008,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal_beta`(vTicketFk INT) RETURNS int(11) READS SQL DATA @@ -46866,20 +47015,20 @@ BEGIN DECLARE vRouteFk INT; DECLARE vAddressFk INT; - + DECLARE vLanded DATE; DECLARE vZoneFk INT; DECLARE vSignificativeFriendship INT DEFAULT 6; DECLARE vVolumeMax DECIMAL(5,1) DEFAULT 10; - + SELECT addressFk, zoneFk, landed INTO vAddressFk, vZoneFk, vLanded - FROM vn.ticket + FROM vn.ticket WHERE id = vTicketFk; - + -- Se inicia la selección de rutas posibles con aquellas cuyas agencias alguna vez han estado asociadas con nuestra zona DROP TEMPORARY TABLE IF EXISTS tmp.route; CREATE TEMPORARY TABLE tmp.route - SELECT r.id routeFk, + SELECT r.id routeFk, zf.friendship zoneFriendship FROM vn.route r JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk @@ -46887,16 +47036,16 @@ BEGIN AND zf.zoneFk = vZoneFk AND r.created = vLanded ORDER BY friendship; - + -- Se eliminan aquellas que superan el volumen máximo DELETE r.* - FROM tmp.route r + FROM tmp.route r JOIN (SELECT routeFk, sum(volume) volume FROM vn.saleVolume WHERE landed = vLanded GROUP BY routeFk) sub ON sub.routeFk = r.routeFk WHERE sub.volume > vVolumeMax; - + -- Se ordenan las que quedan en función con la afinidad del resto de consignatarios de cada ruta SELECT routeFk INTO vRouteFk FROM @@ -46908,7 +47057,7 @@ BEGIN ORDER BY zoneFriendship DESC, friendshipSum DESC ) sub LIMIT 1; - + RETURN vRouteFk; END ;; DELIMITER ; @@ -46916,6 +47065,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `specie_IsForbidden` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46923,38 +47074,38 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `specie_IsForbidden`(vItemFk INT, vAddressFk INT) RETURNS tinyint(1) READS SQL DATA BEGIN - + DECLARE vIsForbbiden BOOL; DECLARE vLeft INT; SELECT zg.lft INTO vLeft - FROM vn.address a - JOIN vn.zoneGeo zg ON zg.name = a.postalCode + FROM vn.address a + JOIN vn.zoneGeo zg ON zg.name = a.postalCode WHERE a.id = vAddressFk; - + SELECT sgi.isForbidden INTO vIsForbbiden - FROM vn.specieGeoInvasive sgi - JOIN vn.zoneGeo zg ON zg.id = sgi.zoneGeofk + FROM vn.specieGeoInvasive sgi + JOIN vn.zoneGeo zg ON zg.id = sgi.zoneGeofk JOIN vn.itemBotanical ib ON ib.genusFk = sgi.genusFk AND sgi.specieFk IN ('sp.',ib.specieFk) WHERE vLeft BETWEEN zg.lft AND zg.rgt AND ib.itemFk = vItemFk - ORDER BY zg.`depth` DESC + ORDER BY zg.`depth` DESC LIMIT 1; RETURN IFNULL(vIsForbbiden, FALSE); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `testCIF` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46962,13 +47113,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `testCIF`(vCIF VARCHAR(9)) RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC BEGIN - + DECLARE vLetraInicial VARCHAR(1); DECLARE vLetraFinal VARCHAR(1); DECLARE vParteNumerica VARCHAR(7); @@ -46980,66 +47129,68 @@ BEGIN SET vLetraInicial = SUBSTR(vCIF, 1, 1); SET vLetraFinal = SUBSTR(vCIF, 9, 1); SET vParteNumerica = SUBSTR(vCIF, 2, 7); - - WHILE i < 7 DO - + + WHILE i < 7 DO + SET i = i + 1; - + SET vNumero = CAST(SUBSTR(vParteNumerica, i, 1) AS DECIMAL(1,0)); - + IF i MOD 2 THEN - + SET vNumero = vNumero * 2; SET vNumero = vNumero MOD 10 + FLOOR(vNumero/10); - + END IF; - + SET vSuma = vSuma + vNumero; - + END WHILE; - + SET vSuma = vSuma MOD 10; - + IF vSuma > 0 THEN - + SET vSuma = 10 - vSuma; - + END IF; - + -- Comprobación de dígito de control IF CAST(vLetraFinal AS DECIMAL(1,0)) = vSuma THEN - + SET vResult = TRUE; - + END IF; - + IF vSuma = 0 THEN - + SET vSuma = 10; - + END IF; - + IF CHAR(64 + vSuma) = vLetraFinal THEN - + SET vResult = TRUE; - + END IF; - + -- Sólo se aceptan letras como caracter inicial IF ASCII(vLetraInicial) < 65 OR ASCII(vLetraInicial) > 87 THEN -- Ha de ser entre la A y la W - + SET vResult = FALSE; - + END IF; - + RETURN vResult; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `testNIE` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47047,13 +47198,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `testNIE`(vNIE VARCHAR(9)) RETURNS tinyint(1) DETERMINISTIC BEGIN - + DECLARE vIndice INT; DECLARE vNumero VARCHAR(7); DECLARE vOperador VARCHAR(9); @@ -47062,51 +47211,53 @@ BEGIN DECLARE vLetraFinal VARCHAR(1); DECLARE vLetrasFinalesPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; DECLARE vLetraInicialEsIncorrecta BOOL DEFAULT FALSE; - + SET vLetraInicial = SUBSTR(vNIE, 1, 1); SET vLetraFinal = SUBSTR(vNIE, 9, 1); SET vNumero = SUBSTR(vNIE, 2, 7); CASE vLetraInicial - + WHEN 'X' THEN - + SET vOperador = "0"; - + WHEN 'Y' THEN - + SET vOperador = "1"; - + WHEN 'Z' THEN - + SET vOperador = "2"; - + ELSE - + SET vLetraInicialEsIncorrecta = TRUE; - + END CASE; - + SET vOperador = CONCAT(vOperador, vNumero); SET vParteNumerica = CAST(vOperador AS DECIMAL(8,0)); SET vIndice = Round(vParteNumerica Mod 23, 0) + 1; IF SUBSTR(vLetrasFinalesPosibles, vIndice, 1) = vLetraFinal AND vLetraInicialEsIncorrecta = FALSE THEN - + RETURN TRUE; - + ELSE - + RETURN FALSE; - + END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `testNIF` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47114,8 +47265,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `testNIF`(vNIF VARCHAR(9)) RETURNS tinyint(1) DETERMINISTIC @@ -47125,29 +47274,31 @@ BEGIN DECLARE vParteNumerica DECIMAL(8,0); DECLARE vLetra VARCHAR(1); DECLARE vLetrasPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; - + SET vLetra = SUBSTRING(vNIF, 9, 1); - + SET vParteNumerica = CAST(SUBSTRING(vNIF, 1, 8) AS DECIMAL(8,0)); - + SET vIndice = Round(vParteNumerica MOD 23, 0) + 1; - + If SUBSTRING(vLetrasPosibles, vIndice, 1) = vLetra Then - + RETURN TRUE; - + ELSE - + RETURN FALSE; - + END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticketCollection_getNoPacked` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47155,27 +47306,25 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticketCollection_getNoPacked`(vCollectionFk INT) RETURNS varchar(100) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci DETERMINISTIC BEGIN - + /* * return message with tickets and collection if there is tickets of a collection without expeditions - * + * * @param vCollectionFk the collection to check * @return an array with collection and tickets without expeditions - * + * */ - + DECLARE vAnswer VARCHAR(100) DEFAULT ''; IF collection_isPacked(vCollectionFk) = FALSE THEN SELECT CONCAT('Colección: ',tc.collectionFk,' Tickets: ' , GROUP_CONCAT(tc.ticketFk) ) INTO vAnswer FROM vn.ticketCollection tc - LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk + LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk WHERE tc.collectionFk = vCollectionFk AND ISNULL(e.id); END IF; @@ -47187,6 +47336,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticketGetTotal` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47194,8 +47345,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticketGetTotal`(vTicketId INT) RETURNS decimal(10,2) READS SQL DATA @@ -47221,15 +47370,17 @@ BEGIN DROP TEMPORARY TABLE tmp.ticket, tmp.ticketTotal; - + RETURN vTotal; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticketPositionInPath` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47237,13 +47388,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticketPositionInPath`(vTicketId INT) RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC BEGIN - + DECLARE vRestTicketsMaxOrder INT; DECLARE vRestTicketsMinOrder INT; DECLARE vRestTicketsPacking INT; @@ -47255,7 +47404,7 @@ BEGIN DECLARE vExpeditionsCount INT; DECLARE vIsValenciaPath BOOLEAN DEFAULT FALSE; -SELECT `order` +SELECT `order` INTO PACKING_ORDER FROM state WHERE code = 'PACKING'; @@ -47266,7 +47415,7 @@ SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0) LEFT JOIN ticketState ts on ts.ticket = t.id WHERE t.id = vTicketId; -SELECT (ag.`name` = 'VN_VALENCIA') +SELECT (ag.`name` = 'VN_VALENCIA') INTO vIsValenciaPath FROM vn2008.Rutas r JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia @@ -47280,7 +47429,7 @@ IF vIsValenciaPath THEN -- Rutas Valencia FROM expedition e JOIN ticket t ON t.id = e.ticketFk WHERE t.routeFk = vMyPath; - + SELECT MAX(ts.productionOrder), MIN(ts.productionOrder) INTO vRestTicketsMaxOrder, vRestTicketsMinOrder FROM ticket t @@ -47289,7 +47438,7 @@ IF vIsValenciaPath THEN -- Rutas Valencia AND t.warehouseFk = vMyWarehouse AND t.id != vTicketid; - SELECT COUNT(*) + SELECT COUNT(*) INTO vRestTicketsPacking FROM ticket t LEFT JOIN ticketState ts on t.id = ts.ticket @@ -47321,6 +47470,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticketSplitCounter` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47328,8 +47479,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticketSplitCounter`(vTicketFk INT) RETURNS varchar(15) CHARSET utf8mb3 COLLATE utf8mb3_general_ci READS SQL DATA @@ -47344,15 +47493,17 @@ BEGIN LEFT JOIN vn2008.movement_label l ON l.Id_Movimiento = s.id WHERE ticketFk = vTicketFk ) sub; - + RETURN IFNULL(vSplitCounter,'--'); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticketTotalVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47360,8 +47511,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticketTotalVolume`(vTicketId INT) RETURNS decimal(10,3) READS SQL DATA @@ -47381,6 +47530,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticketTotalVolumeBoxes` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47388,28 +47539,26 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticketTotalVolumeBoxes`(vTicketId INT) RETURNS decimal(10,1) DETERMINISTIC BEGIN -/* +/* * Devuelve el volumen estimado del ticket sumado, en cajas * * vTicketId Numero de ticket - * + * */ DECLARE vVolumeBoxM3 DOUBLE; DECLARE vTicketTotalVolumeBoxes DECIMAL(10,1); DECLARE vVnBoxId VARCHAR(10) DEFAULT '94'; - + SELECT volume / 1000000 INTO vVolumeBoxM3 FROM packaging WHERE id = vVnBoxId; - + SET vTicketTotalVolumeBoxes = ticketTotalVolume(vTicketId) / vVolumeBoxM3; - + RETURN vTicketTotalVolumeBoxes; END ;; @@ -47418,6 +47567,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticketWarehouseGet` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47425,8 +47576,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticketWarehouseGet`(vTicketFk INT) RETURNS int(11) READS SQL DATA @@ -47434,7 +47583,7 @@ BEGIN DECLARE vWarehouseFk INT; SELECT warehouseFk INTO vWarehouseFk - FROM ticket + FROM ticket WHERE id = vTicketFk; RETURN vWarehouseFk; @@ -47444,6 +47593,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticket_CC_volume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47451,24 +47602,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_CC_volume`(vTicketFk INT) RETURNS decimal(10,1) READS SQL DATA BEGIN - + DECLARE vCC DECIMAL(10,1); SELECT sum(sv.volume * IF(i.itemPackingTypeFk = 'H', vc.dutchCompressionRate, 1)) / (p.volume / 1000000) INTO vCC - FROM vn.saleVolume sv - JOIN vn.sale s ON s.id = sv.saleFk - JOIN vn.item i ON i.id = s.itemFk + FROM vn.saleVolume sv + JOIN vn.sale s ON s.id = sv.saleFk + JOIN vn.item i ON i.id = s.itemFk JOIN vn.packaging p ON p.id = 'CC' - JOIN vn.volumeConfig vc + JOIN vn.volumeConfig vc WHERE sv.ticketFk = vTicketFk; - + RETURN vCC; END ;; @@ -47477,6 +47626,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticket_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47484,50 +47635,48 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_get`(vParamFk INT) RETURNS int(11) READS SQL DATA proc:BEGIN - + /* Devuelve el número de ticket o collection consultando en varias tablas posibles - * + * * @param vParamFk Número a validar * @return vValidFk Identificador validado */ - + DECLARE vValidFk INT; -- Tabla vn.saleGroup SELECT s.ticketFk INTO vValidFk FROM vn.sale s JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk + JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk WHERE sg.id = vParamFk AND sg.created > TIMESTAMPADD(WEEK,-1, util.VN_CURDATE()) LIMIT 1; - + IF vValidFk THEN - + RETURN vValidFk; - + LEAVE proc; - + END IF; -- Tabla vn.collection SELECT c.id INTO vValidFk - FROM vn.collection c + FROM vn.collection c WHERE c.id = vParamFk AND c.created > TIMESTAMPADD(WEEK,-1, util.VN_CURDATE()); - + IF vValidFk THEN - + RETURN vValidFk; - + LEAVE proc; - + END IF; -- Tabla vn.ticket @@ -47535,23 +47684,25 @@ proc:BEGIN FROM vn.ticket t WHERE t.id = vParamFk AND t.shipped > TIMESTAMPADD(WEEK,-1, util.VN_CURDATE()); - + IF vValidFk THEN - + RETURN vValidFk; - + LEAVE proc; - + END IF; RETURN NULL; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticket_getFreightCost` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47559,8 +47710,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getFreightCost`(vTicketFk INT) RETURNS decimal(10,2) DETERMINISTIC @@ -47571,8 +47720,8 @@ BEGIN * @vTicketFk Id del ticket a calcular */ DECLARE deliveryPrice DECIMAL (10,2); - - IF (SELECT isVolumetric FROM ticket t JOIN zone z ON t.zoneFk = z.id + + IF (SELECT isVolumetric FROM ticket t JOIN zone z ON t.zoneFk = z.id WHERE t.id = vTicketFk) THEN SELECT SUM(sv.freight) INTO deliveryPrice FROM vn.saleVolume sv @@ -47583,7 +47732,7 @@ BEGIN LEFT JOIN expedition e ON e.ticketFk = t.id JOIN expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk WHERE t.id = vTicketFk; - + END IF; RETURN deliveryPrice; END ;; @@ -47592,6 +47741,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticket_getWeight` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47599,24 +47750,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getWeight`(vTicketFk INT) RETURNS decimal(10,3) READS SQL DATA BEGIN /** * Devuelve el peso total del ticket - * + * * @return Total peso */ - + DECLARE vWeight DECIMAL(10,3); SELECT sum(weight) INTO vWeight FROM saleVolume WHERE ticketFk = vTicketFk; - + RETURN vWeight; END ;; @@ -47625,6 +47774,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticket_HasUbication` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47632,21 +47783,19 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_HasUbication`(vTicketFk INT) RETURNS tinyint(1) READS SQL DATA BEGIN - + DECLARE hasUbication BOOL; SELECT COUNT(*) INTO hasUbication FROM vn.ticket t JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - WHERE rm.beachFk + WHERE rm.beachFk AND t.id = vTicketFk; - + RETURN hasUbication; END ;; @@ -47655,6 +47804,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `ticket_isOutClosureZone` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47662,8 +47813,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_isOutClosureZone`(vSelf INT) RETURNS tinyint(1) DETERMINISTIC @@ -47690,6 +47839,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `till_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47697,8 +47848,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `till_new`(vClient INT ,vBank INT @@ -47781,6 +47930,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `timeWorkerControl_getDirection` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47788,14 +47939,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME) RETURNS varchar(6) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci READS SQL DATA BEGIN /** - * Verifica la dirección de la fichada + * Verifica la dirección de la fichada * @param vUserFk Identificador del trabajador * @param vTimed Hora de la fichada * @return Retorna sentido de la fichada 'in, out, middle' @@ -47808,40 +47957,40 @@ BEGIN DECLARE vDayStayMax INT; DECLARE vTimedSeconds INT; DECLARE vLastTimeIn INT; - + SELECT UNIX_TIMESTAMP(vTimed) INTO vTimedSeconds; - + SELECT dayStayMax INTO vDayStayMax FROM vn.workerTimeControlParams; SELECT timed, direction INTO vNext,vNextDirection - FROM vn.workerTimeControl - WHERE userFk = vUserFk + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND direction IN ('in','out') AND timed > vTimed ORDER BY timed ASC LIMIT 1; - + SELECT timed, direction INTO vPrevious, vPreviousDirection - FROM vn.workerTimeControl - WHERE userFk = vUserFk + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND direction IN ('in','out') AND timed < vTimed ORDER BY timed DESC - LIMIT 1; - - IF (vTimedSeconds - UNIX_TIMESTAMP(vPrevious) + UNIX_TIMESTAMP(vNext) - vTimedSeconds)<= vDayStayMax AND vPreviousDirection = 'in' AND vNextDirection = 'out' THEN + LIMIT 1; + + IF (vTimedSeconds - UNIX_TIMESTAMP(vPrevious) + UNIX_TIMESTAMP(vNext) - vTimedSeconds)<= vDayStayMax AND vPreviousDirection = 'in' AND vNextDirection = 'out' THEN RETURN 'middle'; END IF; - - + + IF (vTimedSeconds> UNIX_TIMESTAMP(vPrevious)) THEN - IF vPreviousDirection = 'in' THEN + IF vPreviousDirection = 'in' THEN RETURN 'out'; ELSE SELECT UNIX_TIMESTAMP(MAX(timed)) INTO vLastTimeIn - FROM vn.workerTimeControl - WHERE userFk = vUserFk + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND direction ='in' AND timed < vPrevious; IF vTimedSeconds - vLastTimeIn <= vDayStayMax THEN @@ -47857,6 +48006,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `time_getSalesYear` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47864,8 +48015,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `time_getSalesYear`(vMonth INT, vYear INT) RETURNS int(11) DETERMINISTIC @@ -47882,6 +48031,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `travel_getForLogiflora` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47889,17 +48040,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `travel_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11) READS SQL DATA BEGIN - + /** * Devuelve un número de travel para compras de Logiflora a partir de la fecha de llegada y del almacén. * Si no existe lo genera. - * + * * @param vLanded Fecha de llegada al almacén * @param vWarehouseFk Identificador de vn.warehouse */ @@ -47907,8 +48056,8 @@ BEGIN DECLARE vTravelFk INT; IF vLanded THEN - - SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk + + SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk FROM vn.travel tr JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk @@ -47919,14 +48068,14 @@ BEGIN AND landed = vLanded; IF NOT vTravelFk THEN - + INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyModeFk) - SELECT vLanded, util.VN_CURDATE(), vWarehouseFk, wOut.id, am.id - FROM vn.warehouse wOut + SELECT vLanded, util.VN_CURDATE(), vWarehouseFk, wOut.id, am.id + FROM vn.warehouse wOut JOIN vn.agencyMode am ON am.name = 'LOGIFLORA' WHERE wOut.name = 'Holanda'; - - SELECT MAX(tr.id) INTO vTravelFk + + SELECT MAX(tr.id) INTO vTravelFk FROM vn.travel tr JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk @@ -47934,17 +48083,19 @@ BEGIN AND wOut.name = 'Holanda' AND landed = vLanded; END IF; - + END IF; - + RETURN vTravelFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `validationCode` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47952,8 +48103,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `validationCode`(vString VARCHAR(255)) RETURNS int(11) DETERMINISTIC @@ -47965,27 +48114,29 @@ BEGIN DECLARE vChar INT; SET vLength = length(vString); - + WHILE vLength > 0 DO - + SET vChar = MID(vString,vLength,1); - + SET vSeed = vSeed + ASCII(vChar); - + SET vLength = vLength - 1; - + END WHILE; SET vCode = FLOOR(SQRT(vSeed)*1000000) mod 1000; RETURN vCode; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `validationCode_beta` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47993,8 +48144,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `validationCode_beta`(vString VARCHAR(255)) RETURNS int(11) DETERMINISTIC @@ -48006,86 +48155,29 @@ BEGIN DECLARE vChar INT; SET vLength = length(vString); - + WHILE vLength > 0 DO - + SET vChar = MID(vString,vLength,1); - + SET vSeed = vSeed + ASCII(vChar); - + SET vLength = vLength - 1; - + END WHILE; SET vCode = FLOOR(SQRT(vSeed)*1000000) mod 1000; RETURN vCode; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `workerIsBoss` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerIsBoss`(vUserId INT) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Comprueba por jerarquía si el trabajador actual es jefe - * de un trabajador en concreto. - * - * @param vUserId Id del trabajador que se desea comprobar. - * @return Revuelve verdadero si es jefe del empleado por escala jerárquica. - */ - DECLARE vWorkerId INT; - DECLARE vBossId INT; - - SELECT id INTO vWorkerId - FROM vn.worker - WHERE userFk = vUserId; - IF vWorkerId IS NULL THEN - CALL util.throw('USER_NOT_FOUND'); - END IF; - - DROP TEMPORARY TABLE IF EXISTS tCheckedWorker; - CREATE TEMPORARY TABLE tCheckedWorker - (PRIMARY KEY (workerFk)) - ENGINE = MEMORY - SELECT id workerFk FROM worker LIMIT 0; - LOOP - SELECT bossFk INTO vBossId - FROM vn.worker - WHERE id = vWorkerId; - IF (SELECT COUNT(*) FROM tCheckedWorker WHERE workerFk = vBossId) THEN - CALL util.throw('INFINITE_LOOP'); - END IF; - IF vBossId = vWorkerId THEN - RETURN FALSE; - ELSEIF vBossId = account.myUser_getId() THEN - RETURN TRUE; - ELSE - INSERT INTO tCheckedWorker VALUES (vWorkerId); - SET vWorkerId = vBossId; - END IF; - END LOOP; - DROP TEMPORARY TABLE tCheckedWorker; - RETURN FALSE; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `workerMachinery_isRegistered` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48093,8 +48185,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `workerMachinery_isRegistered`(vWorkerFk VARCHAR(10)) RETURNS tinyint(1) READS SQL DATA @@ -48120,6 +48210,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `workerNigthlyHours_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48127,8 +48219,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `workerNigthlyHours_calculate`(vTimeIn DATETIME, vTimeOut DATETIME) RETURNS decimal(5,2) READS SQL DATA @@ -48140,15 +48230,15 @@ BEGIN * @param vTimeOut * @return vNigthlyHours */ - DECLARE vNigthlyHours DECIMAL(5,2); + DECLARE vNigthlyHours DECIMAL(5,2); DECLARE vSecondsPerHour INT(4) DEFAULT 3600; - + SELECT GREATEST(0, TIMESTAMPDIFF(SECOND, - IF(TIME(vTimeIn) BETWEEN endNightlyHours AND startNightlyHours, - CONCAT(DATE(vTimeIn), ' ', startNightlyHours), + IF(TIME(vTimeIn) BETWEEN endNightlyHours AND startNightlyHours, + CONCAT(DATE(vTimeIn), ' ', startNightlyHours), vTimeIn), - IF(TIME(vTimeOut) BETWEEN endNightlyHours AND startNightlyHours, - CONCAT(DATE(vTimeOut), ' ', endNightlyHours), + IF(TIME(vTimeOut) BETWEEN endNightlyHours AND startNightlyHours, + CONCAT(DATE(vTimeOut), ' ', endNightlyHours), vTimeOut))) / vSecondsPerHour INTO vNigthlyHours FROM vn.workerTimeControlConfig; @@ -48159,6 +48249,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48166,8 +48258,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_add`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) DETERMINISTIC @@ -48180,47 +48270,47 @@ BEGIN SELECT dayStayMax INTO vDayStayMax FROM workerTimeControlParams; - + SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; IF vDirection = 'out' THEN - + SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk + FROM workerTimeControl + WHERE userFk = vUserFk AND direction = 'in' AND timed < vTimed; - + UPDATE workerTimeControl wtc SET wtc.direction = 'middle' WHERE userFk = vUserFk AND direction = 'out' AND timed BETWEEN vLastIn AND vTimed; - + ELSE IF vDirection = 'in' THEN - - SELECT COUNT(*) INTO vHasDirectionOut + + SELECT COUNT(*) INTO vHasDirectionOut FROM workerTimeControl wtc - WHERE userFk = vUserFk + WHERE userFk = vUserFk AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); UPDATE workerTimeControl wtc SET wtc.direction = IF (vHasDirectionOut,'middle','out') WHERE userFk = vUserFk AND direction = 'in' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); END IF; END IF; - + INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); - + SET vLastInsertedId = LAST_INSERT_ID(); - + CALL workerTimeControlSOWP(vUserFk, vTimed); - + RETURN vLastInsertedId; END ;; DELIMITER ; @@ -48228,6 +48318,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_addDirection` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48235,8 +48327,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_addDirection`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) DETERMINISTIC @@ -48249,47 +48339,47 @@ BEGIN SELECT dayStayMax INTO vDayStayMax FROM workerTimeControlParams; - + SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; IF vDirection = 'out' THEN - + SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk + FROM workerTimeControl + WHERE userFk = vUserFk AND direction = 'in' AND timed < vTimed; - + UPDATE workerTimeControl wtc SET wtc.direction = 'middle' WHERE userFk = vUserFk AND direction = 'out' AND timed BETWEEN vLastIn AND vTimed; - + ELSE IF vDirection = 'in' THEN - - SELECT COUNT(*) INTO vHasDirectionOut + + SELECT COUNT(*) INTO vHasDirectionOut FROM workerTimeControl wtc - WHERE userFk = vUserFk + WHERE userFk = vUserFk AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); UPDATE workerTimeControl wtc SET wtc.direction = IF (vHasDirectionOut,'middle','out') WHERE userFk = vUserFk AND direction = 'in' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); END IF; END IF; - + INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); - + SET vLastInsertedId = LAST_INSERT_ID(); - + CALL workerTimeControlSOWP(vUserFk, vTimed); - + RETURN vLastInsertedId; END ;; DELIMITER ; @@ -48297,6 +48387,93 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP FUNCTION IF EXISTS `worker_getCode` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `worker_getCode`() RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci + READS SQL DATA +BEGIN + DECLARE vUserCode VARCHAR(3) CHARSET utf8 COLLATE utf8_unicode_ci; + + SELECT code INTO vUserCode + FROM worker + WHERE id = account.myUser_getId(); + + RETURN vUserCode; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP FUNCTION IF EXISTS `worker_isBoss` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isBoss`(vUserId INT) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Comprueba por jerarquía si el trabajador actual es jefe + * de un trabajador en concreto. + * + * @param vSelf Id del trabajador que se desea comprobar. + * @return Revuelve verdadero si es jefe del empleado por escala jerárquica. + */ + DECLARE vWorkerId INT; + DECLARE vBossId INT; + + SELECT id INTO vWorkerId + FROM worker + WHERE id = vSelf; + IF vWorkerId IS NULL THEN + CALL util.throw('USER_NOT_FOUND'); + END IF; + + DROP TEMPORARY TABLE IF EXISTS tCheckedWorker; + CREATE TEMPORARY TABLE tCheckedWorker + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT id workerFk FROM worker LIMIT 0; + LOOP + SELECT bossFk INTO vBossId + FROM worker + WHERE id = vWorkerId; + IF (SELECT COUNT(*) FROM tCheckedWorker WHERE workerFk = vBossId) THEN + CALL util.throw('INFINITE_LOOP'); + END IF; + IF vBossId = vWorkerId THEN + RETURN FALSE; + ELSEIF vBossId = account.myUser_getId() THEN + RETURN TRUE; + ELSE + INSERT INTO tCheckedWorker VALUES (vWorkerId); + SET vWorkerId = vBossId; + END IF; + END LOOP; + DROP TEMPORARY TABLE tCheckedWorker; + RETURN FALSE; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `worker_isWorking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48304,8 +48481,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isWorking`(vWorkerFk INT) RETURNS tinyint(1) READS SQL DATA @@ -48315,17 +48490,17 @@ BEGIN * @return Devuelve TRUE en caso de que este trabajando. Si se encuentra en un descanso devolverá FALSE */ DECLARE vLastIn DATETIME ; - + SELECT MAX(timed) INTO vLastIn - FROM vn.workerTimeControl + FROM vn.workerTimeControl WHERE userFk = vWorkerFk AND direction = 'in'; - IF (SELECT MOD(COUNT(*),2) - FROM vn.workerTimeControl - WHERE userFk = vWorkerFk AND + IF (SELECT MOD(COUNT(*),2) + FROM vn.workerTimeControl + WHERE userFk = vWorkerFk AND timed >= vLastIn - ) THEN + ) THEN RETURN TRUE; ELSE RETURN FALSE; @@ -48336,6 +48511,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `xdiario_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48343,8 +48520,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `xdiario_new`(vAsiento INT, vDated DATE, @@ -48391,6 +48566,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `zoneGeo_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48398,8 +48575,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `zoneGeo_new`(vType VARCHAR(255), vName VARCHAR(255), vParentFk INT) RETURNS int(11) NO SQL @@ -48419,7 +48594,7 @@ BEGIN SET `type` = vType, `name` = vName, parentFk = vParentFk; - + SET vSelf = LAST_INSERT_ID(); UPDATE zoneGeoRecalc SET isChanged = TRUE; @@ -48431,6 +48606,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `addNoteFromDelivery` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48438,12 +48615,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `addNoteFromDelivery`(idTicket INT,nota TEXT) BEGIN - + DECLARE observationTypeFk INT DEFAULT 3; /*3 = REPARTIDOR*/ INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) @@ -48457,6 +48632,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `addressTaxArea` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48464,30 +48641,28 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `addressTaxArea`() READS SQL DATA BEGIN /** - * Devuelve el taxArea para un conjunto de Consignatarios y empresas, + * Devuelve el taxArea para un conjunto de Consignatarios y empresas, * * @table tmp.addressCompany(addressFk, companyFk) valores a calcular * @return tmp.addressTaxArea(addressFk,companyFk) */ - + DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; CREATE TEMPORARY TABLE tmp.addressTaxArea (PRIMARY KEY (addressFk, companyFk)) ENGINE = MEMORY - SELECT CASE - WHEN (NOT IFNULL(auClient.isUeeMember, cClient.isUeeMember) OR NOT cSupplier.isUeeMember) - AND NOT (auSupplier.id <=> auClient.id) THEN + SELECT CASE + WHEN (NOT IFNULL(auClient.isUeeMember, cClient.isUeeMember) OR NOT cSupplier.isUeeMember) + AND NOT (auSupplier.id <=> auClient.id) THEN 'WORLD' - WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.isVies THEN + WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.isVies THEN 'CEE' - WHEN a.isEqualizated AND cClient.code = 'ES' THEN + WHEN a.isEqualizated AND cClient.code = 'ES' THEN 'EQU' ELSE 'NATIONAL' @@ -48508,6 +48683,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `agencyHourGetFirstShipped` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48515,8 +48692,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetFirstShipped`(vAgencyMode INT, vAddress INT, vWarehouse INT) BEGIN @@ -48528,27 +48703,27 @@ BEGIN * @param vAddress id de la direccion * @param vWarehouse id del warehouse * @return vShipped la primera fecha disponible y vLanded la fecha de llegada/recojida -*/ +*/ DECLARE vAgency INT; DECLARE vShipped DATE; DECLARE vLanded DATE DEFAULT util.VN_CURDATE(); SELECT agencyFk INTO vAgency FROM agencyMode WHERE id= vAgencyMode; l: LOOP - + CALL agencyHourGetShipped(vLanded,vAddress,vAgency); - SELECT shipped INTO vShipped + SELECT shipped INTO vShipped FROM tmp.agencyHourGetShipped WHERE warehouseFk = vWarehouse LIMIT 1; - + IF vShipped THEN LEAVE l; END IF; - + SET vLanded = DATE_ADD(vLanded, INTERVAL +1 DAY); - + END LOOP; - + SELECT vShipped,vLanded; END ;; DELIMITER ; @@ -48556,6 +48731,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `agencyHourGetLanded` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48563,8 +48740,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetLanded`(vDated DATE, vAddress INT, vAgency INT, vWarehouse INT) BEGIN @@ -48599,13 +48774,15 @@ BEGIN LIMIT 1 ) t WHERE IF(vDated = util.VN_CURDATE(), t.maxHour > HOUR(util.VN_NOW()), TRUE) AND t.substractDay < 225; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `agencyHourGetWarehouse` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48613,8 +48790,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetWarehouse`(vAddress INT, vDate DATE, vWarehouse INT) BEGIN @@ -48622,14 +48797,14 @@ BEGIN * DEPRECATED usar zoneGetWarehouse * Devuelve el listado de agencias disponibles para la fecha, * dirección y warehouuse pasadas - * + * * @param vAddress no puede ser NULL * @param vWarehouse warehouse donde comprobaremos las agencias y fecha * @param vDate Fecha de recogida * @table agencyModeWarehouseList Listado de agencias disponibles */ DECLARE vAgency INT; - DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vDone BOOL DEFAULT FALSE; DECLARE vCur CURSOR FOR SELECT DISTINCT a.id FROM agency a @@ -48653,13 +48828,13 @@ BEGIN PRIMARY KEY(id) ) ENGINE = MEMORY; - + OPEN vCur; FETCH vCur INTO vAgency; WHILE NOT vDone DO - + INSERT INTO tmp.agencyModeWarehouseList SELECT am.id, am.name, am.description,am.deliveryMethodFk, TIMESTAMPADD(DAY, -ah.substractDay, vDate), w.name FROM agencyHour ah @@ -48688,7 +48863,7 @@ BEGIN END WHILE; CLOSE vCur; - + SELECT * FROM tmp.agencyModeWarehouseList; DROP TEMPORARY TABLE tmp.agencyModeWarehouseList; END ;; @@ -48697,6 +48872,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `agencyHourListGetShipped` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48704,8 +48881,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourListGetShipped`(vDate DATE, vAddress INT, vAgency INT) BEGIN @@ -48714,15 +48889,17 @@ BEGIN CALL vn.agencyHourGetShipped(vDate, vAddress, vAgency); SELECT * FROM tmp.agencyHourGetShipped; - + DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetShipped; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `available_calc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48730,8 +48907,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `available_calc`( vDate DATE, @@ -48754,7 +48929,7 @@ BEGIN DECLARE cWarehouses CURSOR FOR SELECT warehouseFk, shipped FROM tmp.zoneGetShipped; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; @@ -48763,7 +48938,7 @@ BEGIN CALL vn.zone_getShipped (vDate, vAddress, vAgencyMode, FALSE); DROP TEMPORARY TABLE IF EXISTS tmp.availableCalc; - CREATE TEMPORARY TABLE tmp.availableCalc( + CREATE TEMPORARY TABLE tmp.availableCalc( calcFk INT UNSIGNED, PRIMARY KEY (calcFk) ) @@ -48774,7 +48949,7 @@ BEGIN l: LOOP SET vDone = FALSE; FETCH cWarehouses INTO vWarehouse, vShipment; - + IF vDone THEN LEAVE l; END IF; @@ -48793,6 +48968,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `bankEntity_checkBic` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48800,14 +48977,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `bankEntity_checkBic`(vBic VARCHAR(255)) BEGIN /** * If the bic length is Incorrect throw exception - * + * * @param vBic bic code */ @@ -48815,7 +48990,7 @@ BEGIN SELECT bicLength INTO vConfigBicLenght FROM vn.bankEntityConfig bec; - + IF LENGTH(vBic) <> vConfigBicLenght THEN CALL util.throw(CONCAT('bic must be of length ', vConfigBicLenght )); END IF; @@ -48825,6 +49000,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `bankPolicy_notifyExpired` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48832,8 +49009,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `bankPolicy_notifyExpired`() BEGIN @@ -48842,14 +49017,14 @@ BEGIN * Manda correo cuando caduca un seguro * de los leasing * -*/ +*/ INSERT INTO mail (receiver,replyTo,subject,body) SELECT 'administracion@verdnatura.es' receiver, 'noreply@verdnatura.es' replyTo, CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') subject, CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') body - FROM vn.bankPolicy bp - LEFT JOIN vn.supplier s + FROM vn.bankPolicy bp + LEFT JOIN vn.supplier s ON s.id = bp.supplierFk LEFT JOIN vn.bank b ON b.id = bp.bankFk @@ -48860,6 +49035,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buyUltimate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48867,8 +49044,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimate`(vWarehouseFk SMALLINT, vDated DATE) BEGIN @@ -48909,6 +49084,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buyUltimateFromInterval` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48916,8 +49093,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimateFromInterval`(vWarehouseFk SMALLINT, vStarted DATE, vEnded DATE) BEGIN @@ -49051,6 +49226,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_afterUpsert` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49058,8 +49235,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_afterUpsert`(vSelf INT) BEGIN @@ -49078,19 +49253,19 @@ BEGIN DECLARE vIsFeedStock BOOL; DECLARE vWeight DECIMAL(10,2); DECLARE vPacking INT; - - SELECT b.entryFk, - b.itemFk, - i.packingOut, - ic.merchandise, + + SELECT b.entryFk, + b.itemFk, + i.packingOut, + ic.merchandise, vc.standardFlowerBox, b.weight, - b.packing - INTO - vEntryFk, - vItemFk, - vPackingOut, - vIsMerchandise, + b.packing + INTO + vEntryFk, + vItemFk, + vPackingOut, + vIsMerchandise, vStandardFlowerBox, vWeight, vPacking @@ -49098,7 +49273,7 @@ BEGIN LEFT JOIN item i ON i.id = b.itemFk LEFT JOIN itemType it ON it.id = i.typeFk LEFT JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox + LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox JOIN volumeConfig vc ON TRUE WHERE b.id = vSelf; @@ -49115,7 +49290,7 @@ BEGIN warehouseFk = vWarehouse, cm3 = buy_getUnitVolume(vSelf), cm3Delivery = IFNULL((vStandardFlowerBox * 1000) / vPackingOut, buy_getUnitVolume(vSelf)); - + IF vWeight AND vPacking THEN UPDATE itemCost SET grams = vWeight * 1000 / vPacking @@ -49136,13 +49311,15 @@ BEGIN WHERE b.id = vSelf; END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_checkGrouping` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49150,8 +49327,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_checkGrouping`(vGrouping INT) BEGIN @@ -49170,6 +49345,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_getSplit` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49177,16 +49354,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getSplit`(vSelf INT, vDated DATE) BEGIN /** - * Devuelve tantos registros como etiquetas se necesitan para cada uno de los cubos o cajas de - * las ventas correspondientes a la compra que se pasa como parámetro, en los almacenes que tienen + * Devuelve tantos registros como etiquetas se necesitan para cada uno de los cubos o cajas de + * las ventas correspondientes a la compra que se pasa como parámetro, en los almacenes que tienen * habilitada la venta de productos con stock virtual, aunque los productos pueden ser de cualquier tipo. - * + * * @param vSelf Identificador de vn.buy * @param vDated Fecha de preparación de las ventas que queremos etiquetar */ @@ -49261,7 +49436,7 @@ BEGIN WHILE vLabels >= vCounter DO INSERT INTO tmp.split SET - id = vSaleFk, + id = vSaleFk, labels = vLabels, counter = vCounter; @@ -49283,11 +49458,11 @@ BEGIN -- Devuelve los splits creados SELECT CONCAT(sp.counter,'/',sp.labels) labels, COALESCE(sfc.nickname, sfa.nickname, a.nickname) destination, - s.itemFk, - i.longName, - i.`size`, - vn.ticketSplitCounter(t.id) counter, - IF(sfa.id OR sfc.id, + s.itemFk, + i.longName, + i.`size`, + vn.ticketSplitCounter(t.id) counter, + IF(sfa.id OR sfc.id, a.nickname, CONCAT(a.id, ' ', p.`name`,' (', c.`code`,')')) destination2 FROM tmp.split sp @@ -49311,6 +49486,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_getVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49318,8 +49495,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolume`() BEGIN @@ -49332,12 +49507,12 @@ BEGIN item_getVolume(b.itemFk, b.packageFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) carros , CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * item_getVolume(b.itemFk, b.packageFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) espais - FROM buy b + FROM buy b JOIN tmp.buy tb ON tb.buyFk = b.id JOIN volumeConfig vc JOIN item i ON i.id = b.itemFk JOIN itemType it ON it.id = i.typeFk - LEFT JOIN temperature t ON t.code = it.temperatureFk + LEFT JOIN temperature t ON t.code = it.temperatureFk GROUP BY Temp; END ;; DELIMITER ; @@ -49345,6 +49520,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_getVolumeByAgency` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49352,32 +49529,32 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolumeByAgency`(vDated DATE, vAgencyFk INT) BEGIN - + DROP TEMPORARY TABLE IF EXISTS tmp.buy; CREATE TEMPORARY TABLE tmp.buy (buyFk INT NOT NULL, PRIMARY KEY (buyFk)) ENGINE = MEMORY; - INSERT INTO tmp.buy + INSERT INTO tmp.buy SELECT b.id - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk WHERE t.landed = vDated AND t.agencyModeFk IN (0, vAgencyFk); CALL buy_getVolume(); DROP TEMPORARY TABLE tmp.buy; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_getVolumeByEntry` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49385,30 +49562,30 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolumeByEntry`(vEntryFk INT) BEGIN - + DROP TEMPORARY TABLE IF EXISTS tmp.buy; CREATE TEMPORARY TABLE tmp.buy (buyFk INT NOT NULL, PRIMARY KEY (buyFk)) ENGINE = MEMORY; - - INSERT INTO tmp.buy + + INSERT INTO tmp.buy SELECT b.id - FROM buy b - JOIN entry e ON e.id = b.entryFk + FROM buy b + JOIN entry e ON e.id = b.entryFk WHERE e.id = vEntryFk; CALL buy_getVolume(); DROP TEMPORARY TABLE tmp.buy; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_recalcPrices` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49416,8 +49593,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPrices`() BEGIN @@ -49474,6 +49649,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_recalcPricesByAwb` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49481,8 +49658,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPricesByAwb`(IN awbFk varchar(18)) BEGIN @@ -49490,12 +49665,12 @@ BEGIN * inserta en tmp.buyRecalc las compras de un awb * * @param awbFk - */ + */ DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; CREATE TEMPORARY TABLE tmp.buyRecalc SELECT b.id - FROM buy b + FROM buy b JOIN entry e ON e.id = b.entryFk JOIN duaEntry de ON de.entryFk = e.id JOIN dua d ON d.id = de.duaFk @@ -49511,6 +49686,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_recalcPricesByBuy` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49518,8 +49695,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPricesByBuy`(IN vBuyFk INT(11)) BEGIN @@ -49527,7 +49702,7 @@ BEGIN * Recalcula los precios de una compra * * @param vBuyFk - */ + */ DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; CREATE TEMPORARY TABLE tmp.buyRecalc @@ -49542,6 +49717,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_recalcPricesByEntry` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49549,8 +49726,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPricesByEntry`(IN vEntryFk INT(11)) BEGIN @@ -49558,12 +49733,12 @@ BEGIN * Recalcula los precios de una entrada * * @param vEntryFk - */ + */ DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; CREATE TEMPORARY TABLE tmp.buyRecalc SELECT b.id - FROM buy b + FROM buy b WHERE b.entryFk = vEntryFk; CALL buy_recalcPrices(); @@ -49575,6 +49750,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_scan` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49582,8 +49759,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_scan`(vBarcode VARCHAR(512)) BEGIN @@ -49603,15 +49778,15 @@ BEGIN LIMIT 0; INSERT INTO tBuy(buyFk) - SELECT b.id + SELECT b.id FROM buy b JOIN tmp.ekt t ON t.ektFk = b.ektFk JOIN vn.entry en ON en.id = b.entryFk JOIN vn.travel tr ON tr.id = en.travelFk - JOIN vn.warehouse w ON w.id = tr.warehouseInFk + JOIN vn.warehouse w ON w.id = tr.warehouseInFk JOIN vn.country c ON c.id = w.countryFk AND c.code = 'NL'; - SELECT b.id buy, i.doPhoto do_photo, b.stickers - b.printedStickers stickersToPrint + SELECT b.id buy, i.doPhoto do_photo, b.stickers - CAST(b.printedStickers AS INT) stickersToPrint FROM tBuy tb JOIN vn.buy b ON tb.buyFk = b.id JOIN vn.item i ON i.id = b.itemFk; @@ -49627,6 +49802,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_updateGrouping` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49634,8 +49811,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updateGrouping`(vWarehouseFk INT, vItemFk INT, vGrouping INT) BEGIN @@ -49661,6 +49836,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_updatePacking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49668,13 +49845,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT) BEGIN /** - * Actualiza packing + * Actualiza packing * * @param vWarehouseFk warehouse del item * @param vItemFk id del item @@ -49684,8 +49859,8 @@ BEGIN UPDATE buy b JOIN tmp.buyUltimate bu ON b.id = bu.buyFk - SET b.packing = vPacking - WHERE bu.warehouseFk = vWarehouseFk + SET b.packing = vPacking + WHERE bu.warehouseFk = vWarehouseFk AND bu.itemFk = vItemFk; DROP TEMPORARY TABLE tmp.buyUltimate; @@ -49696,6 +49871,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `catalog_calcFromItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49703,8 +49880,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calcFromItem`( vLanded DATE, @@ -49724,7 +49899,7 @@ BEGIN */ DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY + ENGINE = MEMORY SELECT vItemFk itemFk; CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); @@ -49735,6 +49910,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `catalog_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49742,11 +49919,9 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT) -BEGIN +BEGIN /** * Calcula los articulos disponibles y sus precios * @@ -49754,7 +49929,7 @@ BEGIN * @param vLanded Fecha de recepcion de mercancia * @param vAddressFk Id del consignatario * @param vAgencyModeFk Id de la agencia - * @return tmp.ticketCalculateItem(itemFk, available, producer, + * @return tmp.ticketCalculateItem(itemFk, available, producer, * item, size, stems, category, inkFk, image, origin, price) * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) * @return tmp.ticketComponent @@ -49789,22 +49964,22 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem; CREATE TEMPORARY TABLE tmp.ticketCalculateItem( - itemFk INT(11) NOT NULL, + itemFk INT(11) NOT NULL, available INT(11), - producer VARCHAR(50), - item VARCHAR(50), - size INT(10) UNSIGNED, - stems INT(11), - category VARCHAR(3), - inkFk VARCHAR(3), + producer VARCHAR(50), + item VARCHAR(50), + size INT(10) UNSIGNED, + stems INT(11), + category VARCHAR(3), + inkFk VARCHAR(3), image VARCHAR(50), - origin VARCHAR(3), + origin VARCHAR(3), price DECIMAL(10,2), priceKg DECIMAL(10,2), `grouping` INT(10) UNSIGNED, PRIMARY KEY `itemFk` (`itemFk`) ) ENGINE = MEMORY DEFAULT CHARSET=utf8; - + OPEN cTravelTree; l: LOOP @@ -49826,20 +50001,20 @@ BEGIN bu.buyFk, vZoneFk FROM `cache`.available a - LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id + LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id AND anr.calc_id = vAvailableNoRaidsCalc JOIN tmp.item i ON i.itemFk = a.item_id JOIN vn.item it ON it.id = i.itemFk JOIN vn.`zone` z ON z.id = vZoneFk - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = a.item_id - LEFT JOIN edi.supplyResponse sr ON sr.ID = it.supplyResponseFk - LEFT JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = a.item_id + LEFT JOIN edi.supplyResponse sr ON sr.ID = it.supplyResponseFk + LEFT JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID LEFT JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID LEFT JOIN (SELECT isVNHSupplier, isEarlyBird, TRUE AS itemAllowed FROM vn.addressFilter af - JOIN (SELECT ad.provinceFk, p.countryFk, ad.isLogifloraAllowed - FROM vn.address ad - JOIN vn.province p ON p.id = ad.provinceFk + JOIN (SELECT ad.provinceFk, p.countryFk, ad.isLogifloraAllowed + FROM vn.address ad + JOIN vn.province p ON p.id = ad.provinceFk WHERE ad.id = vAddressFk ) sub2 ON sub2.provinceFk <=> IFNULL(af.provinceFk, sub2.provinceFk) AND sub2.countryFk <=> IFNULL(af.countryFk, sub2.countryFk) @@ -49856,13 +50031,13 @@ BEGIN JOIN vn.itemType itt ON itt.id = it.typeFk JOIN vn.itemCategory itc on itc.id = itt.categoryFk JOIN vn.address ad ON ad.id = vAddressFk - LEFT JOIN vn.clientItemType cit + LEFT JOIN vn.clientItemType cit ON cit.clientFk = ad.clientFk AND cit.itemTypeFk = itt.id - LEFT JOIN vn.zoneItemType zit + LEFT JOIN vn.zoneItemType zit ON zit.zoneFk = vZoneFk AND zit.itemTypeFk = itt.id - LEFT JOIN vn.agencyModeItemType ait + LEFT JOIN vn.agencyModeItemType ait ON ait.agencyModeFk = vAgencyModeFk AND ait.itemTypeFk = itt.id WHERE a.calc_id = vAvailableCalc @@ -49934,6 +50109,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `catalog_componentCalculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49941,8 +50118,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentCalculate`( vZoneFk INT, @@ -49955,7 +50130,7 @@ BEGIN * Calcula los componentes de los articulos de tmp.ticketLot * * @param vZoneFk para calcular el transporte - * @param vAddressFk Consignatario + * @param vAddressFk Consignatario * @param vShipped dia de salida del pedido * @param vWarehouseFk warehouse de salida del pedido * @table tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk) @@ -49969,7 +50144,7 @@ BEGIN SELECT clientFk INTO vClientFK FROM address WHERE id = vAddressFk; - + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCalculate (PRIMARY KEY (itemFk, warehouseFk)) ENGINE = MEMORY @@ -49981,7 +50156,7 @@ BEGIN IFNULL(pf.packing, GREATEST(b.grouping, b.packing)) packing, IFNULL(pf.`grouping`, b.`grouping`) `grouping`, ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, - tl.buyFk, + tl.buyFk, i.typeFk, IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping FROM tmp.ticketLot tl @@ -49989,7 +50164,7 @@ BEGIN JOIN item i ON i.id = tl.itemFk JOIN itemType it ON it.id = i.typeFk JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN specialPrice sp ON sp.itemFk = i.id + LEFT JOIN specialPrice sp ON sp.itemFk = i.id AND sp.clientFk = vClientFk LEFT JOIN ( SELECT * FROM ( @@ -50008,7 +50183,7 @@ BEGIN LIMIT 10000000000000000000 ) tpf GROUP BY tpf.itemFk, tpf.warehouseFk - ) pf ON pf.itemFk = tl.itemFk + ) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.merchandise @@ -50040,10 +50215,10 @@ BEGIN FROM tmp.ticketComponent tc JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk GROUP BY tc.itemFk, warehouseFk; - + -- RECOBRO INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, tcb.itemFk, c2.id, + SELECT tcb.warehouseFk, tcb.itemFk, c2.id, ROUND(tcb.base * LEAST( MAX(GREATEST(IFNULL(cr.priceIncreasing,0), @@ -50074,29 +50249,29 @@ BEGIN ROUND(base * (0.01 + wm.pricesModifierRate), 3) manaAuto FROM tmp.ticketComponentBase tcb JOIN `client` c on c.id = vClientFk - JOIN workerMana wm ON c.salesPersonFk = wm.workerFk + JOIN workerMana wm ON c.salesPersonFk = wm.workerFk JOIN vn.component c2 ON c2.code = 'autoMana' WHERE wm.isPricesModifierActivated HAVING manaAuto <> 0; - + -- Precios especiales INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) SELECT tcb.warehouseFk, tcb.itemFk, c2.id, GREATEST( - IFNULL(ROUND(tcb.base * c2.tax, 4), 0), + IFNULL(ROUND(tcb.base * c2.tax, 4), 0), IF(i.hasMinPrice, i.minPrice,0) - tcc.rate3 ) cost FROM tmp.ticketComponentBase tcb JOIN vn.component c2 ON c2.code = 'lastUnitsDiscount' - JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk + JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk JOIN vn.item i ON i.id = tcb.itemFk WHERE sp.value IS NULL AND i.supplyResponseFk IS NULL; - -- Individual + -- Individual INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) SELECT tcb.warehouseFk, tcb.itemFk, @@ -50107,10 +50282,10 @@ BEGIN JOIN vn.client c ON c.id = vClientFk JOIN vn.businessType bt ON bt.code = c.businessTypeFk WHERE bt.code = 'individual'; - + -- Venta por paquetes INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3 + SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3 FROM tmp.ticketComponentCalculate tcc JOIN vn.component c2 ON c2.code = 'salePerPackage' JOIN buy b ON b.id = tcc.buyFk @@ -50122,7 +50297,7 @@ BEGIN SELECT vZoneFk id; CALL zone_getOptionsForShipment(vShipped, TRUE); - + -- Reparto INSERT INTO tmp.ticketComponent SELECT tcc.warehouseFK, @@ -50136,7 +50311,7 @@ BEGIN JOIN agencyMode am ON am.id = z.agencyModeFk JOIN vn.volumeConfig vc JOIN vn.component c2 ON c2.code = 'delivery' - LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk + LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk AND ic.itemFk = tcc.itemFk HAVING cost <> 0; @@ -50189,9 +50364,9 @@ BEGIN CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk + JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 1) = 1 + WHERE IFNULL(tcs.classRate, 1) = 1 AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) GROUP BY tcs.warehouseFk, tcs.itemFk; @@ -50228,7 +50403,7 @@ BEGIN SELECT * FROM tmp.ticketComponentRate ORDER BY price LIMIT 10000000000000000000 ) t GROUP BY itemFk, warehouseFk, `grouping`; - + DROP TEMPORARY TABLE tmp.ticketComponentCalculate, tmp.ticketComponentSum, @@ -50241,6 +50416,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `catalog_componentPrepare` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50248,12 +50425,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentPrepare`() BEGIN - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent; CREATE TEMPORARY TABLE tmp.ticketComponent ( `warehouseFk` INT UNSIGNED NOT NULL, @@ -50263,9 +50438,9 @@ BEGIN INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC), UNIQUE `fkItemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC) )ENGINE=MEMORY DEFAULT CHARSET=utf8; - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice; - CREATE TEMPORARY TABLE tmp.ticketComponentPrice ( + CREATE TEMPORARY TABLE tmp.ticketComponentPrice ( `warehouseFk` INT UNSIGNED NOT NULL, `itemFk` INT NOT NULL, `rate` INT NOT NULL, @@ -50274,13 +50449,15 @@ BEGIN `priceKg` DECIMAL(10,4), INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC), UNIQUE `fkItemWarehouseRate` (`itemFk` ASC, `warehouseFk` ASC, `rate` ASC) - )ENGINE=MEMORY DEFAULT CHARSET=utf8; + )ENGINE=MEMORY DEFAULT CHARSET=utf8; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `catalog_componentPurge` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50288,12 +50465,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentPurge`() BEGIN - DROP TEMPORARY TABLE + DROP TEMPORARY TABLE tmp.ticketComponentPrice, tmp.ticketComponent, tmp.ticketLot; @@ -50303,6 +50478,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50310,8 +50487,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() BEGIN @@ -50348,7 +50523,7 @@ BEGIN DELETE FROM sms WHERE created < v18Month; DELETE FROM saleTracking WHERE created < vOneYearAgo; DELETE FROM ticketTracking WHERE created < v18Month; - DELETE tobs FROM ticketObservation tobs + 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; @@ -50422,12 +50597,12 @@ BEGIN 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 + 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 @@ -50446,7 +50621,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.routeToDelete SELECT * FROM vn.route r - WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); + WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); UPDATE tmp.routeToDelete tmp JOIN vn.dms d ON d.id = tmp.gestdocFk @@ -50495,6 +50670,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clean_logiflora` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50502,99 +50679,93 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean_logiflora`() BEGIN /** - * Partir en 2 procedimientos, uno que borre compras y otro articulos - * item_clean, buy_clean. + * Elimina las compras y los artículos residuales de logiflora. */ - - DECLARE vMaxDated DATE DEFAULT TIMESTAMPADD(DAY, - 7, util.VN_CURDATE()); DECLARE vDone INT DEFAULT FALSE; DECLARE vBuyFk INT; - DECLARE cur1 CURSOR FOR SELECT id FROM tmp.buy; - DECLARE cur2 CURSOR FOR SELECT id FROM tmp.item; + DECLARE vItemFk INT; + + DECLARE cur1 CURSOR FOR SELECT id FROM tBuy; + DECLARE cur2 CURSOR FOR SELECT id FROM tItem; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DROP TEMPORARY TABLE IF EXISTS tmp.buy; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; - CREATE TEMPORARY TABLE tmp.buy - ENGINE = MEMORY + CREATE OR REPLACE TEMPORARY TABLE tBuy + ENGINE = MEMORY SELECT b.id - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.agencyMode am ON am.id = tr.agencyModeFk - WHERE b.quantity = 0 - AND am.name = 'LOGIFLORA' - AND e.isRaid; + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN agencyMode am ON am.id = tr.agencyModeFk + WHERE NOT b.quantity + AND am.code = 'logiflora' + AND e.isRaid; + + START TRANSACTION; OPEN cur1; - read_loop: LOOP - SET vDone = FALSE; - FETCH cur1 INTO vBuyFk; IF vDone THEN LEAVE read_loop; END IF; - DELETE FROM vn.buy WHERE id = vBuyFk; - + DELETE FROM buy WHERE id = vBuyFk; END LOOP; - CLOSE cur1; - DROP TEMPORARY TABLE tmp.buy; - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - - CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY - SELECT DISTINCT i.id - FROM vn.item i - LEFT JOIN hedera.orderRow o ON o.itemFk = i.id - LEFT JOIN vn.sale s ON s.itemFk = i.id - LEFT JOIN vn.buy b ON b.itemFk = i.id - LEFT JOIN bs.waste w ON w.itemFk = i.id - WHERE i.supplyResponseFk + CREATE OR REPLACE TEMPORARY TABLE tItem + ENGINE = MEMORY + SELECT DISTINCT i.id + FROM item i + LEFT JOIN hedera.orderRow o ON o.itemFk = i.id + LEFT JOIN sale s ON s.itemFk = i.id + LEFT JOIN buy b ON b.itemFk = i.id + LEFT JOIN bs.waste w ON w.itemFk = i.id + WHERE i.supplyResponseFk AND o.id IS NULL AND b.id IS NULL AND s.id IS NULL - AND w.rate IS NULL - AND i.created < vMaxDated; + AND w.itemFk IS NULL + AND i.created < (util.VN_CURDATE() - INTERVAL (SELECT daysToKeepItem FROM floramondoConfig) DAY); OPEN cur2; - read_loop: LOOP - SET vDone = FALSE; - FETCH cur2 INTO vBuyFk; + FETCH cur2 INTO vItemFk; IF vDone THEN LEAVE read_loop; END IF; - DELETE FROM vn.item WHERE id = vBuyFk; - + DELETE FROM item WHERE id = vItemFk; END LOOP; - CLOSE cur2; - DROP TEMPORARY TABLE tmp.item; + COMMIT; + + DROP TEMPORARY TABLE tBuy, tItem; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clearShelvingList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50602,8 +50773,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clearShelvingList`(vShelvingFk VARCHAR(8)) BEGIN @@ -50616,92 +50785,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `clientCreate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientCreate`( - vFirstname VARCHAR(50), - vSurnames VARCHAR(50), - vFi VARCHAR(9), - vAddress TEXT, - vPostcode CHAR(5), - vCity VARCHAR(25), - vProvinceFk SMALLINT(5), - vCompanyFk SMALLINT(5), - vPhone VARCHAR(11), - vEmail VARCHAR(255), - vUserFk INT) -BEGIN -/** - * Create new client - * - */ - DECLARE vPayMethodFk INT DEFAULT 4; - DECLARE vDueDay INT DEFAULT 5; - DECLARE vDefaultCredit DECIMAL(10, 2) DEFAULT 300.00; - DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1; - DECLARE vHasCoreVnl BOOLEAN DEFAULT TRUE; - DECLARE vMandateTypeFk INT DEFAULT 2; - - INSERT INTO `client` ( - id, - name, - street, - fi, - phone, - email, - provinceFk, - city, - postcode, - socialName, - payMethodFk, - dueDay, - credit, - isTaxDataChecked, - hasCoreVnl, - isEqualizated) - VALUES ( - vUserFk, - CONCAT(vFirstname, ' ', vSurnames), - vAddress, - TRIM(vFi), - vPhone, - vEmail, - vProvinceFk, - vCity, - vPostcode, - CONCAT(vSurnames, ' ', vFirstname), - vPayMethodFk, - vDueDay, - vDefaultCredit, - vIsTaxDataChecked, - vHasCoreVnl, - FALSE - ) ON duplicate key update - payMethodFk = vPayMethodFk, - dueDay = vDueDay, - credit = vDefaultCredit, - isTaxDataChecked = vIsTaxDataChecked, - hasCoreVnl = vHasCoreVnl, - isActive = TRUE; - - IF (SELECT COUNT(*) FROM mandate WHERE clientFk = vUserFk AND companyFk = vCompanyFk AND mandateTypeFk = vMandateTypeFk) = 0 THEN - INSERT INTO mandate (clientFk, companyFk, mandateTypeFk) - VALUES (vUserFk, vCompanyFk, vMandateTypeFk); - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clientDebtSpray` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50709,8 +50794,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientDebtSpray`(vClientFk INT) BEGIN @@ -50721,21 +50804,21 @@ BEGIN */ DECLARE vClientDebt DOUBLE; - + SELECT vn.client_getDebt(vClientFk, util.VN_CURDATE()) INTO vClientDebt; - + INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) VALUES (vClientFk, 'Saldo pendiente', vClientDebt, util.VN_CURDATE(), 5); - + CALL vn.clientGreugeSpray(vClientFk, TRUE, '', TRUE); - + INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) SELECT vClientFk, 'Liquidación cliente', sum(amount), util.VN_CURDATE(), 5 FROM vn.greuge WHERE clientFk = vClientFk; - - UPDATE vn.client - SET salesPersonFk = NULL + + UPDATE vn.client + SET salesPersonFk = NULL WHERE id = vClientFk; END ;; @@ -50744,6 +50827,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clientFreeze` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50751,8 +50836,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientFreeze`() BEGIN @@ -50800,6 +50883,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clientGetDebtDiary` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50807,8 +50892,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientGetDebtDiary`(vClientFK INT, vCompanyFk INT) BEGIN @@ -50825,33 +50908,33 @@ BEGIN DECLARE vIssued DATETIME; DECLARE vBalance DOUBLE DEFAULT 0.00; DECLARE cur CURSOR FOR - SELECT - created, - issued, + SELECT + created, + issued, ROUND(amount, 2) AS balance FROM invoiceOut - WHERE clientFk = vClientFk AND companyFk = vCompanyFk - UNION ALL - SELECT - created, - payed, + WHERE clientFk = vClientFk AND companyFk = vCompanyFk + UNION ALL + SELECT + created, + payed, ROUND(-1 * amountPaid, 2) AS balance - FROM receipt + FROM receipt WHERE clientFk = vClientFk AND companyFk = vCompanyFk ORDER BY issued, created; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + OPEN cur; - + proc: LOOP SET vDone = FALSE; - + FETCH cur INTO vCreated, vIssued, vBalance; IF vDate IS NULL THEN SET vDate=vIssued; END IF; - + IF vDone THEN LEAVE proc; END IF; @@ -50863,66 +50946,66 @@ BEGIN SET vDone = TRUE; END IF; END LOOP; - + CLOSE cur; - - SELECT - issued, - CAST(debtOut AS DECIMAL(10,2)) debtOut, + + SELECT + issued, + CAST(debtOut AS DECIMAL(10,2)) debtOut, CAST(debtIn AS DECIMAL(10,2)) debtIn, - ref, - companyFk, + ref, + companyFk, priority FROM - (SELECT - NULL AS issued, - SUM(amountUnpaid) AS debtOut, - NULL AS debtIn, - 'Saldo Anterior' AS ref, + (SELECT + NULL AS issued, + SUM(amountUnpaid) AS debtOut, + NULL AS debtIn, + 'Saldo Anterior' AS ref, companyFk, - 0 as priority - FROM - (SELECT SUM(amount) AS amountUnpaid, companyFk, 0 + 0 as priority + FROM + (SELECT SUM(amount) AS amountUnpaid, companyFk, 0 FROM invoiceOut - WHERE clientFk = vClientFK - AND issued < vDate - GROUP BY companyFk - - UNION ALL - - SELECT SUM(-1 * amountPaid), companyFk, 0 - FROM receipt - WHERE clientFk = vClientFK - AND payed < vDate - GROUP BY companyFk) AS transactions - GROUP BY companyFk - - UNION ALL - - SELECT - issued, - amount as debtOut, - NULL AS debtIn, + WHERE clientFk = vClientFK + AND issued < vDate + GROUP BY companyFk + + UNION ALL + + SELECT SUM(-1 * amountPaid), companyFk, 0 + FROM receipt + WHERE clientFk = vClientFK + AND payed < vDate + GROUP BY companyFk) AS transactions + GROUP BY companyFk + + UNION ALL + + SELECT + issued, + amount as debtOut, + NULL AS debtIn, ref, companyFk, - 1 - FROM invoiceOut - WHERE clientFk = vClientFK + 1 + FROM invoiceOut + WHERE clientFk = vClientFK AND issued >= vDate - UNION ALL - - SELECT - r.payed, - NULL as debtOut, - r.amountPaid, - r.invoiceFk, + UNION ALL + + SELECT + r.payed, + NULL as debtOut, + r.amountPaid, + r.invoiceFk, r.companyFk, - 0 + 0 FROM receipt r - WHERE r.clientFk = vClientFK - AND r.payed >= vDate) t - INNER JOIN `client` c ON c.id = vClientFK - HAVING debtOut <> 0 OR debtIn <> 0 + WHERE r.clientFk = vClientFK + AND r.payed >= vDate) t + INNER JOIN `client` c ON c.id = vClientFK + HAVING debtOut <> 0 OR debtIn <> 0 ORDER BY issued, priority DESC, debtIn; END ;; DELIMITER ; @@ -50930,6 +51013,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clientGreugeSpray` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50937,8 +51022,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientGreugeSpray`(IN vClientFk INT, IN onlyForHisOwner BOOL, IN vWorkerCode VARCHAR(3), IN vWithMana BOOLEAN) BEGIN @@ -50980,13 +51063,13 @@ BEGIN WHERE id = vClientFk; ELSE - + SELECT id INTO vOwner FROM vn.worker WHERE code = vWorkerCode COLLATE utf8_general_ci; END IF; - + DROP TEMPORARY TABLE IF EXISTS tmp.clientList; CREATE TEMPORARY TABLE tmp.clientList SELECT DISTINCT t.clientFk, floor(cr.yearSale / 12) monthSale @@ -50998,7 +51081,7 @@ BEGIN AND t.shipped >= TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()) AND c.id != vClientFk HAVING monthSale > 100; - + SELECT SUM(monthSale) INTO vTotalSale FROM tmp.clientList; @@ -51009,13 +51092,173 @@ BEGIN SELECT vClientFk, 'Reparto greuge', -vGreuge, util.VN_CURDATE(), vGreugeTypeFk; END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `clientPackagingOverstock` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstock`(vClientFk INT, vGraceDays INT) +BEGIN + DROP TEMPORARY TABLE IF EXISTS tmp.clientPackagingOverstock; + CREATE TEMPORARY TABLE tmp.clientPackagingOverstock + ENGINE = MEMORY + SELECT itemFk, + sum(GotfromClient) - sum(SenttoClient) as devueltos, + sum(InvoicedtoClient) - sum(InvoicedfromClient) as facturados, + LEAST( + sum(GotfromClient) - sum(SenttoClient), + sum(InvoicedtoClient) - sum(InvoicedfromClient) + ) as abonables + FROM + ( + SELECT t.*, + IF(@month = month, 0, 1) monthEnd, + @month := month + FROM + ( + SELECT x.id as ticketFk, + date(x.shipped) as shipped, + x.itemFk, + IFNULL(cast(sum(x.InvoicedtoClient) as DECIMAL(10,0)),0) InvoicedtoClient, + IFNULL(cast(sum(x.InvoicedfromClient) as DECIMAL(10,0)),0) InvoicedfromClient, + IFNULL(cast(sum(x.SenttoClient) as DECIMAL(10,0)),0) SenttoClient, + IFNULL(cast(sum(x.GotfromClient) as DECIMAL(10,0)),0) GotfromClient, + i.name as concept, + x.refFk as invoice, + month(shipped) month, + x.companyFk + FROM + ( + SELECT t.id, + t.shipped, + IFNULL(pe.equivalentFk, s.itemFk) itemFk, + IF(s.quantity > 0, s.quantity, NULL) InvoicedtoClient, + IF(s.quantity < 0, -s.quantity, NULL) InvoicedfromClient, + NULL SenttoClient, + NULL GotfromClient, + t.refFk, + @month := 0 month, + t.companyFk + FROM sale s + JOIN ticket t on t.id = s.ticketFk + JOIN packaging p ON p.itemFk = s.itemFk + LEFT JOIN packageEquivalentItem pe ON pe.itemFk = s.itemFk + WHERE t.clientFk = vClientFk + AND t.shipped > '2017-11-30' + AND p.isPackageReturnable + UNION ALL + SELECT NULL, + '2017-11-30', + IFNULL(pe.equivalentFk, tps.itemFk) itemFk, + tps.sent InvoicedtoClient, + tps.returned InvoicedfromClient, + NULL SenttoClient, + NULL GotfromClient, + 'Histórico', + NULL, + NULL + FROM ticketPackagingStartingStock tps + LEFT JOIN packageEquivalentItem pe ON pe.itemFk = tps.itemFk + WHERE tps.clientFk = vClientFk + AND tps.isForgetable = FALSE + UNION ALL + SELECT t.id, + t.shipped, + IFNULL(pe.equivalentFk, p.itemFk) itemFk, + NULL, + NULL, + IF(tp.quantity > 0 AND t.shipped <= TIMESTAMPADD(DAY, - vGraceDays, CURDATE()), tp.quantity, NULL) SenttoClient, + IF(tp.quantity < 0, -tp.quantity, NULL) GotfromClient, + NULL AS refFk, + NULL, + t.companyFk + FROM ticketPackaging tp + JOIN ticket t on t.id = tp.ticketFk + JOIN packaging p ON p.id = tp.packagingFk + LEFT JOIN packageEquivalentItem pe ON pe.itemFk = p.itemFk + WHERE t.clientFk = vClientFk + AND t.shipped > '2017-11-21' ) x + + JOIN item i ON x.itemFk = i.id + GROUP BY x.id, x.itemFk + ) t + ORDER BY itemFk, shipped DESC + LIMIT 10000000000000000000 + ) t2 + GROUP BY itemFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `clientPackagingOverstockReturn` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstockReturn`(vClientFk INT, vGraceDays INT) +BEGIN + DECLARE vNewTicket INT DEFAULT 0; + DECLARE vWarehouseFk INT; + + CALL vn.clientPackagingOverstock(vClientFk,vGraceDays); + + SELECT id INTO vWarehouseFk + FROM vn.warehouse + WHERE hasConfectionTeam; + + CALL vn.ticket_add( + vClientFk + ,CURDATE() + ,vWarehouseFk -- Algemesi + ,442 -- Verdnatura + ,NULL -- address + ,NULL -- agencia + ,NULL -- route + ,CURDATE() + ,account.myUser_getId() + ,TRUE + ,vNewTicket); + + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) + SELECT vNewTicket, cpo.itemFk, - cpo.abonables, i.longName, p.price + FROM tmp.clientPackagingOverstock cpo + JOIN vn.item i ON i.id = cpo.itemFk + JOIN vn.packaging p ON p.itemFk = cpo.itemFk + WHERE cpo.abonables > 0; + INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) + SELECT vNewTicket, p.id, cpo.abonables + FROM tmp.clientPackagingOverstock cpo + JOIN vn.packaging p ON p.itemFk = cpo.itemFk + WHERE cpo.abonables > 0; + + SELECT vNewTicket; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clientRemoveWorker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51023,8 +51266,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRemoveWorker`() BEGIN @@ -51046,11 +51287,11 @@ BEGIN LEFT JOIN clientProtected cp ON cp.clientFk = cd.id JOIN client c ON c.id = cd.id JOIN province p ON p.id = c.provinceFk - LEFT JOIN autonomy a ON a.id = p.autonomyFk + LEFT JOIN autonomy a ON a.id = p.autonomyFk JOIN country co ON co.id = p.countryFk WHERE cd.Aviso = 'TERCER AVISO' AND cp.clientFk IS NULL - AND co.code NOT IN ('PT','FR') + AND co.code NOT IN ('PT') AND a.name <> 'Canarias' AND c.salesPersonFk IS NOT NULL; @@ -51069,6 +51310,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `clientRisk_update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51076,8 +51319,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2)) BEGIN @@ -51097,6 +51338,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `client_checkBalance` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51104,8 +51347,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `client_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL) BEGIN @@ -51161,7 +51402,7 @@ BEGIN JOIN client c ON c.accountingAccount = lc.account WHERE lc.`date` BETWEEN vDateFrom AND vDateTo )sub - GROUP BY companyFk, clientFk + GROUP BY companyFk, clientFk ) sub1 ON sub1.clientFk = c.id JOIN supplier s ON s.id = sub1.companyFk JOIN company co ON co.id = sub1.companyFk @@ -51178,6 +51419,108 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `client_create` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `client_create`( + vFirstname VARCHAR(50), + vSurnames VARCHAR(50), + vFi VARCHAR(9), + vAddress TEXT, + vPostcode CHAR(5), + vCity VARCHAR(25), + vProvinceFk SMALLINT(5), + vCompanyFk SMALLINT(5), + vPhone VARCHAR(11), + vEmail VARCHAR(255), + vUserFk INT +) +BEGIN +/** + * Create new client + * + * @params vFirstname firstName + * @params vSurnames surnames + * @params vFi company code from accounting transactions + * @params vAddress address + * @params vPostcode postCode + * @params vCity city + * @params vProvinceFk province + * @params vCompanyFk company in which he has become a client + * @params vPhone telephone number + * @params vEmail email address + * @params vUserFk user id + */ + DECLARE vPayMethodFk INT; + DECLARE vDueDay INT; + DECLARE vDefaultCredit DECIMAL(10, 2); + DECLARE vIsTaxDataChecked TINYINT(1); + DECLARE vHasCoreVnl BOOLEAN; + DECLARE vMandateTypeFk INT; + + SELECT defaultPayMethodFk, + defaultDueDay, + defaultCredit, + defaultIsTaxDataChecked, + defaultHasCoreVnl, + defaultMandateTypeFk + INTO vPayMethodFk, + vDueDay, + vDefaultCredit, + vIsTaxDataChecked, + vHasCoreVnl, + vMandateTypeFk + FROM clientConfig; + + INSERT INTO `client` + SET id = vUserFk, + name = CONCAT(vFirstname, ' ', vSurnames), + street = vAddress, + fi = TRIM(vFi), + phone = vPhone, + email = vEmail, + provinceFk = vProvinceFk, + city = vCity, + postcode = vPostcode, + socialName = UPPER(CONCAT(vSurnames, ' ', vFirstname)), + payMethodFk = vPayMethodFk, + dueDay = vDueDay, + credit = vDefaultCredit, + isTaxDataChecked = vIsTaxDataChecked, + hasCoreVnl = vHasCoreVnl, + isEqualizated = FALSE + ON duplicate KEY UPDATE + payMethodFk = vPayMethodFk, + dueDay = vDueDay, + credit = vDefaultCredit, + isTaxDataChecked = vIsTaxDataChecked, + hasCoreVnl = vHasCoreVnl, + isActive = TRUE; + + INSERT INTO mandate (clientFk, companyFk, mandateTypeFk) + SELECT vUserFk, vCompanyFk, vMandateTypeFk + WHERE NOT EXISTS ( + SELECT id + FROM mandate + WHERE clientFk = vUserFk + AND companyFk = vCompanyFk + AND mandateTypeFk = vMandateTypeFk + ); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `client_getDebt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51185,8 +51528,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `client_getDebt`(vDate DATE) BEGIN @@ -51205,13 +51546,13 @@ BEGIN SET vEnded = TIMESTAMP(IFNULL(vDate, util.VN_CURDATE()), '23:59:59'); DROP TEMPORARY TABLE IF EXISTS tClientRisk; - CREATE TEMPORARY TABLE tClientRisk + CREATE TEMPORARY TABLE tClientRisk ENGINE = MEMORY SELECT cr.clientFk, SUM(cr.amount) amount FROM clientRisk cr JOIN tmp.clientGetDebt c ON c.clientFk = cr.clientFk GROUP BY cr.clientFk; - + INSERT INTO tClientRisk SELECT c.clientFk, SUM(r.amountPaid) FROM receipt r @@ -51226,7 +51567,7 @@ BEGIN WHERE t.receiptFk IS NULL AND t.status = 'ok' GROUP BY t.clientFk; - + INSERT INTO tClientRisk SELECT t.clientFk, totalWithVat FROM ticket t @@ -51242,7 +51583,7 @@ BEGIN FROM client c JOIN tClientRisk cr ON cr.clientFk = c.id GROUP BY c.id; - + DROP TEMPORARY TABLE tClientRisk; END ;; DELIMITER ; @@ -51250,6 +51591,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `client_RandomList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51257,8 +51600,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `client_RandomList`(vNumber INT) BEGIN @@ -51266,9 +51607,9 @@ BEGIN DECLARE i INT DEFAULT 0; DECLARE c INT DEFAULT 0; DECLARE maxClientFk INT; - + DROP TEMPORARY TABLE IF EXISTS tmp.client; - + CREATE TEMPORARY TABLE tmp.`client` (id INT AUTO_INCREMENT, clientFk INT, @@ -51276,40 +51617,40 @@ BEGIN PRIMARY KEY(id), UNIQUE KEY clientFk (clientFk)) ENGINE = MEMORY; - + INSERT INTO tmp.client(clientFk) SELECT DISTINCT clientFk FROM vn.invoiceOut WHERE issued > TIMESTAMPADD(MONTH, -2, util.VN_CURDATE()); - + SELECT max(id) INTO maxClientFk FROM tmp.client; - - + + WHILE i < vNumber DO - + SET i = i + 1; - + WHILE c = 0 DO - + SELECT id INTO c FROM tmp.client WHERE id = floor(RAND() * maxClientFk) + 1 AND isSelected = FALSE LIMIT 1; - + END WHILE; - + -- SELECT i, maxClientFk, c; - - UPDATE tmp.client - SET isSelected = TRUE + + UPDATE tmp.client + SET isSelected = TRUE WHERE id = c; - + SET c = 0; - + END WHILE; - + SELECT c.id, c.name FROM tmp.client tc JOIN vn.client c ON c.id = tc.clientFk WHERE isSelected @@ -51322,6 +51663,72 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `client_unassignSalesPerson` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `client_unassignSalesPerson`() +BEGIN +/** + * Elimina la asignación de salesPersonFk de la ficha del clientes + * que no han realizado una compra en los últimos 3 meses y reparte + * su greuge entre el resto de clientes + */ + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vClientFk INT; + DECLARE vCursor CURSOR FOR + SELECT c.clientFk + FROM tClientList c + LEFT JOIN clientRisk r ON r.clientFk = c.clientFk + GROUP BY c.clientFk + HAVING NOT SUM(IFNULL(r.amount, 0)); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + CREATE OR REPLACE TEMPORARY TABLE tClientList + SELECT c.id clientFk + FROM bs.clientDied cd + JOIN client c ON c.id = cd.id + LEFT JOIN clientProtected cp ON cp.clientFk = c.id + LEFT JOIN salesPersonProtected sp ON sp.salesPersonFk = c.salesPersonFk + JOIN province p ON p.id = c.provinceFk + LEFT JOIN autonomy a ON a.id = p.autonomyFk + JOIN country co ON co.id = p.countryFk + WHERE cd.Aviso = 'TERCER AVISO' + AND cp.clientFk IS NULL + AND sp.salesPersonFk IS NULL + AND a.name <> 'Canarias' + AND c.salesPersonFk IS NOT NULL; + + OPEN vCursor; + l: LOOP + SET vDone = FALSE; + FETCH vCursor INTO vClientFk; + IF vDone THEN + LEAVE l; + END IF; + CALL clientGreugeSpray(vClientFk, TRUE, '', TRUE); + UPDATE client + SET salesPersonFk = NULL + WHERE id = vClientFk; + END LOOP; + CLOSE vCursor; + + DROP TEMPORARY TABLE tClientList; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `cmrPallet_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51329,8 +51736,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cmrPallet_add`(vExpeditionPalletFk INT, vCmrFk INT) BEGIN @@ -51372,6 +51777,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `cmr_getByTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51379,42 +51786,40 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_getByTicket`(vTicketFk INT) BEGIN DECLARE vLanded DATE; - + SELECT DATE_ADD(util.VN_CURDATE(), INTERVAL landingDays DAY) INTO vLanded FROM vn.cmrConfig; IF vTicketFk THEN - + IF (SELECT count(ticketFk) FROM vn.cmr WHERE ticketFk = vTicketFk) THEN - + SELECT id FROM vn.cmr WHERE ticketFk = vTicketFk; - + ELSE - + INSERT INTO vn.cmr(ticketFk, companyFk, addressFromFk, addressToFk, ead) SELECT vTicketFk, t.companyFk, a.id, t.addressFk, vLanded FROM vn.ticket t - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.address a ON a.id = w.addressFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.address a ON a.id = w.addressFk WHERE t.id = vTicketFk; - + SELECT LAST_INSERT_ID(); - + END IF; - + ELSE - + INSERT INTO vn.cmr(ead) VALUES(vLanded); - + SELECT LAST_INSERT_ID(); - + END IF; END ;; DELIMITER ; @@ -51422,6 +51827,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `cmr_sendOverview` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51429,15 +51836,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_sendOverview`() BEGIN /** * Insert the monthly CMR summary in vn.mail on the 5th of each month. */ - + SET SESSION group_concat_max_len = 1000000; -- IF (DAY(util.VN_CURDATE()) = 5) THEN INSERT INTO @@ -51465,7 +51870,7 @@ BEGIN CMR Ticket ' - , GROUP_CONCAT(' ', c.id, ' ', c.ticketFk, ' ' ORDER BY c.id SEPARATOR '' ), + , GROUP_CONCAT(' ', c.id, ' ', c.ticketFk, ' ' ORDER BY c.id SEPARATOR '' ), '

@@ -51483,7 +51888,7 @@ BEGIN -- Actualizamos el estado a 'Enviado' UPDATE vn.cmr c SET c.state = 'Sent' - WHERE c.state = 'Pending' + WHERE c.state = 'Pending' AND MONTH(c.created) = MONTH(util.VN_CURDATE() - INTERVAL 1 MONTH) AND YEAR(c.created) = YEAR(util.VN_CURDATE() - INTERVAL 1 MONTH); -- END IF; @@ -51493,6 +51898,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collectionPlacement_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51500,8 +51907,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collectionPlacement_get`( vParamFk INT(11), @@ -51660,6 +52065,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_addItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51667,8 +52074,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_addItem`( vBarccodeFk INT, @@ -51696,15 +52101,15 @@ BEGIN DATE_FORMAT(util.VN_NOW(), '%H:%i' ), ' ', i.name - ) INTO vConcept + ) INTO vConcept FROM item i WHERE i.id = vItemFk; SELECT name INTO vItemName FROM item WHERE id = vBarccodeFk; - SELECT CONCAT('Añadido articulo ', + SELECT CONCAT('Añadido articulo ', vItemName, - ' cantidad:', + ' cantidad:', vQuantity ) INTO vDescription; @@ -51730,6 +52135,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_assign` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51737,11 +52144,9 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_assign`(vUserFk INT, OUT vCollectionFk INT) -proc:BEGIN +proc:BEGIN /* Comprueba si existen colecciones libres que se ajustan al perfil del usuario * y le asigna la más antigua. * Añade un registro al semillero de colecciones @@ -51774,14 +52179,14 @@ proc:BEGIN FROM vn.collection c JOIN vn.ticketCollection tc ON tc.collectionFk = c.id JOIN vn.state s ON s.code = 'PRINTED_AUTO' - JOIN vn.productionConfig pc - WHERE c.workerFk IS NULL + JOIN vn.productionConfig pc + WHERE c.workerFk IS NULL AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime; DELETE c.* FROM vn.collection c - JOIN vn.productionConfig pc - WHERE c.workerFk IS NULL + JOIN vn.productionConfig pc + WHERE c.workerFk IS NULL AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime; -- Se a�ade registro al semillero @@ -51791,8 +52196,8 @@ proc:BEGIN -- Comprueba si hay colecciones disponibles que se ajustan a su configuracion SELECT MIN(c.id) INTO vCollectionFk - FROM vn.collection c - JOIN vn.operator o + FROM vn.collection c + JOIN vn.operator o ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL) AND o.numberOfWagons = c.wagons AND o.trainFk = c.trainFk @@ -51815,6 +52220,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51822,8 +52229,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_get`(vWorkerFk INT) BEGIN @@ -51839,18 +52244,18 @@ BEGIN SELECT c.id collectionFk, date(c.created) created, COUNT(DISTINCT tc.ticketFk) ticketTotalCount - FROM collection c - JOIN ticketCollection tc ON tc.collectionFk = c.id - JOIN sale s ON s.ticketFk = tc.ticketFk + FROM collection c + JOIN ticketCollection tc ON tc.collectionFk = c.id + JOIN sale s ON s.ticketFk = tc.ticketFk JOIN ticketState ts ON ts.ticketFk = tc.ticketFk JOIN state s2 ON s2.id = ts.stateFk JOIN productionConfig pc JOIN vn.state ss on ss.code = 'PREPARED' LEFT JOIN vn.saleTracking st on st.saleFk = s.id AND st.stateFk = ss.id - WHERE c.workerFk = vWorkerFk + WHERE c.workerFk = vWorkerFk AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge AND s.quantity != 0 - AND s2.order < pc.pendingCollectionsOrder + AND s2.order < pc.pendingCollectionsOrder GROUP BY c.id HAVING COUNT(*) > COUNT(DISTINCT st.id); @@ -51861,6 +52266,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_getTickets` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51868,8 +52275,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_getTickets`(vParamFk INT) BEGIN @@ -51877,15 +52282,15 @@ BEGIN * Selecciona los tickets de una colección/ticket * @param vParamFk ticketFk/collectionFk * @return Retorna ticketFk, level, agencyName, warehouseFk, salesPersonFk, observaciones - */ + */ DECLARE vItemPackingTypeFk VARCHAR(1); -- Si los sacadores son los de pruebas, pinta los colores SELECT itemPackingTypeFk INTO vItemPackingTypeFk - FROM vn.collection + FROM vn.collection WHERE id = vParamFk; - SELECT t.id ticketFk, + SELECT t.id ticketFk, IF (!(vItemPackingTypeFk <=> 'V'), cc.code,CONCAT(SUBSTRING('ABCDEFGH',tc.wagon, 1),'-',tc.`level` )) `level`, am.name agencyName, t.warehouseFk, @@ -51895,20 +52300,20 @@ BEGIN FROM vn.ticket t LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk -- PAK 23/12/21 - LEFT JOIN vn.collectionColors cc - ON cc.wagon = tc.wagon - AND cc.shelve = tc.`level` + LEFT JOIN vn.collectionColors cc + ON cc.wagon = tc.wagon + AND cc.shelve = tc.`level` AND cc.trainFk = c2.trainFk -- PAK 23/12/21 - LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk LEFT JOIN vn.client c ON c.id = t.clientFk LEFT JOIN vn.worker w ON w.id = c.salesPersonFk - LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id + LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = 1 - WHERE t.id = vParamFk + WHERE t.id = vParamFk AND t.shipped >= util.yesterday() UNION ALL - SELECT t.id ticketFk, + SELECT t.id ticketFk, IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`, am.name agencyName, t.warehouseFk, @@ -51918,15 +52323,15 @@ BEGIN FROM vn.ticket t JOIN vn.ticketCollection tc ON t.id = tc.ticketFk LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk -- PAK 23/12/21 - LEFT JOIN vn.collectionColors cc - ON cc.wagon = tc.wagon - AND cc.shelve = tc.`level` + LEFT JOIN vn.collectionColors cc + ON cc.wagon = tc.wagon + AND cc.shelve = tc.`level` AND cc.trainFk = c2.trainFk -- PAK 23/12/21 - LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk LEFT JOIN vn.client c ON c.id = t.clientFk LEFT JOIN vn.worker w ON w.id = c.salesPersonFk - LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id + LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = 1 WHERE tc.collectionFk = vParamFk; @@ -51936,6 +52341,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_kill` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51943,8 +52350,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_kill`(vSelf INT) BEGIN @@ -51965,6 +52370,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_make` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51972,8 +52379,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_make`() proc:BEGIN @@ -52046,6 +52451,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52053,8 +52460,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_new`(vUserFk INT, OUT vCollectionFk INT) proc:BEGIN @@ -52289,8 +52694,8 @@ proc:BEGIN -- Se anulan el resto de carros libres para que sólo uno lleve un pedido excesivo DELETE tt.* FROM tTrain tt - LEFT JOIN (SELECT DISTINCT wagon - FROM tTrain + LEFT JOIN (SELECT DISTINCT wagon + FROM tTrain WHERE ticketFk IS NOT NULL ) nn ON nn.wagon = tt.wagon WHERE nn.wagon IS NULL; @@ -52362,6 +52767,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_printSticker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52369,8 +52776,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_printSticker`( vSelf INT, @@ -52408,6 +52813,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_setParking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52415,8 +52822,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_setParking`(IN `vCollectionFk` VARCHAR(8), IN `vParkingFk` INT) proc: BEGIN @@ -52436,6 +52841,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_setState` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52443,8 +52850,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_setState`(vSelf INT, vStateCode VARCHAR(255) COLLATE utf8_general_ci) BEGIN @@ -52458,7 +52863,7 @@ BEGIN DECLARE vDone INT DEFAULT FALSE; DECLARE vCursor CURSOR FOR SELECT DISTINCT ticketFk - FROM ticketCollection tc + FROM ticketCollection tc WHERE tc.collectionFk = vSelf; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; @@ -52493,6 +52898,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `company_getFiscaldata` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52500,30 +52907,28 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getFiscaldata`(workerFk INT) BEGIN - + DECLARE vCompanyFk INT; - - SELECT IFNULL(uc.companyFk, rc.defaultCompanyFk) + + SELECT IFNULL(uc.companyFk, rc.defaultCompanyFk) INTO vCompanyFk FROM vn.routeConfig rc LEFT JOIN userConfig uc ON uc.userFk = workerFk; - - + + SELECT s.name AS name , s.NIF AS nif , s.street AS street , s.city AS city , - s.postCode AS postCode - - FROM vn.company c + s.postCode AS postCode + + FROM vn.company c JOIN vn.worker w ON w.id = c.workerManagerFk - JOIN vn.supplier s ON s.id = c.id + JOIN vn.supplier s ON s.id = c.id WHERE c.id = vCompanyFk; END ;; DELIMITER ; @@ -52531,6 +52936,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `company_getSuppliersDebt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52538,8 +52945,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getSuppliersDebt`(vSelf INT, vMonthsAgo INT) BEGIN @@ -52580,7 +52985,7 @@ BEGIN IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount, p.dueDated < vStartingDate isBeforeStarting, p.currencyFk - FROM payment p + FROM payment p WHERE p.received > vStartDate AND p.companyFk = vSelf UNION ALL @@ -52588,9 +52993,9 @@ BEGIN r.companyFk, - IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue) AS Total, rv.dueDated < vStartingDate isBeforeStarting, - r.currencyFk - FROM invoiceIn r - INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk + r.currencyFk + FROM invoiceIn r + INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk WHERE r.issued > vStartDate AND r.isBooked AND r.companyFk = vSelf @@ -52642,11 +53047,11 @@ BEGIN -IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue), r.currencyFk, FALSE isPayment, - TRUE - FROM invoiceIn r + TRUE + FROM invoiceIn r LEFT JOIN tOpeningBalances si ON r.companyFk = si.companyFk AND r.supplierFk = si.supplierFk - AND r.currencyFk = si.currencyFk + AND r.currencyFk = si.currencyFk JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk WHERE rv.dueDated >= vStartingDate AND (si.closingBalances IS NULL OR si.closingBalances <> 0) @@ -52701,7 +53106,7 @@ BEGIN FROM tPendingDuedates WHERE balance < vInvalidBalances AND balance > - vInvalidBalances; - + DELETE vp.* FROM tPendingDuedates vp JOIN tRowsToDelete rd ON ( @@ -52729,9 +53134,9 @@ BEGIN FROM tPendingDuedates vp LEFT JOIN supplier s ON s.id = vp.supplierFk LEFT JOIN client c ON c.fi = s.nif - LEFT JOIN clientRisk cr ON cr.clientFk = c.id + LEFT JOIN clientRisk cr ON cr.clientFk = c.id AND cr.companyFk = vp.companyFk; - + DROP TEMPORARY TABLE tOpeningBalances; DROP TEMPORARY TABLE tPendingDuedates; DROP TEMPORARY TABLE tRowsToDelete; @@ -52741,6 +53146,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `conveyorExpedition_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52748,13 +53155,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `conveyorExpedition_Add`(vStarted DATETIME, vEnded DATETIME) BEGIN - + DECLARE startingMinute INT; TRUNCATE vn.conveyorExpedition; @@ -52771,23 +53176,23 @@ BEGIN conveyorBuildingClassFk) SELECT e.id, e.created, - 10 * p.depth as depth, + 10 * p.depth as depth, 10 * p.width as width, 10 * p.height as height, IFNULL(t.routeFk,am.agencyFk) routeFk, hour(e.created) * 60 + minute(e.created), IFNULL(et.description , a.name), IFNULL(t.routeFk,am.agencyFk) criterion, - IFNULL(p.conveyorBuildingClassFk , pc.defaultConveyorBuildingClass) + IFNULL(p.conveyorBuildingClassFk , pc.defaultConveyorBuildingClass) FROM vn.expedition e JOIN vn.ticket t ON t.id = e.ticketFk JOIN vn.packaging p ON p.id = e.packagingFk LEFT JOIN vn.zone z ON z.id = t.zoneFk LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN vn.agency a ON a.id = am.agencyFk - LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk - JOIN vn.packagingConfig pc + LEFT JOIN vn.agency a ON a.id = am.agencyFk + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk + LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + JOIN vn.packagingConfig pc WHERE t.warehouseFk IN (60,1,44) AND e.created BETWEEN vStarted AND vEnded AND p.height < 140 @@ -52796,8 +53201,8 @@ BEGIN SELECT MIN(productionMinute) INTO startingMinute FROM vn.conveyorExpedition ce ; - - UPDATE vn.conveyorExpedition + + UPDATE vn.conveyorExpedition SET productionMinute = productionMinute - startingMinute; END ;; @@ -52806,6 +53211,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `copyComponentsFromSaleList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52813,8 +53220,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `copyComponentsFromSaleList`(vTargetTicketFk INT) BEGIN @@ -52853,6 +53258,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `createPedidoInterno` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52860,13 +53267,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `createPedidoInterno`(vItemFk INT,vQuantity INT) BEGIN - + UPDATE vn.item SET upToDown = vQuantity WHERE id = vItemFk; END ;; @@ -52875,6 +53280,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `crypt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52882,59 +53289,57 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `crypt`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255) ) BEGIN DECLARE vEncryptedText VARCHAR(255) DEFAULT ''; - + DECLARE vKeyLength INT; DECLARE vKeyPosition INT DEFAULT 1; DECLARE vKeyChar VARCHAR(1); - + DECLARE vTextLength INT; DECLARE vTextPosition INT DEFAULT 1; DECLARE vTextChar VARCHAR(1); - + DECLARE vEncryptedChar VARCHAR(1); DECLARE vEncryptedCharPosition INT; - + DECLARE vChain VARCHAR(255) DEFAULT '#$.-_0123456789abcdefghijklmnopqrstuvwxyz'; DECLARE vChainTextPosition INT; DECLARE vChainKeyPosition INT; DECLARE vChainLength INT; - + DECLARE vInvalidadChars VARCHAR(255) DEFAULT ''; - - SET vTextLength = LENGTH(vText); + + SET vTextLength = LENGTH(vText); SET vKeyLength = LENGTH(vKey); SET vChainLength = LENGTH(vChain); - + WHILE vTextPosition <= vTextLength DO - + SET vTextChar = MID(vText,vTextPosition,1); SET vKeyChar = MID(vKey,vKeyPosition,1); - + SET vChainTextPosition = LOCATE(vTextChar, vChain); SET vInvalidadChars = IF(vChainTextPosition, vInvalidadChars, CONCAT(vInvalidadChars,vTextChar)); SET vChainKeyPosition = LOCATE(vKeyChar, vChain); SET vEncryptedCharPosition = vChainTextPosition + vChainKeyPosition; - + IF vEncryptedCharPosition > vChainLength THEN - + SET vEncryptedCharPosition = vEncryptedCharPosition - vChainLength; - + END IF; - + SET vEncryptedChar = MID(vChain, vEncryptedCharPosition,1); - + SET vEncryptedText = CONCAT(vEncryptedText, vEncryptedChar); - + SET vKeyPosition = IF(vKeyPosition = vKeyLength, 1,vKeyPosition + 1); SET vTextPosition = vTextPosition + 1; - + END WHILE; SET vResult = IF(LENGTH(vInvalidadChars), CONCAT('Caracteres no válidos: ',vInvalidadChars),vEncryptedText); @@ -52945,6 +53350,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `cryptOff` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52952,56 +53359,54 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cryptOff`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255)) BEGIN DECLARE vUncryptedText VARCHAR(255) DEFAULT ''; - + DECLARE vKeyLength INT; DECLARE vKeyPosition INT DEFAULT 1; DECLARE vKeyChar VARCHAR(1); - + DECLARE vTextLength INT; DECLARE vTextPosition INT DEFAULT 1; DECLARE vTextChar VARCHAR(1); - + DECLARE vUncryptedChar VARCHAR(1); DECLARE vUncryptedCharPosition INT; - + DECLARE vChain VARCHAR(255) DEFAULT '#$.-_0123456789abcdefghijklmnopqrstuvwxyz'; DECLARE vChainTextPosition INT; DECLARE vChainKeyPosition INT; DECLARE vChainLength INT; - - SET vTextLength = LENGTH(vText); + + SET vTextLength = LENGTH(vText); SET vKeyLength = LENGTH(vKey); SET vChainLength = LENGTH(vChain); - + WHILE vTextPosition <= vTextLength DO - + SET vTextChar = MID(vText,vTextPosition,1); SET vKeyChar = MID(vKey,vKeyPosition,1); - + SET vChainTextPosition = LOCATE(vTextChar, vChain); SET vChainKeyPosition = LOCATE(vKeyChar, vChain); SET vUncryptedCharPosition = vChainTextPosition - vChainKeyPosition; - + IF vUncryptedCharPosition < 1 THEN - + SET vUncryptedCharPosition = vUncryptedCharPosition + vChainLength; - + END IF; - + SET vUncryptedChar = MID(vChain, vUncryptedCharPosition,1); - + SET vUncryptedText = CONCAT(vUncryptedText, vUncryptedChar); - + SET vKeyPosition = IF(vKeyPosition = vKeyLength, 1,vKeyPosition + 1); SET vTextPosition = vTextPosition + 1; - + END WHILE; SET vResult = vUncryptedText; @@ -53012,6 +53417,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `department_calcTree` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53019,8 +53426,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `department_calcTree`() BEGIN @@ -53056,6 +53461,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `department_calcTreeRec` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53063,8 +53470,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `department_calcTreeRec`( vSelf INT, @@ -53097,7 +53502,7 @@ BEGIN OR (vSelf IS NOT NULL AND parentFk = vSelf); DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SET vSons = 0; OPEN vChildren; @@ -53108,11 +53513,11 @@ BEGIN IF vDone THEN LEAVE myLoop; END IF; - + SET vIndex = vIndex + 1; SET vLft = vIndex; SET vSons = vSons + 1; - + CALL department_calcTreeRec( vChildFk, CONCAT(vPath, vChildFk, '/'), @@ -53138,6 +53543,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `department_doCalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53145,8 +53552,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `department_doCalc`() proc: BEGIN @@ -53167,7 +53572,7 @@ proc: BEGIN SELECT isChanged INTO vIsChanged FROM department_recalc; - + IF vIsChanged THEN UPDATE department_recalc SET isChanged = FALSE; CALL vn.department_calcTree; @@ -53180,6 +53585,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `department_getHasMistake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53187,28 +53594,28 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `department_getHasMistake`() BEGIN - + /** * Obtiene los sectores a los cuales les ponemos errores * */ - + SELECT id, name FROM department WHERE hasToMistake <> FALSE; - - + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `department_getLeaves` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53216,8 +53623,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `department_getLeaves`( vParentFk INT, @@ -53261,19 +53666,19 @@ BEGIN FROM department g JOIN tChilds c ON c.id = g.id WHERE g.parentFk IS NOT NULL; - + INSERT IGNORE INTO tNodes SELECT id FROM tParents; - + IF ROW_COUNT() = 0 THEN LEAVE myLoop; END IF; - + DELETE FROM tChilds; INSERT INTO tChilds SELECT id FROM tParents; END LOOP; - + DROP TEMPORARY TABLE tChilds, tParents; @@ -53300,6 +53705,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `deviceLog_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53307,28 +53714,27 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceLog_add`(vWorkerFk INT, vAppName VARCHAR(45), vAppVersion VARCHAR(45), vAndroid_id VARCHAR(100)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceLog_add`(vWorkerFk INT, vAppName VARCHAR(45), vAppVersion VARCHAR(45), vAndroid_id VARCHAR(64)) BEGIN -/* - * Inserta registro en tabla devicelog el log del usuario conectado +/** + * Inserta registro en tabla devicelog el log del usuario conectado. + * * @param vAppName es el nombre de la app * @param vAppVersion es la versión de la app * @param vAndroid_id es el android_id del dispositivo que se ha logueado */ - INSERT INTO deviceLog (userFK, nameApp, versionApp, android_id) VALUES(vWorkerFk, vAppName, vAppVersion, vAndroid_id); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `deviceProductionUser_exists` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53336,23 +53742,23 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_exists`(vUserFk INT) BEGIN - + /* SELECT COUNT(*) AS UserExists - FROM vn.deviceProductionUser dpu + FROM vn.deviceProductionUser dpu WHERE dpu.userFk = vUserFk;*/ SELECT TRUE; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `deviceProductionUser_getWorker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53360,27 +53766,26 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_getWorker`(vAndroid_id VARCHAR(50)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_getWorker`(vAndroid_id VARCHAR(64)) BEGIN /** * Selecciona si hay registrado un device con un android_id * * @param vAndroid_id el número android_id del dispositivo - * */ SELECT account.user_getNameFromId(dpu.userFk) - FROM deviceProductionUser dpu - JOIN deviceProduction dp ON dpu.deviceProductionFk = dp.id - WHERE dp.android_id = vAndroid_id; + FROM deviceProductionUser dpu + JOIN deviceProduction dp ON dpu.deviceProductionFk = dp.id + WHERE dp.android_id = vAndroid_id; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `deviceProduction_getnameDevice` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53388,28 +53793,25 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProduction_getnameDevice`(vAndroid_id VARCHAR(50)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProduction_getnameDevice`(vAndroid_id VARCHAR(64)) BEGIN /** - * Selecciona el id del dispositivo que corresponde al vAndroid_id + * Selecciona el id del dispositivo que corresponde al vAndroid_id. * * @param vAndroid_id el número android_id del dispositivo - * */ - SELECT dp.id FROM deviceProduction dp WHERE dp.android_id = vAndroid_id; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `device_checkLogin` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53417,15 +53819,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `device_checkLogin`(vUserFk INT, vAndroidID VARCHAR(50)) BEGIN - + /* * Comprueba si está registrado el dispositivo mediante su androidId - * + * * @param vUSerFk el id del user * @param vAndroidID es el identificador android_id del dispositivo */ @@ -53437,20 +53837,20 @@ BEGIN SELECT dpc.isAllUsersallowed INTO vIsAllUsersAllowed FROM vn.deviceProductionConfig dpc; - IF NOT vIsAllUsersAllowed THEN - + IF NOT vIsAllUsersAllowed THEN + SELECT COUNT(*) INTO vIsDepartment - FROM vn.workerDepartment dp + FROM vn.workerDepartment dp JOIN department d ON d.id = dp.departmentFk WHERE dp.workerFk = vUserFk AND d.hasToCheckLogin; - + IF vIsDepartment THEN SELECT COUNT(*) INTO vIsAuthorized - FROM vn.deviceProductionUser dpu + FROM vn.deviceProductionUser dpu JOIN vn.deviceProduction dp ON dp.id = dpu.deviceProductionFk WHERE dpu.userFk = vUserFk AND dp.android_id = vAndroidID; - + IF NOT vIsAuthorized THEN SET vMessage = 'Usuario no autorizado'; END IF; @@ -53466,6 +53866,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `duaEntryValueUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53473,22 +53875,20 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `duaEntryValueUpdate`(vDuaFk INT) BEGIN UPDATE duaEntry de - JOIN + JOIN ( SELECT b.entryFk, sum(b.quantity * b.buyingValue) as total FROM buy b JOIN duaEntry de ON de.entryFk = b.entryFk WHERE duaFk = vDuaFk GROUP BY b.entryFk ) sub ON sub.entryFk = de.entryFk - - LEFT JOIN + + LEFT JOIN (SELECT e.id, sum(iit.taxableBase) as euros FROM entry e JOIN invoiceInTax iit ON iit.invoiceInFk = e.invoiceInFk @@ -53496,17 +53896,19 @@ BEGIN WHERE de.duaFk = vDuaFk GROUP BY e.id ) sub2 ON sub2.id = de.entryFk - + SET de.value = sub.total, de.euroValue = sub2.euros WHERE duaFk = vDuaFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `duaInvoiceInBooking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53514,8 +53916,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking`(vDuaFk INT) BEGIN @@ -53524,7 +53924,7 @@ BEGIN DECLARE vInvoiceFk INT; DECLARE vASIEN BIGINT DEFAULT 0; DECLARE vCounter INT DEFAULT 0; - + DECLARE rs CURSOR FOR SELECT e.invoiceInFk FROM entry e @@ -53537,7 +53937,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN rs; - + UPDATE invoiceIn ii JOIN entry e ON e.invoiceInFk = ii.id JOIN duaEntry de ON de.entryFk = e.id @@ -53549,47 +53949,49 @@ BEGIN ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), e.isConfirmed = TRUE WHERE d.id = vDuaFk; - + SELECT IFNULL(ASIEN,0) INTO vASIEN FROM dua WHERE id = vDuaFk; - + FETCH rs INTO vInvoiceFk; - + WHILE NOT done DO CALL invoiceIn_booking(vInvoiceFk); - + IF vCounter > 0 OR vASIEN > 0 THEN - + UPDATE vn2008.XDiario x JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN SET x.ASIEN = vASIEN; - + ELSE - + SELECT lastBookEntry INTO vASIEN FROM vn.ledgerConfig; - + END IF; - + SET vCounter = vCounter + 1; - + FETCH rs INTO vInvoiceFk; END WHILE; - + CLOSE rs; - - UPDATE dua + + UPDATE dua SET ASIEN = vASIEN WHERE id = vDuaFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `duaParcialMake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53597,8 +53999,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `duaParcialMake`(vDuaFk INT) BEGIN @@ -53609,9 +54009,9 @@ BEGIN SELECT awbFk,companyFk FROM dua WHERE id = vDuaFk; - + SELECT LAST_INSERT_ID() INTO vNewDuaFk; - + INSERT INTO duaEntry(duaFk, entryFk, value, customsValue) SELECT vNewDuaFk, entryFk, value, value - customsValue FROM duaEntry @@ -53624,6 +54024,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `duaTaxBooking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53631,8 +54033,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTaxBooking`(vDuaFk INT) BEGIN @@ -53640,11 +54040,11 @@ BEGIN DECLARE vBookDated DATE; DECLARE vDiff DECIMAL(10,2); DECLARE vApunte BIGINT; - + SELECT ASIEN, IFNULL(bookEntried, util.VN_CURDATE()) INTO vBookNumber, vBookDated - FROM dua + FROM dua WHERE id = vDuaFk; - + IF vBookNumber IS NULL OR NOT vBookNumber THEN CALL ledger_next(vBookNumber); END IF; @@ -53655,14 +54055,14 @@ BEGIN ASIEN, FECHA, SUBCTA, - CONCEPTO, + CONCEPTO, EUROHABER, SERIE, empresa_id, CLAVE, FACTURA) - SELECT + SELECT vBookNumber, d.bookEntried, '4700000999', @@ -53675,20 +54075,20 @@ BEGIN FROM duaTax dt JOIN dua d ON d.id = dt.duaFk WHERE dt.duaFk = vDuaFk; - + -- Apuntes por tipo de IVA y proveedor - + INSERT INTO XDiario( ASIEN, FECHA, SUBCTA, - CONTRA, + CONTRA, EURODEBE, BASEEURO, - CONCEPTO, - FACTURA, + CONCEPTO, + FACTURA, IVA, - AUXILIAR, + AUXILIAR, SERIE, FECHA_EX, FECHA_OP, @@ -53708,17 +54108,17 @@ BEGIN FECREGCON ) - SELECT + SELECT vBookNumber ASIEN, vBookDated FECHA, tr.account SUBCTA, '4330002067' CONTRA, sum(dt.tax) EURODEBE, - sum(dt.base) BASEEURO, + sum(dt.base) BASEEURO, CONCAT('DUA nº',d.code) CONCEPTO, d.id FACTURA, dt.rate IVA, - '*' AUXILIAR, + '*' AUXILIAR, 'D' SERIE, d.issued FECHA_EX, d.operated FECHA_OP, @@ -53745,10 +54145,10 @@ BEGIN WHERE ta.effectived <= vBookDated AND taxAreaFk = 'WORLD' ORDER BY ta.effectived DESC - LIMIT 10000000000000000000 + LIMIT 10000000000000000000 ) tba GROUP BY rate - ) tr ON tr.rate = dt.rate + ) tr ON tr.rate = dt.rate JOIN supplier s ON s.id = d.companyFk JOIN country c ON c.id = s.countryFk WHERE d.id = vDuaFk @@ -53757,22 +54157,24 @@ BEGIN SELECT SUM(EURODEBE) -SUM(EUROHABER), MAX(id) INTO vDiff, vApunte FROM XDiario WHERE ASIEN = vBookNumber; - + UPDATE XDiario SET BASEEURO = 100 * (EURODEBE - vDiff) / IVA, - EURODEBE = EURODEBE - vDiff + EURODEBE = EURODEBE - vDiff WHERE id = vApunte; UPDATE dua SET ASIEN = vBookNumber WHERE id = vDuaFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `duaTax_doRecalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53780,28 +54182,26 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTax_doRecalc`(vDuaFk INT) BEGIN /** * Borra los valores de duaTax y los vuelve a crear en base a la tabla duaEntry - * + * * @param vDuaFk Id del dua a recalcular **/ DELETE FROM duaTax WHERE duaFk = vDuaFk; - - INSERT INTO duaTax(duaFk, supplierFk, taxClassFk, base) + + INSERT INTO duaTax(duaFk, supplierFk, taxClassFk, base) SELECT vDuaFk, supplierFk, taxClassFk, sum(sub.Base) as Base FROM intrastat ist JOIN (SELECT - e.supplierFk, + e.supplierFk, i.intrastatFk, CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) * di.amount/ tei.Base AS DECIMAL(10,2)) as Base - FROM buy b + FROM buy b JOIN item i ON i.id = b.itemFk JOIN entry e ON e.id = b.entryFk JOIN duaEntry de ON de.entryFk = e.id @@ -53809,15 +54209,15 @@ BEGIN ( SELECT i.intrastatFk, CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) AS DECIMAL(10,2)) as Base - FROM buy b + FROM buy b JOIN item i ON i.id = b.itemFk JOIN entry e ON e.id = b.entryFk JOIN duaEntry de ON de.entryFk = e.id WHERE de.duaFk = vDuaFk GROUP BY i.intrastatFk - + ) tei ON tei.intrastatFk = i.intrastatFk - JOIN + JOIN ( SELECT intrastatFk, sum(amount) as amount FROM duaIntrastat @@ -53826,7 +54226,7 @@ BEGIN ) di ON di.intrastatFk = i.intrastatFk WHERE de.duaFk = vDuaFk GROUP BY e.supplierFk, i.intrastatFk - HAVING Base + HAVING Base ) sub ON ist.id = sub.intrastatFk GROUP BY ist.taxClassFk, sub.supplierFk; END ;; @@ -53835,6 +54235,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ediTables_Update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53842,18 +54244,16 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ediTables_Update`() BEGIN - - INSERT IGNORE INTO vn.genus(name) + + INSERT IGNORE INTO vn.genus(name) SELECT latin_genus_name FROM edi.genus ; - INSERT IGNORE INTO vn.specie(name) - SELECT LCASE(latin_species_name) + INSERT IGNORE INTO vn.specie(name) + SELECT LCASE(latin_species_name) FROM edi.specie ; END ;; DELIMITER ; @@ -53861,6 +54261,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ektEntryAssign_setEntry` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53868,8 +54270,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ektEntryAssign_setEntry`() BEGIN @@ -53893,71 +54293,71 @@ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN cur1; read_loop: LOOP - + SET done = FALSE; SET vEntryFk = 0; - + FETCH cur1 INTO vId; - + IF done THEN LEAVE read_loop; END IF; - + SELECT IFNULL(e.id,0) INTO vEntryFk FROM vn.entry e JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk AND ea.warehouseInFk = tr.warehouseInFk AND ea.agencyModeFk = tr.agencyModeFk AND ea.supplierFk = e.supplierFk WHERE ea.id = vId AND tr.landed = vLanded LIMIT 1; - + IF NOT vEntryFk THEN - + SELECT IFNULL(e.id,0) INTO vEntryFk FROM vn.entry e JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk AND ea.warehouseInFk = tr.warehouseInFk AND ea.agencyModeFk = tr.agencyModeFk WHERE ea.id = vId AND tr.landed = vLanded AND ea.supplierFk IS NULL LIMIT 1; - + END IF; - + IF NOT vEntryFk THEN - + SET vTravelFk = 0; - - SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk + + SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk FROM vn.travel tr - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk AND ea.warehouseInFk = tr.warehouseInFk AND ea.agencyModeFk = tr.agencyModeFk WHERE ea.id = vId AND tr.landed = vLanded; - + IF NOT vTravelFk THEN - + INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyModeFk) SELECT vLanded, vLanded, warehouseInFk, warehouseOutFk, agencyModeFk - FROM vn.ektEntryAssign + FROM vn.ektEntryAssign WHERE id = vId; - - SELECT MAX(tr.id) INTO vTravelFk + + SELECT MAX(tr.id) INTO vTravelFk FROM vn.travel tr - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk AND ea.warehouseInFk = tr.warehouseInFk AND ea.agencyModeFk = tr.agencyFk WHERE ea.id = vId AND tr.landed = vLanded; - + END IF; - + INSERT INTO vn.entry(travelFk, supplierFk, companyFk, currencyFk) SELECT vTravelFk, IFNULL(ea.supplierFk,s.id), c.id, cu.id FROM vn.supplier s @@ -53965,13 +54365,13 @@ OPEN cur1; JOIN vn.currency cu ON cu.code = 'EUR' JOIN vn.ektEntryAssign ea ON ea.id = vId WHERE s.name = 'KONINKLIJE COOPERATIEVE BLOEMENVEILING FLORAHOLLAN'; - - SELECT MAX(id) INTO vEntryFk + + SELECT MAX(id) INTO vEntryFk FROM vn.entry WHERE travelFk = vTravelFk; - + END IF; - + UPDATE vn.ektEntryAssign SET entryFk = vEntryFk WHERE id = vId; @@ -53979,13 +54379,15 @@ OPEN cur1; END LOOP; CLOSE cur1; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `energyMeter_record` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53993,24 +54395,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `energyMeter_record`(vInput INT, vActiveTime INT) BEGIN DECLARE vConsumption INT; - + SELECT consumption INTO vConsumption FROM energyInput WHERE input = vInput; - INSERT INTO vn.energyMeter - SET - `input` = vInput, - `period` = DATE_FORMAT(util.VN_NOW(), '%Y-%m-%d %H:00:00'), + INSERT INTO vn.energyMeter + SET + `input` = vInput, + `period` = DATE_FORMAT(util.VN_NOW(), '%Y-%m-%d %H:00:00'), `activeTime` = vActiveTime, `consumption` = CAST(IFNULL((vConsumption / 3600) * vActiveTime, 0) AS DECIMAL(10,2)) - ON DUPLICATE KEY UPDATE + ON DUPLICATE KEY UPDATE `activeTime` = `activeTime` + vActiveTime, `consumption` = `consumption` + CAST(VALUES(`consumption`) AS DECIMAL(10,2)); END ;; @@ -54019,6 +54419,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entryDelivered` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54026,35 +54428,33 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entryDelivered`(vDated DATE, vEntryFk INT) BEGIN DECLARE vTravelFk INT; - + SELECT travelFk INTO vTravelFk - FROM vn.entry + FROM vn.entry WHERE id = vEntryFk; - + IF (SELECT COUNT(*) FROM vn.entry WHERE travelFk = vTravelFk) = 1 THEN - + UPDATE vn.travel SET shipped = LEAST(shipped, vDated), landed = vDated WHERE id = vTravelFk; - + ELSE - + INSERT INTO vn.travel(shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, ref, isDelivered, isReceived) SELECT LEAST(shipped, vDated), vDated, warehouseInFk, warehouseOutFk, agencyModeFk, CONCAT(account.myUser_getName(),' ', vEntryFk), TRUE, TRUE FROM vn.travel WHERE id = vTravelFk; - + SELECT LAST_INSERT_ID() INTO vTravelFk; - - UPDATE vn.entry - SET travelFk = vTravelFk + + UPDATE vn.entry + SET travelFk = vTravelFk WHERE id = vEntryFk; - + END IF; END ;; @@ -54063,6 +54463,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entryWithItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54070,8 +54472,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entryWithItem`(vShipmentWarehouse INT, vLandingWarehouse INT,vSale INT, vVolume INT, netCost DECIMAL(10,2), vInOutDate DATE) BEGIN @@ -54080,29 +54480,29 @@ BEGIN DECLARE vEntry INT; DECLARE vBucket VARCHAR(10); DECLARE vSupplierFk INT; - + SET vSupplierFk = IF (vLandingWarehouse = 1, 850, 963); -- seleccionamos travel SELECT t.id, e.id INTO vTravel, vEntry FROM travel t LEFT JOIN entry e ON t.id = e.travelFk - WHERE t.landed = vInOutDate AND t.shipped = vInOutDate AND t.warehouseOutFk = vShipmentWarehouse + WHERE t.landed = vInOutDate AND t.shipped = vInOutDate AND t.warehouseOutFk = vShipmentWarehouse AND t.warehouseInFk = vLandingWarehouse AND t.agencyModeFk IS NULL AND e.supplierFk = vSupplierFk - LIMIT 1; - + LIMIT 1; + -- creamos el travel si es necesario IF IFNULL(vTravel, FALSE) = FALSE THEN INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk) VALUES (vInOutDate, vInOutDate, vLandingWarehouse, vShipmentWarehouse); SELECT LAST_INSERT_ID() INTO vTravel; END IF; - + -- creamos la Entrada si es necesario IF IFNULL(vEntry, FALSE) = FALSE THEN INSERT INTO entry (supplierFk, travelFk) VALUES (vSupplierFk, vTravel); -- proveedor 'CONFECCION ARTIFICIAL' SELECT LAST_INSERT_ID() INTO vEntry; END IF; - + -- creamos el cubo si es necesario SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; IF vBucket IS NULL THEN @@ -54112,7 +54512,7 @@ BEGIN SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; END IF; - INSERT INTO buy(itemFk,quantity, entryFk, packageFk, packing, stickers, buyingValue, price2, price3) + INSERT INTO buy(itemFk,quantity, entryFk, packageFk, packing, stickers, buyingValue, price2, price3) SELECT itemFk, quantity, vEntry, @@ -54130,6 +54530,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_checkPackaging` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54137,14 +54539,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_checkPackaging`(vEntryFk INT) BEGIN /** * Comprueba que los campos package y packaging no sean nulos - * + * * @param vEntryFk Id de entrada */ DECLARE vpackageOrPackingNull INT; @@ -54163,6 +54563,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_clone` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54170,8 +54572,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_clone`(vSelf INT) BEGIN @@ -54196,6 +54596,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_cloneHeader` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54203,8 +54605,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_cloneHeader`( vSelf INT, @@ -54243,13 +54643,14 @@ BEGIN WHERE id = vSelf; SET vNewEntryFk = LAST_INSERT_ID(); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_cloneWithoutBuy` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54257,8 +54658,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_cloneWithoutBuy`(vSelf INT, OUT vNewEntryFk INT) BEGIN @@ -54284,6 +54683,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_copyBuys` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54291,8 +54692,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_copyBuys`(vSelf INT, vCopyTo INT) BEGIN @@ -54356,6 +54755,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_fixMisfit` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54363,8 +54764,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_fixMisfit`( vSelf INT @@ -54405,11 +54804,11 @@ BEGIN weight) SELECT vSelf, itemFk, - SUM(printedStickers - stickers) * packing quantity, + SUM(CAST(printedStickers AS INT) - stickers) * packing quantity, buyingValue, freightValue, TRUE isIgnored, - printedStickers - stickers, + CAST(printedStickers AS INT) - stickers, packing, `grouping`, groupingMode, @@ -54434,6 +54833,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_getRate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54441,49 +54842,59 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_getRate`(vEntry INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_getRate`(vSelf INT) BEGIN - DECLARE vLanded DATE; - DECLARE vWarehouseFk INT; +/** + * Prepara una tabla con las tarifas aplicables en funcion de la fecha + * y el almacén + * + * @param vSelf Id de la tabla entry + * @return tmp.rate (rate0, rate1, rate2, rate3) + */ + DECLARE vDated DATE; + DECLARE vWarehouseFk INT; - -- Obtiene fecha de llegada y almacén entrante - - SELECT landed, warehouseInFk INTO vLanded, vWarehouseFk - FROM vn.travel t - JOIN vn.entry e ON t.id = e.travelFk - WHERE e.id = vEntry; - - -- Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén - - DROP TEMPORARY TABLE IF EXISTS tmp.rate; - CREATE TEMPORARY TABLE tmp.rate - ENGINE = MEMORY - SELECT * FROM - ( - SELECT * FROM - ( - SELECT rate0, rate1, rate2, rate3 - FROM vn.rate - WHERE dated <= vLanded - AND warehouseFk = vWarehouseFk - ORDER BY dated DESC - - ) sub - UNION ALL - SELECT rate0, rate1, rate2, rate3 - FROM rateConfig - ) sub2 - LIMIT 1; + SELECT t.landed, t.warehouseInFk INTO vDated, vWarehouseFk + FROM entry e + JOIN travel t ON t.id = e.travelFk + WHERE e.id = vSelf; + CALL rate_getPrices(vDated, vWarehouseFk); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `entry_lock` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_lock`(vSelf INT) +BEGIN +/** + * Lock the indicated entry + * @vSelf params entry id + */ + UPDATE `entry` + SET lockerUserFk = account.myUser_getId(), + locked = util.VN_NOW() + WHERE id = vSelf; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_moveNotPrinted` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54491,8 +54902,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_moveNotPrinted`(vSelf INT, vDays INT, @@ -54555,11 +54964,11 @@ BEGIN itemOriginalFk) SELECT vNewEntryFk, itemFk, - ((stickers - printedStickers) * packing) quantity, + ((stickers - CAST(printedStickers AS INT)) * packing) quantity, buyingValue, freightValue, isIgnored, - (stickers - printedStickers) stickers, + (stickers - CAST(printedStickers AS INT)) stickers, packing, `grouping`, groupingMode, @@ -54577,7 +54986,7 @@ BEGIN FROM buy b WHERE b.entryFk = vSelf AND b.printedStickers != b.stickers; - + IF vChangeEntry THEN UPDATE buy SET stickers = printedStickers, @@ -54589,7 +54998,7 @@ BEGIN FROM item i WHERE i.description = 'MISFIT' LIMIT 1; - + INSERT INTO buy(entryFk, itemFk, quantity, @@ -54611,11 +55020,11 @@ BEGIN minPrice) SELECT vSelf, itemFk, - (printedStickers - stickers) * packing quantity, + (CAST(printedStickers AS INT) - stickers) * packing quantity, buyingValue, freightValue, TRUE isIgnored, - printedStickers - stickers, + CAST(printedStickers AS INT) - stickers, packing, `grouping`, groupingMode, @@ -54656,7 +55065,7 @@ BEGIN UPDATE entry SET gestDocFk = (SELECT gestDocFk FROM entry WHERE id = vSelf LIMIT 1) WHERE id = vNewEntryFk; - + INSERT INTO duaEntry (duaFk, entryFk) SELECT duaFk, vNewEntryFk FROM duaEntry WHERE entryFk = vSelf LIMIT 1; END ;; @@ -54665,6 +55074,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_notifyChanged` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54672,8 +55083,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_notifyChanged`(vSelf INT, vBuyFk INT, vOldValues VARCHAR(512), vNewValues VARCHAR(512)) BEGIN @@ -54710,6 +55119,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_recalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54717,8 +55128,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_recalc`() BEGIN @@ -54730,12 +55139,12 @@ BEGIN */ DECLARE v_done BOOL DEFAULT FALSE; DECLARE vEntryFk INTEGER; - + DECLARE vCur CURSOR FOR SELECT id FROM tmp.recalcEntryCommision; DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; + SET v_done = TRUE; OPEN vCur; @@ -54746,7 +55155,7 @@ BEGIN IF v_done THEN LEAVE l; END IF; - + CALL vn2008.buy_tarifas_entry(vEntryFk); END LOOP; @@ -54757,6 +55166,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_splitByShelving` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54764,76 +55175,74 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT) BEGIN /** * Divide las compras entre dos entradas de acuerdo con lo ubicado en una matr�cula - * + * * @param vShelvingFk Identificador de vn.shelving * @param vFromEntryFk Entrada origen * @param vToEntryFk Entrada destino */ DECLARE vBuyFk INT; - DECLARE ishStickers INT; - DECLARE buyStickers INT; + DECLARE vIshStickers INT; + DECLARE vBuyStickers INT; DECLARE vDone BOOLEAN DEFAULT FALSE; - DECLARE cur CURSOR FOR + DECLARE cur CURSOR FOR SELECT bb.id buyFk, - FLOOR(ish.visible / ish.packing) AS ishStickers, + FLOOR(ish.visible / ish.packing) ishStickers, bb.stickers buyStickers FROM vn.itemShelving ish - JOIN (SELECT b.id, b.itemFk, b.stickers - FROM vn.buy b + JOIN (SELECT b.id, b.itemFk, b.stickers + FROM vn.buy b WHERE b.entryFk = vFromEntryFk ORDER BY b.stickers DESC - LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk + LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk AND bb.stickers >= FLOOR(ish.visible / ish.packing) WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci GROUP BY ish.id; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - -- Cantidades de la matrícula que exceden la de las entradas - SELECT ish.itemFk, - i.longName, + + -- Cantidades de la matrícula que exceden la de las entradas + SELECT ish.itemFk, + i.longName, FLOOR(ish.visible / ish.packing) AS etiEnMatricula, bb.stickers etiEnEntrada FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - LEFT JOIN (SELECT b.id, b.itemFk, b.stickers - FROM vn.buy b + JOIN vn.item i ON i.id = ish.itemFk + LEFT JOIN (SELECT b.id, b.itemFk, b.stickers + FROM vn.buy b WHERE b.entryFk = vFromEntryFk ORDER BY b.stickers DESC LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci AND IFNULL(bb.stickers,0) < FLOOR(ish.visible / ish.packing) GROUP BY ish.id; - + OPEN cur; read_loop: LOOP SET vDone = FALSE; - - FETCH cur INTO vBuyFk, ishStickers, buyStickers; - + + FETCH cur INTO vBuyFk, vIshStickers, vBuyStickers; + IF vDone THEN LEAVE read_loop; END IF; - - IF ishStickers = buyStickers THEN + + IF vIshStickers = vBuyStickers THEN UPDATE vn.buy SET entryFk = vToEntryFk WHERE id = vBuyFk; ELSE UPDATE vn.buy - SET stickers = stickers - ishStickers, - quantity = stickers * packing + SET stickers = stickers - vIshStickers, + quantity = stickers * packing WHERE id = vBuyFk; - + INSERT INTO vn.buy(entryFk, itemFk, quantity, @@ -54853,7 +55262,6 @@ BEGIN price2, price3, minPrice, - printedStickers, workerFk, isChecked, isPickedOff, @@ -54864,11 +55272,11 @@ BEGIN SELECT vToEntryFk, itemFk, - ishStickers * packing, + vIshStickers * packing, buyingValue, freightValue, isIgnored, - ishStickers, + vIshStickers, packing, `grouping`, groupingMode, @@ -54881,7 +55289,6 @@ BEGIN price2, price3, minPrice, - ishStickers, workerFk, isChecked, isPickedOff, @@ -54892,6 +55299,7 @@ BEGIN FROM vn.buy WHERE id = vBuyFk; + UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID(); END IF; END LOOP; @@ -54902,6 +55310,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_splitMisfit` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54909,21 +55319,19 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitMisfit`(vSelf INT) BEGIN - + /* Divide una entrada, pasando los registros que ha insertado vn.entry_fixMisfit de la entrada original * a la nueva */ - + DECLARE vNewEntryFk INT; DECLARE vBuyFk INT; SELECT MAX(b.id) INTO vBuyFk - FROM vn.buy b + FROM vn.buy b JOIN vn.item i ON i.id = b.itemFk WHERE b.entryFk = vSelf AND i.description = 'MISFIT'; @@ -54932,23 +55340,51 @@ BEGIN SELECT supplierFk, dated, travelFk, currencyFk, companyFk FROM vn.entry e WHERE e.id = vSelf; + + SET vNewEntryFk = LAST_INSERT_ID(); - SET vNewEntryFk = LAST_INSERT_ID(); - - UPDATE vn.buy b + UPDATE vn.buy b SET b.entryFk = vNewEntryFk WHERE b.entryFk = vSelf AND b.id > vBuyFk; - + SELECT vNewEntryFk; - - + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `entry_unlock` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_unlock`(vSelf INT) +BEGIN +/** + * Unlock the indicated entry + * @vSelf params entry id + */ + UPDATE `entry` + SET lockerUserFk = NULL, + locked = NULL + WHERE id = vSelf; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_updateComission` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54956,8 +55392,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_updateComission`(vCurrency INT) BEGIN @@ -54966,19 +55400,33 @@ BEGIN * * @param vCurrency id del tipo de moneda(SAR,EUR,USD,GBP,JPY) */ + DECLARE vCurrencyName VARCHAR(25); + DECLARE vComission INT; + CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision - SELECT e.id + SELECT e.id FROM vn.entry e JOIN vn.travel t ON t.id = e.travelFk - JOIN vn.warehouse w ON w.id = t.warehouseInFk + JOIN vn.warehouse w ON w.id = t.warehouseInFk WHERE t.shipped >= util.VN_CURDATE() AND e.currencyFk = vCurrency; - UPDATE vn.entry e + SET vComission = currency_getCommission(vCurrency); + + UPDATE vn.entry e JOIN tmp.recalcEntryCommision tmp ON tmp.id = e.id - SET e.commission = currency_getCommission(vCurrency); + SET e.commission = vComission; + + SELECT `name` INTO vCurrencyName + FROM currency + WHERE id = vCurrency; CALL entry_recalc(); + SELECT util.notification_send( + 'entry-update-comission', + JSON_OBJECT('currencyName', vCurrencyName, 'referenceCurrent', vComission), + NULL + ); DROP TEMPORARY TABLE tmp.recalcEntryCommision; END ;; @@ -54987,6 +55435,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `errorProduction_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54994,8 +55444,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_add`( vAction VARCHAR(25), @@ -55059,7 +55507,7 @@ BEGIN WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND cr.description = vDepartment GROUP BY cd.workerFk; - + CREATE OR REPLACE TEMPORARY TABLE volume ENGINE = MEMORY SELECT SUM(w.volume) volume, @@ -55070,15 +55518,15 @@ BEGIN CREATE OR REPLACE TEMPORARY TABLE errorsByChecker ENGINE = MEMORY - SELECT sub1.workerFk, COUNT(id) errors + SELECT sub1.workerFk, COUNT(id) errors FROM ( SELECT st.workerFk, t.id FROM saleMistake sm JOIN saleTracking st ON sm.saleFk = st.saleFk JOIN `state` s2 ON s2.id = st.stateFk - JOIN sale s ON s.id = sm.saleFk - JOIN ticket t on t.id = s.ticketFk + JOIN sale s ON s.id = sm.saleFk + JOIN ticket t on t.id = s.ticketFk WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED') ) sub1 @@ -55089,13 +55537,13 @@ BEGIN SELECT COUNT(t.id) errors, e.workerFk FROM vn.expeditionMistake pm - JOIN vn.expedition e ON e.id = pm.expeditionFk + JOIN vn.expedition e ON e.id = pm.expeditionFk JOIN vn.ticket t ON t.id = e.ticketFk WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo GROUP BY e.workerFk; IF (vDepartment = 'Sacadores') THEN - + INSERT INTO errorProduction(userFk, firstname, lastname, @@ -55128,12 +55576,12 @@ BEGIN LEFT JOIN errorsByChecker ec2 ON ec2.workerFk = t.workerFk JOIN (SELECT DISTINCT w.id -- Verificamos que son sacadores FROM vn.collection c - JOIN vn.state s ON s.id = c.stateFk + JOIN vn.state s ON s.id = c.stateFk JOIN vn.train tn ON tn.id = c.trainFk - JOIN vn.worker w ON w.id = c.workerFk + JOIN vn.worker w ON w.id = c.workerFk WHERE c.created BETWEEN vDatedFrom AND vDatedTo) sub ON sub.id = w.id GROUP BY w.id; - + CREATE OR REPLACE TEMPORARY TABLE itemPickerErrors -- Errores de los sacadores, derivadores de los revisadores ENGINE = MEMORY SELECT COUNT(c.ticketFk) errors, @@ -55153,7 +55601,7 @@ BEGIN JOIN itemPickerErrors ipe ON ipe.workerFk = ep.userFk SET ep.error = ep.error + ipe.errors WHERE vDatedFrom = ep.dated AND ep.rol = 'Sacadores'; - + DROP TEMPORARY TABLE itemPickerErrors; ELSE INSERT INTO errorProduction(userFk, @@ -55189,7 +55637,7 @@ BEGIN LEFT JOIN expeditionErrors pe ON pe.workerFk = t.workerFk GROUP BY w.id; END IF; - + DROP TEMPORARY TABLE total, errorsByClaim, volume, @@ -55201,6 +55649,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `errorProduction_addLauncher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55208,14 +55658,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_addLauncher`() BEGIN DECLARE vDatedFrom DATETIME; DECLARE vDatedTo DATETIME; - + SELECT DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; CALL vn.errorProduction_add('SACAR', vDatedFrom, vDatedTo); @@ -55227,6 +55675,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionGetFromRoute` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55234,8 +55684,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionGetFromRoute`( vExpeditionFk INT) @@ -55246,7 +55694,7 @@ BEGIN DECLARE vRouteFk INT DEFAULT 0; SELECT t.routeFk INTO vRouteFk - FROM vn.expedition exp + FROM vn.expedition exp INNER JOIN ticket t on t.id = exp.ticketFk WHERE exp.id = vExpeditionFk; @@ -55272,6 +55720,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionPallet_build` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55279,8 +55729,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_build`(IN vExpeditions JSON, IN vArcId INT, IN vWorkerFk INT, OUT vPalletFk INT) BEGIN @@ -55385,6 +55833,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionPallet_Del` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55392,8 +55842,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_Del`(vPalletFk INT) BEGIN @@ -55407,6 +55855,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionPallet_List` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55414,8 +55864,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_List`(vTruckFk INT) BEGIN @@ -55436,6 +55884,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionPallet_printLabel` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55443,20 +55893,18 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_printLabel`(vSelf INT) BEGIN /** - * Calls the report_print procedure and passes it + * Calls the report_print procedure and passes it * the necessary parameters for printing. * * @param vSelf expeditioPallet id. */ DECLARE vPrinterFk INT; DECLARE vUserFk INT DEFAULT account.myUser_getId(); - + SELECT o.labelerFk INTO vPrinterFk FROM operator o WHERE o.workerFk = vUserFk; @@ -55478,6 +55926,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionPallet_View` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55485,8 +55935,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_View`(vPalletFk INT) BEGIN @@ -55507,6 +55955,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionScan_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55514,8 +55964,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Add`(vPalletFk INT, vTruckFk INT) BEGIN @@ -55523,22 +55971,22 @@ BEGIN DECLARE vTotal INT DEFAULT 0; IF vPalletFk = 0 THEN -- Nuevo pallet - - INSERT INTO vn.expeditionPallet(truckFk) + + INSERT INTO vn.expeditionPallet(truckFk) VALUES(vTruckFk); - + SELECT LAST_INSERT_ID() INTO vPalletFk; - + END IF; - + SELECT COUNT(expeditionFk) INTO vTotal FROM vn.expeditionScan WHERE palletFk = vPalletFk; - + IF vTotal <> 0 THEN - SELECT expeditionFk, + SELECT expeditionFk, palletFk - FROM vn.expeditionScan + FROM vn.expeditionScan WHERE palletFk = vPalletFk; - ELSE + ELSE SELECT 0 expeditionFk,vPalletFk palletFk; END IF; END ;; @@ -55547,6 +55995,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionScan_Del` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55554,8 +56004,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Del`(vScanFk INT) BEGIN @@ -55569,6 +56017,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionScan_List` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55576,8 +56026,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_List`(vPalletFk INT) BEGIN @@ -55599,6 +56047,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionScan_Put` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55606,23 +56056,23 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Put`(vPalletFk INT, vExpeditionFk INT) BEGIN - - REPLACE vn.expeditionScan(expeditionFk, palletFk) + + REPLACE vn.expeditionScan(expeditionFk, palletFk) VALUES(vExpeditionFk, vPalletFk); - + SELECT LAST_INSERT_ID() INTO vPalletFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionState_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55630,43 +56080,43 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_add`(vParam INT, vStateCode VARCHAR(100)) BEGIN - + /** * Inserta nuevos registros en la tabla vn.expeditionState, segun el parámetro - * + * * @param vParam Identificador de vn.expedition o de vn.route * @param vStateCode Corresponde a vn.expeditionStateType.code */ - + IF (SELECT COUNT(*) FROM vn.route r WHERE r.id = vParam) THEN - + INSERT INTO vn.expeditionState(expeditionFk, typeFk) SELECT e.id, est.id FROM vn.expedition e JOIN vn.ticket t ON t.id = e.ticketFk JOIN vn.expeditionStateType est ON est.code = vStateCode WHERE t.routeFk = vParam; - + ELSE - + INSERT INTO vn.expeditionState(expeditionFk, typeFk) SELECT vParam, est.id FROM vn.expeditionStateType est WHERE est.code = vStateCode; - + END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionState_addByAdress` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55674,8 +56124,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByAdress`(vAdressFk INT, vRouteFk INT, vStateCode VARCHAR(100)) BEGIN @@ -55692,7 +56140,7 @@ BEGIN SELECT e.id, est.id FROM vn.expedition e JOIN vn.expeditionStateType est ON est.code = vStateCode - JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.ticket t ON t.id = e.ticketFk WHERE t.addressFk = vAdressFk AND t.routeFk = vRouteFk; END ;; @@ -55701,6 +56149,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionState_addByExpedition` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55708,19 +56158,17 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByExpedition`(vExpeditionFk INT, vStateCode VARCHAR(100)) BEGIN - + /** * Inserta nuevos registros en la tabla vn.expeditionState - * + * * @param vExpeditionFk Identificador de vn.expedition * @param vStateCode Corresponde a vn.expeditionStateType.code */ - + INSERT INTO vn.expeditionState(expeditionFk, typeFk) SELECT vExpeditionFk, est.id FROM vn.expeditionStateType est @@ -55732,6 +56180,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionState_addByPallet` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55739,14 +56189,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByPallet`(vPalletFk INT, vStateCode VARCHAR(100)) BEGIN /** * Inserta nuevos registros en la tabla vn.expeditionState - * + * * @param vPalletFk Identificador de vn.expedition * @param vStateCode Corresponde a vn.expeditionStateType.code */ @@ -55763,7 +56211,7 @@ BEGIN IF NOT hasExpeditions THEN DROP TEMPORARY TABLE tExpeditionScan; - CALL util.throw('palletDoesNotExist'); + CALL util.throw('palletDoesNotExist'); END IF; INSERT INTO vn.expeditionState(expeditionFk, typeFk) @@ -55776,6 +56224,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionState_addByRoute` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55783,32 +56233,32 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByRoute`(vRouteFk INT, vStateCode VARCHAR(100)) BEGIN - + /** * Inserta nuevos registros en la tabla vn.expeditionState, por rutas - * + * * @param vRouteFk Identificador de vn.route * @param vStateCode Corresponde a vn.expeditionStateType.code */ - + INSERT INTO vn.expeditionState(expeditionFk, typeFk) SELECT e.id, est.id FROM vn.expedition e JOIN vn.ticket t ON t.id = e.ticketFk JOIN vn.expeditionStateType est ON est.code = vStateCode WHERE t.routeFk = vRouteFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionTruck_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55816,8 +56266,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_Add`(vHour VARCHAR(5), vDescription VARCHAR(45)) BEGIN @@ -55831,6 +56279,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionTruck_List` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55838,14 +56288,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_List`() BEGIN - SELECT id truckFk, - eta, + SELECT id truckFk, + eta, description Destino FROM expeditionTruck WHERE eta BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) @@ -55856,6 +56304,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expedition_getFromRoute` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55863,8 +56313,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getFromRoute`(vRouteFk INT) BEGIN @@ -55889,7 +56337,7 @@ BEGIN JOIN address a ON t.addressFk = a.id JOIN route r ON r.id = t.routeFk LEFT JOIN warehouse w ON t.warehouseFk = w.id - LEFT JOIN (SELECT sub.ticketFk, + LEFT JOIN (SELECT sub.ticketFk, CONCAT('(', GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk ORDER BY sub.items DESC SEPARATOR ','), ') ') itemPackingTypeConcat FROM (SELECT s.ticketFk , i.itemPackingTypeFk, COUNT(*) items FROM ticket t @@ -55908,6 +56356,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expedition_getState` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55915,12 +56365,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getState`(vExpeditionFk INT) BEGIN - + DECLARE vTicketsPendientes INT; DECLARE vEtiquetasTotales INT; DECLARE vEtiquetasEscaneadas INT; @@ -55930,24 +56378,24 @@ BEGIN FROM vn.ticket t JOIN vn.expedition e ON e.ticketFk = t.id WHERE e.id = vExpeditionFk; - + SELECT COUNT(*) INTO vTicketsPendientes FROM vn.ticket t LEFT JOIN vn.expedition e ON e.ticketFk = t.id WHERE t.routeFk = vRouteFk AND ISNULL(e.id); - + SELECT COUNT(*) INTO vEtiquetasTotales - FROM vn.expedition e + FROM vn.expedition e JOIN vn.ticket t ON t.id = e.ticketFk WHERE t.routeFk = vRouteFk; - + SELECT COUNT(*) INTO vEtiquetasEscaneadas - FROM vn.expeditionScan es + FROM vn.expeditionScan es JOIN vn.expedition e ON e.id = es.expeditionFk - JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.ticket t ON t.id = e.ticketFk WHERE t.routeFk = vRouteFk; - + SELECT e.ticketFk ticket, t.nickname cliente, a.city ciudad, @@ -55961,23 +56409,25 @@ BEGIN vTicketsPendientes AS ticketsPendientes, vEtiquetasTotales AS etiquetasTotales, vEtiquetasEscaneadas AS etiquetasEscaneadas - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.`zone`z ON z.id = t.zoneFk - LEFT JOIN vn.route r ON r.id = t.routeFk - LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk - LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.`zone`z ON z.id = t.zoneFk + LEFT JOIN vn.route r ON r.id = t.routeFk + LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id + LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk WHERE e.id = vExpeditionFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `expedition_StateGet` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55985,17 +56435,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_StateGet`(vExpeditionFk INT) BEGIN - + /* Devuelve una "ficha" con todos los datos relativos a la expedición - * - * param vExpeditionFk + * + * param vExpeditionFk */ - + DECLARE vTicketsPendientes INT; DECLARE vEtiquetasTotales INT; DECLARE vEtiquetasEscaneadas INT; @@ -56006,34 +56454,34 @@ BEGIN FROM vn.ticket t JOIN vn.expedition e ON e.ticketFk = t.id WHERE e.id = vExpeditionFk; - + SELECT COUNT(*) INTO vTicketsPendientes FROM vn.ticket t LEFT JOIN vn.expedition e ON e.ticketFk = t.id WHERE t.routeFk = vRouteFk AND ISNULL(e.id); - + SELECT COUNT(*) INTO vEtiquetasTotales - FROM vn.expedition e + FROM vn.expedition e JOIN vn.ticket t ON t.id = e.ticketFk WHERE t.routeFk = vRouteFk; - + SELECT COUNT(*) INTO vEtiquetasEscaneadas - FROM vn.expeditionScan es + FROM vn.expeditionScan es JOIN vn.expedition e ON e.id = es.expeditionFk - JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.ticket t ON t.id = e.ticketFk WHERE t.routeFk = vRouteFk; - + SELECT COUNT(*) INTO vEtiquetasLeidasSorter - FROM srt.expedition e + FROM srt.expedition e JOIN vn.expedition ve ON ve.id = e.id LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id - JOIN vn.ticket t ON t.id = ve.ticketFk + JOIN vn.ticket t ON t.id = ve.ticketFk WHERE t.routeFk = vRouteFk AND e.created != e.updated - AND ISNULL(es.expeditionFk); - - + AND ISNULL(es.expeditionFk); + + SELECT e.ticketFk ticket, t.nickname cliente, a.city ciudad, @@ -56048,23 +56496,25 @@ BEGIN vEtiquetasTotales AS etiquetasTotales, vEtiquetasEscaneadas AS etiquetasEscaneadas, vEtiquetasLeidasSorter AS etiquetasSorter - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.`zone`z ON z.id = t.zoneFk - LEFT JOIN vn.route r ON r.id = t.routeFk - LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk - LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.`zone`z ON z.id = t.zoneFk + LEFT JOIN vn.route r ON r.id = t.routeFk + LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id + LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk WHERE e.id = vExpeditionFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `freelance_getInfo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56072,8 +56522,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `freelance_getInfo`(workerFk INT) BEGIN @@ -56092,6 +56540,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `fustControl` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56099,12 +56549,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControl`(vFromDated DATE, vToDated DATE) BEGIN - + DECLARE vSijsnerClientFk INT DEFAULT 19752; DECLARE vDateStart DATETIME; @@ -56113,68 +56561,68 @@ BEGIN SET vDateStart = vFromDated; SET vDateEnd = util.Dayend(vToDated); - SELECT p.id FustCode, - CAST(sent.stucks AS DECIMAL(10,0)) FH, - CAST(tp.stucks AS DECIMAL(10,0)) Tickets, - CAST(-sj.stucks AS DECIMAL(10,0)) Sijsner, + SELECT p.id FustCode, + CAST(sent.stucks AS DECIMAL(10,0)) FH, + CAST(tp.stucks AS DECIMAL(10,0)) Tickets, + CAST(-sj.stucks AS DECIMAL(10,0)) Sijsner, CAST(IFNULL(sent.stucks,0) - IFNULL(tp.stucks,0) + IFNULL(sj.stucks,0) AS DECIMAL(10,0)) saldo FROM vn.packaging p LEFT JOIN ( SELECT FustCode, sum(fustQuantity) stucks FROM ( SELECT IFNULL(pe.equivalentFk ,b.packageFk) FustCode, s.quantity / b.packing AS fustQuantity - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk - JOIN vn.buy b ON b.id = lb.buy_id - JOIN vn.packaging p ON p.id = b.packageFk + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk + JOIN vn.buy b ON b.id = lb.buy_id + JOIN vn.packaging p ON p.id = b.packageFk LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p2 ON p2.id = a.provinceFk + JOIN vn.country c ON c.id = p2.countryFk WHERE t.shipped BETWEEN vDateStart AND vDateEnd AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA') sub + AND p.isPackageReturnable + AND c.country = 'FRANCIA') sub GROUP BY FustCode) sent ON sent.FustCode = p.id LEFT JOIN ( SELECT FustCode, sum(quantity) stucks FROM ( SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk + FROM vn.ticketPackaging tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN vn.packaging p ON p.id = tp.packagingFk LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p2 ON p2.id = a.provinceFk + JOIN vn.country c ON c.id = p2.countryFk WHERE t.shipped BETWEEN vDateStart AND vDateEnd AND wa.name = 'VNH' - AND p.isPackageReturnable + AND p.isPackageReturnable AND c.country = 'FRANCIA' AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0) sub + AND tp.quantity > 0) sub GROUP BY FustCode) tp ON tp.FustCode = p.id LEFT JOIN ( SELECT FustCode, sum(quantity) stucks FROM ( SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk + FROM vn.ticketPackaging tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN vn.packaging p ON p.id = tp.packagingFk LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, 1, vDateStart ) AND TIMESTAMPADD(DAY, 1, vDateEnd ) AND wa.name = 'VNH' - AND p.isPackageReturnable - AND t.clientFk = vSijsnerClientFk) sub + AND p.isPackageReturnable + AND t.clientFk = vSijsnerClientFk) sub GROUP BY FustCode) sj ON sj.FustCode = p.id - WHERE sent.stucks + WHERE sent.stucks OR tp.stucks OR sj.stucks; @@ -56184,6 +56632,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `fustControlDetail` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56191,12 +56641,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControlDetail`(vFromDated DATE, vToDated DATE) BEGIN - + DECLARE vSijsnerClientFk INT DEFAULT 19752; DECLARE vDateStart DATETIME; @@ -56204,35 +56652,37 @@ BEGIN SET vDateStart = vFromDated; SET vDateEnd = util.Dayend(vToDated); - + SELECT a.nickname shopName, - a.city , - IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, + a.city , + IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity, tp.ticketFk, CONCAT('From ', vFromDated,' to ', vToDated) AS dateRange - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk + FROM vn.ticketPackaging tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN vn.packaging p ON p.id = tp.packagingFk LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p2 ON p2.id = a.provinceFk + JOIN vn.country c ON c.id = p2.countryFk WHERE t.shipped BETWEEN vFromDated AND util.dayend(vToDated) AND wa.name = 'VNH' - AND p.isPackageReturnable + AND p.isPackageReturnable AND c.country = 'FRANCIA' AND t.clientFk != vSijsnerClientFk AND tp.quantity > 0; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `fv_pca` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56240,8 +56690,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fv_pca`() BEGIN @@ -56252,8 +56700,8 @@ DECLARE vTicketFk INT; DECLARE vSaleFk INT; DECLARE vClonTicket INT DEFAULT 0; -DECLARE cur1 CURSOR FOR -SELECT s.ticketFk, s.id +DECLARE cur1 CURSOR FOR +SELECT s.ticketFk, s.id FROM vn.sale s JOIN vn.ticket t ON t.id = s.ticketFk JOIN vn.item i ON i.id = s.itemFk @@ -56269,17 +56717,17 @@ OPEN cur1; FETCH cur1 INTO vTicketFk, vSaleFk; WHILE done = 0 DO - + SELECT t.id INTO vClonTicket FROM vn.ticket t JOIN (SELECT addressFk, shipped FROM vn.ticket WHERE id = vTicketFk) sub USING(addressFk, shipped) WHERE t.warehouseFk = 44 LIMIT 1; - + SELECT vTicketFk, vClonTicket; - + IF vClonTicket = 0 THEN - + INSERT INTO ticket ( clientFk, shipped, @@ -56307,12 +56755,12 @@ FETCH cur1 INTO vTicketFk, vSaleFk; zonePrice, zoneBonus, routeFk - + FROM ticket WHERE id = vTicketFk; SET vClonTicket = LAST_INSERT_ID(); - + SELECT 'lstID', vClonTicket; /* INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) @@ -56322,20 +56770,20 @@ FETCH cur1 INTO vTicketFk, vSaleFk; WHERE t.id = vClonTicket; */ INSERT INTO ticketLog - SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert', + SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert', description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk); - + END IF; - + UPDATE vn.sale SET ticketFk = vClonTicket WHERE id = vSaleFk; SET vClonTicket = 0; - + SET done = 0; FETCH cur1 INTO vTicketFk, vSaleFk; - + END WHILE; CLOSE cur1; @@ -56347,6 +56795,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `getDayExpeditions` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56354,14 +56804,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `getDayExpeditions`() BEGIN - SELECT - e.expeditions_id as expeditionFk, + SELECT + e.expeditions_id as expeditionFk, date_format(e.odbc_date,'%Y-%m-%d') as expeditionDate, e.ticket_id as ticketFk, t.routeFk as routeFk @@ -56375,6 +56823,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `getInfoDelivery` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56382,8 +56832,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `getInfoDelivery`(vRouteFk INT) BEGIN @@ -56398,6 +56846,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `getPedidosInternos` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56405,8 +56855,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `getPedidosInternos`() BEGIN @@ -56419,6 +56867,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `greuge_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56426,8 +56876,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `greuge_add`() BEGIN @@ -56438,7 +56886,7 @@ BEGIN SELECT DATE_SUB(util.VN_CURDATE(), INTERVAL yearsToDelete YEAR) INTO vDated FROM vn.greugeConfig; - + INSERT INTO vn.greuge(clientFk, description, amount, shipped, created, greugeTypeFk) SELECT clientFk, 'Suma agrupada', SUM(amount), MAX(shipped), MAX(created), greugeTypeFk FROM vn.greuge @@ -56454,6 +56902,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `greuge_notifyEvents` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56461,8 +56911,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `greuge_notifyEvents`() BEGIN @@ -56539,6 +56987,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `inventoryFailureAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56546,8 +56996,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryFailureAdd`() BEGIN @@ -56556,8 +57004,8 @@ DECLARE done BOOL DEFAULT FALSE; DECLARE vTicketFk INT; DECLARE rs CURSOR FOR - SELECT id FROM vn.ticket - WHERE shipped = util.yesterday() + SELECT id FROM vn.ticket + WHERE shipped = util.yesterday() AND clientFk = 400 AND warehouseFk IN (1,44); @@ -56568,13 +57016,13 @@ OPEN rs; FETCH rs INTO vTicketFk; WHILE NOT done DO - + INSERT INTO vn.inventoryFailure(dated, itemFk, quantity, value, warehouseFk, throwerFk) - SELECT t.shipped, - s.itemFk, - s.quantity, + SELECT t.shipped, + s.itemFk, + s.quantity, b.buyingValue + b.freightValue + b.packageValue + b.comissionValue, - t.warehouseFk, + t.warehouseFk, w.id FROM vn.ticket t JOIN vn.sale s ON s.ticketFk = t.id @@ -56585,7 +57033,7 @@ WHILE NOT done DO AND s.quantity > 0; FETCH rs INTO vTicketFk; - + END WHILE; @@ -56600,6 +57048,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `inventoryMake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56607,8 +57057,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vDate DATE, vWh INT) proc: BEGIN @@ -56623,7 +57071,10 @@ proc: BEGIN DECLARE vEntryFk INT; DECLARE vTravelFk INT; DECLARE vDateLastInventory DATE; - DECLARE vDateYesterday DATETIME DEFAULT TIMESTAMPADD(SECOND,-1,vDate); + DECLARE vDateYesterday DATETIME DEFAULT vDate - INTERVAL 1 SECOND; + DECLARE vWarehouseOutFkInventory INT; + DECLARE vInventorySupplierFk INT; + DECLARE vAgencyModeFkInventory INT; DECLARE cWarehouses CURSOR FOR SELECT id @@ -56631,10 +57082,7 @@ proc: BEGIN WHERE isInventory AND vWh IN (0,id); - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - SELECT vDateYesterday; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; OPEN cWarehouses; SET @isModeInventory := TRUE; @@ -56647,13 +57095,24 @@ proc: BEGIN LEAVE l; END IF; + SELECT w.id INTO vWarehouseOutFkInventory + FROM warehouse w + WHERE w.code = 'inv'; + + SELECT inventorySupplierFk INTO vInventorySupplierFk + FROM entryConfig; + + SELECT am.id INTO vAgencyModeFkInventory + FROM agencyMode am + where code = 'inv'; + SELECT MAX(landed) INTO vDateLastInventory FROM travel tr - JOIN entry e ON e.travelFk = tr.id - JOIN buy b ON b.entryFk = e.id - WHERE warehouseOutFk = 13 + JOIN entry e ON e.travelFk = tr.id + JOIN buy b ON b.entryFk = e.id + WHERE warehouseOutFk = vWarehouseOutFkInventory AND landed < vDate - AND e.supplierFk = 4 + AND e.supplierFk = vInventorySupplierFk AND warehouseInFk = vWh AND NOT isRaid; @@ -56666,21 +57125,21 @@ proc: BEGIN SELECT id INTO vTravelFk FROM travel - WHERE warehouseOutFk = 13 + WHERE warehouseOutFk = vWarehouseOutFkInventory AND warehouseInFk = vWh AND landed = vDate - AND agencyModeFk = 53 + AND agencyModeFk = vAgencyModeFkInventory AND ref = 'inventario' LIMIT 1; IF NOT vTravelFK THEN INSERT INTO travel SET - warehouseOutFk = 13, + warehouseOutFk = vWarehouseOutFkInventory, warehouseInFk = vWh, shipped = vDate, landed = vDate, - agencyModeFk = 53, + agencyModeFk = vAgencyModeFkInventory, ref = 'inventario', isDelivered = TRUE, isReceived = TRUE; @@ -56694,13 +57153,13 @@ proc: BEGIN SELECT id INTO vEntryFk FROM entry - WHERE supplierFk = 4 + WHERE supplierFk = vInventorySupplierFk AND travelFk = vTravelFk; IF NOT vEntryFk THEN INSERT INTO entry SET - supplierFk = 4, + supplierFk = vInventorySupplierFk, isConfirmed = TRUE, isOrdered = TRUE, travelFk = vTravelFk; @@ -56714,133 +57173,128 @@ proc: BEGIN END IF; -- Preparamos tabla auxilar - DROP TEMPORARY TABLE IF EXISTS tmp.inventory; - - CREATE TEMPORARY TABLE tmp.inventory - ( - itemFk INT(11) NOT NULL PRIMARY KEY, - quantity int(11) DEFAULT '0', - buyingValue decimal(10,3) DEFAULT '0.000', - freightValue decimal(10,3) DEFAULT '0.000', - packing int(11) DEFAULT '0', - `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', - groupingMode tinyint(4) NOT NULL DEFAULT 0 , - comissionValue decimal(10,3) DEFAULT '0.000', - packageValue decimal(10,3) DEFAULT '0.000', - packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', - price1 decimal(10,2) DEFAULT '0.00', - price2 decimal(10,2) DEFAULT '0.00', - price3 decimal(10,2) DEFAULT '0.00', - minPrice decimal(10,2) DEFAULT '0.00', - producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - INDEX (itemFK)) - ENGINE = MEMORY ; + CREATE OR REPLACE TEMPORARY TABLE tmp.inventory ( + itemFk INT(11) NOT NULL PRIMARY KEY, + quantity int(11) DEFAULT '0', + buyingValue decimal(10,3) DEFAULT '0.000', + freightValue decimal(10,3) DEFAULT '0.000', + packing int(11) DEFAULT '0', + `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', + groupingMode tinyint(4) NOT NULL DEFAULT 0 , + comissionValue decimal(10,3) DEFAULT '0.000', + packageValue decimal(10,3) DEFAULT '0.000', + packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', + price1 decimal(10,2) DEFAULT '0.00', + price2 decimal(10,2) DEFAULT '0.00', + price3 decimal(10,2) DEFAULT '0.00', + minPrice decimal(10,2) DEFAULT '0.00', + producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + INDEX (itemFK)) ENGINE = MEMORY; -- Compras INSERT INTO tmp.inventory(itemFk,quantity) - SELECT b.itemFk, sum(b.quantity) + SELECT b.itemFk, SUM(b.quantity) FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk WHERE tr.warehouseInFk = vWh - AND tr.landed BETWEEN vDateLastInventory + AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday AND NOT isRaid GROUP BY b.itemFk; SELECT vDateLastInventory , vDateYesterday; -- Traslados - INSERT INTO tmp.inventory(itemFk,quantity) + INSERT INTO tmp.inventory(itemFk, quantity) SELECT itemFk, quantityOut FROM ( - SELECT b.itemFk, -sum(b.quantity) quantityOut + SELECT b.itemFk,- SUM(b.quantity) quantityOut FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk WHERE tr.warehouseOutFk = vWh AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday AND NOT isRaid GROUP BY b.itemFk ) sub - ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.quantityOut; + ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut; -- Ventas INSERT INTO tmp.inventory(itemFk,quantity) SELECT itemFk, saleOut FROM ( - SELECT s.itemFk, -sum(s.quantity) saleOut + SELECT s.itemFk, - SUM(s.quantity) saleOut FROM sale s - JOIN ticket t ON t.id = s.ticketFk + JOIN ticket t ON t.id = s.ticketFk WHERE t.warehouseFk = vWh AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday GROUP BY s.itemFk ) sub - ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut; + ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut; -- Actualiza valores de la ultima compra UPDATE tmp.inventory inv - JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh - JOIN buy b ON b.id = lb.buy_id - JOIN item i ON i.id = b.itemFk - LEFT JOIN producer p ON p.id = i.producerFk - SET - inv.buyingValue = b.buyingValue, - inv.freightValue = b.freightValue, - inv.packing = b.packing, - inv.`grouping` = b.`grouping`, - inv.groupingMode = b.groupingMode, + JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh + JOIN buy b ON b.id = lb.buy_id + JOIN item i ON i.id = b.itemFk + LEFT JOIN producer p ON p.id = i.producerFk + SET inv.buyingValue = b.buyingValue, + inv.freightValue = b.freightValue, + inv.packing = b.packing, + inv.`grouping`= b.`grouping`, + inv.groupingMode = b.groupingMode, inv.comissionValue = b.comissionValue, - inv.packageValue = b.packageValue, - inv.packageFk = b.packageFk, - inv.price1 = b.price1, - inv.price2 = b.price2, - inv.price3 = b.price3, - inv.minPrice = b.minPrice, - inv.producer = p.name; + inv.packageValue = b.packageValue, + inv.packageFk = b.packageFk, + inv.price1 = b.price1, + inv.price2 = b.price2, + inv.price3 = b.price3, + inv.minPrice = b.minPrice, + inv.producer = p.name; + + INSERT INTO buy( itemFk, + quantity, + buyingValue, + freightValue, + packing, + `grouping`, + groupingMode, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + entryFk) + SELECT itemFk, + GREATEST(quantity, 0), + buyingValue, + freightValue, + packing, + `grouping`, + groupingMode, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + vEntryFk + FROM tmp.inventory; - INSERT INTO buy( itemFk, - quantity, - buyingValue, - freightValue, - packing, - `grouping`, - groupingMode, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - entryFk) - SELECT itemFk, - GREATEST(quantity,0), - buyingValue, - freightValue, - packing, - `grouping`, - groupingMode, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - vEntryFk - FROM tmp.inventory; - - SELECT vWh, count(*), util.VN_NOW() FROM tmp.inventory; - - -- Actualizamos el campo lastUsed de vn.item - UPDATE vn.item i - JOIN tmp.inventory i2 ON i2.itemFk = i.id - SET i.lastUsed = util.VN_NOW() + SELECT vWh, COUNT(*), util.VN_NOW() FROM tmp.inventory; + + -- Actualizamos el campo lastUsed de item + UPDATE item i + JOIN tmp.inventory i2 ON i2.itemFk = i.id + SET i.lastUsed = NOW() WHERE i2.quantity; - + -- DROP TEMPORARY TABLE tmp.inventory; - + END LOOP; CLOSE cWarehouses; @@ -56852,19 +57306,19 @@ proc: BEGIN CREATE TEMPORARY TABLE tmp.entryToDelete (INDEX(entryId) USING BTREE) ENGINE = MEMORY SELECT e.id as entryId, - t.id as travelId - FROM vn.travel t - JOIN vn.entry e ON e.travelFk = t.id - WHERE e.supplierFk = 4 - AND t.shipped <= TIMESTAMPADD(DAY, -2, TIMESTAMPADD(DAY, -10, util.VN_CURDATE())) - AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, util.VN_CURDATE())); - + t.id as travelId + FROM travel t + JOIN `entry` e ON e.travelFk = t.id + WHERE e.supplierFk = vInventorySupplierFk + AND t.shipped <= util.VN_CURDATE() - INTERVAL 12 DAY + AND (DAY(t.shipped) <> 1 OR shipped < util.VN_CURDATE() - INTERVAL 12 DAY); + DELETE e - FROM vn.entry e + FROM `entry` e JOIN tmp.entryToDelete tmp ON tmp.entryId = e.id; DELETE IGNORE t - FROM vn.travel t + FROM travel t JOIN tmp.entryToDelete tmp ON tmp.travelId = t.id; END ;; DELIMITER ; @@ -56872,6 +57326,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `inventoryMakeLauncher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56879,8 +57335,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMakeLauncher`() BEGIN @@ -56896,6 +57350,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `inventory_repair` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -56903,8 +57359,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inventory_repair`() BEGIN @@ -56920,7 +57374,7 @@ BEGIN b.id AS buyFk, b.entryFk, b.isIgnored, - b.price2, + b.price2, b.price3, b.stickers, b.packing, @@ -56934,20 +57388,20 @@ BEGIN s.id AS supplierFk, s.name AS supplier FROM itemType it - RIGHT JOIN (entry e + RIGHT JOIN (entry e LEFT JOIN supplier s ON s.id = e.supplierFk RIGHT JOIN buy b ON b.entryFk = e.id LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN ink ON ink.id = i.inkFk + LEFT JOIN ink ON ink.id = i.inkFk LEFT JOIN travel tr ON tr.id = e.travelFk LEFT JOIN warehouse w ON w.id = tr.warehouseInFk LEFT JOIN origin o ON o.id = i.originFk ) ON it.id = i.typeFk LEFT JOIN edi.ekt ek ON b.ektFk = ek.id WHERE (b.packageFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO'; - + DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk; - CREATE TEMPORARY TABLE tmp.lastEntryOk + CREATE TEMPORARY TABLE tmp.lastEntryOk (PRIMARY KEY (buyFk)) SELECT i.id AS itemFk, @@ -56957,7 +57411,7 @@ BEGIN b.id AS buyFk, b.entryFk, b.isIgnored, - b.price2, + b.price2, b.price3, b.stickers, b.packing, @@ -56971,11 +57425,11 @@ BEGIN s.id AS supplierFk, s.name AS supplier FROM itemType it - RIGHT JOIN (entry e + RIGHT JOIN (entry e LEFT JOIN supplier s ON s.id = e.supplierFk RIGHT JOIN buy b ON b.entryFk = e.id LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN ink ON ink.id = i.inkFk + LEFT JOIN ink ON ink.id = i.inkFk LEFT JOIN travel tr ON tr.id = e.travelFk LEFT JOIN warehouse w ON w.id = tr.warehouseInFk LEFT JOIN origin o ON o.id = i.originFk @@ -56983,34 +57437,34 @@ BEGIN LEFT JOIN edi.ekt ek ON b.ektFk = ek.id WHERE b.packageFk != "--" AND b.price2 != 0 AND b.packing != 0 AND b.buyingValue > 0 AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-2,util.VN_CURDATE())) ORDER BY tr.landed DESC; - + DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOkGroup; - CREATE TEMPORARY TABLE tmp.lastEntryOkGroup + CREATE TEMPORARY TABLE tmp.lastEntryOkGroup (INDEX (warehouseFk,itemFk)) SELECT * FROM tmp.lastEntryOk tmp GROUP BY tmp.itemFk,tmp.warehouseFk; - + UPDATE buy b JOIN tmp.lastEntry lt ON lt.buyFk = b.id JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk SET b.packageFk = eo.packageFk WHERE b.packageFk = "--"; - + UPDATE buy b JOIN tmp.lastEntry lt ON lt.buyFk = b.id JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk SET b.price2 = eo.price2 WHERE b.price2 = 0 ; - + UPDATE buy b JOIN tmp.lastEntry lt ON lt.buyFk = b.id JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk SET b.packing = eo.packing WHERE b.packing = 0; - + UPDATE buy b JOIN tmp.lastEntry lt ON lt.buyFk = b.id JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk SET b.buyingValue = eo.buyingValue WHERE b.buyingValue = 0; - + DROP TEMPORARY TABLE tmp.lastEntry; DROP TEMPORARY TABLE tmp.lastEntryOk; DROP TEMPORARY TABLE tmp.lastEntryOkGroup; @@ -57020,6 +57474,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceExpenceMake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57027,8 +57483,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceExpenceMake`(IN vInvoice INT) BEGIN @@ -57063,6 +57517,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceFromAddress` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57070,8 +57526,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromAddress`(vMaxTicketDate DATETIME,vAddress INT,vCompany INT) BEGIN @@ -57095,6 +57549,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceFromClient` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57102,8 +57558,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromClient`( IN vMaxTicketDate datetime, @@ -57130,6 +57584,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceFromTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57137,8 +57593,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromTicket`(IN vTicket INT) BEGIN @@ -57157,6 +57611,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceInDueDay_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57164,49 +57620,76 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_calculate`(vInvoiceInFk INT) BEGIN +/** + * Calcula los vctos. de una factura recibida + * En caso de haberlos informado previamente o que el proveedor sea español, no los recalculará + * + * @param vInvoiceInFk Factura recibida + */ + DECLARE vCompanyCountryCode VARCHAR(3); + DECLARE vHasDueDayTax BOOL; + DECLARE vHasDueDay BOOL; - IF !(SELECT COUNT(*) - FROM invoiceInDueDay iid - WHERE iid.invoiceInFk = vInvoiceInFk) THEN + SELECT c.code, IFNULL(a.isUeeMember, TRUE AND co.code ='ES') + INTO vCompanyCountryCode, vHasDueDayTax + FROM invoiceIn ii + JOIN supplier su ON su.id = ii.companyFk + LEFT JOIN country c ON c.id = su.countryFk + LEFT JOIN supplier s ON s.id = ii.supplierFk + LEFT JOIN country co ON co.id = s.countryFk + LEFT JOIN province p ON p.id = s.provinceFk + LEFT JOIN autonomy a ON a.id = p.autonomyFk + WHERE ii.id = vInvoiceInFk; - INSERT INTO invoiceInDueDay (invoiceInFk, - dueDated, - amount, - foreignValue) - SELECT vInvoiceInFk, - IF(payDay, - IF(vn.getNextDueDate(issued, detail, payDay) < DATE_ADD(created, INTERVAL 2 DAY), - DATE_ADD(created, INTERVAL 2 DAY), - vn.getNextDueDate(issued, detail, payDay)), - GREATEST(TIMESTAMPADD(DAY, 2, created), TIMESTAMPADD(DAY, detail, issued))), - IF((@cont:=@cont + 1) < cont, TRUNCATE(venc / cont, 2),venc-(TRUNCATE(venc / cont, 2) * (cont - 1))), - IF(@cont < cont, TRUNCATE(foreignValue / cont, 2), foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) - FROM ( SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100)*(s.countryFk = s2.countryFk)) * iit.taxableBase)/COUNT(DISTINCT(pdd.detail)) venc, - SUM(iit.foreignValue)/COUNT(DISTINCT(pdd.detail)) foreignValue, - s.payDemFk, - ii.companyFk, - COUNT(DISTINCT(pdd.detail)) cont, - s.payDay, - ii.issued, - DATE(ii.created) created - FROM invoiceIn ii - JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id - LEFT JOIN sage.TiposIva AS ti ON ti.CodigoIva= iit.taxTypeSageFk - JOIN supplier s ON s.id = ii.supplierFk - JOIN supplier s2 ON s2.id = ii.companyFk - JOIN vn.payDemDetail pdd ON pdd.id = s.payDemFk - WHERE ii.id = vInvoiceInFk - GROUP BY ii.id - ) sub - JOIN (SELECT @cont:=0) sub2 - JOIN vn.payDemDetail pdd ON pdd.id = sub.payDemFk - GROUP BY detail; - END IF; + SELECT COUNT(*) INTO vHasDueDay + FROM invoiceInDueDay iid + WHERE iid.invoiceInFk = vInvoiceInFk; + + IF NOT vHasDueDay AND vCompanyCountryCode = 'ES' THEN + + SET @cont := 0; + INSERT INTO invoiceInDueDay ( + invoiceInFk, + dueDated, + amount, + foreignValue + ) + SELECT vInvoiceInFk, + IF(payDay, + IF(getNextDueDate(issued, pdd.detail, payDay) < created, + created, + getNextDueDate(issued, pdd.detail, payDay)), + GREATEST(created, issued + INTERVAL pdd.detail DAY)), + IF((@cont := @cont + 1) < cont, + TRUNCATE(venc / cont, 2), + venc - (TRUNCATE(venc / cont, 2) * (cont - 1))), + IF(@cont < cont, + TRUNCATE(foreignValue / cont, 2), + foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) + FROM ( + SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100) * vHasDueDayTax) + * iit.taxableBase) / COUNT(DISTINCT(pdd.detail)) venc, + SUM(iit.foreignValue) / COUNT(DISTINCT(pdd.detail)) foreignValue, + s.payDemFk, + ii.companyFk, + COUNT(DISTINCT(pdd.detail)) cont, + s.payDay, + ii.issued, + DATE(ii.created) + INTERVAL 2 DAY created + FROM invoiceIn ii + JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id + LEFT JOIN sage.TiposIva ti ON ti.CodigoIva= iit.taxTypeSageFk + JOIN supplier s ON s.id = ii.supplierFk + JOIN payDemDetail pdd ON pdd.id = s.payDemFk + WHERE ii.id = vInvoiceInFk + GROUP BY ii.id + )sub + JOIN payDemDetail pdd ON pdd.id = sub.payDemFk + GROUP BY pdd.detail; + END IF; END ;; DELIMITER ; @@ -57214,6 +57697,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceInDueDay_recalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57221,23 +57706,23 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_recalc`(vInvoiceInFk INT) BEGIN DELETE FROM invoiceInDueDay WHERE invoiceInFk = vInvoiceInFk; - + CALL invoiceInDueDay_calculate(vInvoiceInFk); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceInTaxMakeByDua` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57245,8 +57730,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(vDuaFk INT) BEGIN @@ -57283,6 +57766,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceInTax_getFromDua` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57290,8 +57775,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT) BEGIN @@ -57315,7 +57798,7 @@ BEGIN CALL invoiceInTax_getFromEntries(vInvoiceInFk); CALL invoiceInDueDay_calculate(vInvoiceInFk); - + FETCH rs INTO vInvoiceInFk; END WHILE; @@ -57328,6 +57811,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceInTax_getFromEntries` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57335,8 +57820,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vId INT) BEGIN @@ -57347,7 +57830,7 @@ BEGIN SELECT MAX(rr.dated) INTO vDated FROM referenceRate rr JOIN invoiceIn ii ON ii.id = vId - WHERE rr.dated <= ii.issued + WHERE rr.dated <= ii.issued AND rr.currencyFk = ii.currencyFk ; IF vDated THEN @@ -57356,13 +57839,13 @@ BEGIN WHERE dated = vDated; END IF; - SELECT id INTO vExpenceFk - FROM vn.expence - WHERE `name` = 'Adquisición mercancia Extracomunitaria' - GROUP BY id + SELECT id INTO vExpenceFk + FROM vn.expence + WHERE `name` = 'Adquisición mercancia Extracomunitaria' + GROUP BY id LIMIT 1; - - DELETE FROM invoiceInTax + + DELETE FROM invoiceInTax WHERE invoiceInFk = vId; INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) @@ -57376,9 +57859,9 @@ BEGIN JOIN entry e ON e.invoiceInFk = ii.id JOIN supplier s ON s.id = e.supplierFk JOIN buy b ON b.entryFk = e.id - LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk + LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk AND rr.dated = ii.issued - WHERE ii.id = vId + WHERE ii.id = vId HAVING taxableBase IS NOT NULL; END ;; DELIMITER ; @@ -57386,6 +57869,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceIn_booking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57393,21 +57878,19 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_booking`(vSelf INT) BEGIN DECLARE vBookNumber INT; - DROP TEMPORARY TABLE IF EXISTS tInvoiceIn; - CREATE TEMPORARY TABLE tInvoiceIn + CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn ENGINE = MEMORY SELECT ii.bookEntried, iit.foreignValue, ii.companyFk, - ii.expenceFkDeductible, + ii.expenceFkDeductible, iit.taxableBase, + iit.transactionTypeSageFk, ii.serial, ii.issued, ii.operated, @@ -57423,6 +57906,7 @@ BEGIN s.account supplierAccount, s.name supplierName, s.nif, + s.IsVies, iit.taxTypeSageFk, tt.code taxCode, ti.Iva, @@ -57443,7 +57927,7 @@ BEGIN JOIN country c ON c.id = s.countryFk JOIN supplier sc ON sc.id = ii.companyFk JOIN country cc ON cc.id = sc.countryFk - JOIN invoiceInSerial iis ON iis.code = ii.serial + JOIN invoiceInSerial iis ON iis.code = ii.serial JOIN cplusInvoiceType472 cit ON cit.id = ii.cplusInvoiceType472Fk LEFT JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id LEFT JOIN sage.TiposTransacciones ttr ON ttr.CodigoTransaccion = iit.transactionTypeSageFk @@ -57466,18 +57950,18 @@ BEGIN NFACTICK, CLAVE, empresa_id) - SELECT + SELECT vBookNumber ASIEN, tii.bookEntried FECHA, tii.supplierAccount SUBCTA, - SUM(tii.taxableBase * - IF(tii.serial= 'R' AND ((tii.taxCode IS NULL OR tii.taxCode <> 'ISP21') - AND tii.taxTypeSageFk IS NOT NULL), - 1 + (tii.PorcentajeIva / 100), - 1)) EUROHABER, - CONCAT('s/fra', - RIGHT(tii.supplierRef, 8), - ':', + SUM(tii.taxableBase * + IF(tii.serial= 'R' AND ((tii.taxCode IS NULL OR tii.taxCode <> 'ISP21') + AND tii.taxTypeSageFk IS NOT NULL), + 1 + (tii.PorcentajeIva / 100), + 1)) EUROHABER, + CONCAT('s/fra', + RIGHT(tii.supplierRef, 8), + ':', LEFT(tii.supplierName, 10)) CONCEPTO, CAST(tii.taxableBase / tii.foreignValue AS DECIMAL (10,4)) CAMBIO, SUM(tii.foreignValue * IF(tii.serial = 'R', 1 + (tii.PorcentajeIva / 100), 1)) HABERME, @@ -57494,7 +57978,7 @@ BEGIN CONTRA, EURODEBE, EUROHABER, - CONCEPTO, + CONCEPTO, CAMBIO, DEBEME, HABERME, @@ -57506,9 +57990,9 @@ BEGIN tii.supplierAccount CONTRA, IF(tii.isWithheld AND tii.taxableBase < 0, NULL, ROUND(SUM(tii.taxableBase),2)) EURODEBE, IF(tii.isWithheld AND tii.taxableBase < 0, ROUND(SUM(-tii.taxableBase), 2), NULL) EUROHABER, - CONCAT('s/fra', - RIGHT(tii.supplierRef, 8), - ':', + CONCAT('s/fra', + RIGHT(tii.supplierRef, 8), + ':', LEFT(tii.supplierName, 10)) CONCEPTO, CAST(tii.taxableBase / tii.foreignValue AS DECIMAL (10, 4)) CAMBIO, IF(tii.isWithheld, NULL,ABS(ROUND(SUM(tii.foreignValue), 2))) DEBEME, @@ -57520,17 +58004,17 @@ BEGIN GROUP BY tii.expenceFk; -- Líneas de IVA - INSERT INTO XDiario( + INSERT INTO XDiario( ASIEN, FECHA, SUBCTA, - CONTRA, + CONTRA, EURODEBE, BASEEURO, CONCEPTO, - FACTURA, + FACTURA, IVA, - AUXILIAR, + AUXILIAR, SERIE, TIPOOPE, FECHA_EX, @@ -57579,28 +58063,28 @@ BEGIN tii.companyFk FROM tInvoiceIn tii LEFT JOIN ( - SELECT e.id + SELECT e.id FROM tInvoiceIn tii - JOIN expence e ON e.id = tii.expenceFk + JOIN expence e ON e.id = tii.expenceFk WHERE e.isWithheld LIMIT 1 - ) eWithheld ON TRUE - WHERE tii.taxTypeSageFk IS NOT NULL - AND (tii.taxCode IS NULL OR tii.taxCode NOT IN ('import10', 'import21')) + ) eWithheld ON TRUE + WHERE tii.taxTypeSageFk IS NOT NULL + AND (tii.taxCode IS NULL OR tii.taxCode NOT IN ('import10', 'import21')) GROUP BY tii.PorcentajeIva, tii.expenceFk; -- Línea iva inversor sujeto pasivo - INSERT INTO XDiario( + INSERT INTO XDiario( ASIEN, FECHA, SUBCTA, - CONTRA, + CONTRA, EUROHABER, BASEEURO, CONCEPTO, - FACTURA, + FACTURA, IVA, - AUXILIAR, + AUXILIAR, SERIE, TIPOOPE, FECHA_EX, @@ -57646,30 +58130,34 @@ BEGIN tii.supplierName TERNOM, tii.companyFk FROM tInvoiceIn tii + JOIN sage.config c WHERE tii.taxCode = 'ISP21' OR MID(tii.supplierAccount, 4, 1) = '1' AND tii.taxTypeSageFk IS NOT NULL + AND NOT(tii.isVies + AND c.nontaxableTransactionTypeFk = tii.transactionTypeSageFk + AND tii.taxCode = 'nonTaxable') GROUP BY tii.PorcentajeIva, tii.expenceFk; - - -- Actualización del registro original + + -- Actualización del registro original UPDATE invoiceIn ii SET ii.isBooked = TRUE WHERE ii.id = vSelf; - + -- Problemas derivados de la precisión en los decimales al calcular los impuestos - UPDATE XDiario - SET EURODEBE = EURODEBE - + UPDATE XDiario + SET EURODEBE = EURODEBE - (SELECT IF(ABS(sub.difference) = 0.01, sub.difference, 0) FROM( - SELECT SUM(IFNULL(ROUND(EURODEBE, 2),0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) difference + SELECT SUM(IFNULL(ROUND(EURODEBE, 2),0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) difference FROM XDiario WHERE ASIEN = vBookNumber )sub ) - WHERE ASIEN = vBookNumber + WHERE ASIEN = vBookNumber AND EURODEBE <> 0 ORDER BY id DESC LIMIT 1; - + DROP TEMPORARY TABLE tInvoiceIn; END ;; DELIMITER ; @@ -57677,6 +58165,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOutAgain` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57684,8 +58174,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutAgain`(IN vInvoiceRef VARCHAR(15), vTaxArea VARCHAR(25)) BEGIN @@ -57747,6 +58235,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOutBooking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57754,8 +58244,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutBooking`(IN vInvoice INT) BEGIN @@ -57784,7 +58272,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS rs; CREATE TEMPORARY TABLE rs - SELECT + SELECT c.accountingAccount AS clientBookingAccount, io.amount as totalAmount, CONCAT('n/fra ', io.ref) as simpleConcept, @@ -57818,19 +58306,19 @@ BEGIN WHERE io.id = vInvoice; CALL vn.ledger_next(vBookNumber); - + -- Linea del cliente INSERT INTO XDiario( ASIEN, FECHA, - SUBCTA, + SUBCTA, EURODEBE, - CONCEPTO, + CONCEPTO, FECHA_EX, FECHA_OP, empresa_id ) - SELECT + SELECT vBookNumber AS ASIEN, rs.FECHA, rs.clientBookingAccount AS SUBCTA, @@ -57846,14 +58334,14 @@ BEGIN ASIEN, FECHA, SUBCTA, - CONTRA, + CONTRA, EUROHABER, - CONCEPTO, + CONCEPTO, FECHA_EX, FECHA_OP, empresa_id ) - SELECT + SELECT vBookNumber AS ASIEN, rs.FECHA, ioe.expenceFk AS SUBCTA, @@ -57867,8 +58355,8 @@ BEGIN JOIN invoiceOutExpence ioe WHERE ioe.invoiceOutFk = vInvoice; - SELECT GROUP_CONCAT(`name` SEPARATOR ',') - INTO vExpenceConcept + SELECT GROUP_CONCAT(`name` SEPARATOR ',') + INTO vExpenceConcept FROM expence e JOIN invoiceOutExpence ioe ON ioe.expenceFk = e.id WHERE ioe.invoiceOutFk = vInvoice; @@ -57878,7 +58366,7 @@ BEGIN ASIEN, FECHA, SUBCTA, - CONTRA, + CONTRA, EUROHABER, BASEEURO, CONCEPTO, @@ -57906,7 +58394,7 @@ BEGIN TIPORECTIF, empresa_id ) - SELECT + SELECT vBookNumber AS ASIEN, rs.FECHA, iot.pgcFk AS SUBCTA, @@ -57926,11 +58414,11 @@ BEGIN rs.FECHA_OP, rs.FECHA_EX, rs.TIPOOPE, - rs.NFACTICK, + rs.NFACTICK, rs.TERIDNIF, rs.TERNIF, rs.TERNOM, - pgc.mod340 AS L340, + pgc.mod340 AS L340, pgc.cplusTrascendency477Fk AS TIPOCLAVE, pgc.cplusTaxBreakFk as TIPOEXENCI, rs.TIPONOSUJE, @@ -57938,13 +58426,13 @@ BEGIN rs.TIPORECTIF, rs.companyFk AS empresa_id FROM rs - JOIN invoiceOutTax iot + JOIN invoiceOutTax iot JOIN pgc ON pgc.code = iot.pgcFk LEFT JOIN pgcEqu pe ON pe.vatFk = iot.pgcFk -- --------------- Comprueba si la linea es de iva con rec.equiv. asociado - LEFT JOIN pgc pgce ON pgce.code = pe.equFk + LEFT JOIN pgc pgce ON pgce.code = pe.equFk LEFT JOIN pgcEqu pe2 ON pe2.equFk = iot.pgcFk -- --------------- Comprueba si la linea es de rec.equiv. WHERE iot.invoiceOutFk = vInvoice; - + UPDATE invoiceOut SET booked = util.VN_CURDATE() WHERE id = vInvoice; @@ -57954,6 +58442,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOutBookingRange` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -57961,8 +58451,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutBookingRange`() BEGIN @@ -57976,7 +58464,7 @@ BEGIN DECLARE done BOOL DEFAULT FALSE; - DECLARE rs CURSOR FOR + DECLARE rs CURSOR FOR SELECT io.id FROM invoiceOut io WHERE RIGHT(ref,7) BETWEEN 1724215 AND 1724224 @@ -57991,15 +58479,15 @@ BEGIN WHILE NOT done DO CALL invoiceOutBooking(vInvoice); - + FETCH rs INTO vInvoice ; - + SET vContador = vContador + 1; - + IF vContador MOD 50 = 0 THEN - + SELECT CONCAT(vContador, ' de momento') AS FACTURAS_ASENTADAS; - + END IF; END WHILE; @@ -58014,6 +58502,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOutDelete` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58021,22 +58511,20 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutDelete`(vRef VARCHAR(15)) BEGIN DECLARE vAsien INTEGER; DECLARE vSendMail BOOL; DECLARE vBody TEXT; - + SELECT ASIEN INTO vAsien - FROM XDiario + FROM XDiario WHERE SERIE = SUBSTRING(vRef, 1, 1) AND FACTURA = SUBSTRING(vRef, 2, LENGTH(vRef)-1) LIMIT 1; - SELECT IF(enlazado OR enlazadoSage, TRUE, FALSE), + SELECT IF(enlazado OR enlazadoSage, TRUE, FALSE), CONCAT( ' @@ -58045,7 +58533,7 @@ BEGIN - ', + ', GROUP_CONCAT( CONCAT(' @@ -58058,14 +58546,14 @@ BEGIN ) SEPARATOR ' ' ), '
FECHACONCEPTO EURODEBE EUROHABER
', IFNULL(FECHA,''), '
' - ) + ) INTO vSendMail, vBody - FROM XDiario + FROM XDiario WHERE ASIEN = vAsien; - DELETE FROM XDiario + DELETE FROM XDiario WHERE ASIEN = vAsien; - + IF vSendMail THEN CALL mail_insert( 'administracion@verdnatura.es', @@ -58083,7 +58571,7 @@ BEGIN SET refFk = NULL WHERE refFk = vRef; - DELETE + DELETE FROM invoiceOut WHERE ref = vRef; @@ -58093,6 +58581,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOutListByCompany` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58100,13 +58590,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutListByCompany`(vCompany INT, vStarted DATE, vEnded DATE) BEGIN -SELECT +SELECT c.socialName as RazonSocial, c.fi as NIF, io.ref as Factura, @@ -58118,7 +58606,7 @@ SELECT pgc.rate as Tipo, iot.vat as Cuota, pgc.name as Concepto - + FROM vn.invoiceOut io JOIN vn.invoiceOutTax iot ON iot.invoiceOutFk = io.id JOIN vn.client c ON c.id = io.clientFk @@ -58133,6 +58621,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOutTaxAndExpence` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58140,8 +58630,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutTaxAndExpence`() BEGIN @@ -58222,6 +58710,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOut_exportationFromClient` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58229,8 +58719,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_exportationFromClient`( vMaxTicketDate DATETIME, @@ -58267,15 +58755,15 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOut_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_new`( vSerial VARCHAR(255), @@ -58552,6 +59040,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOut_newFromClient` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58559,21 +59049,19 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_newFromClient`( - IN vClientFk INT, - IN vSerial CHAR(2), + IN vClientFk INT, + IN vSerial CHAR(2), IN vMaxShipped DATE, - IN vCompanyFk INT, + IN vCompanyFk INT, IN vTaxArea VARCHAR(25), - IN vRef VARCHAR(25), + IN vRef VARCHAR(25), OUT vInvoiceId INT) BEGIN /** * Factura los tickets de un cliente hasta una fecha dada - * @param vClientFk Id del cliente a facturar + * @param vClientFk Id del cliente a facturar * @param vSerial Serie de factura * @param vMaxShipped Fecha hasta la cual cogera tickets para facturar * @param vCompanyFk Id de la empresa desde la que se factura @@ -58592,11 +59080,11 @@ BEGIN IF NOT vIsRefEditable THEN CALL util.throw('serial non editable'); END IF; - END IF; + END IF; SELECT COUNT(*) INTO vIsExportation FROM vn.invoiceOutSerial - WHERE taxAreaFk = 'WORLD' + WHERE taxAreaFk = 'WORLD' AND `code` = vSerial; IF vIsExportation THEN @@ -58609,7 +59097,7 @@ BEGIN UPDATE invoiceOut SET `ref` = vRef - WHERE id = vInvoiceId + WHERE id = vInvoiceId AND vRef IS NOT NULL; IF vSerial <> 'R' AND NOT ISNULL(vInvoiceId) AND vInvoiceId <> 0 THEN @@ -58621,6 +59109,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceOut_newFromTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58628,8 +59118,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_newFromTicket`(IN vTicketFk int, IN vSerial char(2), IN vTaxArea varchar(25), IN vRef varchar(25), OUT vInvoiceId int) @@ -58638,7 +59126,7 @@ BEGIN * Factura un ticket * @param vTicketFk Id del ticket * @param vSerial Serie de factura - * @param vTaxArea Area de la factura en caso de querer forzarlo, + * @param vTaxArea Area de la factura en caso de querer forzarlo, * en la mayoria de los casos poner NULL * @return vInvoiceId */ @@ -58653,11 +59141,11 @@ BEGIN IF NOT vIsRefEditable THEN CALL util.throw('serial non editable'); END IF; - - UPDATE invoiceOut + + UPDATE invoiceOut SET `ref` = vRef WHERE id = vInvoiceId; - END IF; + END IF; IF vSerial <> 'R' AND NOT ISNULL(vInvoiceId) AND vInvoiceId <> 0 THEN CALL invoiceOutBooking(vInvoiceId); @@ -58668,6 +59156,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceTaxMake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58675,8 +59165,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceTaxMake`(vInvoice INT, vTaxArea VARCHAR(25)) BEGIN @@ -58725,6 +59213,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemBarcode_update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58732,14 +59222,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemBarcode_update`(vItemFk INT,vCode VARCHAR(22), vDelete BOOL) BEGIN IF vDelete THEN DELETE FROM vn.itemBarcode WHERE itemFk = vItemFk AND code = vCode; -ELSE +ELSE INSERT INTO vn.itemBarcode(itemFk,code) VALUES (vItemFk,vCode); END IF; @@ -58749,6 +59237,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemFreight_Show` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58756,13 +59246,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemFreight_Show`(vItemFk INT, vWarehouseFk INT) BEGIN - - SELECT cm3 Volumen_Entrada, + + SELECT cm3 Volumen_Entrada, cm3delivery Volumen_Salida, p.volume Volumen_del_embalaje, p.width Ancho_del_embalaje, @@ -58775,11 +59263,11 @@ BEGIN b.id buyFk, b.entryFk, w.name warehouseFk - FROM vn.itemCost ic - JOIN vn.item i ON i.id = ic.itemFk - LEFT JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN vn.packaging p ON p.id = b.packageFk + FROM vn.itemCost ic + JOIN vn.item i ON i.id = ic.itemFk + LEFT JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN vn.packaging p ON p.id = b.packageFk LEFT JOIN vn.warehouse w ON w.id = ic.warehouseFk WHERE ic.itemFk = vItemFk AND ic.warehouseFk = vWarehouseFk; @@ -58789,6 +59277,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemFuentesBalance` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58796,40 +59286,38 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemFuentesBalance`(vDaysInFuture INT) BEGIN /* Se utiliza para calcular la necesidad de mover mercancia entre el almacén de fuentes y el nuestro - * + * * @param vDaysInFuture Rango de dias para calcular entradas y salidas - * + * */ - + DECLARE vWarehouseFk INT; SELECT s.warehouseFk INTO vWarehouseFk - FROM vn.sector s + FROM vn.sector s WHERE s.code = 'FUENTES_PICASSE'; - + CALL cache.stock_refresh(FALSE); - SELECT i.id itemFk, + SELECT i.id itemFk, i.longName, i.size, i.subName, - v.amount - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as visible, - fue.Fuentes, + v.amount - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as visible, + fue.Fuentes, alb.Albenfruit, - sale.venta, - IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra, - IFNULL(v.amount,0) + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) + sale.venta, + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra, + IFNULL(v.amount,0) + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as saldo - FROM vn.item i - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk + FROM vn.item i + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk LEFT JOIN ( SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS Fuentes FROM vn.itemShelving ish @@ -58837,7 +59325,7 @@ BEGIN JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.sector s ON s.id = p.sectorFk WHERE s.code = 'FUENTES_PICASSE' - GROUP BY ish.itemFk + GROUP BY ish.itemFk ) fue ON fue.itemFk = i.id LEFT JOIN ( SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS Albenfruit @@ -58846,7 +59334,7 @@ BEGIN JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.sector s ON s.id = p.sectorFk WHERE s.code = 'ALBENFRUIT' - GROUP BY ish.itemFk + GROUP BY ish.itemFk ) alb ON alb.itemFk = i.id LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk LEFT JOIN ( @@ -58871,9 +59359,9 @@ BEGIN AND warehouse_id = vWarehouseFk GROUP BY item_id ) mov ON mov.item_id = i.id - WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit) + WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit) AND i.itemPackingTypeFk = 'H' - AND ic.shortLife + AND ic.shortLife ; END ;; @@ -58882,6 +59370,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemPlacementFromTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58889,13 +59379,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementFromTicket`(vTicket INT) BEGIN /** - * Llama a itemPlacementUpdateVisible + * Llama a itemPlacementUpdateVisible * de los articulos de la tabla temporal tmp.itemPlacement(itemFk) * @treturn tmp.itemPlacement * @param vTicket Id del Ticket @@ -58909,9 +59397,9 @@ BEGIN FROM ticket t JOIN sale s ON s.ticketFk = t.id WHERE t.id = vTicket; - + CALL itemPlacementUpdateVisible(); - + DROP TEMPORARY TABLE tmp.itemPlacement; END ;; DELIMITER ; @@ -58919,6 +59407,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemPlacementSupplyAiming` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58926,8 +59416,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyAiming`(vShelvingFk VARCHAR(10), quantity INT, vItemFk INT) BEGIN @@ -58944,7 +59432,7 @@ BEGIN CAST(FLOOR(LEAST(ish.stock,quantity) / ish.packing) AS DECIMAL(10,0)), ' x ', ish.packing, - IF ( + IF ( LEAST(ish.stock,quantity) MOD ish.packing, CONCAT(' + ',CAST(LEAST(ish.stock,quantity) MOD ish.packing AS DECIMAL(10,0))), '' @@ -58962,6 +59450,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemPlacementSupplyCloseOrder` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58969,13 +59459,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyCloseOrder`(vId INT, vQuantity INT) BEGIN - UPDATE vn.itemPlacementSupply + UPDATE vn.itemPlacementSupply SET priority = 10 WHERE id = vId; @@ -58985,6 +59473,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemPlacementSupplyGetOrder` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -58992,8 +59482,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyGetOrder`(vSector INT ) BEGIN @@ -59001,7 +59489,7 @@ BEGIN DECLARE vId INT; DECLARE vLastParkingFk INT; DECLARE vNextParkingFk INT; - + SELECT sh.parkingFk INTO vLastParkingFk FROM vn.itemShelvingPlacementSupply isps JOIN vn.itemShelving ish ON ish.id = isps.itemShelvingFk @@ -59009,9 +59497,9 @@ BEGIN WHERE isps.userFk = getUser() ORDER BY isps.created DESC LIMIT 1; - + SET vNextParkingFk = vn.itemShelvingPlacementSupply_ClosestGet(vLastParkingFk); - + SELECT ipsl.id INTO vId FROM vn.itemPlacementSupplyList ipsl JOIN vn.itemShelvingPlacementSupplyStock ispss ON ispss.itemFk = ipsl.itemFk @@ -59020,13 +59508,13 @@ BEGIN AND ipsl.sectorFk = vSector ORDER BY ipsl.repoUserFk DESC, ipsl.priority DESC, (ispss.parkingFk = vNextParkingFk) DESC, ispss.parking DESC, ipsl.created LIMIT 1; - + UPDATE vn.itemPlacementSupply SET repoUserFk = getUser() WHERE id = vId; - - SELECT * FROM vn.itemPlacementSupplyList - WHERE id = vId + + SELECT * FROM vn.itemPlacementSupplyList + WHERE id = vId AND sectorFk = vSector; END ;; @@ -59035,6 +59523,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemPlacementSupplyStockGetTargetList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59042,8 +59532,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyStockGetTargetList`(vItemFk INT,vSectorFk INT) BEGIN @@ -59082,6 +59570,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemProposal` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59089,8 +59579,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal`(vItemFk INT, vTicketFk INT,vShowType BOOL) BEGIN @@ -59101,20 +59589,20 @@ BEGIN * @param vItemFk item id * @param vTicketFk ticket id * @param vShowType mostrar tipos - */ + */ DECLARE vWarehouseFk INT; DECLARE vShipped DATE; DECLARE vCalcFk INT; DECLARE vTypeFk INT; - - + + DECLARE vTag1 VARCHAR(25); DECLARE vTag5 VARCHAR(25); DECLARE vTag6 VARCHAR(25); DECLARE vTag7 VARCHAR(25); DECLARE vTag8 VARCHAR(25); - + DECLARE vValue1 VARCHAR(50); DECLARE vValue5 VARCHAR(50); DECLARE vValue6 VARCHAR(50); @@ -59124,16 +59612,16 @@ BEGIN SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped FROM vn.ticket WHERE id = vTicketFk; - + SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 FROM vn.item i LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk WHERE i.id = vItemFk; - + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); - + SELECT i.id itemFk, i.longName, i.subName, @@ -59166,7 +59654,7 @@ BEGIN ORDER BY counter DESC, (t1.name = vTag1 COLLATE utf8_general_ci) DESC, (it1.value = vValue1 COLLATE utf8_general_ci) DESC, - (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, + (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, @@ -59174,7 +59662,7 @@ BEGIN (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, (i.value8 = vValue8 COLLATE utf8_general_ci) DESC; - + END ;; DELIMITER ; @@ -59182,6 +59670,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemProposal_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59189,8 +59679,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal_Add`(vSaleFk INT, vMateFk INT, vQuantity INT) BEGIN @@ -59200,7 +59688,7 @@ BEGIN * @param vSaleFk id de la tabla sale * @param vMateFk articulo sustituto * @ param vQuantity cantidad que se va a sustituir - */ + */ DECLARE vTicketFk INT; DECLARE vItemFk INT; DECLARE vWarehouseFk SMALLINT; @@ -59209,41 +59697,41 @@ BEGIN DECLARE vBox INT; DECLARE vPacking INT; DECLARE vRoundQuantity INT DEFAULT 1; - + SELECT s.ticketFk, LEAST(s.quantity, vQuantity), s.itemFk,t.shipped,t.warehouseFk INTO vTicketFk, vQuantity, vItemFk,vDate,vWarehouseFk FROM vn.sale s JOIN vn.ticket t ON t.id = s.ticketFk WHERE s.id = vSaleFk; - + UPDATE vn.sale SET quantity = quantity - vQuantity WHERE id = vSaleFk; - + CALL vn.buyUltimate(vWarehouseFk, vDate); - + SELECT `grouping`, groupingMode, packing INTO vGrouping,vBox,vPacking FROM buy b JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk WHERE tmp.itemFk = vMateFk AND tmp.WarehouseFk = vWarehouseFk; - + IF vBox = 2 AND vPacking > 0 THEN SET vRoundQuantity = vPacking; END IF; IF vBox = 1 AND vGrouping > 0 THEN SET vRoundQuantity = vGrouping; END IF; - + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept) SELECT vTicketFk, vMateFk, CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName) FROM vn.item i WHERE id = vMateFk; - + SELECT LAST_INSERT_ID() INTO vSaleFk; - + CALL vn.sale_calculateComponent(vSaleFk, NULL); - + INSERT INTO vn.itemProposal(itemFk, mateFk, counter) VALUES(vItemFk, vMateFk, 1) ON DUPLICATE KEY UPDATE counter = counter + 1; @@ -59254,6 +59742,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemProposal_beta` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59261,8 +59751,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal_beta`(vItemFk INT, vTicketFk INT) BEGIN @@ -59272,13 +59760,13 @@ BEGIN DECLARE vCalcFk INT; DECLARE vTypeFk INT; DECLARE vResultsMax INT DEFAULT 10; - + DECLARE vTag1 VARCHAR(25); DECLARE vTag5 VARCHAR(25); DECLARE vTag6 VARCHAR(25); DECLARE vTag7 VARCHAR(25); DECLARE vTag8 VARCHAR(25); - + DECLARE vValue1 VARCHAR(50); DECLARE vValue5 VARCHAR(50); DECLARE vValue6 VARCHAR(50); @@ -59288,16 +59776,16 @@ BEGIN SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped FROM vn.ticket WHERE id = vTicketFk; - + SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 - FROM vn.item i + FROM vn.item i LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk WHERE i.id = vItemFk; - + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); - + SELECT i.id itemFk, i.longName, i.subName, @@ -59315,7 +59803,7 @@ BEGIN (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, a.available, IFNULL(ip.counter,0) counter - FROM vn.item i + FROM vn.item i JOIN cache.available a ON a.item_id = i.id LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 @@ -59329,7 +59817,7 @@ BEGIN (it1.value = vValue1 COLLATE utf8_general_ci) DESC, (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, - (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, + (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, @@ -59343,6 +59831,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemRefreshTags` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59350,8 +59840,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemRefreshTags`(IN vItem INT) BEGIN @@ -59365,7 +59853,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.item SELECT vItem id; - + CALL item_refreshTags(); DROP TEMPORARY TABLE tmp.item; @@ -59376,6 +59864,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemSale_byWeek` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59383,29 +59873,26 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSale_byWeek`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT) BEGIN - + DECLARE vStarted DATE; DECLARE vEnded DATETIME; SELECT MIN(dated), util.dayEnd(MAX(dated)) INTO vStarted, vEnded - FROM `time` t + FROM `time` t WHERE CONCAT(vYear, LPAD(vWeek, 2, 0)) = t.period; SELECT t.shipped, w.name warehouse, - s.ticketFk, - c.quality, + s.ticketFk, t.nickname client, - am.name agencyName, + am.name agencyName, wk.code salesPerson, s.itemFk, - IFNULL(CONCAT(ig.longName,' ',ig.`size`,' ',ig.subName), s.concept) AS concept, - s.quantity, + IFNULL(CONCAT(ig.longName,' ',ig.`size`,' ',ig.subName), s.concept) AS concept, + s.quantity, s.price, s.priceFixed, s.discount, @@ -59415,15 +59902,15 @@ BEGIN wk.id salesPersonFk FROM sale s JOIN ticket t ON t.id = s.ticketFk - JOIN warehouse w ON w.id = t.warehouseFk + JOIN warehouse w ON w.id = t.warehouseFk JOIN address a ON a.id = t.addressFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk JOIN `client` c ON c.id = a.clientFk - LEFT JOIN worker wk ON wk.id = c.salesPersonFk + LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN ticketLastState tls ON tls.ticketFk = t.id - LEFT JOIN saleBuy sb ON sb.saleFk = s.id - LEFT JOIN buy b ON b.id = sb.buyFk - LEFT JOIN item ig ON ig.id = b.itemOriginalFk + LEFT JOIN saleBuy sb ON sb.saleFk = s.id + LEFT JOIN buy b ON b.id = sb.buyFk + LEFT JOIN item ig ON ig.id = b.itemOriginalFk WHERE s.itemFk = vItemFk AND t.shipped BETWEEN vStarted AND vEnded AND IF(vWarehouseFk = 0, w.hasComission , t.warehouseFk = vWarehouseFk) @@ -59435,6 +59922,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemSaveMin` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59442,17 +59931,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSaveMin`(min INT,vBarcode VARCHAR(22)) BEGIN DECLARE vItemFk INT; SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - + UPDATE vn.item SET minimum = min WHERE id = vItemFk; - + END ;; @@ -59461,6 +59948,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemSearchShelving` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59468,14 +59957,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSearchShelving`(`vShelvingFk` VARCHAR(3)) BEGIN SELECT p.`column` AS col , p.`row` - FROM vn.shelving s - JOIN parking p ON s.parkingFk = p.id + FROM vn.shelving s + JOIN parking p ON s.parkingFk = p.id WHERE s.`code` = vShelvingFk COLLATE utf8_general_ci; END ;; DELIMITER ; @@ -59483,6 +59970,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingDelete` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59490,8 +59979,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingDelete`(vId INT) BEGIN @@ -59504,6 +59991,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingLog_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59511,47 +60000,47 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingLog_get`(vShelvingFk VARCHAR(10) ) BEGIN - + /** * Devuelve el log de los item en cada carro * - * @param vShelvingFk Matrícula del carro - * + * @param vShelvingFk Matrícula del carro + * */ - - SELECT isl.itemShelvingFk, - isl.created, - isl.accion, - isl.itemFk, - isl.shelvingFk, - isl.quantity, + + SELECT isl.itemShelvingFk, + isl.created, + isl.accion, + isl.itemFk, + isl.shelvingFk, + isl.quantity, isl.visible, - isl.available, - isl.grouping, - isl.packing, - isl.stars, - item.longName, - item.size, - item.subName, - worker.code, + isl.available, + isl.grouping, + isl.packing, + isl.stars, + item.longName, + item.size, + item.subName, + worker.code, isl.accion - FROM item - JOIN itemShelvingLog isl ON item.id = isl.itemFk + FROM item + JOIN itemShelvingLog isl ON item.id = isl.itemFk JOIN worker ON isl.workerFk = worker.id WHERE shelvingFk = vShelvingFk OR isl.itemFk = vShelvingFk ORDER BY isl.created DESC; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingMakeFromDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59559,12 +60048,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, `vCreated` VARCHAR(22)) BEGIN - + DECLARE vItemFk INT; SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; @@ -59583,9 +60070,9 @@ BEGIN END IF; - IF (SELECT COUNT(*) FROM vn.itemShelving - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk - AND itemFk = vItemFk + IF (SELECT COUNT(*) FROM vn.itemShelving + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk AND packing = vPacking) = 1 THEN UPDATE vn.itemShelving @@ -59615,14 +60102,16 @@ BEGIN LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk LEFT JOIN vn.buy b ON b.id = lb.buy_id WHERE i.id = vItemFk; - END IF; - + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingMatch` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59630,16 +60119,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMatch`(vEntryFk INT, vAllTravel BOOLEAN, vFromTimed DATETIME, vToTimed DATETIME) BEGIN DECLARE vTravelFk INT; - - SELECT travelFk INTO vTravelFk - FROM entry + + SELECT travelFk INTO vTravelFk + FROM entry WHERE id = vEntryFk; SELECT i.id, i.longName, i.size, i.subName, b.stickers, ish.etiquetas, b.printed @@ -59652,7 +60139,7 @@ BEGIN GROUP BY itemFk ) b ON b.itemFk = i.id LEFT JOIN ( - SELECT itemFk, sum(cast(visible / packing AS DECIMAL(10,0))) AS etiquetas + SELECT itemFk, sum(cast(visible / packing AS DECIMAL(10,0))) AS etiquetas FROM itemShelving ish JOIN shelving sh ON sh.code = ish.shelvingFk LEFT JOIN parking pk ON pk.id = sh.parkingFk @@ -59667,6 +60154,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingPlacementSupplyAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59674,8 +60163,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingPlacementSupplyAdd`(vItemShelvingFk INT, vItemPlacementSupplyFk INT, vQuantity INT) BEGIN @@ -59692,7 +60179,7 @@ BEGIN UPDATE vn.itemShelving SET visible = visible - vQuantity WHERE id = vItemShelvingFk; - + END ;; DELIMITER ; @@ -59700,6 +60187,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingProblem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59707,61 +60196,61 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingProblem`(vSectorFk INT) BEGIN DECLARE vVisibleCache INT; DECLARE vWarehouseFk INT; - + SELECT warehouseFk INTO vWarehouseFk FROM vn.sector WHERE id = vSectorFk; CALL cache.visible_refresh (vVisibleCache, FALSE, vWarehouseFk); - - SELECT t.id as ticketFk, - CAST(s.quantity AS DECIMAL(10,0)) as Cantidad, - s.itemFk, - s.concept, - v.visible - GREATEST(0,iss.visible) + IFNULL(sub3.transit,0) as Nicho, + + SELECT t.id as ticketFk, + CAST(s.quantity AS DECIMAL(10,0)) as Cantidad, + s.itemFk, + s.concept, + v.visible - GREATEST(0,iss.visible) + IFNULL(sub3.transit,0) as Nicho, i.subName, - GREATEST(0,iss.visible - IFNULL(sub3.transit,0)) as Altillo, + GREATEST(0,iss.visible - IFNULL(sub3.transit,0)) as Altillo, s.id as saleFk, IFNULL(sub3.transit,0) transit, v.visible, s.isPicked, s.reserved, t.shipped, tst.productionOrder, mm.Id_Movimiento - FROM vn.ticket t + FROM vn.ticket t JOIN vn.ticketState tst ON tst.ticketFk = t.id JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk JOIN cache.visible v ON s.itemFk = v.item_id AND v.calc_id = vVisibleCache LEFT JOIN vn2008.Movimientos_mark mm ON mm.Id_Movimiento = s.id AND mm.stateFk = 26 - JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id + JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id LEFT JOIN - (SELECT itemFk, sum(saldo) as transit - FROM vn.itemPlacementSupplyList - WHERE saldo > 0 + (SELECT itemFk, sum(saldo) as transit + FROM vn.itemPlacementSupplyList + WHERE saldo > 0 AND sectorFk = vSectorFk GROUP BY itemFk) sub3 ON sub3.itemFk = i.id - WHERE v.visible + IFNULL(sub3.transit,0) - GREATEST(0,iss.visible) < s.quantity + WHERE v.visible + IFNULL(sub3.transit,0) - GREATEST(0,iss.visible) < s.quantity AND IFNULL(sub3.transit,0) < s.quantity - AND s.isPicked = FALSE + AND s.isPicked = FALSE AND s.reserved = FALSE - AND t.shipped BETWEEN util.VN_CURDATE() AND MIDNIGHT(util.VN_CURDATE()) + AND t.shipped BETWEEN util.VN_CURDATE() AND MIDNIGHT(util.VN_CURDATE()) AND tst.isPreviousPreparable = TRUE AND t.warehouseFk = vWarehouseFk AND iss.sectorFk = vSectorFk AND mm.Id_Movimiento IS NULL ORDER BY itemFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingRadar` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59769,12 +60258,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`(vSectorFk INT) proc:BEGIN - + DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; DECLARE hasFatherSector BOOLEAN; @@ -59782,17 +60269,17 @@ proc:BEGIN DECLARE vWarehouseFk INT DEFAULT 0; DECLARE vSonSectorFk INT; DECLARE vWorkerFk INT; - - SELECT s.workerFk - INTO vWorkerFk + + SELECT s.workerFk + INTO vWorkerFk FROM vn.sector s WHERE s.id = vSectorFk; SELECT w.id, s.warehouseFk INTO vBuyerFk, vWarehouseFk - FROM vn.worker w + FROM vn.worker w JOIN vn.sector s ON s.code = w.code WHERE s.id = vSectorFk; - + SELECT s.id INTO vSectorFk FROM vn.sector s WHERE s.warehouseFk = vWarehouseFk @@ -59802,21 +60289,21 @@ proc:BEGIN SELECT COUNT(*) INTO hasFatherSector FROM vn.sector WHERE sonFk = vSectorFk; - + SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk FROM vn.sector WHERE id = vSectorFk; - + CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); - + DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; - + IF hasFatherSector THEN CREATE TEMPORARY TABLE tmp.itemShelvingRadar (PRIMARY KEY (itemFk)) - ENGINE = MEMORY + ENGINE = MEMORY SELECT * FROM ( SELECT iss.itemFk, i.longName, @@ -59827,7 +60314,7 @@ proc:BEGIN SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible,0), 0)) downstairs, IF(it.isPackaging, null, IFNULL(v.visible,0)) as visible, vSectorFk as sectorFk - + FROM vn.itemShelvingStock iss JOIN vn.sector s ON s.id = iss.sectorFk JOIN vn.item i on i.id = iss.itemFk @@ -59836,11 +60323,11 @@ proc:BEGIN LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk WHERE vSectorFk IN (iss.sectorFk, s.sonFk) AND it.workerFk != 3366 - + GROUP BY iss.itemFk - + UNION ALL - + SELECT v.item_id, i.longName, i.size, @@ -59850,7 +60337,7 @@ proc:BEGIN 0 downstairs, IF(it.isPackaging, NULL, v.visible) visible, vSectorFk as sectorFk - FROM cache.visible v + FROM cache.visible v JOIN vn.item i on i.id = v.item_id JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk @@ -59859,8 +60346,8 @@ proc:BEGIN AND iss.itemFk IS NULL AND it.isInventory ) sub GROUP BY itemFk; - - SELECT ishr.*, + + SELECT ishr.*, CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho, CAST(downstairs - IFNULL(notPickedYed,0) AS DECIMAL(10,0)) as pendiente FROM tmp.itemShelvingRadar ishr @@ -59875,13 +60362,13 @@ proc:BEGIN ) sub ON sub.itemFk = ishr.itemFk ORDER BY i.typeFk, i.longName ; - - + + ELSE - + CREATE TEMPORARY TABLE tmp.itemShelvingRadar (PRIMARY KEY (itemFk)) - ENGINE = MEMORY + ENGINE = MEMORY SELECT iss.itemFk, 0 `hour`, 0 `minute`, @@ -59893,7 +60380,7 @@ proc:BEGIN IFNULL(a.available,0) available, IFNULL(v.visible - iss.visible,0) dayEndVisible, IFNULL(v.visible - iss.visible,0) firstNegative, - IFNULL(v.visible - iss.visible,0) itemPlacementVisible, + IFNULL(v.visible - iss.visible,0) itemPlacementVisible, IFNULL(i.minimum * b.packing,0) itemPlacementSize, ips.onTheWay, iss.visible itemShelvingStock, @@ -59907,13 +60394,13 @@ proc:BEGIN LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk LEFT JOIN (SELECT itemFk, sum(saldo) as onTheWay - FROM vn.itemPlacementSupplyList - WHERE saldo > 0 + FROM vn.itemPlacementSupplyList + WHERE saldo > 0 GROUP BY itemFk ) ips ON ips.itemFk = i.id - WHERE IFNULL(iss.sectorFk,0) IN (0, vSectorFk) - OR iss.sectorFk = vSectorFk; - /* + WHERE IFNULL(iss.sectorFk,0) IN (0, vSectorFk) + OR iss.sectorFk = vSectorFk; + /* UPDATE tmp.itemShelvingRadar isr JOIN vn.itemShelvingStock iss ON iss.itemFk = isr.itemFk SET isr.dayEndVisible = isr.dayEndVisible + iss.visible, @@ -59924,10 +60411,10 @@ proc:BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.itemOutTime; CREATE TEMPORARY TABLE tmp.itemOutTime SELECT *,SUM(amount) quantity - FROM + FROM (SELECT item_id itemFk, - amount, - IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, + amount, + IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes FROM vn2008.item_out io JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.item_id @@ -59935,23 +60422,23 @@ proc:BEGIN JOIN vn.ticketState ts on ts.ticketFk = io.ticketFk JOIN vn.state s ON s.id = ts.stateFk LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN (SELECT DISTINCT saleFk - FROM vn.saleTracking st - WHERE st.created > util.VN_CURDATE() + LEFT JOIN (SELECT DISTINCT saleFk + FROM vn.saleTracking st + WHERE st.created > util.VN_CURDATE() AND st.isChecked ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk WHERE t.warehouseFk = vWarehouseFk - AND s.isPicked = 0 - AND NOT io.Reservado + AND s.isPicked = 0 + AND NOT io.Reservado AND stPrevious.saleFk IS NULL - AND io.dat >= util.VN_CURDATE() + AND io.dat >= util.VN_CURDATE() AND io.dat < util.VN_CURDATE() + INTERVAL 1 DAY ) sub GROUP BY itemFk, hours, minutes; - + INSERT INTO tmp.itemShelvingRadar (itemFk) SELECT itemFk FROM tmp.itemOutTime - ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity, + ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity, firstNegative = if (firstNegative < 0, firstNegative, firstNegative + quantity), `hour` = ifnull(if (firstNegative > 0 , `hour`, hours),0), `minute` = ifnull(if (firstNegative > 0, `minute`, minutes),0); @@ -59967,13 +60454,15 @@ proc:BEGIN END IF; DROP TEMPORARY TABLE tmp.itemShelvingRadar; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingRadar_Entry` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -59981,8 +60470,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Entry`(vEntryFk INT) BEGIN @@ -59991,24 +60478,24 @@ BEGIN DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(util.VN_CURDATE()); - + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); - + DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item ENGINE = MEMORY SELECT DISTINCT itemFk - FROM vn.buy + FROM vn.buy WHERE entryFk = vEntryFk; - + DROP TEMPORARY TABLE IF EXISTS tmp.item2; CREATE TEMPORARY TABLE tmp.item2 ENGINE = MEMORY SELECT * FROM tmp.item; - - SELECT i.id as itemFk, + + SELECT i.id as itemFk, i.minimum, CAST(IFNULL(v.visible,0) - IFNULL(iss.visible,0) AS DECIMAL(10,0)) as enNicho, CAST(IFNULL(a.available,0) AS DECIMAL(10,0)) as disponible, @@ -60028,17 +60515,19 @@ BEGIN AND IFNULL(tst.productionOrder,0) < 5 GROUP BY s.itemFK ) ts ON ts.itemFk = i.id; - - + + DROP TEMPORARY TABLE tmp.item; DROP TEMPORARY TABLE tmp.item2; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingRadar_Entry_State_beta` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60046,8 +60535,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Entry_State_beta`(vEntryFk INT) BEGIN @@ -60056,40 +60543,42 @@ BEGIN DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(util.VN_CURDATE()); - + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); - + DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item ENGINE = MEMORY SELECT DISTINCT itemFk - FROM vn.buy + FROM vn.buy WHERE entryFk = vEntryFk; - + DROP TEMPORARY TABLE IF EXISTS tmp.item2; CREATE TEMPORARY TABLE tmp.item2 ENGINE = MEMORY SELECT * FROM tmp.item; - - SELECT i.id as itemFk, + + SELECT i.id as itemFk, CAST(IFNULL(iss.visible,0) - IFNULL(v.visible,0) AS DECIMAL(10,0)) as outShelving FROM vn.item i JOIN tmp.item ti ON ti.itemFk = i.id LEFT JOIN cache.visible v ON v.calc_id = vCalcVisibleFk AND v.item_id = i.id LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id; - - + + DROP TEMPORARY TABLE tmp.item; DROP TEMPORARY TABLE tmp.item2; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingSale_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60097,17 +60586,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_Add`(vItemShelvingFk INT, vSaleFk INT, vQuantity INT) BEGIN /** * Añade línea a itemShelvingSale y regulariza el carro - * + * * @param vItemShelvingFk Id itemShelving * @param vSaleFk Id de sale - * @param vQuantity cantidad a regularizar + * @param vQuantity cantidad a regularizar */ INSERT INTO itemShelvingSale(itemShelvingFk, saleFk, @@ -60132,6 +60619,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelvingTransfer` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60139,8 +60628,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingTransfer`(vItemShelvingFk INT, vShelvingFk VARCHAR(3)) BEGIN @@ -60190,6 +60677,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60197,12 +60686,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT) BEGIN - + /** * Añade registro o lo actualiza si ya existe. @@ -60214,7 +60701,7 @@ BEGIN * @param vGrouping el grouping del producto en itemShelving, NULL para coger el de la ultima compra * @param vPacking el packing del producto, NULL para coger el de la ultima compra * @param vWarehouseFk indica el sector - * + * **/ DECLARE vItemFk INT; @@ -60224,21 +60711,21 @@ BEGIN IF (SELECT COUNT(*) FROM shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN INSERT IGNORE INTO parking(code) VALUES(vShelvingFk); - INSERT INTO shelving(code, parkingFk) + INSERT INTO shelving(code, parkingFk) SELECT vShelvingFk, id - FROM parking + FROM parking WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; END IF; - IF (SELECT COUNT(*) FROM itemShelving - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk - AND itemFk = vItemFk + IF (SELECT COUNT(*) FROM itemShelving + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk AND packing = vPacking) = 1 THEN UPDATE itemShelving SET visible = visible+vQuantity - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; ELSE CALL cache.last_buy_refresh(FALSE); @@ -60266,6 +60753,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_addByClaim` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60273,8 +60762,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_addByClaim`(vClaimFk INT, vShelvingFk VARCHAR(3)) BEGIN @@ -60309,6 +60796,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_addList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60316,8 +60805,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_addList`(vShelvingFk VARCHAR(3), vList TEXT, vIsChecking BOOL, vWarehouseFk INT) BEGIN @@ -60369,6 +60856,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_BuyerGet` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60376,20 +60865,20 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_BuyerGet`( ) BEGIN SELECT * FROM vn.buyer; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_filterBuyer` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60397,8 +60886,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_filterBuyer`(vBuyerFk INT, vWarehouseFk INT) proc:BEGIN @@ -60410,10 +60897,10 @@ proc:BEGIN * @return Lista de articulos */ DECLARE vCalcVisibleFk INT; - + CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - SELECT * FROM + SELECT * FROM (SELECT sub.itemFk, sub.longName, CONCAT('Hoy saldrán ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, @@ -60430,28 +60917,28 @@ proc:BEGIN 0 upstairs, SUM(IFNULL(iss.visible,0)) downstairs, IF(it.isPackaging, null, IFNULL(v.visible, 0)) visible, - ik.name + ik.name FROM itemShelvingStock iss JOIN sector s ON s.id = iss.sectorFk JOIN item i on i.id = iss.itemFk - LEFT JOIN ink ik ON ik.id = i.inkFk + LEFT JOIN ink ik ON ik.id = i.inkFk JOIN itemType it ON it.id = i.typeFk LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk WHERE s.warehouseFk = vWarehouseFk AND it.workerFk = vBuyerFk - GROUP BY itemFk + GROUP BY itemFk ) sub LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente FROM sale s LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk + JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND st.saleFk IS NULL AND ct.code IN ('normal', 'trust') GROUP BY s.itemFk - ) sub2 ON sub2.itemFk = sub.itemFk - UNION ALL + ) sub2 ON sub2.itemFk = sub.itemFk + UNION ALL SELECT v.item_id , i.longName, CONCAT('Hoy saldrán ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, @@ -60469,7 +60956,7 @@ proc:BEGIN LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente FROM sale s LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk + JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) @@ -60489,6 +60976,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60496,18 +60985,16 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_get`(IN vSelf VARCHAR(8)) BEGIN /** -* Lista artículos de itemshelving +* Lista artículos de itemshelving * * @param vSelf matrícula del carro **/ - SELECT ish.itemFk item, - IFNULL(i.longName, CONCAT(i.name, ' ', i.size)) description, + SELECT ish.itemFk item, + IFNULL(i.longName, CONCAT(i.name, ' ', i.size)) description, ish.visible, CEIL(ish.visible/ish.packing) stickers, ish.packing, @@ -60527,15 +61014,15 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_getAlternatives` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getAlternatives`(vShelvingFk VARCHAR(10)) BEGIN @@ -60545,15 +61032,14 @@ BEGIN * * @param vShelvingFk matricula del carro */ - SELECT is2.id,is2.shelvingFk , p.code, is2.itemFk , is2.visible, p.pickingOrder + SELECT is2.id,is2.shelvingFk , p.code, is2.itemFk , is2.visible, p.pickingOrder FROM itemShelving is2 JOIN shelving sh ON sh.code = is2.shelvingFk JOIN parking p ON p.id = sh.parkingFk JOIN sector s ON s.id = p.sectorFk - LEFT JOIN operator o ON o.sectorFk = s.id - LEFT JOIN worker w ON w.sectorFk = s.id AND w.id = account.myUser_getId() + LEFT JOIN operator o ON o.sectorFk = s.id AND o.workerFk = account.myUser_getId() JOIN warehouse wh ON wh.id = s.warehouseFk - JOIN itemShelving is3 ON is3.itemFk = is2.itemFk AND is3.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci + JOIN itemShelving is3 ON is3.itemFk = is2.itemFk AND is3.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci WHERE is2.shelvingFk <> vShelvingFk COLLATE utf8_unicode_ci GROUP BY is2.id ORDER BY p.pickingOrder DESC; @@ -60563,6 +61049,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_getInfo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60570,8 +61058,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getInfo`(vItemFk VARCHAR(22)) BEGIN @@ -60600,6 +61086,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_getSaleDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60607,40 +61095,38 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getSaleDate`(vShelvingFk VARCHAR(3)) BEGIN - + /* Devuelve la minima fecha en que se necesita cada producto en esa matricula. - * + * * @param vShelvingFk Matrícula del carro o pallet */ - + DECLARE vWarehouseFk INT; SELECT warehouseFk INTO vWarehouseFk FROM shelving s - JOIN parking p ON s.parkingFk = p.id + JOIN parking p ON s.parkingFk = p.id JOIN sector st ON st.id = p.sectorFk WHERE s.code = vShelvingFk COLLATE utf8_unicode_ci; - + DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingDistinct; CREATE TEMPORARY TABLE tmp.itemShelvingDistinct (PRIMARY KEY (itemFk)) ENGINE = MEMORY SELECT itemFk, SUM(visible) visible - FROM vn.itemShelving + FROM vn.itemShelving WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci - GROUP BY itemFk; - + GROUP BY itemFk; + DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item (PRIMARY KEY (itemFk)) ENGINE = MEMORY SELECT * FROM tmp.itemShelvingDistinct; - + DROP TEMPORARY TABLE IF EXISTS tmp.stockByDay; CREATE TEMPORARY TABLE tmp.stockByDay (index (itemFk, dated)) @@ -60651,16 +61137,16 @@ BEGIN FROM ( SELECT * FROM ( SELECT t2.* FROM ( - SELECT item_id itemFk, amount, util.VN_CURDATE() dated - FROM cache.stock + SELECT item_id itemFk, amount, util.VN_CURDATE() dated + FROM cache.stock WHERE warehouse_id = vWarehouseFk UNION ALL SELECT ish.itemFk, - sum(visible), util.VN_CURDATE() - FROM vn.itemShelving ish - JOIN shelving sh ON sh.code = ish.shelvingFk - JOIN parking p ON sh.parkingFk = p.id + FROM vn.itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON sh.parkingFk = p.id JOIN sector s ON s.id = p.sectorFk - WHERE s.isReserve + WHERE s.isReserve GROUP BY ish.itemFk UNION ALL SELECT item_id, sum(iei.amount), dat @@ -60669,9 +61155,9 @@ BEGIN AND warehouse_id = vWarehouseFk AND isVirtualStock = FALSE GROUP BY item_id, dat - UNION ALL + UNION ALL SELECT item_id, sum(ieo.amount), dat - FROM vn2008.item_entry_out ieo + FROM vn2008.item_entry_out ieo WHERE dat >= util.VN_CURDATE() AND warehouse_id = vWarehouseFk GROUP BY item_id, dat @@ -60682,11 +61168,11 @@ BEGIN WHERE io.dat >= util.VN_CURDATE() AND io.warehouse_id = vWarehouseFk GROUP BY io.item_id, io.dat - ) t2 + ) t2 JOIN tmp.itemShelvingDistinct ish ON ish.itemFk = t2.itemFk) t order by t.itemFk, DATE(t.dated), t.amount DESC) t3; - - SELECT sbd.itemFk, i.longName, DATE(dated) dated, ish.visible amount, sbd.stock + + SELECT sbd.itemFk, i.longName, DATE(dated) dated, ish.visible amount, sbd.stock FROM tmp.stockByDay sbd JOIN vn.item i ON i.id = sbd.itemFk JOIN tmp.itemShelvingDistinct ish ON ish.itemFk = sbd.itemFk @@ -60703,6 +61189,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_inventory` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60710,56 +61198,74 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_inventory`(vParkingFromFk INT, vParkingToFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_inventory`(vParkingFromFk VARCHAR(8), vParkingToFk VARCHAR(8)) BEGIN - - /** - * Devuelve un listado de ubicaciones a revisar - * - * @param vParkingFromFk Parking de partida, identificador de vn.parking - * @param vParkingToFk Parking de llegada, identificador de vn.parking - */ - +/** + * Devuelve un listado de ubicaciones a revisar + * + * @param vParkingFromFk Parking de partida, identificador de parking + * @param vParkingToFk Parking de llegada, identificador de parking + */ DECLARE vSectorFk INT; DECLARE vPickingOrderFrom INT; DECLARE vPickingOrderTo INT; SELECT p.sectorFk, p.pickingOrder INTO vSectorFk, vPickingOrderFrom - FROM vn.parking p - WHERE p.id = vParkingFromFk; + FROM parking p + WHERE p.code = vParkingFromFk COLLATE 'utf8mb3_general_ci'; SELECT p.pickingOrder INTO vPickingOrderTo - FROM vn.parking p - WHERE p.id = vParkingToFk; + FROM parking p + WHERE p.code = vParkingToFk COLLATE 'utf8mb3_general_ci'; - CALL vn.visible_getMisfit(vSectorFk); + CALL visible_getMisfit(vSectorFk); - SELECT p.code parking , - ish.shelvingFk , + SELECT ish.id, + p.pickingOrder, + p.code parking, + ish.shelvingFk, ish.itemFk, i.longName, - ish.visible , - ish.visible / ish.packing packs, - ish.packing, - sm.visible - sm.parked faltan - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk + ish.visible, + p.sectorFk, + it.workerFk buyer, + CONCAT('http:',ic.url, '/catalog/1600x900/',i.image) urlImage, + ish.isChecked, + CASE + WHEN s.notPrepared > sm.parked THEN 0 + WHEN sm.visible > sm.parked THEN 1 + ELSE 2 + END priority + FROM itemShelving ish + JOIN item i ON i.id = ish.itemFk + JOIN itemType it ON it.id = i.typeFk JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + JOIN ( + SELECT s.itemFk, sum(s.quantity) notPrepared + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN warehouse w ON w.id = t.warehouseFk + JOIN config c ON c.mainWarehouseFk = w.id + WHERE t.shipped BETWEEN util.VN_CURDATE() + AND util.dayEnd(util.VN_CURDATE()) + AND s.isPicked = FALSE + GROUP BY s.itemFk + ) s ON s.itemFk = i.id + JOIN hedera.imageConfig ic WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo AND p.sectorFk = vSectorFk - ORDER BY p.pickingOrder ; - + ORDER BY p.pickingOrder; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_selfConsumption` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60767,19 +61273,17 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_selfConsumption`( - vShelvingFk VARCHAR(10) COLLATE utf8_general_ci, - vItemFk INT, + vShelvingFk VARCHAR(10) COLLATE utf8_general_ci, + vItemFk INT, vQuantity INT ) -BEGIN +BEGIN /** - * Leave the indicated amount on the shelf + * Leave the indicated amount on the shelf * and create a ticket with the difference. - * + * * @param vShelvingFk id of the shelf where the item is located. * @param vItemFk article of which the self-consumption ticket is to be created. * @param vQuantity amount that will stay on the shelf @@ -60823,10 +61327,10 @@ BEGIN END IF; SELECT SUM(visible), id INTO vVisible, vItemShelvingFk - FROM itemShelving + FROM itemShelving WHERE shelvingFk = vShelvingFk AND itemFk = vItemFk; - + IF vVisible IS NULL THEN CALL util.throw('The item is not on the shelf.'); END IF; @@ -60858,6 +61362,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60865,8 +61371,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_update`(vVisible INT, vPacking INT, vShelf INT ,vGrouping INT ) BEGIN @@ -60879,9 +61383,9 @@ BEGIN * @param vGrouping el grouping del producto en itemShelving */ UPDATE itemShelving - SET visible = vVisible, - packing = vPacking, - grouping = vGrouping + SET visible = vVisible, + packing = vPacking, + grouping = vGrouping WHERE id = vShelf; END ;; @@ -60890,75 +61394,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `itemStock` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemStock`(vWarehouseFk SMALLINT, vDated DATETIME, vItemFk INT) -BEGIN -/** - * Calcula el stock del vWarehouseFk desde FechaInventario hasta vDated - * @param vWarehouse warehouse id - * @param vDated max date to filter - * @param vItemFk item id - **/ - - - DECLARE vIsLogifloraDay BOOLEAN; - - SET vDated = TIMESTAMP(DATE(vDated), '00:00:00'); - - SELECT vn.isLogifloraDay(vDated, vWarehouseFk) INTO vIsLogifloraDay ; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemList; - CREATE TEMPORARY TABLE tmp.itemList - (UNIQUE INDEX i USING HASH (itemFk)) - ENGINE = MEMORY - SELECT itemFk, SUM(quantity) stock, SUM(quantity) visible, SUM(quantity) available FROM ( - SELECT itemFk, quantity - FROM itemTicketOut - WHERE shipped >= util.VN_CURDATE() AND shipped < vDated - AND warehouseFk = vWarehouseFk - AND (vItemFk IS NULL OR itemFk = vItemFk) - UNION ALL - SELECT itemFk, quantity - FROM itemEntryIn i - LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk - WHERE i.landed >= util.VN_CURDATE() AND i.landed < vDated - AND i.warehouseInFk = vWarehouseFk - AND (vItemFk IS NULL OR i.itemFk = vItemFk) - AND (ISNULL(wf.entryFk) OR vIsLogifloraDay) - UNION ALL - SELECT itemFk, quantity - FROM itemEntryOut - WHERE shipped >= util.VN_CURDATE() AND shipped < vDated - AND warehouseOutFk = vWarehouseFk - AND (vItemFk IS NULL OR itemFk = vItemFk) - ) t - GROUP BY itemFk HAVING stock != 0; - - CALL `cache`.stock_refresh (FALSE); - - INSERT INTO tmp.itemList (itemFk,stock,visible,available) - SELECT item_id,amount,amount,amount - FROM `cache`.stock - WHERE warehouse_id = vWarehouseFk AND (vItemFk IS NULL OR vItemFk = item_id) - ON DUPLICATE KEY UPDATE - stock = stock + VALUES(stock), - visible = visible + VALUES(visible), - available = available + VALUES(available); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemTagMake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60966,13 +61403,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagMake`(vItemFk INT) BEGIN -/* * Crea los tags usando la tabla plantilla itemTag +/* * Crea los tags usando la tabla plantilla itemTag * y si no existe a partir de la ficha del artículo. * @param vItemFk El item al que se le añaden los tags */ @@ -60982,33 +61417,33 @@ BEGIN DECLARE vProducer VARCHAR(50); DECLARE vOrigin VARCHAR(20); DECLARE vTypeFk INTEGER; - - DELETE FROM itemTag + + DELETE FROM itemTag WHERE itemFk = vItemFk; - - SELECT typeFk INTO vTypeFk + + SELECT typeFk INTO vTypeFk FROM item WHERE id = vItemFk; - + INSERT INTO itemTag(itemFk, tagFk, value, priority) SELECT vItemFk, itt.tagFk, NULL, itt.priority FROM itemTag it LEFT JOIN itemTypeTag itt ON itt.itemTypeFk = vTypeFk WHERE it.itemFk = vItemFk; - + IF (SELECT COUNT(*) FROM itemTag WHERE itemFk = vItemFk LIMIT 1) = 0 THEN - SELECT ik.name, i.size, i.category, p.name, o.name + SELECT ik.name, i.size, i.category, p.name, o.name INTO vInk, vSize, vCategory, vProducer, vOrigin FROM item i LEFT JOIN ink ik ON ik.id = i.inkFk LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible LEFT JOIN origin o ON o.id = i.originFk WHERE i.id = vItemFk; - + INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) VALUES(vItemFk, 1, vInk, 1); - + INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) VALUES (vItemFk, 8, vSize, 2); @@ -61017,17 +61452,19 @@ BEGIN INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) VALUES(vItemFk, 37, vProducer, 4); - + INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) VALUES(vItemFk, 35, vOrigin, 5); END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemTagReorder` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61035,19 +61472,17 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorder`(itemTypeFk INT) BEGIN SET @isTriggerDisabled = TRUE; - + -- No se puede usar temporary porque da error Error Code: 1137. No puedo reabrir tabla: 'i DROP TABLE IF EXISTS tmp.item; CREATE TABLE tmp.item SELECT DISTINCT i.id - FROM vn.item i + FROM vn.item i WHERE i.typeFk = itemTypeFk; UPDATE itemTag it @@ -61056,8 +61491,8 @@ BEGIN JOIN itemTypeTag itt ON itt.itemTypeFk = item.typeFk AND itt.tagFk = it.tagFk SET it.priority = itt.priority WHERE itt.itemTypeFk = itemTypeFk; - - CALL item_refreshTags(); + + CALL item_refreshTags(); SET @isTriggerDisabled = FALSE; @@ -61068,6 +61503,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemTagReorderByName` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61075,19 +61512,17 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorderByName`(vName VARCHAR(255)) BEGIN SET @isTriggerDisabled = TRUE; - + -- No se puede usar temporary porque da error Error Code: 1137. No puedo reabrir tabla: 'i DROP TABLE IF EXISTS tmp.item; CREATE TABLE tmp.item SELECT DISTINCT i.id - FROM vn.item i + FROM vn.item i WHERE i.`name` LIKE CONCAT(vName,'%'); UPDATE itemTag it @@ -61096,8 +61531,8 @@ BEGIN JOIN itemTypeTag itt ON itt.itemTypeFk = item.typeFk AND itt.tagFk = it.tagFk SET it.priority = itt.priority WHERE itt.itemTypeFk = itemTypeFk; - - CALL item_refreshTags(); + + CALL item_refreshTags(); SET @isTriggerDisabled = FALSE; @@ -61108,6 +61543,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemTag_replace` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61115,47 +61552,47 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTag_replace`(vItemFromFk INT, vItemToFk INT, vPicture VARCHAR(100)) BEGIN - + /* Reemplaza los tags de un artículo por los de otro, así como su imagen - * + * * @param vItemFromFk id de vn.item con el artículo del que se toman los tags * @param vItemToFk id de vn.item con el artículo del que se toman los tags * @param vPicture imagen del artículo. Opcional. Si no se especifica, hereada la del vItemFromFk */ - DELETE FROM vn.itemTag + DELETE FROM vn.itemTag WHERE itemFk = vItemToFk; - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) SELECT vItemToFk, tagFk, value, priority - FROM vn.itemTag + FROM vn.itemTag WHERE itemFk = vItemFromFk; - + IF ISNULL(vPicture) THEN - - SELECT image INTO vPicture - FROM vn.item + + SELECT image INTO vPicture + FROM vn.item WHERE id = vItemFromFk; - + END IF; - UPDATE vn.item i + UPDATE vn.item i SET i.image = vPicture WHERE i.id = vItemToFk; - + CALL vn.itemRefreshTags(vItemToFk); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemTopSeller` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61163,8 +61600,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTopSeller`() BEGIN @@ -61174,9 +61609,9 @@ BEGIN SELECT DISTINCT id FROM vn.itemCategory WHERE merchandise <> FALSE; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN RESIGNAL; END; @@ -61187,51 +61622,53 @@ BEGIN INNER JOIN bs.ventas v ON v.Id_Movimiento = s.id WHERE v.fecha BETWEEN TIMESTAMPADD(DAY, - 7, util.VN_CURDATE()) AND util.VN_CURDATE() GROUP BY s.itemFk; - + DROP TABLE IF EXISTS tmp.topSeller; - CREATE TEMPORARY TABLE tmp.topSeller - ( + CREATE TEMPORARY TABLE tmp.topSeller + ( `id` int(11) NOT NULL DEFAULT '0', `typeFk` smallint(5) unsigned NOT NULL, `itemCategoryFk` int(10) unsigned NOT NULL, `total` bigint(21) NOT NULL DEFAULT '0' ) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - + OPEN rs; read_loop: LOOP FETCH rs INTO vCategoryFk; - + IF vDone THEN LEAVE read_loop; END IF; - + INSERT INTO tmp.topSeller SELECT tsm.itemFk, tsm.typeFk, it.categoryFk, tsm.total FROM tmp.topSellerMin tsm INNER JOIN vn.itemType it ON it.id = tsm.typeFk WHERE it.categoryFk = vCategoryFk ORDER BY tsm.itemFk ,tsm.total DESC - LIMIT 5; + LIMIT 5; END LOOP; CLOSE rs; - + SELECT i.name ,i.id, i.image, i.typeFk, it.categoryFk AS itemCategoryFk, ic.name AS itemCategoryName, it.name AS itemTypeName, ts.total FROM tmp.topSeller ts INNER JOIN vn.item i ON i.id = ts.id INNER JOIN vn.itemType it ON it.id = ts.typeFk INNER JOIN vn.itemCategory ic ON ic.id = it.categoryFk; - + DROP TABLE IF EXISTS topSellerMin; DROP TABLE IF EXISTS tmp.topSeller; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemTrash` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61239,8 +61676,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTrash`( vItemFk INT, @@ -61286,7 +61721,7 @@ BEGIN INSERT INTO sale(ticketFk, itemFk, concept, quantity) SELECT vTicketFk, vItemFk, - CONCAT(longName,' ',getWorkerCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), + CONCAT(longName,' ',worker_getCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), vQuantity FROM item WHERE id = vItemFk; @@ -61301,6 +61736,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemUpdateTag` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61308,8 +61745,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemUpdateTag`(IN vItem BIGINT) BEGIN @@ -61335,7 +61770,7 @@ SET tag6 = t.name, value6 = it.value WHERE it.priority = 2 AND (vItem IS NULL OR vItem = it.itemFk); -UPDATE item i +UPDATE item i JOIN itemTag it ON it.itemFk = i.id JOIN tag t ON t.id = it.tagFk SET tag7 = t.name, value7 = it.value @@ -61355,6 +61790,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_cleanFloramondo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61362,13 +61799,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_cleanFloramondo`() BEGIN /** -* Elimina todos los items repetidos de floramondo +* Elimina todos los items repetidos de floramondo * y los sustituye por el que tiene menor id */ DECLARE vItemFrom INT; @@ -61434,7 +61869,7 @@ BEGIN AND i2.EmbalageCode <=> i.EmbalageCode AND i2.quality <=> i.quality JOIN ( - SELECT DISTINCT b.itemFk + SELECT DISTINCT b.itemFk FROM buy b JOIN item i ON i.id = b.itemFk WHERE i.isFloramondo @@ -61442,7 +61877,7 @@ BEGIN )sub2 ON sub2.itemFk = GREATEST(i.id, i2.id) WHERE i.isFloramondo AND i.id <> i2.id; - + DECLARE EXIT HANDLER FOR SQLEXCEPTION SET vDone = TRUE; BEGIN SET vDone = TRUE; @@ -61545,6 +61980,14 @@ BEGIN SET itemFk = vItemNew WHERE itemFk = vItemOld; + # Mantenemos la imagen si el nuevo no tiene + UPDATE vn.item itemNew + LEFT JOIN item itemOld ON itemOld.id = vItemOld + AND itemOld.image IS NOT NULL + SET itemNew.image = itemOld.image + WHERE itemNew.id = vItemNew + AND itemNew.image IS NULL; + # Eliminamos el item sustituido DELETE FROM item WHERE id = vItemOld; @@ -61563,6 +62006,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_deactivateUnused` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61570,8 +62015,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_deactivateUnused`() BEGIN @@ -61607,6 +62050,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_getAtp` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61614,8 +62059,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getAtp`(vDated DATE) BEGIN @@ -61669,6 +62112,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_getBalance` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61676,8 +62121,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getBalance`( vItemFk INT, @@ -61688,14 +62131,13 @@ BEGIN /** * @vItemFk item a buscar * @vWarehouseFk almacen donde buscar - * @vDate Si la fecha es null, muestra el histórico desde el inventario. + * @vDate Si la fecha es null, muestra el histórico desde el inventario. * Si la fecha no es null, muestra histórico desde la fecha pasada. */ DECLARE vDateInventory DATETIME; - DECLARE vInvCalculated INT; IF vDate IS NULL THEN - SELECT inventoried INTO vDateInventory + SELECT inventoried INTO vDateInventory FROM config; ELSE SELECT mockUtcTime INTO vDateInventory @@ -61721,7 +62163,7 @@ BEGIN inventorySupplierFk INT(10) ); - INSERT INTO tItemDiary + INSERT INTO tItemDiary SELECT tr.landed shipped, b.quantity `in`, NULL `out`, @@ -61742,14 +62184,14 @@ BEGIN JOIN entry e ON e.id = b.entryFk JOIN travel tr ON tr.id = e.travelFk JOIN supplier s ON s.id = e.supplierFk - JOIN state st ON st.`code` = IF( tr.landed < util.VN_CURDATE() + JOIN state st ON st.`code` = IF( tr.landed < util.VN_CURDATE() OR (util.VN_CURDATE() AND tr.isReceived), - 'DELIVERED', + 'DELIVERED', 'FREE') JOIN entryConfig ec WHERE tr.landed >= vDateInventory AND vWarehouseFk = tr.warehouseInFk - AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL) + AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL) AND b.itemFk = vItemFk AND e.isExcludedFromAvailable = FALSE AND e.isRaid = FALSE @@ -61775,14 +62217,14 @@ BEGIN JOIN travel tr ON tr.id = e.travelFk JOIN warehouse w ON w.id = tr.warehouseOutFk JOIN supplier s ON s.id = e.supplierFk - JOIN state st ON st.`code` = IF(tr.shipped < util.VN_CURDATE() + JOIN state st ON st.`code` = IF(tr.shipped < util.VN_CURDATE() OR (tr.shipped = util.VN_CURDATE() AND tr.isReceived), - 'DELIVERED', + 'DELIVERED', 'FREE') JOIN entryConfig ec WHERE tr.shipped >= vDateInventory AND vWarehouseFk = tr.warehouseOutFk - AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL) + AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL) AND b.itemFk = vItemFk AND e.isExcludedFromAvailable = FALSE AND w.isFeedStock = FALSE @@ -61811,12 +62253,12 @@ BEGIN JOIN client c ON c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(), - 'DELIVERED', + 'DELIVERED', IF (t.shipped > util.dayEnd(util.VN_CURDATE()), 'FREE', IFNULL(ts.code, 'FREE'))) LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' - LEFT JOIN saleTracking stk ON stk.saleFk = s.id + LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id LEFT JOIN claimBeginning cb ON s.id = cb.saleFk WHERE t.shipped >= vDateInventory @@ -61832,7 +62274,7 @@ BEGIN `out` DESC; IF vDate IS NULL THEN - + SET @a := 0; SET @currentLineFk := 0; SET @shipped := ''; @@ -61847,9 +62289,9 @@ BEGIN `in` invalue, `out`, @a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0) balance, - @currentLineFk := IF (@shipped < util.VN_CURDATE() + @currentLineFk := IF (@shipped < util.VN_CURDATE() OR (@shipped = util.VN_CURDATE() AND (isPicked OR a.`code` >= 'ON_PREPARATION')), - lineFk, + lineFk, @currentLineFk) lastPreparedLineFk, isTicket, lineFk, @@ -61860,7 +62302,7 @@ BEGIN LEFT JOIN alertLevel a ON a.id = tItemDiary.alertLevel; ELSE - SELECT SUM(`in`) - SUM(`out`) INTO vInvCalculated + SELECT SUM(`in`) - SUM(`out`) INTO @a FROM tItemDiary WHERE shipped < vDate; @@ -61871,9 +62313,9 @@ BEGIN '' reference, 0 clientFk, 'Inventario calculado', - vInvCalculated invalue, + @a invalue, NULL `out`, - 0 balance, + @a balance, 0 lastPreparedLineFk, 0 isTicket, 0 lineFk, @@ -61881,25 +62323,25 @@ BEGIN 0 clientType, 0 claimFk UNION ALL - SELECT shipped, - alertlevel, - stateName, - origin, - reference, - clientFk, - name, `in`, - `out`, - 0, - 0, - isTicket, - lineFk, - isPicked, - clientType, + SELECT shipped, + alertlevel, + stateName, + origin, + reference, + clientFk, + name, `in`, + `out`, + @a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0), + 0, + isTicket, + lineFk, + isPicked, + clientType, claimFk FROM tItemDiary WHERE shipped >= vDate; END IF; - + DROP TEMPORARY TABLE tItemDiary; END ;; DELIMITER ; @@ -61907,6 +62349,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_getInfo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61914,8 +62358,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getInfo`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT) BEGIN @@ -61992,6 +62434,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_getLack` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61999,14 +62443,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getLack`(IN vForce BOOLEAN, IN vDays INT) BEGIN /** * Calcula una tabla con el máximo negativo visible para cada producto y almacen - * + * * @param vForce Fuerza el recalculo del stock * @param vDays Numero de dias a considerar **/ @@ -62015,31 +62457,31 @@ BEGIN CALL item_getMinacum(NULL, util.VN_CURDATE(), vDays, NULL); CALL item_getMinETD(); - SELECT i.id itemFk, + SELECT i.id itemFk, i.longName, w.id warehouseFk, - p.`name` producer, + p.`name` producer, i.`size`, i.category, - w.name warehouse, + w.name warehouse, SUM(IFNULL(sub.amount,0)) lack, i.inkFk, - IFNULL(im.timed, util.midnight()) timed - FROM (SELECT item_id, - warehouse_id, + IFNULL(im.timed, util.midnight()) timed + FROM (SELECT item_id, + warehouse_id, amount FROM cache.stock WHERE amount > 0 UNION ALL - SELECT itemFk, - warehouseFk, + SELECT itemFk, + warehouseFk, amount FROM tmp.itemMinacum ) sub JOIN warehouse w ON w.id = sub.warehouse_id JOIN item i ON i.id = sub.item_id - LEFT JOIN producer p ON p.id = i.producerFk - JOIN itemType it ON it.id = i.typeFk + LEFT JOIN producer p ON p.id = i.producerFk + JOIN itemType it ON it.id = i.typeFk JOIN itemCategory ic ON ic.id = it.categoryFk LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id WHERE w.isForTicket @@ -62056,6 +62498,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_getMinacum` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62063,8 +62507,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getMinacum`(IN vWarehouseFk TINYINT, IN vDatedFrom DATETIME, IN vRange INT, IN vItemFk INT) BEGIN @@ -62148,6 +62590,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_getMinETD` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62155,17 +62599,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getMinETD`() BEGIN - + /* Devuelve una tabla temporal con la primera ETD, para todos los artículos con salida hoy. - * + * * @return tmp.itemMinETD(itemFk, timed) */ - + DECLARE vMidnight DATETIME DEFAULT util.midnight(); DROP TEMPORARY TABLE IF EXISTS tmp.itemMinETD; @@ -62176,7 +62618,7 @@ BEGIN SELECT s.itemFk, MIN(TIME(IFNULL(z.`hour`,vMidnight))) timed FROM ticket t JOIN sale s ON s.ticketFk = t.id - LEFT JOIN `zone` z ON z.id = t.zoneFk + LEFT JOIN `zone` z ON z.id = t.zoneFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND vMidnight GROUP BY s.itemFk; END ;; @@ -62185,6 +62627,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_getSimilar` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62192,8 +62636,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getSimilar`(vItemFk INT, vWarehouseFk INT, vDate DATE, vIsShowedByType BOOL) BEGIN @@ -62206,33 +62648,33 @@ BEGIN * @param vWarehouseFk warehouse id * @param vDate fecha para revisar disponible * @param vIsShowedByType para mostrar solo artículos de ese tipo - */ + */ DECLARE vCalcFk INT; DECLARE vTypeFk INT; - + DECLARE vTag1 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vTag5 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vTag6 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vTag7 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vTag8 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - + DECLARE vValue1 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vValue5 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vValue6 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vValue7 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vValue8 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - + SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 FROM vn.item i LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk WHERE i.id = vItemFk; - + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDate); - + SELECT i.id itemFk, i.longName, i.subName, @@ -62265,7 +62707,7 @@ BEGIN ORDER BY counter DESC, (t1.name = vTag1) DESC, (it1.value = vValue1) DESC, - (i.tag6 = vTag6) DESC, + (i.tag6 = vTag6) DESC, (i.value6 = vValue6) DESC, (i.tag5 = vTag5) DESC, (i.value5 = vValue5) DESC, @@ -62274,7 +62716,7 @@ BEGIN (i.tag8 = vTag8) DESC, (i.value8 = vValue8) DESC LIMIT 30; - + END ;; DELIMITER ; @@ -62282,6 +62724,93 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `item_getStock` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getStock`( + vWarehouseFk SMALLINT, + vDated DATE, + vItemFk INT +) +BEGIN +/** + * Calcula el stock de un artículo de un vWarehouseFk, + * desde la fecha del inventario hasta vDated + * + * @param vWarehouse Warehouse id + * @param vDated Max date to filter + * @param vItemFk Item id + * + * @return tmp.itemList(itemFk, stock, visible, available) + */ + DECLARE vIsLogifloraDay BOOL DEFAULT vn.isLogifloraDay(vDated, vWarehouseFk); + + SET vDated = TIMESTAMP(vDated, '00:00:00'); + + CREATE OR REPLACE TEMPORARY TABLE tmp.itemList + (UNIQUE INDEX i USING HASH (itemFk)) + ENGINE = MEMORY + SELECT itemFk, + SUM(quantity) stock, + SUM(quantity) visible, + SUM(quantity) available + FROM ( + SELECT itemFk, quantity + FROM itemTicketOut + WHERE shipped >= util.VN_CURDATE() + AND shipped < vDated + AND warehouseFk = vWarehouseFk + AND (vItemFk IS NULL OR itemFk = vItemFk) + UNION ALL + SELECT iei.itemFk, iei.quantity + FROM itemEntryIn iei + LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = iei.entryFk + JOIN item i ON i.id = iei.itemFk + WHERE iei.landed >= util.VN_CURDATE() + AND iei.landed < vDated + AND iei.warehouseInFk = vWarehouseFk + AND (vItemFk IS NULL OR iei.itemFk = vItemFk) + AND (wf.entryFk IS NULL OR vIsLogifloraDay) + AND NOT (iei.landed > util.VN_CURDATE() AND i.isFloramondo) + UNION ALL + SELECT ieo.itemFk, ieo.quantity + FROM itemEntryOut ieo + JOIN item i ON i.id = ieo.itemFk + WHERE ieo.shipped >= util.VN_CURDATE() + AND ieo.shipped < vDated + AND ieo.warehouseOutFk = vWarehouseFk + AND (vItemFk IS NULL OR ieo.itemFk = vItemFk) + AND NOT (ieo.shipped > util.VN_CURDATE() AND i.isFloramondo) + ) sub + GROUP BY itemFk + HAVING stock; + + CALL cache.stock_refresh(FALSE); + + INSERT INTO tmp.itemList(itemFk, stock, visible, available) + SELECT item_id, amount, amount, amount + FROM cache.stock + WHERE warehouse_id = vWarehouseFk + AND (vItemFk IS NULL OR vItemFk = item_id) + ON DUPLICATE KEY UPDATE + stock = stock + VALUES(stock), + visible = visible + VALUES(visible), + available = available + VALUES(available); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_GetVisible` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62289,8 +62818,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_GetVisible`(vWarehouse SMALLINT, vItem INT) BEGIN @@ -62338,6 +62865,83 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `item_refreshFromTags` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshFromTags`(vSelf INT) +BEGIN +/** + * Updates item attributes with its corresponding tags. + * + * @param vSelf The item id + */ + DECLARE vTags JSON; + DECLARE vValues JSON; + DECLARE vAbbrs JSON; + DECLARE vOverwrites JSON; + + SELECT JSON_OBJECTAGG(`priority`, t.`name`), + JSON_OBJECTAGG(`priority`, it.`value`), + JSON_OBJECTAGG(`priority`, IFNULL(a.abbreviation, it.`value`)), + JSON_OBJECTAGG(`overwrite`, it.`value`) + INTO vTags, vValues, vAbbrs, vOverwrites + FROM itemTag it + JOIN tag t ON t.id = it.tagFk + LEFT JOIN tagAbbreviation a ON a.`value` = it.`value` + AND (a.tagFk IS NULL OR a.tagFk = t.id) + WHERE it.itemFk = vSelf; + + UPDATE item i + LEFT JOIN ink k ON k.name = JSON_VALUE(vOverwrites, '$.inkFk') + LEFT JOIN origin o ON o.name = JSON_VALUE(vOverwrites, '$.originFk') + LEFT JOIN producer p ON p.name = JSON_VALUE(vOverwrites, '$.producerFk') + SET i.`name` = CONCAT_WS(' ', + JSON_VALUE(vAbbrs, '$.1'), + JSON_VALUE(vAbbrs, '$.2'), + IF(i.isFloramondo, NULL, JSON_VALUE(vAbbrs, '$.3')) + ), + i.longName = CONCAT_WS(' ', + JSON_VALUE(vValues, '$.1'), + JSON_VALUE(vValues, '$.2'), + JSON_VALUE(vValues, '$.3') + ), + i.subname = JSON_VALUE(vValues, '$.4'), + i.size = JSON_VALUE(vOverwrites, '$.size'), + i.stems = JSON_VALUE(vOverwrites, '$.stems'), + i.category = JSON_VALUE(vOverwrites, '$.category'), + i.tag5 = JSON_VALUE(vTags, '$.5'), + i.tag6 = JSON_VALUE(vTags, '$.6'), + i.tag7 = JSON_VALUE(vTags, '$.7'), + i.tag8 = JSON_VALUE(vTags, '$.8'), + i.tag9 = JSON_VALUE(vTags, '$.9'), + i.tag10 = JSON_VALUE(vTags, '$.10'), + i.value5 = JSON_VALUE(vValues, '$.5'), + i.value6 = JSON_VALUE(vValues, '$.6'), + i.value7 = JSON_VALUE(vValues, '$.7'), + i.value8 = JSON_VALUE(vValues, '$.8'), + i.value9 = JSON_VALUE(vValues, '$.9'), + i.value10 = JSON_VALUE(vValues, '$.10'), + i.producerFk = p.id, + i.inkFk = k.id, + i.originFk = IFNULL(o.id, i.originFk) + WHERE i.id = vSelf; + + CALL item_setGeneric(vSelf); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_refreshTags` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62345,152 +62949,41 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshTags`() BEGIN /** - * Actualiza la tabla item, los campos "cache" de tags + * Update item table, tag "cache" fields * - * @param temporary table tmp.item(id) del articulo - **/ + * @param temporary table tmp.item(id) of the article + */ + DECLARE vDone BOOL; + DECLARE vItemFk INT; + DECLARE vCur CURSOR FOR SELECT id FROM tmp.item; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DECLARE done INT DEFAULT FALSE; - DECLARE vItemFk INT; - DECLARE cur1 CURSOR FOR SELECT id FROM tmp.item; + OPEN vCur; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + l: LOOP + SET vDone = FALSE; + FETCH vCur INTO vItemFk; - OPEN cur1; + IF vDone THEN + LEAVE l; + END IF; - read_loop: LOOP - - FETCH cur1 INTO vItemFk; - - IF done THEN - LEAVE read_loop; - END IF; - - UPDATE item i - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, IF(it3.`value` = 'A1','',it3.`value`)) - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value` - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` AND ta2.tagFk IS NULL - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value` - SET i.`name` = CONCAT_WS(' ', - IFNULL(ta1.abbreviation,it1.`value`), - IFNULL(ta2.abbreviation,it2.`value`), - IF(i.isFloramondo,'',IFNULL(ta3.abbreviation,it3.`value`))) - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4 - SET i.subName = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag5 = t.name, value5 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag6 = t.name, value6 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7 - LEFT JOIN tag t ON t.id = it.tagFk - SET i.tag7 = t.name, i.value7 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag8 = t.name, value8 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag9 = t.name, value9 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag10 = t.name, value10 = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag color se modifica también el antiguo campo color - UPDATE item i - JOIN tag t ON t.overwrite = 'inkFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN ink ON ink.`name` = it.`value` - SET i.inkFk = ink.id - WHERE i.id = vItemFk; - - -- Al insertar el tag origen se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'originFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN origin o ON o.`name` = it.`value` - SET i.originFk = o.id - WHERE i.id = vItemFk; - - -- Al insertar el tag medida se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'size' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.size = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag productor se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'producerFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN producer p ON p.`name` = it.`value` - SET i.producerFk = p.id - WHERE i.id = vItemFk; - - -- Al insertar el tag tallos se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'stems' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.stems = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag categoria se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'category' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.category = it.`value` - WHERE i.id = vItemFk; - - -- Comprueba si existe un genérico y lo asigna - CALL vn.item_setGeneric(vItemFk); - - END LOOP; - - CLOSE cur1; + CALL item_refreshFromTags(vItemFk); + END LOOP; + CLOSE vCur; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_saveReference` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62498,8 +62991,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_saveReference`(vBarcode VARCHAR(22), vReference VARCHAR(150)) BEGIN @@ -62510,11 +63001,11 @@ BEGIN * @param vBarcode del item * @param vReference referencia a actualizar */ - + DECLARE vItemFk INT; SELECT barcodeToItem(vBarcode) INTO vItemFk; - + UPDATE item SET comment = vReference WHERE id = vItemFk; END ;; @@ -62523,6 +63014,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_setGeneric` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62530,50 +63023,59 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setGeneric`(vSelf INT) BEGIN /** * Asigna el código genérico a un item, salvo que sea un código de item genérico. - * + * * @param vSelf identificador de vn.item */ DECLARE vGenericFk INT; SELECT itemFk INTO vGenericFk FROM ( - SELECT itemFk, (sum(matches) = maxMatches) `match` + SELECT itemFk, SUM(matches) = maxMatches `match` FROM ( - SELECT ga.id gaid, - ga.itemFk, - (it.value <=> ga.origin) - + (it.value <=> ga.color) - + (it.value <=> ga.quality) - + (it.value <=> ga.numFlores) - + (it.value <=> ga.category) - + (it.value <=> ga.productor) matches, - !ISNULL(ga.origin) - +!ISNULL(ga.color) - +!ISNULL(ga.quality) - +!ISNULL(ga.numFlores) - +!ISNULL(ga.category) - +!ISNULL(ga.productor) maxMatches + SELECT ga.id gaid, ga.itemFk, + CASE + WHEN t.code = 'nflowers' THEN + it.value <=> ga.numFlores + WHEN t.code = 'origin' THEN + it.value <=> ga.origin + WHEN t.code = 'quality' THEN + it.value <=> ga.quality + WHEN t.code = 'color' THEN + it.value <=> ga.color + WHEN t.code = 'category' THEN + it.value <=> ga.category + WHEN t.code = 'producer' THEN + it.value <=> ga.productor + ELSE + 0 + END matches, + (NOT ISNULL(ga.origin)) + + (NOT ISNULL(ga.color)) + + (NOT ISNULL(ga.quality)) + + (NOT ISNULL(ga.numFlores)) + + (NOT ISNULL(ga.category)) + + (NOT ISNULL(ga.productor)) maxMatches FROM vn.item i JOIN vn.itemTag it ON it.itemFk = i.id + JOIN vn.tag t ON t.id = it.tagFk JOIN vn.genericAllocation ga ON (i.typeFk = ga.typeFk OR ga.typeFk IS NULL) AND (i.longName = ga.longName OR ga.longName IS NULL) AND (i.`size` = ga.`size` OR ga.`size` IS NULL) AND i.id != ga.itemFk WHERE i.id = vSelf - AND NOT i.isFloramondo) sub + AND NOT i.isFloramondo) sub GROUP BY gaid - HAVING `match`) sub2; + HAVING `match`) sub2 + LIMIT 1; - UPDATE vn.item - SET genericFk = vGenericFk + UPDATE vn.item + SET genericFk = vGenericFk WHERE id = vSelf; END ;; DELIMITER ; @@ -62581,6 +63083,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingShelve` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62588,29 +63092,29 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingShelve`(vSelf INT, vPacking INT) BEGIN - + /** * Actualiza el valor de item.packingShelve - * + * * @param vSelf Identificador de vn.item * @param vPacking Cantidad de unidades de venta que caben en una bandeja */ - - UPDATE vn.item i + + UPDATE vn.item i SET i.packingShelve = vPacking WHERE i.id = vSelf; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingType` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62618,8 +63122,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingType`(vItem INT, vItemPackingTypeFk VARCHAR(1)) BEGIN @@ -62637,6 +63139,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_ValuateInventory` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62644,8 +63148,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_ValuateInventory`(IN vDated DATE, IN vIsDetailed BOOLEAN) BEGIN @@ -62654,9 +63156,9 @@ BEGIN DECLARE vHasNotInventory BOOLEAN DEFAULT FALSE; DECLARE vInventoried2 DATE; DECLARE vDateDayEnd DATETIME; - + SET vDateDayEnd = util.dayEnd(vDated); - + SELECT landed INTO vInventoried FROM travel tr JOIN entry E ON E.travelFk = tr.id @@ -62666,7 +63168,7 @@ BEGIN LIMIT 1; SET vHasNotInventory = IF (vInventoried is null, TRUE, FALSE); - + IF vHasNotInventory THEN SELECT landed INTO vInventoried2 @@ -62687,13 +63189,13 @@ BEGIN CREATE TEMPORARY TABLE inv (warehouseFk SMALLINT, Id_Article BIGINT, - cantidad INT, + cantidad INT, coste DOUBLE DEFAULT 0, total DOUBLE DEFAULT 0, Almacen VARCHAR(20), PRIMARY KEY (Almacen, Id_Article) USING HASH) ENGINE = MEMORY; - + IF vHasNotInventory = TRUE THEN INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) @@ -62770,7 +63272,7 @@ BEGIN AND it.isInventory ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,0,1); - END IF; + END IF; -- Mercancia en transito INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) @@ -62788,7 +63290,7 @@ BEGIN AND t.isInventory AND e.isConfirmed ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity); - + CALL vn.buyUltimate(NULL,vDateDayEnd); UPDATE inv i @@ -62803,20 +63305,20 @@ BEGIN IF vIsDetailed THEN SELECT inv.warehouseFk, - i.id itemFk, - i.longName , - i.size, - inv.Cantidad, + i.id itemFk, + i.longName , + i.size, + inv.Cantidad, tp.name Tipo, - ic.name Reino, - inv.coste, + ic.name Reino, + inv.coste, cast(inv.total as decimal(10,2)) total, almacen FROM inv JOIN warehouse w on w.id = warehouseFk JOIN item i ON i.id = inv.Id_Article JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk + JOIN itemCategory ic ON ic.id = tp.categoryFk WHERE w.valuatedInventory and inv.total > 0 order by inv.total desc; @@ -62842,6 +63344,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ledger_doCompensation` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62849,8 +63353,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_doCompensation`(vDated DATE, vCompensationAccount VARCHAR(10) , vBankFk VARCHAR(10), vConcept VARCHAR(255), vAmount DECIMAL(10,2), vCompanyFk INT, vOriginalAccount VARCHAR(10)) BEGIN @@ -62863,37 +63365,37 @@ BEGIN * @param vConcept descripcion * @param vAmount cantidad que se compensa * @param vCompany empresa - * @param vOriginalAccount cuenta contable desde la cual se compensa - * - */ + * @param vOriginalAccount cuenta contable desde la cual se compensa + * + */ DECLARE vNewBookEntry INT; DECLARE vIsClientCompensation INT; DECLARE vClientFk INT; DECLARE vSupplierFk INT; DECLARE vIsOriginalAClient BOOL; DECLARE vPayMethodCompensation INT; - + CALL ledger_next(vNewBookEntry); SELECT COUNT(id) INTO vIsOriginalAClient FROM client WHERE accountingAccount LIKE vOriginalAccount COLLATE utf8_general_ci; - SELECT id, COUNT(id) INTO vClientFk, vIsClientCompensation - FROM client + SELECT id, COUNT(id) INTO vClientFk, vIsClientCompensation + FROM client WHERE accountingAccount LIKE vCompensationAccount COLLATE utf8_general_ci; - + SET @vAmount1:= 0.0; SET @vAmount2:= 0.0; - INSERT INTO XDiario (ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EUROHABER, empresa_id) - VALUES ( vNewBookEntry, - vDated, - vOriginalAccount, - vCompensationAccount, - vConcept, + INSERT INTO XDiario (ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EUROHABER, empresa_id) + VALUES ( vNewBookEntry, + vDated, + vOriginalAccount, + vCompensationAccount, + vConcept, @vAmount1:= IF( - (vIsOriginalAClient AND vAmount > 0) OR - (NOT vIsOriginalAClient AND vAmount < 0), - 0, + (vIsOriginalAClient AND vAmount > 0) OR + (NOT vIsOriginalAClient AND vAmount < 0), + 0, ABS(vAmount) ), @vAmount2:= IF(@vAmount1, @@ -62902,20 +63404,20 @@ BEGIN ), vCompanyFk ), - ( vNewBookEntry, - vDated, - vCompensationAccount, - vOriginalAccount, - vConcept, + ( vNewBookEntry, + vDated, + vCompensationAccount, + vOriginalAccount, + vConcept, @vAmount2, @vAmount1, vCompanyFk); - + IF vIsClientCompensation THEN IF vIsOriginalAClient THEN SET vAmount = -vAmount; END IF; - INSERT INTO receipt(invoiceFk, amountPaid, payed, bankFk, companyFk, clientFk, isConciliate) + INSERT INTO receipt(invoiceFk, amountPaid, payed, bankFk, companyFk, clientFk, isConciliate) VALUES (vConcept, vAmount, vDated, vBankFk, vCompanyFk, vClientFk, TRUE); ELSE IF NOT vIsOriginalAClient THEN @@ -62923,7 +63425,7 @@ BEGIN END IF; SELECT id INTO vSupplierFk FROM supplier WHERE `account` LIKE vCompensationAccount COLLATE utf8_general_ci; SELECT id INTO vPayMethodCompensation FROM payMethod WHERE `code` = 'compensation'; - + INSERT INTO payment (received, dueDated, supplierFk, amount, bankFk, payMethodFk, concept, companyFk, isConciliated) VALUES(vDated, vDated, vSupplierFk, vAmount, vBankFk, vPayMethodCompensation, vConcept, vCompanyFk, TRUE); END IF; @@ -62933,6 +63435,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ledger_next` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62940,21 +63444,21 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_next`(OUT vNewBookEntry INT) BEGIN - + UPDATE vn.ledgerConfig SET lastBookEntry = LAST_INSERT_ID(lastBookEntry + 1); SET vNewBookEntry = LAST_INSERT_ID(); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `logShow` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62962,8 +63466,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `logShow`(vOriginFk INT, vEntity VARCHAR(45)) BEGIN @@ -62974,15 +63476,15 @@ BEGIN * @param vEntity Nombre que hace referencia a la tabla. */ DECLARE vTableName VARCHAR(45); - + SET vTableName = CONCAT(vEntity, 'Log'); - + SET @qryLog := CONCAT( 'SELECT ot.id, ot.originFk, ot.userFk, u.name, ot.action, ot.creationDate, ot.description FROM ', vTableName, ' AS ot', ' INNER JOIN account.user u ON u.id = ot.userFk', ' WHERE ot.originFk = ', vOriginFk, ' ORDER BY ot.creationDate DESC' ); - + PREPARE stmt FROM @qryLog; EXECUTE stmt; END ;; @@ -62991,6 +63493,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `lungSize_generator` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62998,8 +63502,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `lungSize_generator`(vDate DATE) BEGIN @@ -63007,9 +63509,9 @@ BEGIN SET @buildingOrder := 0; SET @route := 0; set @cajas := 0; - + UPDATE tmp.sorter - SET buildingOrder = @buildingOrder := IF(@route = @route := routeFk, @buildingOrder, 0) + 1 + SET buildingOrder = @buildingOrder := IF(@route = @route := routeFk, @buildingOrder, 0) + 1 where date(created) = vDate order by routeFk, created, weight DESC; @@ -63027,23 +63529,23 @@ set @cajas := 0; UPDATE tmp.sorter SET lungGrow = IF(palletOrder = 0, -13, lungGrow); - + DELETE FROM tmp.lungSize WHERE dia = vDate; - + INSERT INTO tmp.lungSize(dia, hora,size) select vDate,hora, @cajas := @cajas + cajas as size from ( select IF(lungGrow BETWEEN -12 AND -1, ETD,time_format(created,"%H:%i")) as hora, sum(if(lungGrow <= 0, lungGrow, 1)) as cajas, @cajas := 0 - from tmp.sorter + from tmp.sorter where date(created) = vDate group by hora ) sub; - + SELECT * FROM tmp.lungSize WHERE dia = vDate; - - + + END ;; @@ -63052,6 +63554,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `machineWorker_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63059,34 +63563,34 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_add`(vPlate VARCHAR(10), vWorkerFk INT) BEGIN - + /** * Inserta registro si el vWorkerFk no ha registrado nada en las últimas 12 horas * @param vPlate número de matrícula - * @param vWorkerFk id del worker - * -*/ - UPDATE vn.machineWorker mw - JOIN vn.machine m ON m.id = mw.machineFk + * @param vWorkerFk id del worker + * +*/ + UPDATE vn.machineWorker mw + JOIN vn.machine m ON m.id = mw.machineFk SET mw.outTimed = util.VN_NOW() WHERE (mw.workerFk = vWorkerFk OR m.plate = vPlate) AND ISNULL(mw.outTimed); - + INSERT INTO machineWorker (machineFk, workerFk) SELECT m.id, vWorkerFk FROM machine m - WHERE m.plate= vPlate; + WHERE m.plate= vPlate; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `machineWorker_getHistorical` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63094,33 +63598,33 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_getHistorical`(vPlate VARCHAR(20), vWorkerFk INT) BEGIN /** - * Obtiene historial de la matrícula vPlate que el trabajador vWorkerFk escanea, + * Obtiene historial de la matrícula vPlate que el trabajador vWorkerFk escanea, * si es jefe de producción muestra el historial completo. - * + * * @param vPlate número de matrícula - * @param vWorkerFk id del trabajador - * + * @param vWorkerFk id del trabajador + * */ DECLARE vWorkerName VARCHAR(255) DEFAULT account.user_getNameFromId(vWorkerFk); - SELECT mw.inTimed,account.user_getNameFromId(mw.workerFk) as workerName, mw.outTimed + SELECT mw.inTimed,account.user_getNameFromId(mw.workerFk) as workerName, mw.outTimed FROM machineWorker mw JOIN machine m ON m.plate = vPlate WHERE mw.machineFk = m.id AND mw.workerFk = IF(account.user_hasRole(vWorkerName, 'coolerAssist'), mw.workerFk, vWorkerFk) - ORDER BY mw.inTimed DESC; + ORDER BY mw.inTimed DESC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `machineWorker_update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63128,18 +63632,16 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_update`(vPlate VARCHAR(10), vWorkerFk INT) BEGIN - + /** - * Actualiza el registro correspondiente si el vWorkerFk se ha registrado en las últimas horas (campo maxHours de machineWorkerConfig) con vPlate, - * + * Actualiza el registro correspondiente si el vWorkerFk se ha registrado en las últimas horas (campo maxHours de machineWorkerConfig) con vPlate, + * * @param vPlate número de matrícula - * @param vWorkerFk id del trabajador - * + * @param vWorkerFk id del trabajador + * */ DECLARE vMachineFk INT(10); @@ -63148,30 +63650,32 @@ BEGIN SELECT m.id INTO vMachineFk FROM machine m WHERE m.plate = vPlate; - + SELECT maxHours INTO vMaxHours FROM machineWorkerConfig; - IF (SELECT COUNT(*) + IF (SELECT COUNT(*) FROM machineWorker m WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed)) THEN - + AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed)) THEN + UPDATE machineWorker m SET m.outTimed = CURRENT_TIMESTAMP() - WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) + WHERE m.workerFk = vWorkerFk + AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed) AND m.machineFk = vMachineFk; - + END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `machine_getWorkerPlate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63179,8 +63683,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `machine_getWorkerPlate`(vWorkerFk INT) BEGIN @@ -63201,6 +63703,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `mail_insert` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63208,8 +63712,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `mail_insert`( vReceiver VARCHAR(255), @@ -63220,12 +63722,12 @@ BEGIN /** * Inserta en la tabla vn.mail * - * @param vReceiver Receptor del correo + * @param vReceiver Receptor del correo * @param vReplyTo A quién contestar el correo * @param vSubject Título del correo * @param vBody Cuerpo del correo */ - + DECLARE vIsRepeated BOOLEAN; SELECT COUNT(*) INTO vIsRepeated @@ -63252,6 +63754,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `makeNewItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63259,19 +63763,17 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `makeNewItem`() BEGIN DECLARE newItemFk INT; - + SELECT getNewItemId() INTO newItemFk; - + INSERT INTO item(id,name,typeFk,originFk) SELECT newItemFk, 'Nuevo artículo', 78,39; - + SELECT newItemFk; @@ -63281,6 +63783,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `makePCSGraf` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63288,8 +63792,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `makePCSGraf`(vDated DATE) BEGIN @@ -63299,40 +63801,42 @@ BEGIN DECLARE vMinute INT DEFAULT 0; DECLARE vBoxes INT; - + DROP TEMPORARY TABLE IF EXISTS vn.pcsDay; CREATE TEMPORARY TABLE vn.pcsDay SELECT 0 as hh, 0 as mm, 0 as boxes; - + -- Creamos una tabla soporte para acumular las cajas a lo largo del dia WHILE vHour < 24 DO - + WHILE vMinute < 59 DO - + SET vMinute = vMinute + 1; - + INSERT INTO vn.pcsDay(hh,mm) VALUES(vHour, vMinute); - + END WHILE; - + SET vMinute = -1; SET vHour = vHour + 1; - + END WHILE; - + -- Acumulamos UPDATE vn.pcsDay pd LEFT JOIN (SELECT * FROM vn.pcs_graf WHERE dia = vDated) pg USING(hh,mm) SET pd.boxes = pd.boxes + pg.box; - + SELECT * FROM vn.pcsDay; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `manaSpellersRequery` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63340,8 +63844,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `manaSpellersRequery`(vWorkerFk INTEGER) BEGIN @@ -63349,7 +63851,7 @@ BEGIN * Recalcula el mana consumido por un trabajador * * @param vWorkerFk Id Trabajador - */ + */ DECLARE vWorkerIsExcluded BOOLEAN; DECLARE vFromDated DATE; DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,util.VN_CURDATE()); @@ -63358,32 +63860,32 @@ BEGIN DECLARE vClaimMana INT; DECLARE vManaBank INT; DECLARE vManaGreugeType INT; - + SELECT COUNT(*) INTO vWorkerIsExcluded FROM workerManaExcluded WHERE workerFk = vWorkerFk; - + IF NOT vWorkerIsExcluded THEN - SELECT id INTO vMana + SELECT id INTO vMana FROM `component` WHERE code = 'mana'; - - SELECT id INTO vAutoMana + + SELECT id INTO vAutoMana FROM `component` WHERE code = 'autoMana'; - - SELECT id INTO vClaimMana + + SELECT id INTO vClaimMana FROM `component` WHERE code = 'manaClaim'; - - SELECT id INTO vManaBank + + SELECT id INTO vManaBank FROM `bank` WHERE code = 'mana'; - - SELECT id INTO vManaGreugeType + + SELECT id INTO vManaGreugeType FROM `greugeType` WHERE code = 'mana'; - SELECT max(dated) INTO vFromDated + SELECT max(dated) INTO vFromDated FROM clientManaCache; - + REPLACE workerMana (workerFk, amount) - SELECT vWorkerFk, sum(mana) FROM + SELECT vWorkerFk, sum(mana) FROM ( SELECT s.quantity * sc.value as mana FROM ticket t @@ -63404,8 +63906,8 @@ BEGIN FROM greuge g JOIN client c ON c.id = g.clientFk WHERE c.salesPersonFk = vWorkerFk AND g.greugeTypeFk = vManaGreugeType - AND g.shipped > vFromDated and g.shipped < util.VN_CURDATE() - UNION ALL + AND g.shipped > vFromDated and g.shipped < util.VN_CURDATE() + UNION ALL SELECT cc.mana FROM clientManaCache cc JOIN client c ON c.id = cc.clientFk @@ -63418,6 +63920,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `mysqlConnectionsSorter_kill` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63425,27 +63929,25 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlConnectionsSorter_kill`() BEGIN /** - * Elimina conexiones del usuario sorter con tiempo >= 30seg. Asociado al evento con el mismo nombre - */ - + * Elimina conexiones del usuario sorter con tiempo >= 30seg. Asociado al evento con el mismo nombre + */ + DECLARE vDone INT DEFAULT 0; DECLARE vProcesId INT; DECLARE vCursor CURSOR FOR - SELECT p.id + SELECT p.id FROM information_schema.processlist p - WHERE USER = 'sorter' + WHERE USER = 'sorter' AND TIME >= 30; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + OPEN vCursor; l: LOOP @@ -63468,6 +63970,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `mysqlPreparedCount_check` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63475,14 +63979,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlPreparedCount_check`() BEGIN DECLARE vPreparedCount INTEGER; - SELECT VARIABLE_VALUE INTO vPreparedCount + SELECT VARIABLE_VALUE INTO vPreparedCount FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE '%prepared_stmt_count%'; @@ -63490,7 +63992,7 @@ BEGIN CALL `vn`.`mail_insert`('cau@verdnatura.es', NULL, 'Problemas BBDD prepared_stmt_count', - CONCAT('Existen problemas con el servicio de Logiflora, prepared_stmt_count con valor: ', + CONCAT('Existen problemas con el servicio de Logiflora, prepared_stmt_count con valor: ', vPreparedCount, ', está próximo a exceder su límite. \r\n Hay que reiniciar el servicio LF.VMP.Service del servidor a3.') ); @@ -63502,6 +64004,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `nextShelvingCodeMake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63509,45 +64013,43 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `nextShelvingCodeMake`() BEGIN DECLARE newShelving VARCHAR(3); DECLARE vCode VARCHAR(3); - + SELECT MAX(code) INTO vCode FROM vn.shelving WHERE isPrinted = FALSE; - + SET @a1 := ASCII(MID(vCode,1,1)); SET @a2 := ASCII(MID(vCode,2,1)); SET @a3 := ASCII(MID(vCode,3,1)) + 1; - + IF @a3 > 90 THEN - + SET @a3 = 65; SET @a2 = @a2 + 1; - + IF @a2 > 90 THEN - + SET @a2 = 65; SET @a1 = @a1 + 1; - + IF @a1 > 90 THEN - + SET @a1 = 65; - + END IF; - + END IF; - + END IF; SET newShelving = CHAR(@a1,@a2,@a3 USING utf8); - + INSERT INTO vn.shelving(code) VALUES(newShelving); END ;; @@ -63556,6 +64058,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `observationAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63563,8 +64067,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `observationAdd`(vOriginFk INT, vTableCode VARCHAR(45), vDescription TEXT) BEGIN @@ -63576,18 +64078,18 @@ BEGIN * @param descripcion Texto de la observacion */ DECLARE vTableName VARCHAR(45); - + SET vTableName = CONCAT(vTableCode,'Observation'); - + IF ISNULL(vTableName) THEN CALL util.throw('CODE_NOT_FOUND'); END IF; - + SET @qryLog := CONCAT( 'INSERT INTO ', vTableName, ' (originFk, userFk, description)', ' VALUES (', vOriginFk, ', ', account.myUser_getId(), ', "', vDescription, '")' ); - + PREPARE stmt FROM @qryLog; EXECUTE stmt; DEALLOCATE PREPARE stmt; @@ -63597,6 +64099,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `orderCreate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63604,8 +64108,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `orderCreate`( vLanded DATE, @@ -63617,15 +64119,15 @@ BEGIN DECLARE vDeliveryMethod INT; DECLARE vClient INT; - + SELECT deliveryMethodFk INTO vDeliveryMethod - FROM vn.agencyMode + FROM vn.agencyMode WHERE id = vAgencyMode; - + SELECT clientFk INTO vClient FROM vn.address WHERE id = vAddress; - + INSERT INTO hedera.order(date_send,customer_id,delivery_method_id,agency_id,address_id,source_app) VALUES( vLanded,vClient ,vDeliveryMethod,vAgencyMode ,vAddress ,vSourceApp); @@ -63637,6 +64139,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `orderDelete` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63644,20 +64148,20 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `orderDelete`(IN vId INT) BEGIN DELETE FROM hedera.`order` where id = vId; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `orderListCreate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63665,8 +64169,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `orderListCreate`( vLanded DATE, @@ -63678,13 +64180,15 @@ BEGIN DECLARE vOrderId INT; CALL vn.orderCreate(vLanded,vAgencyMode,vAddress,vSourceApp,vOrderId); SELECT vOrderId; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `orderListVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63692,13 +64196,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `orderListVolume`(IN vOrderId INT) BEGIN - SELECT + SELECT o.id, o.itemFk, i.description, @@ -63714,6 +64216,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `packageInvoicing` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63721,10 +64225,8 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `packageInvoicing`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `packageInvoicing`( IN vClient INT, IN vDate DATE, IN vCompany INT, @@ -63743,20 +64245,20 @@ BEGIN SET vGraceDays = IF(vIsAllInvoiceable ,0, 30); SET vGraceDate = TIMESTAMPADD(DAY, - vGraceDays, vDate); - - /* Clientes especiales: + + /* Clientes especiales: 3240 MADEFLOR 992 JAVIER FELIU 4 TONI VENDRELL */ - + IF vClient IN (992, 3240, 4) THEN - + SET vGraceDays = 365; - + END IF; /* Fin clientes especiales */ - + SET vDateEnd = DATE_ADD(vDate, INTERVAL 1 DAY); DROP TEMPORARY TABLE IF EXISTS tmp.packageToInvoice; @@ -63780,22 +64282,22 @@ BEGIN FROM tmp.packageToInvoice GROUP BY itemFk HAVING totalQuantity > 0; - + SELECT COUNT(*) INTO vIsInvoiceable FROM tmp.packageToInvoicePositives; IF vIsInvoiceable THEN - CALL ticket_add(vClient, + CALL ticket_add(vClient, vDateEnd, - vWarehouse, - vCompany, - NULL, - NULL, - NULL, - vDateEnd, - account.myUser_getId(), + vWarehouse, + vCompany, + NULL, + NULL, + NULL, + vDateEnd, + account.myUser_getId(), TRUE, vNewTicket); @@ -63804,50 +64306,52 @@ BEGIN packagingFk, quantity, pvp) - SELECT vNewTicket, - pti.packagingFk, - - SUM(pti.quantity) AS totalQuantity, + SELECT vNewTicket, + pti.packagingFk, + - SUM(pti.quantity) AS totalQuantity, pti.price FROM tmp.packageToInvoice pti - LEFT JOIN tmp.packageToInvoicePositives ptip ON pti.itemFk = ptip.itemFk - WHERE ptip.itemFK IS NOT NULL + LEFT JOIN tmp.packageToInvoicePositives ptip ON pti.itemFk = ptip.itemFk + WHERE ptip.itemFK IS NOT NULL OR vIsAllInvoiceable GROUP BY packagingFk HAVING totalQuantity; INSERT INTO sale( ticketFk, - itemFk, - concept, - quantity, + itemFk, + concept, + quantity, price ) - SELECT vNewTicket, - pti.itemFk, - i.name as concept, - sum(pti.quantity) as totalQuantity, + SELECT vNewTicket, + pti.itemFk, + i.name as concept, + sum(pti.quantity) as totalQuantity, pti.price FROM tmp.packageToInvoice pti JOIN item i ON i.id = pti.itemFk LEFT JOIN tmp.packageToInvoicePositives ptip ON pti.itemFk = ptip.itemFk - WHERE ptip.itemFK IS NOT NULL + WHERE ptip.itemFK IS NOT NULL OR vIsAllInvoiceable GROUP BY pti.itemFk HAVING totalQuantity; - + INSERT INTO saleComponent(saleFk, componentFk, value) SELECT id, vComponentCost, price FROM sale WHERE ticketFk = vNewTicket; - + END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `packingListPrinted` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63855,8 +64359,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `packingListPrinted`(ticketFk INT) BEGIN @@ -63867,13 +64369,15 @@ BEGIN WHERE mm.valor = 1 -- Listo para imprimir AND mm.stateFk = 9 -- Encajando AND m.Id_Ticket = ticketFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `packingListSwitch` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63881,23 +64385,21 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `packingListSwitch`(saleFk INT) BEGIN DECLARE valueFk INT; DECLARE encajando INT DEFAULT 9; - - SELECT valor INTO valueFk - FROM vn2008.Movimientos_mark - WHERE Id_Movimiento = saleFk + + SELECT valor INTO valueFk + FROM vn2008.Movimientos_mark + WHERE Id_Movimiento = saleFk AND stateFk = encajando; - + SET valueFk = (IFNULL(valueFk,0) + 1) MOD 3; - - REPLACE vn2008.Movimientos_mark(Id_Movimiento, valor, Id_Trabajador, stateFk) + + REPLACE vn2008.Movimientos_mark(Id_Movimiento, valor, Id_Trabajador, stateFk) VALUES(saleFk,valueFk,account.myUser_getId(),encajando); @@ -63907,52 +64409,72 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `packingSite_startCollection` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `packingSite_startCollection`(vSelf INT, vTicketFk INT) -BEGIN +proc: BEGIN /** * @param vSelf packingSite id * @param vTicketFk A ticket id from the collection to start */ - DECLARE vNewCollectionFk INT; - DECLARE vOldCollectionFk INT; - DECLARE vIsPackingByOther BOOL; + DECLARE vExists BOOL; + DECLARE vIsAdvanced BOOL; + DECLARE vNewCollectionFk INT; + DECLARE vOldCollectionFk INT; + DECLARE vIsPackingByOther BOOL; - SELECT collectionFk INTO vNewCollectionFk - FROM ticketCollection WHERE ticketFk = vTicketFk; + SELECT id, collectionFk + INTO vExists, vOldCollectionFk + FROM packingSite + WHERE id = vSelf; - SELECT collectionFk INTO vOldCollectionFk - FROM packingSite WHERE id = vSelf; + IF NOT vExists THEN + CALL util.throw('packingSiteNotExists'); + END IF; - IF NOT (vOldCollectionFk <=> vNewCollectionFk) THEN - SELECT COUNT(*) > 0 - INTO vIsPackingByOther - FROM packingSite - WHERE id <> vSelf - AND collectionFk = vOldCollectionFk; + SELECT COUNT(*) > 0 + INTO vIsAdvanced + FROM packingSiteAdvanced + WHERE ticketFk = vTicketFk; - IF NOT vIsPackingByOther AND NOT collection_isPacked(vOldCollectionFk) AND vSelf IS NOT NULL THEN - CALL util.throw('cannotChangeCollection'); - END IF; - END IF; + IF vIsAdvanced THEN + LEAVE proc; + END IF; - UPDATE packingSite SET collectionFk = vNewCollectionFk - WHERE id = vSelf; + SELECT collectionFk INTO vNewCollectionFk + FROM ticketCollection WHERE ticketFk = vTicketFk; + + IF vOldCollectionFk IS NOT NULL + AND vOldCollectionFk <> vNewCollectionFk THEN + SELECT COUNT(*) > 0 + INTO vIsPackingByOther + FROM packingSite + WHERE id <> vSelf + AND collectionFk = vOldCollectionFk; + + IF NOT vIsPackingByOther AND NOT collection_isPacked(vOldCollectionFk) THEN + CALL util.throw('cannotChangeCollection'); + END IF; + END IF; + + UPDATE packingSite SET collectionFk = vNewCollectionFk + WHERE id = vSelf; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `parking_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63960,8 +64482,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN) BEGIN @@ -63971,34 +64491,34 @@ BEGIN DECLARE vLetters VARCHAR(26) DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; DECLARE vMaxId INT; DECLARE vCode VARCHAR(8); - + SET vColumn = vFromColumn; SET vRow = vFromRow; SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); - + SELECT MAX(id) INTO vMaxId FROM vn.parking; WHILE vColumn <= vToColumn DO - + WHILE vRow <= vToRow DO - + INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`, pickingOrder) VALUES (vColumn, vRow, vSectorFk, vCode, vColumn * 100 + vRow ) ON DUPLICATE KEY UPDATE `code` = vCode; - + SET vRow = vRow + 1; SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); - + END WHILE; - + SET vRow = vFromRow; SET vColumn = vColumn + 1; - + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); - + END WHILE; - + SELECT * FROM vn.parking WHERE `column` BETWEEN vFromColumn AND vToColumn; END ;; @@ -64007,6 +64527,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `parking_algemesi` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64014,8 +64536,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_algemesi`(vFromRow INT, vToRow INT, vSectorFk INT, vLetter VARCHAR(1), vPickingOrder INT, vTrolleysByLine INT) BEGIN @@ -64023,65 +64543,67 @@ BEGIN DECLARE vRow INT; DECLARE vCode VARCHAR(8); DECLARE i INT; - + IF vToRow < vFromRow THEN - + SET vRow = vFromRow; - + WHILE vRow >= vToRow DO - + SET i = 1; - + WHILE i <= vTrolleysByLine DO - + SET vCode = CONCAT(vLetter,'-', LPAD(vRow,2,'0'),'-', i); - + INSERT IGNORE INTO vn.parking( sectorFk, `code`, pickingOrder) VALUES (vSectorFk, vCode, vPickingOrder + (i * 10)) ON DUPLICATE KEY UPDATE `code` = vCode; - + SET i = i + 1; - + END WHILE; - + SET vRow = vRow - 1; - + END WHILE; ELSE - + SET vRow = vFromRow; - + WHILE vRow <= vToRow DO - + SET i = 1; - + WHILE i <= vTrolleysByLine DO - + SET vCode = CONCAT(vLetter,'-', LPAD(vRow,2,'0'),'-', i); - + INSERT IGNORE INTO vn.parking( sectorFk, `code`, pickingOrder) VALUES (vSectorFk, vCode, vPickingOrder + (i * 10) ) ON DUPLICATE KEY UPDATE `code` = vCode; - + SET i = i + 1; - + END WHILE; - + SET vRow = vRow + 1; - + END WHILE; - - + + END IF; - - + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `parking_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64089,8 +64611,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_new`(vStart INT, vEnd INT, vSectorFk INT) BEGIN @@ -64099,34 +64619,36 @@ BEGIN DECLARE vColumn INT; DECLARE vLetters VARCHAR(200); DECLARE vLettersLength INT; - + SET vColumn = vStart; SET vRow = 1; SET vLetters = 'ABCDEF'; SET vLettersLength = LENGTH(vLetters); - + WHILE vColumn <= vEnd DO - + REPLACE vn.parking(`column`, `row`, `code`, sectorFk) VALUES(vColumn, vRow, CONCAT(vColumn,MID(vLetters,vRow,1)), vSectorFk); - + SET vRow = vRow + 1; - + IF vRow > vLettersLength THEN - + SET vRow = 1; SET vColumn = vColumn + 1; - + END IF; - + END WHILE; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `parking_setOrder` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64134,16 +64656,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_setOrder`(vWarehouseFk INT) BEGIN - + /* * Ordena el orden de preparacion de los parking de acuerdo con la tabla vn.corridor */ - + UPDATE vn.parking p JOIN ( SELECT code, @@ -64152,21 +64672,23 @@ BEGIN SELECT c.prepOrder, p.code, @orden := 0, - IF(c.isAscendent, 1,-1) * CAST(SUBSTRING(p.code,3,2) AS DECIMAL(2,0)) subCorridor , - CAST(IF(LENGTH(p.code) > 5, SUBSTRING(p.code,6,2), 0) AS DECIMAL(2,0)) ubication + IF(c.isAscendent, 1,-1) * CAST(SUBSTRING(p.code,3,2) AS DECIMAL(2,0)) subCorridor , + CAST(IF(LENGTH(p.code) > 5, SUBSTRING(p.code,6,2), 0) AS DECIMAL(2,0)) ubication FROM vn.parking p - JOIN vn.sector s ON s.id = p.sectorFk + JOIN vn.sector s ON s.id = p.sectorFk JOIN vn.corridor c ON c.code = LEFT(p.code,1) COLLATE utf8_general_ci - WHERE s.warehouseFk = vWarehouseFk) sub - ORDER BY sub.prepOrder, subCorridor, ubication) sub2 ON sub2.code = p.code + WHERE s.warehouseFk = vWarehouseFk) sub + ORDER BY sub.prepOrder, subCorridor, ubication) sub2 ON sub2.code = p.code SET p.pickingOrder = sub2.po; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `prepareClientList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64174,28 +64696,28 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareClientList`() BEGIN - + /* * Require la tabla tmp.ticket(id,clientFk) */ - + DROP TEMPORARY TABLE IF EXISTS tmp.client; CREATE TEMPORARY TABLE tmp.client (PRIMARY KEY (id)) ENGINE = MEMORY SELECT DISTINCT clientFk id - FROM tmp.ticket; + FROM tmp.ticket; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `prepareTicketList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64203,8 +64725,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME) BEGIN @@ -64231,6 +64751,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `previousSticker_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64238,8 +64760,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `previousSticker_get`(vSaleGroupFk INT) BEGIN @@ -64302,6 +64822,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `printer_checkSector` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64309,22 +64831,20 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `printer_checkSector`(vLabelerFk tinyint(3) unsigned, vSector INT(11)) BEGIN /** * Comprueba si la impresora pertenece al sector * - * @param vLabelerFk id de la impresora + * @param vLabelerFk id de la impresora * @param vSector sector a comprobar */ DECLARE isPrinterInNewSector BOOL; IF vLabelerFk IS NOT NULL THEN SELECT COUNT(sectorFK) INTO isPrinterInNewSector - FROM vn.printer p + FROM vn.printer p WHERE id = vLabelerFk AND sectorFk = vSector; IF !isPrinterInNewSector THEN @@ -64337,6 +64857,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `productionControl` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64344,11 +64866,9 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `productionControl`( - vWarehouseFk INT, + vWarehouseFk INT, vScopeDays INT ) proc: BEGIN @@ -64369,7 +64889,7 @@ proc: BEGIN SELECT isTodayRelative INTO vIsTodayRelative FROM worker - WHERE userFk = getUser(); + WHERE id = getUser(); CALL prepareTicketList( util.VN_CURDATE() - INTERVAL 1 DAY, vEndingDate); @@ -64449,7 +64969,7 @@ proc: BEGIN LEFT JOIN parking pk ON pk.id = tp.parkingFk WHERE t.warehouseFk = vWarehouseFk AND dm.code IN ('AGENCY', 'DELIVERY', 'PICKUP'); - + UPDATE tmp.productionBuffer pb JOIN ( SELECT pb.ticketFk, GROUP_CONCAT(p.code) previaParking @@ -64457,12 +64977,12 @@ proc: BEGIN JOIN sale s ON s.ticketFk = pb.ticketFk JOIN saleGroupDetail sgd ON sgd.saleFk = s.id JOIN saleGroup sg ON sg.id = sgd.saleGroupFk - JOIN parking p ON p.id = sg.parkingFk + JOIN parking p ON p.id = sg.parkingFk GROUP BY pb.ticketFk ) t ON t.ticketFk = pb.ticketFk SET pb.previaParking = t.previaParking; - -- Problemas por ticket + -- Problemas por ticket ALTER TABLE tmp.productionBuffer CHANGE COLUMN `problem` `problem` VARCHAR(255), ADD COLUMN `collectionH` INT, @@ -64559,6 +65079,7 @@ proc: BEGIN AND (sc.itemPackingTypeFk IS NULL OR (i.itemPackingTypeFk IS NULL AND NOT pb.V) OR sc.itemPackingTypeFk = i.itemPackingTypeFk) + AND s.quantity > 0 GROUP BY pb.ticketFk; -- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado @@ -64569,6 +65090,7 @@ proc: BEGIN JOIN saleGroupDetail sgd ON sgd.saleFk = s.id JOIN saleGroup sg ON sg.id = sgd.saleGroupFk WHERE sg.parkingFk IS NOT NULL + AND s.quantity > 0 GROUP BY pb.ticketFk) sub ON twp.ticketFk = sub.ticketFk SET twp.salesInParkingCount = sub.salesInParkingCount; @@ -64589,6 +65111,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `productionSectorList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64596,8 +65120,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `productionSectorList`(vSectorFk INT) BEGIN @@ -64710,6 +65232,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `rangeDateInfo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64717,8 +65241,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `rangeDateInfo`(vStarted DATE, vEnded DATE) BEGIN @@ -64741,7 +65263,7 @@ BEGIN `yearMonth` INT ) ENGINE = MEMORY; - + WHILE vDated <= vEnded DO INSERT INTO tmp.rangeDate SET `dated` = vDated, @@ -64751,7 +65273,7 @@ BEGIN `day` = DAY(vDated), `week` = WEEK(vDated, 1), `yearMonth` = YEAR(vDated) * 100 + MONTH(vDated); - + SET vDated = DATE_ADD(vDated, INTERVAL 1 DAY); END WHILE; END ;; @@ -64760,6 +65282,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `rate_getPrices` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64767,82 +65291,57 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices`(vDated DATE, vWarehouseFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices`( + vDated DATE, + vWarehouseFk INT +) BEGIN /** - * Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén + * Prepara una tabla con las tarifas aplicables + * en funcion de la fecha y el almacén. * - * @param vDated fecha para la cual calcula la tarifa - * @param vWarehouseFk warehouse para el cual calcula la tafia - * @return tmp.rate(rate0, rate1, rate2, rate3) + * @param vDated Fecha para la cual calcula la tarifa + * @param vWarehouseFk Warehouse para el cual calcula la tarifa + * @return tmp.rate (rate0, rate1, rate2, rate3) */ - DROP TEMPORARY TABLE IF EXISTS tRate; - CREATE TEMPORARY TABLE tRate - SELECT rate0, rate1, rate2, rate3 - FROM vn.rate - WHERE dated <= vDated - AND warehouseFk = vWarehouseFk - ORDER BY dated DESC; - - DROP TEMPORARY TABLE IF EXISTS tmp.rate; - CREATE TEMPORARY TABLE tmp.rate + CREATE OR REPLACE TEMPORARY TABLE tmp.rate ENGINE = MEMORY - SELECT * FROM - ( - SELECT * FROM tRate - UNION ALL - SELECT rate0, rate1, rate2, rate3 FROM rateConfig - ) sub2 - LIMIT 1; - DROP TEMPORARY TABLE tRate; + SELECT rate0, + rate1, + rate2, + rate3 + FROM( + (SELECT 1 `order`, + rate0, + rate1, + rate2, + rate3 + FROM rate + WHERE dated <= vDated + AND warehouseFk = vWarehouseFk + ORDER BY dated DESC + LIMIT 1 + ) + UNION + (SELECT 2, + rate0, + rate1, + rate2, + rate3 + FROM rateConfig + ) + ORDER BY `order` ASC + LIMIT 1 + )sub; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `rate_getPrices2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices2`(vLanded DATE, vWarehouseFk INT) -BEGIN - - -- Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén - DROP TEMPORARY TABLE IF EXISTS tRate; - CREATE TEMPORARY TABLE tRate - SELECT rate0, rate1, rate2, rate3 - FROM vn.rate - WHERE dated <= vLanded - AND warehouseFk = vWarehouseFk - ORDER BY dated DESC; - - DROP TEMPORARY TABLE IF EXISTS tmp.rate; - CREATE TEMPORARY TABLE tmp.rate - ENGINE = MEMORY - SELECT * FROM - ( - SELECT * FROM tRate - UNION ALL - SELECT rate0, rate1, rate2, rate3 FROM rateConfig - ) sub2 - LIMIT 1; - DROP TEMPORARY TABLE tRate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `recipe_Cook` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64850,8 +65349,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `recipe_Cook`(vItemFk INT, vBunchesQuantity INT, vDate DATE) BEGIN @@ -64865,7 +65362,7 @@ BEGIN CALL cache.available_refresh(vCalc, FALSE, vWarehouseFk, vDate); DROP TEMPORARY TABLE IF EXISTS tmp.recipeCook; - + CREATE TEMPORARY TABLE tmp.recipeCook SELECT *, @counter := IF(@element = element COLLATE utf8_general_ci , @counter + 1, 1) as counter, @@ -64883,22 +65380,22 @@ BEGIN IFNULL((i.inkFk = r.inkFk ) ,0) + IFNULL((i.size = r.size) ,0) + IFNULL((i.name LIKE CONCAT('%',r.name,'%')) ,0) - + IFNULL((i.longName LIKE CONCAT('%',r.longName,'%')),0) + + IFNULL((i.longName LIKE CONCAT('%',r.longName,'%')),0) + IFNULL((i.typeFk = r.typeFk),0) as matches, i.typeFk, rl.previousSelected - FROM vn.recipe r + FROM vn.recipe r JOIN vn.item i ON (IFNULL(i.name LIKE CONCAT('%',r.name,'%'), 0) OR IFNULL(i.longName LIKE CONCAT('%',r.longName,'%'),0)) OR i.typeFk <=> r.typeFk JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalc LEFT JOIN (SELECT recipe_ItemFk, element as log_element, selected_ItemFk, count(*) as previousSelected FROM vn.recipe_log - GROUP BY recipe_ItemFk, element, selected_ItemFk) rl ON rl.recipe_ItemFk = r.itemFk + GROUP BY recipe_ItemFk, element, selected_ItemFk) rl ON rl.recipe_ItemFk = r.itemFk AND rl.log_element = r.element AND rl.selected_ItemFk = i.id WHERE r.itemFk = vItemFk - AND a.available > vBunchesQuantity * r.quantity + AND a.available > vBunchesQuantity * r.quantity UNION ALL SELECT 100 itemFk, CONCAT('? ',r.element,' ',IFNULL(r.size,''),' ',IFNULL(r.inkFk,'')) as longName, @@ -64915,21 +65412,23 @@ BEGIN WHERE r.itemFk = vItemFk GROUP BY r.element ) sub - + ORDER BY element, matches DESC, previousSelected DESC; - - SELECT * + + SELECT * FROM tmp.recipeCook WHERE counter < 6 - OR itemFk = 100 + OR itemFk = 100 ; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `recipe_Plaster` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64937,8 +65436,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `recipe_Plaster`(vItemFk INT, vTicketFk INT, vQuantity INT) BEGIN @@ -64948,71 +65445,71 @@ BEGIN DECLARE vShipped DATE; DECLARE vEntryFk INT; DECLARE vTravelFk INT; - + CALL cache.last_buy_refresh(FALSE); - - SELECT warehouseFk, shipped + + SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped - FROM vn.ticket + FROM vn.ticket WHERE id = vTicketFk; UPDATE vn.ticket t JOIN vn.item i ON i.id = vItemFk SET t.nickname = CONCAT(vQuantity,' ',i.longName) WHERE t.id = vTicketFk; - + SELECT b.buyingValue INTO vLastCost FROM vn.buy b JOIN cache.last_buy lb ON lb.buy_id = b.id WHERE lb.item_id = vItemFk ORDER BY (lb.warehouse_id = vWarehouseFk) DESC LIMIT 1; - + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) SELECT vTicketFk, 98, - vQuantity, i.longName, vLastCost FROM vn.item i WHERE i.id = vItemFk; - /* + /* SELECT tr.id INTO vTravelFk FROM vn.travel tr JOIN vn.warehouse w ON w.id = tr.warehouseOutFk WHERE tr.warehouseInFk = vWarehouseFk AND tr.landed = vShipped AND w.name = 'Confeccion'; - + IF IFNULL(vTravelFk,0) = 0 THEN - + INSERT INTO vn.travel(shipped, landed, warehouseInFk, warehouseOutFk, agencyFk) SELECT vShipped, vShipped, vWarehouseFk, w.id, am.id - FROM vn.warehouse w - JOIN vn.agencyMode am + FROM vn.warehouse w + JOIN vn.agencyMode am WHERE w.name = 'Confeccion' AND am.name = 'DIRECTO PROVEEDOR'; - + SET vTravelFk = LAST_INSERT_ID(); - - END IF; - + + END IF; + SELECT e.id INTO vEntryFk FROM vn.entry e JOIN vn.supplier s ON s.id = supplierFk WHERE e.travelFk = vTravelFk AND s.name = 'Confeccion Natural' AND e.isRaid = FALSE; - + IF IFNULL(vEntryFk,0) = 0 THEN - + INSERT INTO vn.entry(supplierFk, evaNotes, travelFk, companyFk) SELECT s.id, t.nickname, vTravelFk, c.id FROM vn.supplier s JOIN vn.ticket t ON t.id = vTicketFk - JOIN vn.company c ON c.code = 'VNL' + JOIN vn.company c ON c.code = 'VNL' WHERE s.name = 'Confeccion Natural'; - + SET vEntryFk = LAST_INSERT_ID(); - + END IF; - + INSERT INTO vn.buy(entryFk, itemFk, quantity, buyingValue, packageFk, packing, grouping) SELECT vEntryFk, b.itemFk, vQuantity, b.buyingValue, b.packageFk, b.packing, b.grouping FROM cache.last_buy lb @@ -65027,6 +65524,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `reportLabelCollection_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65034,8 +65533,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `reportLabelCollection_get`( vParam INT, @@ -65095,6 +65592,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `report_print` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65102,8 +65601,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `report_print`( vReportName VARCHAR(100), @@ -65114,7 +65611,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `report_print`( ) BEGIN /** - * Inserts in the print queue the report to be printed and the necessary parameters for this + * Inserts in the print queue the report to be printed and the necessary parameters for this * one taking into account the paper size of both the printer and the report. * * @param vReportName the report to be printed. @@ -65157,11 +65654,11 @@ BEGIN END IF; IF vReportFk IS NULL THEN - CALL util.throw('reportNotExists'); + CALL util.throw('reportNotExists'); END IF; IF vReportSize <> vPrinteSize THEN - CALL util.throw('incorrectSize'); + CALL util.throw('incorrectSize'); END IF; START TRANSACTION; @@ -65170,7 +65667,7 @@ BEGIN priorityFk = vPriorityFk, reportFk = vReportFk, workerFk = vUserFk; - + SET vPrintQueueFk = LAST_INSERT_ID(); WHILE vI < vLength DO @@ -65191,6 +65688,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `riskAllClients` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65198,21 +65697,19 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `riskAllClients`(maxRiskDate DATE) BEGIN - + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; CREATE TEMPORARY TABLE tmp.client_list (PRIMARY KEY (Id_Cliente)) ENGINE = MEMORY SELECT id Id_Cliente, null grade FROM vn.client; - + CALL vn2008.risk_vs_client_list(maxRiskDate); - - SELECT + + SELECT c.RazonSocial, c.Id_Cliente, c.Credito, @@ -65224,7 +65721,7 @@ BEGIN JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente GROUP BY c.Id_cliente; - + DROP TEMPORARY TABLE IF EXISTS tmp.risk; DROP TEMPORARY TABLE IF EXISTS tmp.client_list; END ;; @@ -65233,6 +65730,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `routeGuessPriority` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65240,8 +65739,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `routeGuessPriority`(IN vRuta INT) BEGIN @@ -65266,6 +65763,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `routeInfo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65273,8 +65772,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `routeInfo`(vRouteFk INT) BEGIN @@ -65283,25 +65780,25 @@ BEGIN DECLARE vM3 INT; DECLARE vKg INT; DECLARE vMatricula varchar(50); - + SELECT sum(packages) as bultos INTO vPackages - FROM vn.ticket t + FROM vn.ticket t WHERE routeFk = vRouteFk; - + SELECT SUM(sv.physicalVolume), SUM(sv.physicalWeight) INTO vM3, vKg FROM vn.saleVolume sv WHERE sv.routeFk = vRouteFk; - + SELECT v.numberPlate as matricula INTO vMatricula - FROM vn.route r + FROM vn.route r JOIN vn.vehicle v ON r.vehicleFk = v.id WHERE r.id = vRouteFk; - + SELECT vRouteFk as Ruta, - vPackages as Bultos, + vPackages as Bultos, vM3 as m3, vKg as Kg, vMatricula as Matricula; @@ -65312,6 +65809,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `routeMonitor_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65319,8 +65818,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `routeMonitor_calculate`( vDate DATE, @@ -65366,7 +65863,7 @@ BEGIN ) sub ON sub.routeFk = rm.routeFk SET rm.ticketFree = sub.ticketFree; - UPDATE routesMonitor rm + UPDATE routesMonitor rm JOIN( SELECT t.routeFk, COUNT(*) AS ticketPacked FROM vn.ticket t @@ -65439,6 +65936,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `routeSetOk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65446,23 +65945,23 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `routeSetOk`( vRouteFk INT) BEGIN - + UPDATE vn.route r SET r.isOk = 1 WHERE r.id = vRouteFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `routeUpdateM3` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65470,8 +65969,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `routeUpdateM3`(vRoute INT) BEGIN @@ -65485,6 +65982,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `route_calcCommission` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65492,8 +65991,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `route_calcCommission`(vSelf INT) proc: BEGIN @@ -65521,17 +66018,17 @@ proc: BEGIN IF vIsFreelance THEN INSERT INTO routeCommission ( - routeFk, - workCenterFk, - freelanceYearlyM3, - cat4m3, + routeFk, + workCenterFk, + freelanceYearlyM3, + cat4m3, cat5m3 ) SELECT vSelf, r.commissionWorkCenterFk, rc.freelanceM3 * IF( - IFNULL(r.m3, 0) >= rc.freelanceMinM3, - IFNULL(r.m3, 0), + IFNULL(r.m3, 0) >= rc.freelanceMinM3, + IFNULL(r.m3, 0), 0), rc.distributionCat4M3 * IFNULL(r.m3, 0), rc.distributionCat5M3 * IFNULL(r.m3, 0) @@ -65543,20 +66040,20 @@ proc: BEGIN AND r.commissionWorkCenterFk; ELSE INSERT INTO routeCommission ( - routeFk, - workCenterFk, - km, - m3, - yearlyKm, - yearlyM3, - cat4m3, + routeFk, + workCenterFk, + km, + m3, + yearlyKm, + yearlyM3, + cat4m3, cat5m3 ) SELECT vSelf, r.commissionWorkCenterFk, - (r.kmEnd - r.kmStart) * + (r.kmEnd - r.kmStart) * IF(v.isKmTruckRate, rc.kmHeavy, rc.kmLight), - IFNULL(r.m3, 0) * + IFNULL(r.m3, 0) * IF(v.isKmTruckRate, rc.deliveryM3Cat5, rc.deliveryM3Cat4), (r.kmEnd - r.kmStart) * rc.kmYearly, IFNULL(r.m3, 0) * rc.m3Yearly, @@ -65578,6 +66075,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `route_doRecalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65585,15 +66084,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `route_doRecalc`() proc: BEGIN /** * Recalculates modified route. */ - + DECLARE vDone BOOL; DECLARE vRouteFk INT; @@ -65602,7 +66099,7 @@ proc: BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN DO RELEASE_LOCK('vn.route_doRecalc'); @@ -65639,6 +66136,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `route_getTickets` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65646,8 +66145,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `route_getTickets`(vRouteFk INT) BEGIN @@ -65678,7 +66175,8 @@ SELECT * wm.mediaValue SalePersonPhone, tob.description Note, t.isSigned Signed, - t.priority + t.priority, + t.cmrFk FROM ticket t JOIN client c ON t.clientFk = c.id JOIN address a ON t.addressFk = a.id @@ -65720,6 +66218,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `route_updateM3` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65727,8 +66227,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `route_updateM3`(vRoute INT) BEGIN @@ -65747,187 +66245,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `rutasAnalyze` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `rutasAnalyze`(vYear INT, vMonth INT) -BEGIN - -/** - * Analiza los costes de las rutas de reparto y lo almacena en la tabla Rutas_Master - * - * PAK 15/4/2019 - */ - - DELETE FROM bi.rutasBoard - WHERE year = vYear AND month = vMonth; - - -- Rellenamos la tabla con los datos de las rutas VOLUMETRICAS, especialmente con los bultos "virtuales" - INSERT INTO bi.rutasBoard(year, - month, - warehouse_id, - Id_Ruta, - Id_Agencia, - km, - Dia, - Fecha, - m3, - bultos, - Matricula, - Tipo, - Terceros) - SELECT YEAR(r.created), - MONTH(r.created), - IFNULL(GREATEST(1,a.warehouseFk), 0), - r.id, - r.agencyModeFk, - IFNULL(r.kmEnd, 0) - IFNULL(r.kmStart, 0), - DAYNAME(r.created), - r.created, - SUM(r.m3), - SUM(sv.volume / ebv.m3), - v.numberPlate, - IF(ISNULL(`r`.`cost`), 'P', 'A'), - IFNULL(r.cost,0) - FROM route r - JOIN ticket t ON t.routeFk = r.id - LEFT JOIN zone z ON z.id = t.zoneFk - LEFT JOIN agencyMode am ON am.id = r.agencyModeFk - LEFT JOIN agency a ON a.id = am.agencyFk - LEFT JOIN vehicle v ON v.id = r.vehicleFk - JOIN saleVolume sv ON sv.ticketFk = t.id - JOIN expeditionBoxVol ebv ON ebv.boxFk = 71 - WHERE YEAR(r.created) = vYear AND MONTH(r.created) = vMonth - AND z.isVolumetric - GROUP BY r.id; - -- Rellenamos la tabla con los datos de las rutas NO VOLUMETRICAS, especialmente con los bultos "virtuales" - INSERT INTO bi.rutasBoard(year, - month, - warehouse_id, - Id_Ruta, - Id_Agencia, - km, - Dia, - Fecha, - m3, - Bultos, - Matricula, - Tipo, - Terceros) - SELECT YEAR(r.created), - MONTH(r.created), - IFNULL(GREATEST(1,a.warehouseFk), 0), - r.id, - r.agencyModeFk, - IFNULL(r.kmEnd, 0) - IFNULL(r.kmStart,0), - DAYNAME(r.created), - r.created, - SUM(r.m3), - SUM(t.packages), - v.numberPlate, - IF(ISNULL(`r`.`cost`), 'P', 'A'), - IFnULL(r.cost,0) - FROM route r - JOIN ticket t ON t.routeFk = r.id - LEFT JOIN zone z ON z.id = t.zoneFk - LEFT JOIN agencyMode am ON am.id = r.agencyModeFk - LEFT JOIN agency a ON a.id = am.agencyFk - LEFT JOIN vehicle v ON v.id = r.vehicleFk - WHERE YEAR(r.created) = vYear AND MONTH(r.created) = vMonth - AND z.isVolumetric = FALSE - GROUP BY r.id - ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos); - - -- Coste REAL de cada bulto "virtual", de acuerdo con el valor apuntado a mano en la ruta - UPDATE bi.rutasBoard r - INNER JOIN vn2008.Rutas_Master rm ON rm.año = r.year AND rm.mes = r.month AND rm.warehouse_id = r.warehouse_id - SET r.coste_bulto = IF(r.Tipo ='A', r.Terceros, r.km * rm.coste_km ) / r.Bultos - WHERE r.Bultos > 0 - AND rm.año = vYear - AND rm.mes = vMonth; - - -- Coste PRACTICO de cada bulto, de acuerdo con los componentes de tipo AGENCIA en cada linea de venta - UPDATE bi.rutasBoard r - JOIN ( - SELECT t.routeFk, sum(s.quantity * sc.value) practicoTotal - FROM route r - JOIN time tm ON tm.dated = r.created - JOIN ticket t ON t.routeFk = r.id - JOIN sale s ON s.ticketFk = t.id - JOIN saleComponent sc ON sc.saleFk = s.id - JOIN component c ON c.id = sc.componentFk - JOIN componentType ct ON ct.id = c.typeFk - WHERE ct.type = 'agencia' - AND tm.year = vYear - AND tm.month = vMonth - GROUP BY r.id - ) sub ON sub.routeFk = r.Id_Ruta - SET r.practico = IFNULL(sub.practicoTotal / r.Bultos, 0); - - -- Coste TEORICO de una caja "virtual" para cada ruta, teniendo en cuenta que hay carros, pallets, etc - UPDATE bi.rutasBoard r - JOIN ( - SELECT t.routeFk, - SUM(t.zonePrice/ ebv.ratio)/ count(*) AS BultoTeoricoMedio - FROM ticket t - JOIN route r ON r.id = t.routeFk - JOIN time tm ON tm.dated = r.created - JOIN expedition e ON e.ticketFk = t.id - JOIN expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk - JOIN address ad ON ad.id = t.addressFk - JOIN client c ON c.id = ad.clientFk - LEFT JOIN zone z ON z.id = t.zoneFk - WHERE tm.year = vYear - AND tm.month = vMonth - AND z.isVolumetric = FALSE - GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk - SET r.teorico = IFNULL(sub.BultoTeoricoMedio, 0); - - -- Coste VOLUMETRICO TEORICO de una caja "virtual" para cada ruta - UPDATE bi.rutasBoard r - JOIN ( - SELECT t.routeFk, - SUM(freight) AS BultoTeoricoMedio - FROM ticket t - JOIN route r ON r.id = t.routeFk - JOIN time tm ON tm.dated = r.created - JOIN saleVolume sf ON sf.ticketFk = t.id - JOIN client c ON c.id = t.clientFk - JOIN zone z ON z.id = t.zoneFk - WHERE tm.year = vYear - AND tm.month = vMonth - AND z.isVolumetric != FALSE - GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk - SET r.teorico = IFNULL(sub.BultoTeoricoMedio / r.Bultos, 0); - - -- La diferencia entre el teorico y el practico se deberia de cobrar en greuges, cada noche - UPDATE bi.rutasBoard r - JOIN ( - SELECT t.routeFk, - Sum(g.amount) AS greuge - FROM ticket t - JOIN route r ON r.id = t.routeFk - JOIN time tm ON tm.dated = r.created - JOIN greuge g ON g.ticketFk = t.id - JOIN greugeType gt ON gt.id = g.greugeTypeFk - WHERE tm.year = vYear - AND tm.month = vMonth - AND gt.name = 'Diferencia portes' - GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk - SET r.greuge = sub.greuge / r.Bultos; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleBuy_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65935,38 +66254,38 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleBuy_Add`(vSaleFk INT, vBuyFk INT) BEGIN - + /* Añade un registro a la tabla saleBuy en el caso de que sea posible mantener la trazabilidad - * + * * @param vSaleFk clave primaria de vn.sale * @param vBuyFk clave primaria de vn.buy */ - /*IF (SELECT COUNT(*) + /*IF (SELECT COUNT(*) FROM vn.sale s JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk WHERE s.id = vSaleFk AND ic.code = 'fruit') THEN */ - - IF (SELECT COUNT(*) FROM vn.buy WHERE id = vBuyFk AND itemOriginalFk) THEN - + + IF (SELECT COUNT(*) FROM vn.buy WHERE id = vBuyFk AND itemOriginalFk) THEN + INSERT INTO vn.saleBuy (saleFk, buyFk) VALUES(vSaleFk, vBuyFk); - + END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleGroup_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -65974,8 +66293,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_add`(vSectorFk INT) BEGIN @@ -65984,7 +66301,7 @@ BEGIN * * @param vSectorFk Identificador de vn.sector */ - INSERT INTO vn.saleGroup(userFk, sectorFk) + INSERT INTO vn.saleGroup(userFk, sectorFk) VALUES (account.myUser_getId(), vSectorFk); SELECT LAST_INSERT_ID(); @@ -65994,6 +66311,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleGroup_setParking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66001,8 +66320,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_setParking`(IN `vSaleGroupFk` VARCHAR(8), IN `vParkingFk` INT) proc: BEGIN @@ -66024,6 +66341,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleMistake_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66031,8 +66350,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleMistake_Add`(vSaleFk INT, vUserFk INT, vTypeFk INT) BEGIN @@ -66046,6 +66363,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `salePreparingList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66053,8 +66372,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `salePreparingList`(IN vTicketFk BIGINT) BEGIN @@ -66105,6 +66422,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sales_merge` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66112,42 +66431,51 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sales_merge`(vTicketFk INT) -BEGIN - DROP TEMPORARY TABLE IF EXISTS salesToPreserve; - CREATE TEMPORARY TABLE salesToPreserve - SELECT s.id, s.itemFk, sum(s.quantity) as newQuantity - FROM vn.sale s - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - WHERE s.ticketFk = vTicketFk - AND it.isMergeable - GROUP BY s.itemFk, s.price, s.discount; - - UPDATE vn.sale s - JOIN salesToPreserve stp ON stp.id = s.id - SET quantity = newQuantity - WHERE s.ticketFk = vTicketFk; - - DELETE s.* - FROM vn.sale s - LEFT JOIN salesToPreserve stp ON stp.id = s.id - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - WHERE s.ticketFk = vTicketFk - AND stp.id IS NULL - AND it.isMergeable; - - DROP TEMPORARY TABLE salesToPreserve; +BEGIN + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + CREATE OR REPLACE TEMPORARY TABLE tSalesToPreserve + SELECT s.id, s.itemFk, SUM(s.quantity) newQuantity + FROM sale s + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + WHERE s.ticketFk = vTicketFk + AND it.isMergeable + GROUP BY s.itemFk, s.price, s.discount; + + START TRANSACTION; + + UPDATE sale s + JOIN tSalesToPreserve stp ON stp.id = s.id + SET quantity = newQuantity + WHERE s.ticketFk = vTicketFk; + + DELETE s.* + FROM sale s + LEFT JOIN tSalesToPreserve stp ON stp.id = s.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + WHERE s.ticketFk = vTicketFk + AND stp.id IS NULL + AND it.isMergeable; + + COMMIT; + + DROP TEMPORARY TABLE tSalesToPreserve; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sales_mergeByCollection` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66155,8 +66483,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sales_mergeByCollection`(vCollectionFk INT) BEGIN @@ -66176,17 +66502,17 @@ BEGIN OPEN cCur; myLoop: LOOP - + SET vDone = FALSE; - + FETCH cCur INTO vTicketFk; IF vDone THEN LEAVE myLoop; END IF; - + CALL vn.sales_merge(vTicketFk); - + END LOOP; CLOSE cCur; @@ -66197,6 +66523,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleTracking_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66204,8 +66532,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_add`(vSaleGroupFk INT) BEGIN @@ -66232,6 +66558,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleTracking_addPreparedSaleGroup` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66239,8 +66567,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_addPreparedSaleGroup`(vSaleGroupFk INT) BEGIN @@ -66260,6 +66586,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleTracking_addPrevOK` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66267,8 +66595,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_addPrevOK`(vSectorCollectionFk INT) BEGIN @@ -66298,6 +66624,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleTracking_del` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66305,8 +66633,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_del`(vSaleFk INT, vState VARCHAR(50)) BEGIN @@ -66317,15 +66643,17 @@ BEGIN DELETE st.* FROM vn.saleTracking st JOIN vn.state s ON s.id = st.stateFk - WHERE st.saleFk = vSaleFk + WHERE st.saleFk = vSaleFk AND s.code = vState COLLATE utf8_unicode_ci; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleTracking_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66333,15 +66661,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_new`( - vSaleFK INT, - vIsChecked BOOLEAN, - vOriginalQuantity INT, - vWorkerFk INT, - vAction VARCHAR(50), +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_new`( + vSaleFK INT, + vIsChecked BOOLEAN, + vOriginalQuantity INT, + vWorkerFk INT, + vAction VARCHAR(50), vState VARCHAR(50), vIsScanned BOOLEAN) BEGIN @@ -66357,12 +66683,12 @@ BEGIN * @param vIsScanned Identificador si se ha escaneado automáticamente o manual */ - REPLACE vn.saleTracking(saleFk, - isChecked, - originalQuantity, - workerFk, + REPLACE vn.saleTracking(saleFk, + isChecked, + originalQuantity, + workerFk, stateFk, - isScanned) + isScanned) SELECT vSaleFK, vIsChecked, vOriginalQuantity, @@ -66377,6 +66703,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `saleTracking_updateIsChecked` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66384,32 +66712,30 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_updateIsChecked`(vSaleFK INT, vIsChecked BOOL, vIsScanned BOOL) BEGIN - + /** * Actualiza el estado del campo vn.saleTracking.isChecked y elimina las lineas de vn.itemShelving * si procede, en el caso de las preparaciones previas, por usuario - * + * * @param vSaleFk Identificador de vn.sale * @param vIsChecked Estado del registro */ - + UPDATE vn.saleTracking st JOIN vn.state s ON s.id = st.stateFk AND s.code = 'PREVIOUS_PREPARATION' SET st.isChecked = vIsChecked, st.isScanned = vIsScanned WHERE st.saleFk = vSaleFK AND st.workerFk = account.myUser_getId(); - + IF vIsChecked = FALSE THEN - - DELETE FROM vn.itemShelvingSale + + DELETE FROM vn.itemShelvingSale WHERE saleFk = vSaleFK; - + END IF; END ;; @@ -66418,6 +66744,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_calculateComponent` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66425,8 +66753,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_calculateComponent`(vSelf INT, vOption INT) proc: BEGIN @@ -66435,14 +66761,14 @@ proc: BEGIN * * @param vSelf Id de la venta * @param vOption indica en que componente pone el descuadre, NULL en casos habituales - */ + */ CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales SELECT s.id FROM sale s WHERE s.id = vSelf; - + CALL sale_recalcComponent(vOption); - + DROP TEMPORARY TABLE tmp.recalculateSales; END ;; DELIMITER ; @@ -66450,6 +66776,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_checkNoComponents` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66457,8 +66785,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_checkNoComponents`(vCreatedFrom DATETIME, vCreatedTo DATETIME) BEGIN @@ -66489,7 +66815,7 @@ BEGIN GROUP BY s.id; DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; + SET v_done = TRUE; DROP TEMPORARY TABLE IF EXISTS tmp.coste; @@ -66497,7 +66823,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.coste (PRIMARY KEY (id)) ENGINE = MEMORY SELECT s.id - FROM sale s + FROM sale s JOIN item i ON i.id = s.itemFk JOIN itemType tp ON tp.id = i.typeFk JOIN itemCategory ic ON ic.id = tp.categoryFk @@ -66516,23 +66842,25 @@ BEGIN IF v_done THEN LEAVE l; END IF; - + SELECT ticketFk, concept INTO vTicketFk, vConcept FROM sale WHERE id = vSaleFk; - + CALL sale_calculateComponent(vSaleFk, 1); END LOOP; CLOSE vCur; - DROP TEMPORARY TABLE tmp.coste; + DROP TEMPORARY TABLE tmp.coste; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_getFromTicketOrCollection` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66540,8 +66868,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getFromTicketOrCollection`(vParam INT) BEGIN @@ -66612,29 +66938,29 @@ DECLARE vIsCollection BOOL; TRIM(CONCAT(LPAD(s.concept,30,' '), ' ', RPAD(IFNULL(i.size,''),5,' '))) line1, '' cel1, - TRIM(CONCAT(LPAD(IFNULL(ip.productor,''),30,' '), ' ',LPAD(IFNULL(o.code,''),4,' '))) line2, + TRIM(CONCAT(LPAD(IFNULL(ip.productor,''),30,' '), ' ',LPAD(IFNULL(o.code,''),4,' '))) line2, IF(s.quantity MOD IFNULL(b.packing,s.quantity + 1), CONCAT(CAST(s.quantity/IFNULL(b.`grouping`,1) AS DECIMAL(10,0)),' x ',IFNULL(b.`grouping`,1)), CONCAT(CAST(s.quantity / IFNULL(b.packing,1) AS DECIMAL(10,0)),' pack de ',IFNULL(b.packing,1))) cel2, TRIM(CONCAT(ic.color)) line3, p.code cel3, s.isAdded, - sub2.originalQuantity startQuantity, -- eliminar cuando tengamos la nueva apk IF(c.workerFk IS NULL, getUser(), c.workerFk) workerFk, IF(SUM(iss.quantity) IS NULL, 0, SUM(iss.quantity)) pickedQuantity, i.packingShelve, MIN(iss.created) picked, - IF(sm.id, TRUE, FALSE) hasMistake + IF(sm.id, TRUE, FALSE) hasMistake, + sg.sectorFk FROM tmp.ticket t JOIN sale s ON s.ticketFk = t.id JOIN ticket tt ON tt.id = t.id LEFT JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = tt.warehouseFk - LEFT JOIN buy b ON b.id = lb.buy_id + LEFT JOIN buy b ON b.id = lb.buy_id JOIN item i ON i.id = s.itemFk LEFT JOIN ticketCollection tc ON tc.ticketFk = t.id LEFT JOIN collection c ON c.id = tc.collectionFk - LEFT JOIN (SELECT sub.saleFk, sub.isChecked, sub.stateFk, sub.originalQuantity - FROM (SELECT DISTINCT st.id, st.saleFk, st.isChecked, st.stateFk, st.originalQuantity + LEFT JOIN (SELECT sub.saleFk, sub.isChecked, sub.stateFk, sub.originalQuantity + FROM (SELECT DISTINCT st.id, st.saleFk, st.isChecked, st.stateFk, st.originalQuantity FROM tmp.ticket2 t JOIN sale s ON s.ticketFk = t.id JOIN saleTracking st ON st.saleFk = s.id @@ -66646,7 +66972,7 @@ DECLARE vIsCollection BOOL; LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk LEFT JOIN itemProductor ip ON ip.itemFk = s.itemFk LEFT JOIN origin o ON o.id = i.originFk - LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id + LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk LEFT JOIN parking p ON p.id = sg.parkingFk LEFT JOIN saleMistake sm ON sm.saleFk = s.id @@ -66661,6 +66987,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_getProblems` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66668,8 +66996,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblems`(IN vIsTodayRelative tinyint(1)) BEGIN @@ -66698,8 +67024,8 @@ BEGIN DELETE tt.* FROM tmp.sale_getProblems tt JOIN vn.ticketObservation tto ON tto.ticketFk = tt.ticketFk - JOIN vn.observationType ot ON ot.id = tto.observationTypeFk - WHERE ot.code = 'administrative' + JOIN vn.observationType ot ON ot.id = tto.observationTypeFk + WHERE ot.code = 'administrative' AND tto.description = 'Miriam'; CREATE OR REPLACE TEMPORARY TABLE tmp.sale_problems ( @@ -66731,7 +67057,7 @@ BEGIN -- Too Little INSERT INTO tmp.sale_problems(ticketFk, isTooLittle) - SELECT tp.ticketFk, TRUE + SELECT tp.ticketFk, TRUE FROM tmp.sale_getProblems tp JOIN vn.ticket t ON t.id = tp.ticketFk JOIN (SELECT t.addressFk, SUM(sv.litros) litros, t.totalWithoutVat @@ -66762,6 +67088,7 @@ BEGIN JOIN vn.agencyMode am ON am.id = t.agencyModeFk JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk WHERE dm.code IN('AGENCY','DELIVERY','PICKUP') + AND s.quantity > 0 GROUP BY s.id LIMIT 10000000000000000) sub WHERE sub.hasComponentLack; @@ -66817,25 +67144,25 @@ BEGIN -- Disponible: no va a haber suficiente producto para preparar todos los pedidos CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, vDate); - - -- Faltas: visible, disponible y ubicado son menores que la cantidad vendida + + -- Faltas: visible, disponible y ubicado son menores que la cantidad vendida CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk); INSERT INTO tmp.sale_problems(ticketFk, itemShortage, saleFk) SELECT ticketFk, problem, saleFk FROM ( - SELECT tl.ticketFk, - LEFT(CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')),250) problem, + SELECT tl.ticketFk, + LEFT(CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')),250) problem, s.id AS saleFk FROM tmp.ticket_list tl JOIN vn.ticket t ON t.id = tl.ticketFk JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk JOIN vn.itemType it on it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk WHERE IFNULL(v.visible,0) < s.quantity AND IFNULL(av.available ,0) < s.quantity AND IFNULL(issw.visible, 0) < s.quantity @@ -66848,7 +67175,7 @@ BEGIN AND t.warehouseFk = vWarehouseFk GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE itemShortage = sub.problem, saleFk = sub.saleFk; - + -- Inventario: Visible suficiente, pero ubicado menor a la cantidad vendida INSERT INTO tmp.sale_problems(ticketFk, itemLost, saleFk) SELECT ticketFk, problem, saleFk @@ -66861,7 +67188,7 @@ BEGIN JOIN vn.itemType it on it.id = i.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk WHERE IFNULL(v.visible,0) >= s.quantity AND IFNULL(issw.visible, 0) < s.quantity AND s.quantity > 0 @@ -66874,7 +67201,7 @@ BEGIN AND t.warehouseFk = vWarehouseFk GROUP BY tl.ticketFk) sub ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; - + -- Retraso: Disponible suficiente, pero no visible ni ubicado INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk) SELECT ticketFk, problem, saleFk @@ -66888,7 +67215,7 @@ BEGIN JOIN vn.itemCategory ic ON ic.id = it.categoryFk LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk WHERE IFNULL(v.visible,0) < s.quantity AND IFNULL(av.available ,0) >= s.quantity AND IFNULL(issw.visible, 0) < s.quantity @@ -66908,13 +67235,13 @@ BEGIN INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) SELECT ticketFk, problem, saleFk FROM ( - SELECT - tl.ticketFk, + SELECT + tl.ticketFk, s.id saleFk , - LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,''), ' '), 250) problem, + LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,''), ' '), 250) problem, MOD(s.quantity, b.`grouping`) hasRounding FROM tmp.ticket_list tl - JOIN ticket t ON t.id = tl.ticketFk + JOIN ticket t ON t.id = tl.ticketFk AND t.warehouseFk = vWarehouseFk JOIN sale s ON s.ticketFk = tl.ticketFk JOIN item i ON i.id = s.itemFk @@ -66922,12 +67249,12 @@ BEGIN JOIN buy b ON b.id = bu.buyFk GROUP BY tl.ticketFk HAVING hasRounding - ) sub + ) sub ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; END LOOP; CLOSE vCursor; - + INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked) SELECT DISTINCT tl.ticketFk, FALSE FROM tmp.ticket_list tl @@ -66944,6 +67271,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_getProblemsByTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66951,22 +67280,20 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1)) BEGIN /** - * Calcula los problemas de cada venta + * Calcula los problemas de cada venta * para un conjunto de tickets. * * @return Problems result */ DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems; - CREATE TEMPORARY TABLE tmp.sale_getProblems + CREATE TEMPORARY TABLE tmp.sale_getProblems (INDEX (ticketFk)) ENGINE = MEMORY - SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped + SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped FROM ticket t WHERE t.id = vTicketFk; @@ -66983,6 +67310,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_PriceFix` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66990,12 +67319,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_PriceFix`(vTicketFk INT) BEGIN - + DELETE sc.* FROM vn.saleComponent sc JOIN vn.sale s ON s.id = sc.saleFk @@ -67018,6 +67345,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_recalcComponent` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67025,58 +67354,56 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_recalcComponent`(vOption INT) proc: BEGIN /** - * Este procedimiento recalcula los componentes de un conjunto de sales, + * Este procedimiento recalcula los componentes de un conjunto de sales, * eliminando los componentes existentes e insertandolos de nuevo * * @param vOption si no se quiere forzar llamar con NULL * @table tmp.recalculateSales (id) - */ - DECLARE vShipped DATE; + */ + DECLARE vShipped DATE; DECLARE vWarehouseFk SMALLINT; DECLARE vAgencyModeFk INT; DECLARE vAddressFk INT; DECLARE vTicketFk INT; - DECLARE vLanded DATE; + DECLARE vLanded DATE; DECLARE vIsEditable BOOLEAN; DECLARE vZoneFk INTEGER; DECLARE vDone BOOL DEFAULT FALSE; - + DECLARE vCur CURSOR FOR SELECT DISTINCT s.ticketFk FROM tmp.recalculateSales rs JOIN vn.sale s ON s.id = rs.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + OPEN vCur; l: LOOP SET vDone = FALSE; - FETCH vCur INTO vTicketFk; - + FETCH vCur INTO vTicketFk; + IF vDone THEN LEAVE l; END IF; - SELECT (hasToRecalcPrice OR ts.alertLevel IS NULL) AND t.refFk IS NULL, - t.zoneFk, - t.warehouseFk, - t.shipped, - t.addressFk, - t.agencyModeFk, + SELECT (hasToRecalcPrice OR ts.alertLevel IS NULL) AND t.refFk IS NULL, + t.zoneFk, + t.warehouseFk, + t.shipped, + t.addressFk, + t.agencyModeFk, t.landed - INTO vIsEditable, - vZoneFk, - vWarehouseFk, - vShipped, - vAddressFk, - vAgencyModeFk, + INTO vIsEditable, + vZoneFk, + vWarehouseFk, + vShipped, + vAddressFk, + vAgencyModeFk, vLanded FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket @@ -67084,31 +67411,31 @@ proc: BEGIN WHERE t.id = vTicketFk; CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); - - IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN - CALL util.throw('There is no zone for these parameters'); + + IF NOT EXISTS (SELECT TRUE FROM tmp.zoneGetLanded LIMIT 1) THEN + CALL util.throw(CONCAT('There is no zone for these parameters ', vTicketFk)); END IF; - + IF vLanded IS NULL OR vZoneFk IS NULL THEN - + UPDATE ticket t - SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) + SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) WHERE t.id = vTicketFk AND t.landed IS NULL; - + IF vZoneFk IS NULL THEN SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; UPDATE ticket t SET t.zoneFk = vZoneFk WHERE t.id = vTicketFk AND t.zoneFk IS NULL; END IF; - + END IF; - + DROP TEMPORARY TABLE tmp.zoneGetLanded; - - -- rellena la tabla buyUltimate con la ultima compra - CALL buyUltimate (vWarehouseFk, vShipped); - + + -- rellena la tabla buyUltimate con la ultima compra + CALL buyUltimate (vWarehouseFk, vShipped); + CREATE OR REPLACE TEMPORARY TABLE tmp.sale (PRIMARY KEY (saleFk)) ENGINE = MEMORY SELECT s.id saleFk, vWarehouseFk warehouseFk @@ -67116,7 +67443,7 @@ proc: BEGIN JOIN tmp.recalculateSales rs ON s.id = rs.id WHERE s.ticketFk = vTicketFk; - CREATE OR REPLACE TEMPORARY TABLE tmp.ticketLot + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketLot SELECT vWarehouseFk warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk FROM sale s JOIN tmp.recalculateSales rs ON s.id = rs.id @@ -67130,15 +67457,15 @@ proc: BEGIN IF vOption IS NULL THEN SET vOption = IF(vIsEditable, 1, 6); END IF; - - CALL ticketComponentUpdateSale(vOption); + + CALL ticketComponentUpdateSale(vOption); CALL catalog_componentPurge(); - + DROP TEMPORARY TABLE tmp.buyUltimate; DROP TEMPORARY TABLE tmp.sale; - + END LOOP; - CLOSE vCur; + CLOSE vCur; END ;; DELIMITER ; @@ -67146,6 +67473,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sectorCollectionSaleGroup_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67153,28 +67482,26 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollectionSaleGroup_add`(vSaleGroupFk INT, vSectorCollectionFk INT) BEGIN /** - * Inserta un nuevo registro en vn.sectorCollectionSaleGroup + * Inserta un nuevo registro en vn.sectorCollectionSaleGroup * Actualiza el usuario en vn.saleGroup y reemplaza los registros de vn.saleTracking - * + * * @param vSaleGroupFk Identificador de vn.saleGroup * @param vSectorCollectionFk Identificador de vn.sectorCollection */ REPLACE sectorCollectionSaleGroup - SET sectorCollectionFk = vSectorCollectionFk, + SET sectorCollectionFk = vSectorCollectionFk, saleGroupFk = vSaleGroupFk; - + UPDATE saleGroup sg JOIN sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id JOIN sectorCollection sc ON sc.id = scsg.sectorCollectionFk - SET sg.userFk = sc.userFk + SET sg.userFk = sc.userFk WHERE sg.id = vSaleGroupFk; - + INSERT IGNORE saleTracking( saleFk, isChecked, @@ -67186,8 +67513,8 @@ BEGIN sc.userFk, s.id FROM saleGroupDetail sgd - JOIN sectorCollectionSaleGroup scsg - ON scsg.saleGroupFk = sgd.saleGroupFk + JOIN sectorCollectionSaleGroup scsg + ON scsg.saleGroupFk = sgd.saleGroupFk JOIN sectorCollection sc ON sc.id = scsg.sectorCollectionFk JOIN state s ON s.code = 'PREVIOUS_PREPARATION' WHERE sgd.saleGroupFk = vSaleGroupFk; @@ -67197,6 +67524,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sectorCollection_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67204,8 +67533,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_get`() BEGIN @@ -67232,6 +67559,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sectorCollection_getSale` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67239,8 +67568,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_getSale`(vSelf INT) BEGIN @@ -67277,6 +67604,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sectorCollection_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67284,40 +67613,40 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_new`(vSectorFk INT) -BEGIN -/** - * Inserta una nueva colección, si el usuario no tiene ninguna vacia. - * Esto se hace para evitar que por error se generen colecciones sin sentido. - * - * @param vSectorFk Identificador de #vn.sector - */ - DECLARE hasEmptyCollections BOOL; - DECLARE vUserFk INT; - - SET vUserFk = account.myUser_getId(); - - SELECT (COUNT(sc.id) > 0) INTO hasEmptyCollections - FROM vn.sectorCollection sc - LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id - WHERE ISNULL(scsg.id) - AND sc.userFk = vUserFk - AND sc.sectorFk = vSectorFk - AND sc.created >= util.VN_CURDATE(); - - IF NOT hasEmptyCollections THEN - INSERT INTO vn.sectorCollection(userFk, sectorFk) - VALUES(vUserFk, vSectorFk); - END IF; +BEGIN +/** + * Inserta una nueva colección, si el usuario no tiene ninguna vacia. + * Esto se hace para evitar que por error se generen colecciones sin sentido. + * + * @param vSectorFk Identificador de #vn.sector + */ + DECLARE hasEmptyCollections BOOL; + DECLARE vUserFk INT; + + SET vUserFk = account.myUser_getId(); + + SELECT (COUNT(sc.id) > 0) INTO hasEmptyCollections + FROM vn.sectorCollection sc + LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id + WHERE ISNULL(scsg.id) + AND sc.userFk = vUserFk + AND sc.sectorFk = vSectorFk + AND sc.created >= util.VN_CURDATE(); + + IF NOT hasEmptyCollections THEN + INSERT INTO vn.sectorCollection(userFk, sectorFk) + VALUES(vUserFk, vSectorFk); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sectorProductivity_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67325,8 +67654,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorProductivity_add`() BEGIN @@ -67405,6 +67732,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sector_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67412,8 +67741,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sector_get`() BEGIN @@ -67431,6 +67758,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sector_getWarehouse` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67438,8 +67767,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sector_getWarehouse`(vSectorFk INT) BEGIN @@ -67447,13 +67774,15 @@ BEGIN SELECT s.warehouseFk FROM vn.sector s WHERE s.id = vSectorFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `setParking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67461,8 +67790,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `setParking`(IN `vParam` VARCHAR(8), IN `vParkingCode` VARCHAR(8)) proc: BEGIN @@ -67528,6 +67855,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `shelvingChange` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67535,23 +67864,23 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8)) BEGIN UPDATE vn.itemShelving - SET shelvingFk = vShelvingD COLLATE utf8_unicode_ci - WHERE shelvingFk = vShelvingO COLLATE utf8_unicode_ci; - - + SET shelvingFk = vShelvingD COLLATE utf8_unicode_ci + WHERE shelvingFk = vShelvingO COLLATE utf8_unicode_ci; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `shelvingLog_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67559,21 +67888,19 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingLog_get`(shelvingFk VARCHAR(10)) BEGIN - + /* Lista el log de un carro - * + * * @param shelvingFk matrícula del carro - * + * */ - + SELECT originFk, name, creationDate, description FROM shelvingLog sl - JOIN account.user u ON u.id = sl.userFk + JOIN account.user u ON u.id = sl.userFk WHERE sl.originFk = shelvingFk COLLATE utf8_general_ci ORDER BY creationDate DESC; @@ -67583,6 +67910,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `shelvingParking_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67590,28 +67919,26 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingParking_get`(vShelvingFk VARCHAR(10), vWarehouseFk INT, vDayRange INT) BEGIN - -SELECT s.itemFk, + +SELECT s.itemFk, s.concept, - CAST(SUM(s.quantity) AS DECIMAL(10,0)) as sinServir, - CAST(IFNULL(ist.visible,0) AS DECIMAL(10,0)) as aparcado + CAST(SUM(s.quantity) AS DECIMAL(10,0)) as sinServir, + CAST(IFNULL(ist.visible,0) AS DECIMAL(10,0)) as aparcado FROM vn.sale s LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id JOIN vn.ticket t ON t.id = s.ticketFk LEFT JOIN vn.itemShelvingStock ist ON ist.itemFk = s.itemFk AND ist.warehouseFk = vWarehouseFk JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk AND ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci - WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), util.VN_CURDATE())) + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), util.VN_CURDATE())) AND iss.saleFk IS NULL AND t.warehouseFk = vWarehouseFk GROUP BY s.itemFk HAVING sinServir > aparcado; - + END ;; DELIMITER ; @@ -67619,6 +67946,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `shelvingPriority_update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67626,8 +67955,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingPriority_update`(priority INT,vShelvingFk VARCHAR(10)) BEGIN @@ -67640,6 +67967,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `shelving_clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67647,8 +67976,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_clean`() BEGIN @@ -67656,12 +67983,12 @@ BEGIN DELETE FROM vn.shelving WHERE length(code) > 3 AND parked < TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); - + DELETE FROM vn.itemShelving WHERE visible <= 0 AND created < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); - DELETE ish.* + DELETE ish.* FROM vn.itemShelving ish JOIN vn.shelving sh ON sh.code = ish.shelvingFk WHERE sh.parkingFk IS NULL @@ -67669,12 +67996,12 @@ BEGIN UPDATE vn.shelving sh LEFT JOIN vn.itemShelving its ON its.shelvingFk = sh.`code` - SET isPrinted = 0, + SET isPrinted = 0, parkingFk = NULL WHERE its.id IS NULL - AND sh.isRecyclable - AND ( sh.parked IS NULL - OR + AND sh.isRecyclable + AND ( sh.parked IS NULL + OR sh.parked < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()) ); @@ -67684,6 +68011,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `shelving_getSpam` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67691,8 +68020,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_getSpam`(vDated DATE, vWarehouseFk INT) BEGIN @@ -67781,6 +68108,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `shelving_setParking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67788,8 +68117,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_setParking`(IN `vShelvingCode` VARCHAR(8), IN `vParkingFk` INT) proc: BEGIN @@ -67817,6 +68144,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sleep_X_min` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67824,8 +68153,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sleep_X_min`() BEGIN @@ -67839,6 +68166,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `solunionRiskRequest` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67846,25 +68175,23 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `solunionRiskRequest`() BEGIN - + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; CREATE TEMPORARY TABLE tmp.client_list (PRIMARY KEY (Id_Cliente)) ENGINE = MEMORY - SELECT * FROM (SELECT cc.client Id_Cliente, ci.grade FROM vn.creditClassification cc + SELECT * FROM (SELECT cc.client Id_Cliente, ci.grade FROM vn.creditClassification cc JOIN vn.creditInsurance ci ON cc.id = ci.creditClassification WHERE dateEnd IS NULL ORDER BY ci.creationDate DESC LIMIT 10000000000000000000) t1 GROUP BY Id_Cliente; - + CALL vn2008.risk_vs_client_list(util.VN_CURDATE()); - - SELECT + + SELECT c.Id_Cliente, c.Cliente, c.Credito credito_vn, c.creditInsurance solunion, cast(r.risk as DECIMAL(10,0)) riesgo_vivo, cast(c.creditInsurance - r.risk as decimal(10,0)) margen_vivo, f.Consumo consumo_anual, c.Vencimiento, ci.grade @@ -67874,7 +68201,7 @@ BEGIN JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente JOIN bi.facturacion_media_anual f ON c.Id_Cliente = f.Id_Cliente GROUP BY Id_cliente; - + DROP TEMPORARY TABLE IF EXISTS tmp.risk; DROP TEMPORARY TABLE IF EXISTS tmp.client_list; END ;; @@ -67883,6 +68210,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `stockBuyedByWorker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67890,8 +68219,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyedByWorker`( vDate DATE, @@ -67942,6 +68269,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `stockBuyed_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -67949,62 +68278,75 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyed_add`(vDated DATE) BEGIN /** - * Inserta el volumen de compra por comprador en vn.stockBuyed de acuerdo con la fecha + * Inserta el volumen de compra por comprador en stockBuyed de acuerdo con la fecha * * @param vDated Fecha de compra */ - CALL vn.stockTraslation(vDated); - DELETE - FROM vn.stockBuyed - WHERE `date` = vDated; + CREATE OR REPLACE TEMPORARY TABLE tStockBuyed + (INDEX (userFk)) + ENGINE = MEMORY + SELECT requested, reserved, userFk + FROM stockBuyed + WHERE dated = vDated; - INSERT INTO vn.stockBuyed(`user`, buyed, `date`, description) + CALL stockTraslation(vDated); + + INSERT INTO stockBuyed(userFk, buyed, `dated`, description) SELECT it.workerFk, - SUM(( ti.amount / b.packing ) * vn.buy_getVolume(b.id)) / vc.palletM3 / 1000000 buyed, + SUM(( ti.amount / b.packing ) * buy_getVolume(b.id)) / vc.palletM3 / 1000000 buyed, vDated, u.name FROM tmp.item ti - JOIN vn.item i ON i.id = ti.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.warehouse wh ON wh.code = 'VNH' + JOIN item i ON i.id = ti.item_id + JOIN itemType it ON it.id = i.typeFk + JOIN itemCategory ic ON ic.id = it.categoryFk + JOIN warehouse wh ON wh.code = 'VNH' JOIN tmp.buyUltimate bu ON bu.itemFk = i.id AND bu.warehouseFk = wh.id - JOIN vn.buy b ON b.id = bu.buyFk - JOIN vn.volumeConfig vc + JOIN buy b ON b.id = bu.buyFk + JOIN volumeConfig vc JOIN account.`user` u ON u.id = it.workerFk - WHERE ic.display != 0 + WHERE ic.display <> 0 GROUP BY it.workerFk; - INSERT INTO stockBuyed(buyed, `date`, description) - SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000), vDated, IF(c.country = 'España',p.name,c.country) destiny - FROM vn.itemTicketOut ito - JOIN vn.ticket t ON t.id = ito.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.warehouse wh ON wh.id = t.warehouseFk - JOIN vn.itemCost ic ON ic.itemFk = ito.itemFk AND ic.warehouseFk = t.warehouseFk - JOIN vn.volumeConfig vc + INSERT INTO stockBuyed(buyed, dated, description) + SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000), + vDated, + IF(c.country = 'España',p.name,c.country) destiny + FROM itemTicketOut ito + JOIN ticket t ON t.id = ito.ticketFk + JOIN `address` a ON a.id = t.addressFk + JOIN province p ON p.id = a.provinceFk + JOIN country c ON c.id = p.countryFk + JOIN warehouse wh ON wh.id = t.warehouseFk + JOIN itemCost ic ON ic.itemFk = ito.itemFk AND ic.warehouseFk = t.warehouseFk + JOIN volumeConfig vc WHERE ito.shipped BETWEEN vDated AND util.dayend(vDated) AND wh.code = 'VNH' GROUP BY destiny; + UPDATE stockBuyed s + JOIN tStockBuyed ts ON ts.userFk = s.userFk + SET s.requested = ts.requested, + s.reserved = ts.reserved + WHERE s.dated = vDated; + DROP TEMPORARY TABLE tmp.buyUltimate, - tmp.item; + tmp.item, + tStockBuyed; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `stockTraslation` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68012,8 +68354,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `stockTraslation`(vDate DATE) BEGIN @@ -68025,7 +68365,7 @@ BEGIN */ DECLARE vAuctionWarehouseFk INT; - DELETE FROM stockBuyed WHERE `date` = vDate; + DELETE FROM stockBuyed WHERE dated = vDate; SELECT warehouseFk INTO vAuctionWarehouseFk FROM auctionConfig; @@ -68059,6 +68399,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `subordinateGetList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68066,8 +68408,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `subordinateGetList`(vBossFk INT) BEGIN @@ -68076,10 +68416,10 @@ BEGIN DECLARE vBossId INT; DECLARE vDone BOOL; DECLARE workerCur CURSOR FOR - SELECT workerFk - FROM tmp.subordinate + SELECT workerFk + FROM tmp.subordinate WHERE NOT isChecked; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE EXIT HANDLER FOR 1062 BEGIN @@ -68087,29 +68427,29 @@ BEGIN END; DROP TEMPORARY TABLE IF EXISTS tmp.subordinate; - + CREATE TEMPORARY TABLE tmp.subordinate (PRIMARY KEY (workerFk)) ENGINE = MEMORY SELECT vBossFk AS workerFk, 0 AS isChecked; - + WHILE (SELECT COUNT(*) FROM tmp.subordinate WHERE NOT isChecked) > 0 DO OPEN workerCur; workerLoop: LOOP SET vDone = FALSE; FETCH workerCur INTO vBossId; - + IF vDone THEN LEAVE workerLoop; END IF; - - INSERT INTO tmp.subordinate - SELECT id, 0 - FROM worker + + INSERT INTO tmp.subordinate + SELECT id, 0 + FROM worker WHERE bossFk = vBossId; - - UPDATE tmp.subordinate + + UPDATE tmp.subordinate SET isChecked = 1 WHERE workerFk = vBossId; END LOOP; @@ -68122,6 +68462,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `supplierExpenses` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68129,8 +68471,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierExpenses`(vEnded DATE) BEGIN @@ -68149,13 +68489,13 @@ BEGIN -- Calcula el balance inicial y final de cada proveedor INSERT INTO openingBalance SELECT MAX(dueDated), - supplierFk, - companyFk, + supplierFk, + companyFk, sum(amount) eurAmount, sum(divisa) foreignAmount FROM ( SELECT p.dueDated, - p.supplierFk, + p.supplierFk, p.companyFk, p.amount, p.divisa @@ -68171,7 +68511,7 @@ BEGIN SELECT iidd.dueDated, ii.supplierFk, ii.companyFk, - - iidd.amount, + - iidd.amount, - iidd.foreignValue FROM invoiceIn ii JOIN invoiceInDueDay iidd ON ii.id = iidd.invoiceInFk @@ -68179,14 +68519,14 @@ BEGIN JOIN company co ON co.id = ii.companyFk WHERE iidd.dueDated > '2014-12-31' AND iidd.dueDated <= vEnded - AND ii.isBooked AND co.`code` = 'VNL' + AND ii.isBooked AND co.`code` = 'VNL' AND c.`code` <> 'EUR' UNION ALL SELECT se.dueDated, se.supplierFk, se.companyFk, - - se.amount, + - se.amount, 0 FROM supplierExpense se JOIN currency c ON c.id = se.currencyFk @@ -68196,7 +68536,7 @@ BEGIN AND co.`code` = 'VNL' AND c.`code` <> 'EUR' ) sub GROUP BY companyFk, supplierFk; - + SELECT ob.dueDated , ob.supplierFk , ob.companyFk @@ -68214,6 +68554,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `supplierPackaging_ReportSource` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68221,71 +68563,62 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierPackaging_ReportSource`(vFromDated DATE, vSupplierFk INT) BEGIN - /** - * Selecciona los embalajes de un proveedor a partir de una fecha - * - * @param vFromDated Fecha de la que partir - * @param vSupplierFk Id del proveedor - */ - +* Selecciona los embalajes de un proveedor a partir de una fecha +* +* @param vFromDated Fecha de la que partir +* @param vSupplierFk Id del proveedor +*/ DECLARE vCounter INT DEFAULT 0; DECLARE vMaxRow INT DEFAULT 0; DECLARE vItemFk INT DEFAULT 0; - SET @vRowNumber = 0; SET @vBalance = 0; - DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackagingList; - CREATE TEMPORARY TABLE tmp.supplierPackagingList - SELECT itemFk, - @vRowNumber:= @vRowNumber + 1 `row` + CREATE OR REPLACE TEMPORARY TABLE tSupplierPackagingList + SELECT ROW_NUMBER() OVER(ORDER BY landed) `row`, + itemFk, + entryFk FROM ( - SELECT * - FROM ( - SELECT supplierFk, - itemFk, - longName, - supplier, - entryFk, - landed, - `out`, - `in`, - warehouse, - buyingValue - FROM supplierPackaging - WHERE supplierFk = vSupplierFk - AND landed >= vFromDated - - UNION ALL - - SELECT vSupplierFk, - itemFk, - longName, - supplier, - 'previous', - vFromDated, - SUM(`out`), - SUM(`in`), - NULL, - buyingValue - FROM supplierPackaging - WHERE supplierFk = vSupplierFk - AND landed < vFromDated - GROUP BY itemFk) i + SELECT supplierFk, + itemFk, + longName, + supplier, + entryFk, + landed, + `out`, + `in`, + warehouse, + buyingValue + FROM supplierPackaging + WHERE supplierFk = vSupplierFk + AND landed >= vFromDated + UNION ALL + SELECT vSupplierFk, + itemFk, + longName, + supplier, + 'previous', + vFromDated, + SUM(`out`), + SUM(`in`), + NULL, + buyingValue + FROM supplierPackaging + WHERE supplierFk = vSupplierFk + AND landed < vFromDated GROUP BY itemFk - ORDER BY landed) i2; + ) sub + GROUP BY itemFk + HAVING entryFk <> 'previous' + ORDER BY landed; - SELECT MAX(`row`) - INTO vMaxRow - FROM tmp.supplierPackagingList; + SELECT MAX(`row`) INTO vMaxRow + FROM tSupplierPackagingList; - DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackaging; - CREATE TEMPORARY TABLE tmp.supplierPackaging( + CREATE OR REPLACE TEMPORARY TABLE tSupplierPackaging( supplierFk INT, itemFk INT, longName VARCHAR(50), @@ -68296,24 +68629,23 @@ BEGIN `out` VARCHAR(50), warehouse INT, buyingValue INT, - balance INT); + balance INT + ); l1: LOOP - + SET @vBalance = 0; IF vCounter = vMaxRow THEN LEAVE l1; ELSE SET vCounter = vCounter + 1; - SET @vBalance = 0; END IF; - SELECT itemFk - INTO vItemFk - FROM tmp.supplierPackagingList + SELECT itemFk INTO vItemFk + FROM tSupplierPackagingList WHERE `row` = vCounter; - INSERT INTO tmp.supplierPackaging - SELECT supplierFk, + INSERT INTO tSupplierPackaging + SELECT supplierFk, itemFk, longName, supplier, @@ -68325,7 +68657,7 @@ BEGIN buyingValue, @vBalance:= (`in` - `out` + @vBalance) FROM ( - SELECT supplierFk, + SELECT supplierFk, itemFk, longName, supplier, @@ -68339,10 +68671,8 @@ BEGIN WHERE supplierFk = vSupplierFk AND landed >= vFromDated AND itemFk = vItemFk - UNION ALL - - SELECT vSupplierFk, + SELECT vSupplierFk, itemFk, longName, supplier, @@ -68357,25 +68687,26 @@ BEGIN AND landed < vFromDated AND itemFk = vItemFk GROUP BY itemFk + ORDER BY landed ) sub - WHERE `out` OR `in` - ORDER BY itemFk, landed; - + WHERE `out` OR `in`; END LOOP l1; - SELECT * FROM tmp.supplierPackaging; - - DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackagingList; - DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackaging; - SET @vRowNumber = 0; - SET @vBalance = 0; + SELECT * + FROM tSupplierPackaging + ORDER BY itemFk, landed; + DROP TEMPORARY TABLE IF EXISTS + tSupplierPackaging, + tSupplierPackagingList; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `supplier_checkBalance` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68383,8 +68714,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL) BEGIN @@ -68421,7 +68750,7 @@ BEGIN - SUM(iid.amount) mysql, 0 sage FROM invoiceInDueDay iid - JOIN invoiceIn ii ON ii.id = iid.invoiceInFk + JOIN invoiceIn ii ON ii.id = iid.invoiceInFk WHERE IFNULL(ii.bookEntried, ii.issued) BETWEEN vDateFrom AND vDateTo AND ii.isBooked GROUP BY ii.id @@ -68463,6 +68792,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `supplier_checkIsActive` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68470,8 +68801,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_checkIsActive`(vSelf INT) BEGIN @@ -68493,6 +68822,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `supplier_disablePayMethodChecked` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68500,8 +68831,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_disablePayMethodChecked`() BEGIN @@ -68529,6 +68858,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `test` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68536,8 +68867,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `test`() BEGIN @@ -68548,6 +68877,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketBoxesView` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68555,20 +68886,18 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketBoxesView`(IN vTicketFk INT) BEGIN - - SELECT s.id, - s.itemFk, - s.concept, - floor(s.quantity / b.packing) as Cajas, - b.packing, - s.isPicked, + + SELECT s.id, + s.itemFk, + s.concept, + floor(s.quantity / b.packing) as Cajas, + b.packing, + s.isPicked, i.size - FROM ticket t + FROM ticket t JOIN sale s ON s.ticketFk = t.id JOIN item i ON i.id = s.itemFk JOIN cache.last_buy lb on lb.warehouse_id = t.warehouseFk AND lb.item_id = s.itemFk @@ -68579,13 +68908,15 @@ BEGIN AND p.isBox GROUP BY s.itemFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketBuiltTime` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68593,15 +68924,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketBuiltTime`(vDate DATE) BEGIN DECLARE vDateStart DATETIME DEFAULT DATE(vDate); DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketBuiltTime; CREATE TEMPORARY TABLE tmp.ticketBuiltTime @@ -68614,7 +68943,7 @@ BEGIN SELECT ticketFk, builtTime FROM ( - SELECT + SELECT ticketFk, created as builtTime FROM @@ -68622,13 +68951,13 @@ BEGIN WHERE created BETWEEN vDateStart AND vDateEnd ORDER BY ticketFk, created DESC LIMIT 10000000000000000000 - ) sub + ) sub GROUP BY ticketFk ) sub2 ON sub2.ticketFk = t.id WHERE t.shipped BETWEEN vDate AND util.dayEnd(vDate) AND t.clientFk NOT IN (50,400,200) AND t.companyFk = 442 - + ; END ;; @@ -68637,6 +68966,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketCalculateClon` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68644,8 +68975,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT) BEGIN @@ -68657,36 +68986,38 @@ BEGIN */ REPLACE INTO orderTicket(orderFk,ticketFk) - SELECT orderFk, vTicketNew - FROM orderTicket + SELECT orderFk, vTicketNew + FROM orderTicket WHERE ticketFk = vTicketOld; - + -- Bionizamos lineas con Preu = 0 CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales (PRIMARY KEY (id)) ENGINE = MEMORY - SELECT id + SELECT id FROM sale WHERE ticketFk = vTicketNew AND price = 0; - + CALL sale_recalcComponent(1); -- Bionizamos lineas con Preu > 0 CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales (PRIMARY KEY (id)) ENGINE = MEMORY - SELECT id + SELECT id FROM sale WHERE ticketFk = vTicketNew AND price > 0; - + CALL sale_recalcComponent(6); DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketCalculateFromType` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68694,8 +69025,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateFromType`( vLanded DATE, vAddressFk INT, @@ -68703,12 +69032,12 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateFromType`( vLanded D vTypeFk INT) BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - (INDEX (itemFk)) - ENGINE = MEMORY + CREATE TEMPORARY TABLE tmp.item + (INDEX (itemFk)) + ENGINE = MEMORY SELECT id itemFk FROM vn.item WHERE typeFk = vTypeFk; - + CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); DROP TEMPORARY TABLE tmp.item; DROP TEMPORARY TABLE tmp.ticketLot; @@ -68718,6 +69047,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketCalculatePurge` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68725,12 +69056,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculatePurge`() BEGIN - DROP TEMPORARY TABLE + DROP TEMPORARY TABLE tmp.ticketCalculateItem, tmp.ticketComponentPrice, tmp.ticketComponent, @@ -68742,6 +69071,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketClon` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68749,67 +69080,67 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon`(vTicketFk INT, vNewShipped DATE) BEGIN - + DECLARE done INT DEFAULT FALSE; - DECLARE vNewTicketFk INT; + DECLARE vNewTicketFk INT; DECLARE vOldSaleFk INT; DECLARE vNewSaleFk INT; - + DECLARE cur1 CURSOR FOR SELECT id FROM vn.sale WHERE ticketFk = vTicketFk; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - + SET vNewShipped = IFNULL(vNewShipped, util.VN_CURDATE()); - + CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - - UPDATE vn.ticket + + UPDATE vn.ticket SET landed = TIMESTAMPADD(DAY, DATEDIFF(vNewShipped, shipped), landed), shipped = vNewShipped WHERE id = vNewTicketFk; - + OPEN cur1; - + read_loop: LOOP - + FETCH cur1 INTO vOldSaleFk; - + IF done THEN LEAVE read_loop; END IF; - + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed) SELECT vNewTicketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed FROM vn.sale WHERE id = vOldSaleFk; - + SELECT max(id) INTO vNewSaleFk FROM vn.sale WHERE ticketFk = vNewTicketFk; - + INSERT INTO vn.saleComponent(saleFk, componentFk, value, isGreuge) SELECT vNewSaleFk, componentFk, value, isGreuge FROM vn.saleComponent WHERE saleFk = vOldSaleFk; - + END LOOP; CLOSE cur1; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketClon_OneYear` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68817,26 +69148,24 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon_OneYear`(vTicketFk INT) BEGIN DECLARE vShipped DATE; DECLARE vMaxDated DATE; - - SELECT shipped, TIMESTAMPADD(YEAR,1,shipped) + + SELECT shipped, TIMESTAMPADD(YEAR,1,shipped) INTO vShipped, vMaxDated FROM vn.ticket WHERE id = vTicketFk; - + WHILE vShipped <= vMaxDated DO - + SET vShipped = TIMESTAMPADD(WEEK, 1, vShipped); - + CALL vn.ticketClon(vTicketFk, vShipped); - + END WHILE; END ;; @@ -68845,6 +69174,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketCollection_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68852,22 +69183,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_get`(vTicketFk INT) BEGIN - SELECT tc.collectionFk + SELECT tc.collectionFk FROM vn.ticketCollection tc WHERE ticketFk = vTicketFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketCollection_setUsedShelves` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68875,29 +69206,29 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_setUsedShelves`(vTicketFk INT, vUsedShelves INT) BEGIN - + /* * Inserta número de baldas que ocupa un ticket - * + * * @param vTicketFk Identificador de ticket * @param vUsedShelves Número de baldas */ - + UPDATE ticketCollection tc SET tc.usedShelves = vUsedShelves WHERE tc.ticketFk = vTicketFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketComponentUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68905,8 +69236,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentUpdate`( vTicketFk INT, @@ -68929,18 +69258,18 @@ BEGIN END; START TRANSACTION; - + IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN - - UPDATE ticket t + + UPDATE ticket t JOIN address a ON a.id = vAddressFk SET t.nickname = a.nickname WHERE t.id = vTicketFk; - + END IF; - + UPDATE ticket t - SET + SET t.clientFk = vClientFk, t.agencyModeFk = vAgencyModeFk, t.addressFk = vAddressFk, @@ -68951,12 +69280,12 @@ BEGIN t.isDeleted = vIsDeleted WHERE t.id = vTicketFk; - + IF vHasToBeUnrouted THEN UPDATE ticket t SET t.routeFk = NULL WHERE t.id = vTicketFk; END IF; - + IF vOption <> 8 THEN DROP TEMPORARY TABLE IF EXISTS tmp.sale; CREATE TEMPORARY TABLE tmp.sale @@ -68976,6 +69305,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketComponentUpdateSale` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -68983,8 +69314,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentUpdateSale`(vOption INT) BEGIN @@ -68998,104 +69327,104 @@ BEGIN DECLARE vComponentFk INT; DECLARE vRenewComponents BOOLEAN; DECLARE vKeepPrices BOOLEAN; - + CASE vOption - WHEN 1 THEN + WHEN 1 THEN SET vRenewComponents = TRUE; SET vKeepPrices = FALSE; WHEN 2 THEN - SELECT id INTO vComponentFk FROM component WHERE `code` = 'debtCollection'; + SELECT id INTO vComponentFk FROM component WHERE `code` = 'debtCollection'; SET vRenewComponents = TRUE; SET vKeepPrices = TRUE; - WHEN 3 THEN - SELECT id INTO vComponentFk FROM component WHERE `code` = 'mana'; + WHEN 3 THEN + SELECT id INTO vComponentFk FROM component WHERE `code` = 'mana'; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + WHEN 4 THEN + SELECT id INTO vComponentFk FROM component WHERE `code` = 'buyerDiscount'; SET vRenewComponents = TRUE; SET vKeepPrices = TRUE; - WHEN 4 THEN - SELECT id INTO vComponentFk FROM component WHERE `code` = 'buyerDiscount'; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - /* WHEN 5 THEN + /* WHEN 5 THEN SET vComponentFk = 35; SET vRenewComponents = TRUE; SET vKeepPrices = TRUE;*/ - WHEN 6 THEN + WHEN 6 THEN SELECT id INTO vComponentFk FROM component WHERE `code` = 'imbalance'; SET vRenewComponents = TRUE; SET vKeepPrices = TRUE; WHEN 7 THEN REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3) + SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3) FROM sale s JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk NOT IN (28, 29) GROUP BY s.id; - + REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3) + SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3) FROM sale s JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk NOT IN (28, 29) GROUP BY s.id; - + SET vRenewComponents = FALSE; SET vKeepPrices = FALSE; WHEN 8 THEN - DELETE sc.* + DELETE sc.* FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk; - + REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3) + SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3) FROM sale s JOIN tmp.sale tmps ON tmps.saleFk = s.id; - + SET vRenewComponents = FALSE; SET vKeepPrices = FALSE; - WHEN 9 THEN + WHEN 9 THEN SET vRenewComponents = TRUE; SET vKeepPrices = TRUE; END CASE; IF vRenewComponents THEN - DELETE sc.* - FROM tmp.sale tmps + DELETE sc.* + FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk JOIN `component` c ON c.id = sc.componentFk WHERE c.isRenewable; - + REPLACE INTO saleComponent(saleFk, componentFk, value) SELECT s.id, tc.componentFk, tc.cost - FROM sale s + FROM sale s JOIN tmp.sale tmps ON tmps.saleFk = s.id JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk = tc.componentFk - LEFT JOIN `component` c ON c.id = tc.componentFk + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + AND sc.componentFk = tc.componentFk + LEFT JOIN `component` c ON c.id = tc.componentFk WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE); - - -- Añadir componente venta por paquete + + -- Añadir componente venta por paquete DROP TEMPORARY TABLE IF EXISTS tmp.sale2; CREATE TEMPORARY TABLE tmp.sale2 (PRIMARY KEY (saleFk)) - ENGINE = MEMORY + ENGINE = MEMORY SELECT * FROM tmp.sale; - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent2; CREATE TEMPORARY TABLE tmp.ticketComponent2 - SELECT * FROM tmp.ticketComponent; - - REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT * FROM tmp.ticketComponent; + + REPLACE INTO saleComponent(saleFk, componentFk, value) SELECT t.id, t.componentFk, t.cost FROM ( SELECT s.id, tc.componentFk, tc.cost, MOD(s.quantity, b.packing) as resto FROM vn.sale s JOIN tmp.sale tmps ON tmps.saleFk = s.id - JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND tmps.warehouseFk = lb.warehouse_id + JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND tmps.warehouseFk = lb.warehouse_id JOIN vn.buy b ON b.id = buy_id JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk - JOIN `component` c ON c.id = tc.componentFk AND c.code = 'salePerPackage' + JOIN `component` c ON c.id = tc.componentFk AND c.code = 'salePerPackage' LEFT JOIN ( SELECT s.id FROM vn.sale s @@ -69106,8 +69435,8 @@ BEGIN ) tp ON tp.id = s.id WHERE tp.id IS NULL HAVING resto <> 0) t; - - DROP TEMPORARY TABLE IF EXISTS + + DROP TEMPORARY TABLE IF EXISTS tmp.sale2, tmp.ticketComponent2; END IF; @@ -69125,26 +69454,26 @@ BEGIN UPDATE sale s JOIN item i on i.id = s.itemFk JOIN itemType it on it.id = i.typeFk - JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk + JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk FROM saleComponent sc JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk GROUP BY sc.saleFk) sc ON sc.saleFk = s.id SET s.price = sumValue / ((100 - s.discount) / 100) - WHERE it.code != 'PRT' ; - + WHERE it.code != 'PRT' ; + REPLACE INTO saleComponent(saleFk, componentFk, value) SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue FROM sale s JOIN tmp.sale tmps ON tmps.saleFk = s.id LEFT JOIN saleComponent sc ON sc.saleFk = s.id WHERE sc.componentFk != 21 - GROUP BY s.id + GROUP BY s.id HAVING ROUND(saleValue, 4) <> 0; END IF; - + UPDATE sale s JOIN ( - SELECT SUM(sc.value) sumValue, sc.saleFk + SELECT SUM(sc.value) sumValue, sc.saleFk FROM saleComponent sc JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk JOIN `component` c ON c.id = sc.componentFk @@ -69158,10 +69487,10 @@ BEGIN JOIN sale s on s.id = sc.saleFk JOIN item i ON i.id = s.itemFk JOIN itemType it ON it.id = i.typeFk - WHERE it.code = 'PRT'; - + WHERE it.code = 'PRT'; + INSERT INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 15, s.price + SELECT s.id, 15, s.price FROM sale s JOIN tmp.sale tmps ON tmps.saleFk = s.id JOIN item i ON i.id = s.itemFK @@ -69173,6 +69502,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketDown_PrintableSelection` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69180,8 +69511,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketDown_PrintableSelection`(vSectorFk INT) BEGIN @@ -69208,6 +69537,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketGetTaxAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69215,8 +69546,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTaxAdd`(vTicketFk INT) BEGIN @@ -69228,30 +69557,32 @@ BEGIN CREATE TEMPORARY TABLE tmp.ticket ENGINE = MEMORY SELECT vTicketFk ticketFk; - + CALL vn.ticket_getTax(NULL); - SELECT + SELECT tt.ticketFk, CAST(tt.taxableBase AS DECIMAL(10, 2)) AS taxableBase, CAST(tt.rate * tt.taxableBase / 100 AS DECIMAL(10, 2)) AS tax, - pgc.*, + pgc.*, CAST(IF(pe.equFk IS NULL, taxableBase, 0) AS DECIMAL(10, 2)) AS Base, pgc.rate / 100 as vatPercent FROM tmp.ticketTax tt JOIN vn.pgc ON pgc.code = tt.pgcFk LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code; - + DROP TEMPORARY TABLE tmp.ticket; DROP TEMPORARY TABLE tmp.ticketTax; DROP TEMPORARY TABLE tmp.ticketAmount; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketGetTax_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69259,8 +69590,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTax_new`() READS SQL DATA @@ -69283,29 +69612,29 @@ BEGIN JOIN ticket t ON t.id = tmpTicket.ticketFk; CALL addressTaxArea (); - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; CREATE TEMPORARY TABLE tmp.ticketTax (INDEX (ticketFk)) ENGINE = MEMORY SELECT tmpTicket.ticketFk, bp.pgcFk, - SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2) + SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2) ) AS taxableBase, SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2) ) * pgc.rate / 100 AS tax, tc.code - + FROM tmp.ticket tmpTicket JOIN sale s ON s.ticketFk = tmpTicket.ticketFk JOIN item i ON i.id = s.itemFk JOIN ticket t ON t.id = tmpTicket.ticketFk JOIN supplier su ON su.id = t.companyFk - JOIN tmp.addressTaxArea ata + JOIN tmp.addressTaxArea ata ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN itemTaxCountry itc + JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk - JOIN bookingPlanner bp + JOIN bookingPlanner bp ON bp.countryFk = su.countryFk AND bp.taxAreaFk = ata.areaFk AND bp.taxClassFk = itc.taxClassFk @@ -69313,7 +69642,7 @@ BEGIN JOIN taxClass tc ON tc.id = bp.taxClassFk GROUP BY tmpTicket.ticketFk, pgc.code HAVING taxableBase != 0; - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; CREATE TEMPORARY TABLE tmp.ticketAmount (INDEX (ticketFk)) @@ -69324,13 +69653,15 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketGetTotal` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69338,14 +69669,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTotal`(vTaxArea VARCHAR(25)) BEGIN /** * Calcula el total con IVA para un conjunto de tickets. - * + * + * @param vTaxArea * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular * @return tmp.ticketTotal Total para cada ticket */ @@ -69361,7 +69691,7 @@ BEGIN FROM tmp.ticket t LEFT JOIN tmp.ticketAmount ta ON t.ticketFk = ta.ticketFk GROUP BY ticketFk; - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; END ;; @@ -69370,6 +69700,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketGetVisibleAvailable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69377,8 +69709,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetVisibleAvailable`( vTicket INT) @@ -69416,6 +69746,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketMissed_List` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69423,8 +69755,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketMissed_List`(vTicketFk INT) BEGIN @@ -69433,18 +69763,18 @@ BEGIN DECLARE vParked DATETIME; DECLARE vLevel INT; DECLARE vCollectionFk INT; - - SELECT IFNULL(`level`,0), IFNULL(collectionFk,0) + + SELECT IFNULL(`level`,0), IFNULL(collectionFk,0) INTO vLevel, vCollectionFk FROM vn.ticketCollection WHERE ticketFk = vTicketFk LIMIT 1; - - SELECT created, parkingFk + + SELECT created, parkingFk INTO vParked, vParkingFk FROM vn.ticketParking WHERE ticketFk = vTicketFk; - + SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia FROM vn.ticketParking tp JOIN vn.parking p ON p.id = tp.parkingFk @@ -69471,13 +69801,15 @@ BEGIN AND sc.isPackagingArea AND tp.created < vParked AND t.packages <=> 0); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketNotInvoicedByClient` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69485,14 +69817,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketNotInvoicedByClient`(vClientFk INT) BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - + CREATE TEMPORARY TABLE tmp.ticket SELECT id ticketFk FROM ticket @@ -69502,7 +69832,7 @@ BEGIN CALL vn.ticketGetTotal(NULL); - SELECT c.id, + SELECT c.id, c.name as Cliente, t.shipped as Fecha, t.id as Id_Ticket, @@ -69513,7 +69843,7 @@ BEGIN DROP TEMPORARY TABLE tmp.ticket, - tmp.ticketTotal; + tmp.ticketTotal; END ;; DELIMITER ; @@ -69521,6 +69851,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketObservation_addNewBorn` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69528,32 +69860,32 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketObservation_addNewBorn`(vTicketFk INT) BEGIN - + /** * Inserta observaciones para los tickets con clientes nuevos o recuperados - * + * * @param vTicketFk Identificador de vn.ticket */ - + DECLARE vDescription VARCHAR(20) DEFAULT '¡Cliente NUEVO! '; INSERT INTO vn.ticketObservation(ticketFk, observationTypeFk, description) SELECT vTicketFk, ot.id, vDescription FROM vn.observationType ot WHERE ot.hasNewBornMessage - ON DUPLICATE KEY UPDATE description = CONCAT(vDescription, ticketObservation.description); - + ON DUPLICATE KEY UPDATE description = CONCAT(vDescription, ticketObservation.description); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketPackaging_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69561,8 +69893,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketPackaging_add`( vClientFk INT, @@ -69587,7 +69917,7 @@ BEGIN DECLARE vComponentCost INT; DECLARE vDone INT DEFAULT FALSE; DECLARE vClientId INT; - + DECLARE vCursor CURSOR FOR SELECT DISTINCT clientFk FROM ( @@ -69604,31 +69934,31 @@ BEGIN RESIGNAL; END; - SELECT id INTO vWarehouseInventory - FROM warehouse + SELECT id INTO vWarehouseInventory + FROM warehouse WHERE `code`= 'inv'; - - SELECT id INTO vComponentCost - FROM component + + SELECT id INTO vComponentCost + FROM component WHERE `code`= 'purchaseValue'; - - SELECT packagingInvoicingDated INTO vDateStart - FROM ticketConfig; - + + SELECT packagingInvoicingDated INTO vDateStart + FROM ticketConfig; + IF vWarehouseInventory IS NULL THEN CALL util.throw('Warehouse inventory not set'); END IF; IF vComponentCost IS NULL THEN CALL util.throw('Component cost not set'); - END IF; + END IF; SET vDateEnd = vDated + INTERVAL 1 DAY; - + IF NOT vWithoutPeriodGrace THEN SET vGraceDate = vGraceDate -INTERVAL 1 MONTH; END IF; - + DROP TEMPORARY TABLE IF EXISTS tmp.packagingToInvoice; CREATE TEMPORARY TABLE tmp.packagingToInvoice (INDEX (clientFk)) @@ -69641,7 +69971,7 @@ BEGIN t.clientFk FROM ticketPackaging tp JOIN packaging p ON p.id = tp.packagingFk - JOIN ticket t ON t.id = tp.ticketFk + JOIN ticket t ON t.id = tp.ticketFk JOIN client c ON c.id = t.clientFk WHERE c.isActive AND (vClientFk IS NULL OR t.clientFk = vClientFk) @@ -69649,7 +69979,7 @@ BEGIN AND (tp.quantity < 0 OR (tp.quantity > 0 AND t.shipped < vGraceDate)) AND tp.quantity AND p.itemFk; - + OPEN vCursor; l: LOOP @@ -69662,25 +69992,25 @@ BEGIN START TRANSACTION; CALL ticket_add( - vClientId, + vClientId, vDateEnd, - vWarehouseInventory, - vCompanyFk, - NULL, - NULL, - NULL, - vDateEnd, - account.myUser_getId(), + vWarehouseInventory, + vCompanyFk, + NULL, + NULL, + NULL, + vDateEnd, + account.myUser_getId(), TRUE, vNewTicket); - + INSERT INTO ticketPackaging(ticketFk, packagingFk, quantity, pvp) SELECT vNewTicket, packagingFk, - SUM(quantity) totalQuantity, price - FROM tmp.packagingToInvoice + FROM tmp.packagingToInvoice WHERE clientFk = vClientId GROUP BY packagingFk HAVING IF(vWithoutPeriodGrace, totalQuantity <> 0, totalQuantity < 0); - + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price) SELECT vNewTicket, pti.itemFk, i.name, SUM(pti.quantity) totalQuantity, pti.price FROM tmp.packagingToInvoice pti @@ -69688,12 +70018,12 @@ BEGIN WHERE pti.clientFk = vClientId GROUP BY pti.itemFk HAVING IF(vWithoutPeriodGrace, totalQuantity <> 0, totalQuantity > 0); - + INSERT INTO saleComponent(saleFk, componentFk, value) SELECT id, vComponentCost, price FROM sale WHERE ticketFk = vNewTicket; - + COMMIT; END LOOP; CLOSE vCursor; @@ -69705,6 +70035,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketParking_findSkipped` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69712,42 +70044,40 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketParking_findSkipped`(vTicketFk INT, vItemPackingTypeFk VARCHAR(1)) BEGIN - + /** * Averigua los tickets que se han saltado por un error en el proceso encajado * @param vTicketFk Ticket * @param vItemPackingTypeFk Modo de encajado * @return un select con los tickets afectados - */ + */ DECLARE vParkingFk INT; DECLARE vParked DATETIME; DECLARE vLevel INT; DECLARE vWagon INT; DECLARE vCollectionFk INT; - - SELECT IFNULL(`level`,0), IFNULL(`wagon`,0),IFNULL(collectionFk,0) + + SELECT IFNULL(`level`,0), IFNULL(`wagon`,0),IFNULL(collectionFk,0) INTO vLevel, vWagon, vCollectionFk FROM vn.ticketCollection tc JOIN vn.collection c ON c.id = tc.collectionFk AND c.itemPackingTypeFk = vItemPackingTypeFk WHERE ticketFk = vTicketFk ORDER BY c.id DESC LIMIT 1; - - SELECT created, parkingFk + + SELECT created, parkingFk INTO vParked, vParkingFk FROM vn.ticketParking tp - JOIN vn.parking p ON p.id = tp.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk WHERE ticketFk = vTicketFk AND s.itemPackingTypeFk = vItemPackingTypeFk AND s.isPackagingArea ; - + SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' ', tc.wagon, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia FROM vn.ticketParking tp JOIN vn.parking p ON p.id = tp.parkingFk @@ -69764,9 +70094,9 @@ BEGIN AND ( ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) OR - ( tc.collectionFk = vCollectionFk + ( tc.collectionFk = vCollectionFk AND (LEFT(tc.wagon,1) < LEFT(vWagon,1) - OR (LEFT(tc.wagon,1) = LEFT(vWagon,1) AND LEFT(tc.level,1) < LEFT(vLevel,1))) + OR (LEFT(tc.wagon,1) = LEFT(vWagon,1) AND LEFT(tc.level,1) < LEFT(vLevel,1))) ) ) ) -- Etiquetas que no se han escaneado y ya estamos con una posterior @@ -69774,7 +70104,7 @@ BEGIN (s.alertLevel > 1 AND tp.parkingFk = vParkingFk AND sc.isPackagingArea - AND tp.created < vParked + AND tp.created < vParked AND t.packages <=> 0); END ;; DELIMITER ; @@ -69782,6 +70112,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketRefund_beforeUpsert` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69789,8 +70121,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketRefund_beforeUpsert`(vRefundTicketFk INT, vOriginalTicketFk INT) BEGIN @@ -69813,6 +70143,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketRequest_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69820,17 +70152,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketRequest_Add`(vDescription VARCHAR(255), vQuantity INT, vPrice DOUBLE, vTicketFk INT, vBuyerCode VARCHAR(3)) BEGIN - INSERT INTO vn.ticketRequest(description, - quantity, - price, - ticketFk, - buyerCode, + INSERT INTO vn.ticketRequest(description, + quantity, + price, + ticketFk, + buyerCode, requesterFk) VALUES(vDescription, vQuantity, @@ -69838,13 +70168,15 @@ BEGIN vTicketFk, vBuyerCode, vn.getUser()); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketStateToday_setState` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69852,31 +70184,29 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45)) BEGIN - + /* Modifica el estado de un ticket de hoy - * + * * @param vTicketFk el id del ticket * @param vStateCode estado a modificar del ticket - * + * */ - + DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM state s - JOIN ticketStateToday tst ON tst.state = s.id + + SELECT s.alertLevel INTO vAlertLevel + FROM state s + JOIN ticketStateToday tst ON tst.state = s.id WHERE tst.ticket = vTicketFk LIMIT 1; - + IF vAlertLevel < 2 THEN - + CALL vn.ticket_setState(vTicketFk, vStateCode); - + END IF; END ;; @@ -69885,6 +70215,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketStateUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69892,28 +70224,26 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateUpdate`(vTicketFk INT, vStateCode VARCHAR(45)) BEGIN - + /* * @deprecated:utilizar ticket_setState */ - + DECLARE vAlertLevel INT; - SELECT s.alertLevel INTO vAlertLevel + SELECT s.alertLevel INTO vAlertLevel FROM vn.state s JOIN vn.ticketState ts ON ts.stateFk = s.id WHERE ts.ticketFk = vTicketFk; - - IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN - + + IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN + INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) SELECT id, vTicketFk, account.myUser_getId() - FROM vn.state + FROM vn.state WHERE `code` = vStateCode collate utf8_unicode_ci; END IF; @@ -69924,6 +70254,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketToInvoiceByAddress` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69931,8 +70263,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByAddress`( vStarted DATE, @@ -69960,6 +70290,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketToInvoiceByDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69967,8 +70299,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByDate`( vStarted DATE, @@ -69996,6 +70326,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketToInvoiceByRef` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70003,8 +70335,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByRef`(IN vInvoiceRef VARCHAR(15)) BEGIN @@ -70056,6 +70386,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70063,8 +70395,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_add`( vClientId INT @@ -70181,6 +70511,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_administrativeCopy` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70188,31 +70520,31 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_administrativeCopy`(vOriginalTicket INT, OUT vNewTicket INT) BEGIN - + INSERT INTO vn.ticket(clientFk, addressFk, shipped, warehouseFk, companyFk, landed) - SELECT t.clientFk , t.addressFk , t.shipped ,w.id, t.companyFk , t.landed + SELECT t.clientFk , t.addressFk , t.shipped ,w.id, t.companyFk , t.landed FROM vn.ticket t JOIN vn.warehouse w ON w.name = 'INVENTARIO' WHERE t.id = vOriginalTicket; - + SELECT LAST_INSERT_ID() INTO vNewTicket; INSERT INTO vn.sale(ticketFk, itemFk, concept, quantity, price, discount) - SELECT vNewTicket, s.itemFk , s.concept , s.quantity , s.price , s.discount + SELECT vNewTicket, s.itemFk , s.concept , s.quantity , s.price , s.discount FROM vn.sale s WHERE s.ticketFk = vOriginalTicket; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_canAdvance` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70220,8 +70552,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT) BEGIN @@ -70351,6 +70681,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_canbePostponed` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70358,8 +70690,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT) BEGIN @@ -70436,6 +70766,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_canMerge` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70443,14 +70775,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) BEGIN /** * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro - * + * * @param vDated Fecha en cuestión * @param vScopeDays Dias en el futuro a sondear * @param vLitersMax Volumen máximo de los tickets a catapultar @@ -70514,6 +70844,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_checkNoComponents` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70521,8 +70853,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME) BEGIN @@ -70531,10 +70861,10 @@ BEGIN * Comprueba que los tickets entre un rango de fechas tienen componentes * y recalcula sus componentes * - * @param vShippedFrom rango inicial de fecha + * @param vShippedFrom rango inicial de fecha * @param vShippedTo rango final de fecha */ - + CREATE OR REPLACE TEMPORARY TABLE tmp.coste (primary key (id)) ENGINE = MEMORY SELECT s.id @@ -70563,15 +70893,17 @@ BEGIN AND ic.merchandise; CALL vn.sale_recalcComponent(1); - + DROP TEMPORARY TABLE tmp.recalculateSales; - DROP TEMPORARY TABLE tmp.coste; + DROP TEMPORARY TABLE tmp.coste; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_Clone` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70579,8 +70911,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_Clone`(vOriginalTicket INT, OUT vNewTicket INT) BEGIN @@ -70646,6 +70976,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_cloneWeekly` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70653,10 +70985,8 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_cloneWeekly`(IN vWeek INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_cloneWeekly`(vWeek INT) BEGIN DECLARE vIsDone BOOL; DECLARE vLanding DATE; @@ -70670,56 +71000,67 @@ BEGIN DECLARE vAgencyModeFk INT; DECLARE vNewTicket INT; DECLARE vYear INT; + DECLARE vSalesPersonFK INT; + DECLARE vItemPicker INT; DECLARE rsTicket CURSOR FOR - SELECT tt.ticketFk, tt.weekDay, t.clientFk, t.warehouseFk, t.companyFk, t.addressFk, tt.agencyModeFk - FROM vn.ticketWeekly tt - JOIN vn.ticket t ON tt.ticketFk = t.id; + SELECT tt.ticketFk, + tt.weekDay, + t.clientFk, + t.warehouseFk, + t.companyFk, + t.addressFk, + tt.agencyModeFk + FROM ticketWeekly tt + JOIN ticket t ON tt.ticketFk = t.id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE; - SET vYear = YEAR(util.VN_CURDATE()) + IF(vWeek < WEEK(util.VN_CURDATE()),1, 0); + SET vYear = YEAR(util.VN_CURDATE()) + IF(vWeek < WEEK(util.VN_CURDATE()),1, 0); OPEN rsTicket; myLoop: LOOP BEGIN DECLARE vSalesPersonEmail VARCHAR(150); - DECLARE vMailSent BOOL; + DECLARE vIsDuplicateMail BOOL; DECLARE vSubject VARCHAR(150); DECLARE vMessage TEXT; - + SET vIsDone = FALSE; FETCH rsTicket INTO vTicketFk, vWeekDay, vClientFk, vWarehouseFk, vCompanyFk, vAddressFk, vAgencyModeFk; IF vIsDone THEN LEAVE myLoop; END IF; - - SELECT dated INTO vShipment + + SELECT dated INTO vShipment FROM `time` WHERE `year` = vYear AND `week` = vWeek AND WEEKDAY(dated) = vWeekDay; -- busca si el ticket ya ha sido clonado - IF (SELECT COUNT(*) FROM vn.ticket tOrig - JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk - JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id - JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk - JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk - WHERE tOrig.id = vTicketFk AND tClon.isDeleted = FALSE AND DATE(tClon.shipped) = vShipment) > 0 + IF EXISTS (SELECT TRUE FROM ticket tOrig + JOIN sale saleOrig ON tOrig.id = saleOrig.ticketFk + JOIN saleCloned sc ON sc.saleOriginalFk = saleOrig.id + JOIN sale saleClon ON saleClon.id = sc.saleClonedFk + JOIN ticket tClon ON tClon.id = saleClon.ticketFk + WHERE tOrig.id = vTicketFk + AND tClon.isDeleted = FALSE + AND DATE(tClon.shipped) = vShipment) THEN ITERATE myLoop; END IF; IF vAgencyModeFk IS NULL THEN - SELECT agencyModeFk INTO vAgencyModeFk + SELECT agencyModeFk INTO vAgencyModeFk FROM address - WHERE clientFk = vClientFk AND isDefaultAddress; + WHERE clientFk = vClientFk + AND isDefaultAddress; END IF; - CALL vn.zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk,FALSE); + CALL zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk,FALSE); SET vLanding = NULL; - SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1; + SELECT landed INTO vLanding FROM tmp.zoneGetLanded LIMIT 1; CALL ticket_add( vClientFk, @@ -70734,72 +71075,127 @@ BEGIN FALSE, vNewTicket); - UPDATE ticket - SET clonedFrom = vTicketFk + UPDATE ticket + SET clonedFrom = vTicketFk WHERE id = vNewTicket; - IF (vLanding IS NULL) THEN - - SELECT e.email INTO vSalesPersonEmail - FROM vn.client c - JOIN vn.worker sp ON sp.id = c.salesPersonFk - JOIN account.emailUser e ON e.userFk = sp.userFk - WHERE c.id = vClientFk; - - SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicketFk, - ' para el dia: ', vShipment); - SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicketFk, - ' para el dia: ', vShipment, - ' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket, - ' pero ha que revisar las fechas y la agencia'); - - SELECT COUNT(*) INTO vMailSent - FROM vn.mail - WHERE receiver = vSalesPersonEmail - AND subject = vSubject; - - IF NOT vMailSent THEN - CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage); - END IF; - CALL vn.ticketStateUpdate (vNewTicket, 'FIXING'); - END IF; - - INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed) - SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed - FROM vn.sale saleOrig + INSERT INTO sale (ticketFk, itemFk, concept, quantity, price, + discount, priceFixed, isPriceFixed) + SELECT vNewTicket, + saleOrig.itemFk, + saleOrig.concept, + saleOrig.quantity, + saleOrig.price, + saleOrig.discount, + saleOrig.priceFixed, + saleOrig.isPriceFixed + FROM sale saleOrig WHERE saleOrig.ticketFk = vTicketFk; - INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk) + INSERT IGNORE INTO saleCloned(saleOriginalFk, saleClonedFk) SELECT saleOriginal.id, saleClon.id - FROM vn.sale saleOriginal - JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity - WHERE saleOriginal.ticketFk = vTicketFk AND saleClon.ticketFk = vNewTicket; + FROM sale saleOriginal + JOIN sale saleClon ON saleOriginal.itemFk = saleClon.itemFk + AND saleOriginal.quantity = saleClon.quantity + WHERE saleOriginal.ticketFk = vTicketFk + AND saleClon.ticketFk = vNewTicket; - INSERT INTO ticketRequest (description,ordered,shipped,quantity,price,itemFk,clientFk,response, - total,buyed,requesterFk,attenderFk,ticketFk) - SELECT description,ordered,shipped,quantity,price,itemFk,clientFk,response, - total,buyed,requesterFk,attenderFk,vNewTicket + INSERT INTO ticketRequest (description, + ordered, + shipped, + quantity, + price, + itemFk, + clientFk, + response, + total, + buyed, + requesterFk + ,attenderFk, + ticketFk) + SELECT description, + ordered, + shipped, + quantity, + price, + itemFk, + clientFk, + response, + total, + buyed, + requesterFk, + attenderFk, + vNewTicket FROM ticketRequest WHERE ticketFk =vTicketFk; - INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) VALUES(vNewTicket,4,CONCAT('turno desde ticket: ',vTicketFk)) - ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); + SELECT id INTO vSalesPersonFK + FROM observationType + WHERE code = 'salesPerson'; - INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) VALUES(vNewTicket,1,'ATENCION: Contiene lineas de TURNO') - ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); + SELECT id INTO vItemPicker + FROM observationType + WHERE code = 'itemPicker'; + + INSERT INTO ticketObservation( + ticketFk, + observationTypeFk, + description) + VALUES( + vNewTicket, + vSalesPersonFK, + CONCAT('turno desde ticket: ',vTicketFk)) + ON DUPLICATE KEY UPDATE description = + CONCAT(ticketObservation.description,VALUES(description),' '); + + INSERT INTO ticketObservation(ticketFk, + observationTypeFk, + description) + VALUES( + vNewTicket, + vItemPicker, + 'ATENCION: Contiene lineas de TURNO') + ON DUPLICATE KEY UPDATE description = + CONCAT(ticketObservation.description,VALUES(description),' '); + + IF (vLanding IS NULL) THEN + + SELECT e.email INTO vSalesPersonEmail + FROM client c + JOIN account.emailUser e ON e.userFk = c.salesPersonFk + WHERE c.id = vClientFk; + + SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', + vTicketFk,' para el dia: ', vShipment); + SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicketFk, + ' para el dia: ', vShipment, + ' porque no hay una zona de envío disponible. Se ha creado el ticket: ', + vNewTicket, ' pero ha que revisar las fechas y la agencia'); + + SELECT COUNT(*) INTO vIsDuplicateMail + FROM mail + WHERE receiver = vSalesPersonEmail + AND subject = vSubject; + + IF NOT vIsDuplicateMail THEN + CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage); + END IF; + CALL ticketStateUpdate (vNewTicket, 'FIXING'); + ELSE + CALL ticketCalculateClon(vNewTicket, vTicketFk); + END IF; - CALL vn.ticketCalculateClon(vNewTicket, vTicketFk); END; END LOOP; - CLOSE rsTicket; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_close` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70807,13 +71203,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_close`() BEGIN /** - * Realiza el cierre de todos los + * Realiza el cierre de todos los * tickets de la tabla tmp.ticket_close. * * @table tmp.ticket_close(ticketFk) Identificadores de los tickets a cerrar @@ -70831,7 +71225,7 @@ BEGIN DECLARE cur CURSOR FOR SELECT ticketFk FROM tmp.ticket_close; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN RESIGNAL; @@ -70841,7 +71235,7 @@ BEGIN proc: LOOP SET vDone = FALSE; - + FETCH cur INTO vCurTicketFk; IF vDone THEN @@ -70858,12 +71252,12 @@ BEGIN c.hasToInvoice INTO vClientFk, vIsTaxDataChecked, - vCompanyFk, + vCompanyFk, vShipped, vHasDailyInvoice, vWithPackage, vHasToInvoice - FROM ticket t + FROM ticket t JOIN `client` c ON c.id = t.clientFk JOIN province p ON p.id = c.provinceFk LEFT JOIN autonomy a ON a.id = p.autonomyFk @@ -70873,22 +71267,22 @@ BEGIN INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) (SELECT vCurTicketFk, p.id, COUNT(*) - FROM expedition e + FROM expedition e JOIN packaging p ON p.itemFk = e.freightItemFk WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable AND vWithPackage GROUP BY p.itemFk); -- No retornables o no catalogados - INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed) + INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed) (SELECT e.freightItemFk, vCurTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.freightItemFk, vClientFk), 1 - FROM expedition e + FROM expedition e JOIN item i ON i.id = e.freightItemFk LEFT JOIN packaging p ON p.itemFk = i.id WHERE e.ticketFk = vCurTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 AND getSpecialPrice(e.freightItemFk, vClientFk) > 0 GROUP BY e.freightItemFk); - + IF(vHasDailyInvoice) AND vHasToInvoice THEN -- Facturacion rapida @@ -70896,10 +71290,10 @@ BEGIN -- Facturar si está contabilizado IF vIsTaxDataChecked THEN CALL invoiceOut_newFromClient( - vClientFk, - (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), - vShipped, - vCompanyFk, + vClientFk, + (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), + vShipped, + vCompanyFk, NULL, NULL, vNewInvoiceId); @@ -70916,6 +71310,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_closeByTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70923,8 +71319,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_closeByTicket`(IN vTicketFk int) BEGIN @@ -70956,6 +71350,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_componentMakeUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -70963,29 +71359,27 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentMakeUpdate`( - vTicketFk INT, + vTicketFk INT, vClientFk INT, - vNickname VARCHAR(50), + vNickname VARCHAR(50), vAgencyModeFk INT, - vAddressFk INT, - vZoneFk INT, + vAddressFk INT, + vZoneFk INT, vWarehouseFk INT, - vCompanyFk INT, + vCompanyFk INT, vShipped DATETIME, - vLanded DATE, + vLanded DATE, vIsDeleted BOOLEAN, - vHasToBeUnrouted BOOLEAN, + vHasToBeUnrouted BOOLEAN, vOption INT) BEGIN - + /** * Modifica en el ticket los campos que se le pasan por parámetro * y cambia sus componentes - * + * * @param vTicketFk Id del ticket a modificar * @param vClientFk nuevo cliente * @param vNickname nuevo alias @@ -71000,29 +71394,29 @@ BEGIN * @param vHasToBeUnrouted si se le elimina la ruta al ticket * @param vOption opcion para el case del proc ticketComponentUpdateSale */ - + DECLARE vPrice DECIMAL(10,2); DECLARE vBonus DECIMAL(10,2); CALL ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk); IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN - - UPDATE ticket t + + UPDATE ticket t JOIN address a ON a.id = vAddressFk SET t.nickname = a.nickname WHERE t.id = vTicketFk; - + END IF; CALL zone_getShipped(vLanded, vAddressFk, vAgencyModeFk, TRUE); - SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus + SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus FROM tmp.zoneGetShipped WHERE shipped BETWEEN DATE(vShipped) AND util.dayEnd(vShipped) AND warehouseFk = vWarehouseFk LIMIT 1; - + UPDATE ticket t - SET + SET t.clientFk = vClientFk, t.nickname = vNickname, t.agencyModeFk = vAgencyModeFk, @@ -71037,12 +71431,12 @@ BEGIN t.isDeleted = vIsDeleted WHERE t.id = vTicketFk; - + IF vHasToBeUnrouted THEN UPDATE ticket t SET t.routeFk = NULL WHERE t.id = vTicketFk; END IF; - + IF vOption <> 8 THEN DROP TEMPORARY TABLE IF EXISTS tmp.sale; CREATE TEMPORARY TABLE tmp.sale @@ -71068,6 +71462,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_componentPreview` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71075,12 +71471,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentPreview`( vTicketFk INT, - vLanded DATE, + vLanded DATE, vAddressFk INT, vZoneFk INT, vWarehouseFk SMALLINT) @@ -71096,7 +71490,7 @@ BEGIN * * @return tmp.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost) */ - DECLARE vHasDataChanged BOOL DEFAULT FALSE; + DECLARE vHasDataChanged BOOL DEFAULT FALSE; DECLARE vHasAddressChanged BOOL; DECLARE vHasZoneChanged BOOL DEFAULT FALSE; DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE; @@ -71107,8 +71501,8 @@ BEGIN DECLARE vHasChangeAll BOOL DEFAULT FALSE; - SELECT DATE(landed) <> vLanded, - addressFk <> vAddressFk, + SELECT DATE(landed) <> vLanded, + addressFk <> vAddressFk, zoneFk <> vZoneFk, warehouseFk <> vWarehouseFk INTO @@ -71131,15 +71525,15 @@ BEGIN SET vAgencyModeTypeRateFk = 6; END IF; - SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped + SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped FROM zone WHERE id = vZoneFk; - + CALL buyUltimate(vWarehouseFk, vShipped); - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY ( - SELECT + CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY ( + SELECT vWarehouseFk AS warehouseFk, NULL AS available, s.itemFk, @@ -71159,9 +71553,9 @@ BEGIN JOIN sale s ON s.id = sc.saleFk JOIN ticket t ON t.id = s.ticketFk JOIN `component` c ON c.id = sc.componentFk - WHERE s.ticketFk = vTicketFk - AND (c.isRenewable = FALSE - OR + WHERE s.ticketFk = vTicketFk + AND (c.isRenewable = FALSE + OR (NOT vHasChangeAll AND (NOT (c.typeFk <=> vAddressTypeRateFk OR c.typeFk <=> vAgencyModeTypeRateFk)))); @@ -71182,6 +71576,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_DelayTruck` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71189,8 +71585,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT) BEGIN @@ -71229,6 +71623,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_DelayTruckSplit` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71236,57 +71632,55 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_DelayTruckSplit`(vTicketFk INT) BEGIN - + /* * Splita las lineas de ticket que no estan ubicadas - * + * */ - + DECLARE vNewTicketFk INT; DECLARE vTotalLines INT; DECLARE vLinesToSplit INT; DROP TEMPORARY TABLE IF EXISTS tmp.SalesToSplit; - + SELECT COUNT(*) INTO vTotalLines - FROM vn.sale + FROM vn.sale WHERE ticketFk = vTicketFk; - + CREATE TEMPORARY TABLE tmp.SalesToSplit SELECT s.id saleFk FROM vn.ticket t - JOIN vn.sale s ON t.id = s.ticketFk - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = s.itemFk AND issw.warehouseFk = t.warehouseFk + JOIN vn.sale s ON t.id = s.ticketFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = s.itemFk AND issw.warehouseFk = t.warehouseFk WHERE s.quantity > IFNULL(issw.visible, 0) AND s.quantity > 0 AND s.isPicked = FALSE AND s.reserved = FALSE AND t.id = vTicketFk; - + SELECT COUNT(*) INTO vLinesToSplit FROM tmp.SalesToSplit; - + IF vLinesToSplit = vTotalLines AND vLinesToSplit > 0 THEN - + SET vNewTicketFk = vTicketFk; - + ELSE - + CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - - UPDATE vn.sale s - JOIN tmp.SalesToSplit sts ON sts.saleFk = s.id + + UPDATE vn.sale s + JOIN tmp.SalesToSplit sts ON sts.saleFk = s.id SET s.ticketFk = vNewTicketFk; - + END IF; - + CALL vn.ticketStateUpdate(vNewTicketFk, 'FIXING'); - + DROP TEMPORARY TABLE tmp.SalesToSplit; END ;; @@ -71295,6 +71689,110 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ticket_doCmr` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_doCmr`(vSelf INT) +BEGIN +/** +* Crea u actualiza la información del CMR asociado con +* un ticket específico en caso de que sea necesario. +* +* @param vSelf El id del ticket +*/ + DECLARE vCmrFk, vPreviousCmrFk, vCurrentCmrFk INT; + SELECT cmrFk INTO vCmrFk + FROM ticket + WHERE id = vSelf; + + CREATE OR REPLACE TEMPORARY TABLE tTicket + SELECT wo.firstName, + v.numberPlate, + com.id companyFk, + a.id addressFk, + c2.defaultAddressFk, + su.id supplierFk, + t.landed + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN `state` s ON s.id = ts.stateFk + JOIN alertLevel al ON al.id = s.alertLevel + JOIN client c ON c.id = t.clientFk + JOIN `address` a ON a.id = t.addressFk + JOIN province p ON p.id = a.provinceFk + JOIN country co ON co.id = p.countryFk + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + JOIN warehouse w ON w.id = t.warehouseFk + JOIN company com ON com.id = t.companyFk + JOIN client c2 ON c2.id = com.clientFk + JOIN supplierAccount sa ON sa.id = com.supplierAccountFk + JOIN supplier su ON su.id = sa.supplierFk + LEFT JOIN route r ON r.id = t.routeFk + LEFT JOIN worker wo ON wo.id = r.workerFk + LEFT JOIN vehicle v ON v.id = r.vehicleFk + WHERE t.shipped BETWEEN util.yesterday() AND util.dayEnd(util.VN_CURDATE()) + AND al.code IN ('PACKED', 'DELIVERED') + AND co.code <> 'ES' + AND am.name <> 'ABONO' + AND w.code = 'ALG' + AND dm.code = 'DELIVERY' + AND t.id = vSelf + GROUP BY t.id; + + START TRANSACTION; + + IF vCmrFk THEN + UPDATE cmr c + JOIN tTicket t + SET c.senderInstruccions = t.firstName, + c.truckPlate = t.numberPlate, + c.companyFk = t.companyFk, + c.addressToFk = t.addressFk, + c.addressFromFk = t.defaultAddressFk, + c.supplierFk = t.supplierFk, + c.ead = t.landed + WHERE id = vCmrFk; + ELSE + SELECT MAX(id) INTO vPreviousCmrFk FROM cmr; + + INSERT INTO cmr ( + senderInstruccions, + truckPlate, + companyFk, + addressToFk, + addressFromFk, + supplierFk, + ead + ) + SELECT * FROM tTicket; + + SELECT MAX(id) INTO vCurrentCmrFk FROM cmr; + + IF vPreviousCmrFk <> vCurrentCmrFk THEN + UPDATE ticket + SET cmrFk = vCurrentCmrFk + WHERE id = vSelf; + END IF; + END IF; + + COMMIT; + DROP TEMPORARY TABLE tTicket; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_doRecalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71302,8 +71800,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_doRecalc`() proc: BEGIN @@ -71361,6 +71857,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_getFromFloramondo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71368,8 +71866,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getFromFloramondo`(vDateFrom DATE, vDateTo DATE) BEGIN @@ -71501,6 +71997,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_getMovable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71508,8 +72006,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) BEGIN @@ -71521,43 +72017,45 @@ BEGIN * @param vTicketFk -> Ticket * @param vDatedNew -> Nueva fecha * @return Sales con Movible -*/ +*/ DECLARE vDatedOld DATETIME; SET vDatedNew = DATE_ADD(vDatedNew, INTERVAL 1 DAY); SELECT t.shipped INTO vDatedOld - FROM ticket t + FROM ticket t WHERE t.id = vTicketFk; - CALL itemStock(vWarehouseFk, vDatedNew, NULL); + CALL item_getStock(vWarehouseFk, vDatedNew, NULL); CALL item_getMinacum(vWarehouseFk, vDatedNew, DATEDIFF(DATE_SUB(vDatedOld, INTERVAL 1 DAY), vDatedNew), NULL); - - SELECT s.id, - s.itemFk, - s.quantity, - s.concept, - s.price, + + SELECT s.id, + s.itemFk, + s.quantity, + s.concept, + s.price, s.reserved, - s.discount, - i.image, - i.subName, + s.discount, + i.image, + i.subName, il.stock + IFNULL(im.amount, 0) AS movable FROM ticket t JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk + JOIN item i ON i.id = s.itemFk LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk AND im.warehouseFk = vWarehouseFk LEFT JOIN tmp.itemList il ON il.itemFk = s.itemFk WHERE t.id = vTicketFk; DROP TEMPORARY TABLE IF EXISTS tmp.itemList; - DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; - + DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_getProblems` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71565,8 +72063,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getProblems`(IN vIsTodayRelative tinyint(1)) BEGIN @@ -71580,10 +72076,10 @@ BEGIN CALL sale_getProblems(vIsTodayRelative); DROP TEMPORARY TABLE IF EXISTS tmp.ticket_problems; - CREATE TEMPORARY TABLE tmp.ticket_problems + CREATE TEMPORARY TABLE tmp.ticket_problems (PRIMARY KEY (ticketFk)) ENGINE = MEMORY - SELECT + SELECT ticketFk, MAX(p.isFreezed) isFreezed, MAX(p.risk) risk, @@ -71601,7 +72097,7 @@ BEGIN GROUP BY ticketFk; UPDATE tmp.ticket_problems tp - SET tp.totalProblems = + SET tp.totalProblems = ( (tp.isFreezed) + IF(tp.risk, TRUE, FALSE) + @@ -71623,6 +72119,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_getSplitList` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71630,8 +72128,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getSplitList`(vDated DATE, vHour TIME, vWarehouseFk INT) BEGIN @@ -71655,17 +72151,17 @@ BEGIN (saleFk INT PRIMARY KEY, ticketFk INT, problem VARCHAR(1)) ENGINE = MEMORY; - + INSERT INTO tmp.salesToSplit(saleFk, ticketFk, problem) SELECT s.id, s.ticketFk, 'F' FROM vn.ticket t JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk JOIN vn.itemType it on it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk WHERE IFNULL(v.visible,0) < s.quantity AND IFNULL(av.available ,0) < s.quantity AND IFNULL(issw.visible, 0) < s.quantity @@ -71675,16 +72171,16 @@ BEGIN AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND NOT i.generic AND t.warehouseFk = vWarehouseFk; - + INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem) SELECT s.id, s.ticketFk, 'I' - FROM vn.ticket t + FROM vn.ticket t JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk JOIN vn.itemType it on it.id = i.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk WHERE IFNULL(v.visible,0) >= s.quantity AND IFNULL(issw.visible, 0) < s.quantity AND s.quantity > 0 @@ -71694,7 +72190,7 @@ BEGIN AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND NOT i.generic AND t.warehouseFk = vWarehouseFk; - + INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem) SELECT s.id, s.ticketFk, 'R' FROM vn.ticket t @@ -71704,7 +72200,7 @@ BEGIN JOIN vn.itemCategory ic ON ic.id = it.categoryFk LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk WHERE IFNULL(v.visible,0) < s.quantity AND IFNULL(av.available ,0) >= s.quantity AND IFNULL(issw.visible, 0) < s.quantity @@ -71715,7 +72211,7 @@ BEGIN AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND NOT i.generic AND t.warehouseFk = vWarehouseFk; - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketsToSplit; CREATE TEMPORARY TABLE tmp.ticketsToSplit @@ -71736,11 +72232,11 @@ BEGIN JOIN vn.ticket t ON t.id = ss.ticketFk JOIN vn.sale s ON s.id = ss.saleFk JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk GROUP BY ss.ticketFk; - - SELECT - ts.*, + + SELECT + ts.*, t.id ticketFuture, st.name state, zc.`hour` tfEtd, @@ -71749,23 +72245,23 @@ BEGIN FROM tmp.ticketsToSplit ts LEFT JOIN vn.ticketState ts2 ON ts2.ticketFk = ts.ticketFk LEFT JOIN vn.state st ON st.id = ts2.stateFk - LEFT JOIN vn.ticket t - ON t.id != ts.ticketFk + LEFT JOIN vn.ticket t + ON t.id != ts.ticketFk AND t.addressFk = ts.addressFk AND t.shipped BETWEEN vDated AND util.dayend(vDated) LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = vDated LEFT JOIN vn.sale s ON s.ticketFk = t.id LEFT JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id + LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id LEFT JOIN vn.state st2 ON st2.id = tst.stateFk - WHERE (t.id IS NULL + WHERE (t.id IS NULL OR (vDated > util.VN_CURDATE()) OR (vDated = util.VN_CURDATE() AND vHour >= zc.`hour`)) AND ts.etd <= vHour GROUP BY ts.ticketFk, t.id ORDER BY ts.etd, ts.ticketFk; - - DROP TEMPORARY TABLE + + DROP TEMPORARY TABLE tmp.ticketsToSplit; END ;; DELIMITER ; @@ -71773,6 +72269,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_getTax` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71780,8 +72278,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getTax`(IN vTaxArea VARCHAR(25)) BEGIN @@ -71802,7 +72298,7 @@ BEGIN JOIN ticket t ON t.id = tmpTicket.ticketFk; CALL addressTaxArea (); - + IF vTaxArea IS NOT NULL THEN UPDATE tmp.addressTaxArea SET areaFk = vTaxArea; @@ -71874,8 +72370,8 @@ BEGIN CREATE TEMPORARY TABLE tmp.ticketAmount (INDEX (ticketFk)) ENGINE = MEMORY - SELECT ticketFk, - taxableBase, + SELECT ticketFk, + taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax, code FROM tmp.ticketTax @@ -71889,6 +72385,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_getWarnings` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71896,8 +72394,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getWarnings`() BEGIN @@ -71944,6 +72440,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_getWithParameters` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71951,15 +72449,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getWithParameters`( - vClientFk INT, + vClientFk INT, vWarehouseFk INT, - vShipped DATE, - vAddressFk INT, - vCompanyFk INT, + vShipped DATE, + vAddressFk INT, + vCompanyFk INT, vAgencyModeFk INT, OUT vTicketFk INT ) @@ -71973,8 +72469,8 @@ BEGIN * @param vAddressFk Consignatario * @param vCompanyFk Empresa * @param vAgencyModeFk agencia - */ - + */ + SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.clientFk <=> vClientFk @@ -71984,7 +72480,7 @@ BEGIN AND (t.companyFk <=> vCompanyFk OR vCompanyFk IS NULL) AND (t.agencyModeFk <=> vAgencyModeFk OR vAgencyModeFk IS NULL) LIMIT 1; - + IF vTicketFk IS NULL THEN CALL vn.ticket_add( vClientFk, @@ -72006,6 +72502,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_insertZone` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72013,8 +72511,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_insertZone`() BEGIN @@ -72024,24 +72520,24 @@ BEGIN DECLARE vAddressFk INT; DECLARE vAgencyModeFk INT; DECLARE vWarehouseFk INT; - DECLARE vCursor CURSOR FOR + DECLARE vCursor CURSOR FOR SELECT id, landed, addressFk, agencyModeFk, warehouseFk FROM vn.ticket WHERE shipped > '2020-01-01' AND zoneFk is null; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET vDone = 1; - + OPEN vCursor; REPEAT FETCH vCursor INTO vFechedTicket, vLanded, vAddressFk, vAgencyModeFk, vWarehouseFk; CALL vn.zone_getShipped (vlanded, vAddressFk, vAgencyModeFk, TRUE); - + UPDATE vn.ticket t JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = vWarehouseFk SET t.zoneFk = zgs.zoneFk WHERE t.id = vFechedTicket; - + UNTIL vDone END REPEAT; DROP TEMPORARY TABLE tmp.zoneGetShipped; - + CLOSE vCursor; END ;; DELIMITER ; @@ -72049,6 +72545,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_priceDifference` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72056,19 +72554,17 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_priceDifference`( vTicketFk INT, - vLanded DATE, + vLanded DATE, vAddressFk INT, vZoneFk INT, vWarehouseFk INT) BEGIN /** * Devuelve las diferencias de precio de los movimientos de un ticket. - * + * * @param vTicketFk Id del ticket * @param vLanded Fecha de recepcion * @param vAddressFk Id del consignatario @@ -72077,26 +72573,26 @@ BEGIN */ CALL vn.ticket_componentPreview(vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk); - SELECT s.itemFk, - i.name, - i.size, - i.category, - IFNULL(s.quantity, 0) AS quantity, - IFNULL(s.price, 0) AS price, + SELECT s.itemFk, + i.name, + i.size, + i.category, + IFNULL(s.quantity, 0) AS quantity, + IFNULL(s.price, 0) AS price, ROUND(SUM(tc.cost), 2) AS newPrice, s.quantity * (s.price - ROUND(SUM(tc.cost), 2)) difference, s.id AS saleFk FROM sale s - JOIN item i ON i.id = s.itemFk - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN tmp.ticketComponentPreview tc ON tc.itemFk = s.itemFk + JOIN item i ON i.id = s.itemFk + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN tmp.ticketComponentPreview tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = vWarehouseFk - LEFT JOIN saleComponent sc ON sc.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk = tc.componentFk - LEFT JOIN `component` c ON c.id = tc.componentFk - WHERE t.id = vTicketFk - AND IF(sc.componentFk IS NULL - AND c.classRate IS NOT NULL, FALSE, TRUE) + LEFT JOIN `component` c ON c.id = tc.componentFk + WHERE t.id = vTicketFk + AND IF(sc.componentFk IS NULL + AND c.classRate IS NOT NULL, FALSE, TRUE) GROUP BY s.id ORDER BY s.id; DROP TEMPORARY TABLE tmp.ticketComponentPreview; @@ -72106,6 +72602,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_printLabelPrevious` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72113,13 +72611,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_printLabelPrevious`(vTicketFk INT) BEGIN /** - * Calls the report_print procedure and passes it + * Calls the report_print procedure and passes it * the necessary parameters for printing. * * @param vTicketFk id ticket to print. @@ -72127,18 +72623,18 @@ BEGIN DECLARE vPrinterFk INT; DECLARE vSaleGroup INT; DECLARE vUserFk INT DEFAULT account.myUser_getId(); - - SELECT sg.id, w.labelerFk INTO vSaleGroup, vPrinterFk + + SELECT sg.id, o.labelerFk INTO vSaleGroup, vPrinterFk FROM saleGroup sg JOIN sector sc ON sc.id = sg.sectorFk - JOIN saleGroupDetail sgd ON sg.id = sgd.saleGroupFk + JOIN saleGroupDetail sgd ON sg.id = sgd.saleGroupFk JOIN sale s ON sgd.saleFk = s.id JOIN ticket t ON s.ticketFk = t.id - JOIN worker w ON w.id = vUserFk - WHERE sc.id = w.sectorFk + JOIN operator o ON o.workerFk = vUserFk + WHERE sc.id = o.sectorFk AND t.id = vTicketFk LIMIT 1; - + CALL report_print( 'LabelPrevia', vPrinterFk, @@ -72152,6 +72648,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_recalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72159,25 +72657,23 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalc`(vSelf INT, vTaxArea VARCHAR(25)) proc:BEGIN /** * Calcula y guarda el total con/sin IVA en un ticket. * - * @param vTicketId Identificador del ticket + * @param vSelf Identificador del ticket + * @param vTaxArea */ - DECLARE hasInvoice BOOL; - SELECT COUNT(*) INTO hasInvoice - FROM ticket + SELECT COUNT(*) INTO hasInvoice + FROM ticket WHERE id = vSelf AND refFk IS NOT NULL; - - IF hasInvoice THEN + + IF hasInvoice THEN LEAVE proc; END IF; @@ -72202,6 +72698,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_recalcComponents` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72209,8 +72707,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponents`(vSelf INT, vOption INT) proc: BEGIN @@ -72236,6 +72732,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_requestRecalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72243,8 +72741,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_requestRecalc`(vSelf INT) proc: BEGIN @@ -72264,6 +72760,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_setNextState` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72271,8 +72769,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setNextState`(vSelf INT) BEGIN @@ -72300,6 +72796,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_setParking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72307,8 +72805,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setParking`(IN `vTicketFk` VARCHAR(8), IN `vParkingFk` INT) proc: BEGIN @@ -72355,6 +72851,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_setPreviousState` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72362,8 +72860,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setPreviousState`(vTicketFk INT) BEGIN @@ -72400,6 +72896,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_setState` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72407,68 +72905,72 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`(vSelf INT, vStateCode VARCHAR(255) COLLATE utf8_general_ci) -BEGIN -/** - * Modifica el estado de un ticket si se cumplen las condiciones necesarias. - * - * @param vSelf el id del ticket - * @param vStateCode estado a modificar del ticket - */ - DECLARE vticketAlertLevel INT; - DECLARE vTicketStateCode VARCHAR(255); - DECLARE vCanChangeState BOOL; - DECLARE vPackedAlertLevel INT; - DECLARE vOnPreparationAlertLevel INT; - DECLARE vNextAlertLevel INT; - DECLARE vZoneFk INT; - - SELECT s.alertLevel, s.`code`, s2.alertLevel, t.zoneFk - INTO vticketAlertLevel, vTicketStateCode, vNextAlertLevel , vZoneFk - FROM state s - JOIN ticketTracking tt ON tt.stateFk = s.id - JOIN state s2 ON s2.code = vStateCode - JOIN ticket t ON t.id = tt.ticketFk - WHERE tt.ticketFk = vSelf - ORDER BY tt.created DESC - LIMIT 1; - - SELECT id INTO vPackedAlertLevel FROM alertLevel WHERE code = 'PACKED'; - SELECT id INTO vOnPreparationAlertLevel FROM alertLevel WHERE code = 'ON_PREPARATION'; - - IF vStateCode = 'OK' AND vZoneFk IS NULL THEN - CALL util.throw('ASSIGN_ZONE_FIRST'); - END IF; - - IF vNextAlertLevel > vticketAlertLevel && vticketAlertLevel < vOnPreparationAlertLevel THEN - UPDATE sale - SET originalQuantity = quantity - WHERE ticketFk = vSelf; - END IF; - - SET vCanChangeState = (vStateCode <> 'ON_CHECKING' OR vticketAlertLevel < vPackedAlertLevel) - AND NOT ( - vTicketStateCode IN ('CHECKED', 'CHECKING') - AND vStateCode IN ('PREPARED', 'ON_PREPARATION') - ); - - IF vCanChangeState THEN - INSERT INTO ticketTracking (stateFk, ticketFk, workerFk) - SELECT id, vSelf, account.myUser_getId() - FROM state - WHERE `code` = vStateCode COLLATE utf8_unicode_ci; - ELSE - CALL util.throw('INCORRECT_TICKET_STATE'); - END IF; +BEGIN +/** + * Modifica el estado de un ticket si se cumplen las condiciones necesarias. + * + * @param vSelf el id del ticket + * @param vStateCode estado a modificar del ticket + */ + DECLARE vticketAlertLevel INT; + DECLARE vTicketStateCode VARCHAR(255); + DECLARE vCanChangeState BOOL; + DECLARE vPackedAlertLevel INT; + DECLARE vOnPreparationAlertLevel INT; + DECLARE vNextAlertLevel INT; + DECLARE vZoneFk INT; + + SELECT s.alertLevel, s.`code`, s2.alertLevel, t.zoneFk + INTO vticketAlertLevel, vTicketStateCode, vNextAlertLevel , vZoneFk + FROM state s + JOIN ticketTracking tt ON tt.stateFk = s.id + JOIN state s2 ON s2.code = vStateCode + JOIN ticket t ON t.id = tt.ticketFk + WHERE tt.ticketFk = vSelf + ORDER BY tt.created DESC + LIMIT 1; + + SELECT id INTO vPackedAlertLevel FROM alertLevel WHERE code = 'PACKED'; + SELECT id INTO vOnPreparationAlertLevel FROM alertLevel WHERE code = 'ON_PREPARATION'; + + IF vStateCode = 'OK' AND vZoneFk IS NULL THEN + CALL util.throw('ASSIGN_ZONE_FIRST'); + END IF; + + IF vNextAlertLevel > vticketAlertLevel && vticketAlertLevel < vOnPreparationAlertLevel THEN + UPDATE sale + SET originalQuantity = quantity + WHERE ticketFk = vSelf; + END IF; + + SET vCanChangeState = (vStateCode <> 'ON_CHECKING' OR vticketAlertLevel < vPackedAlertLevel) + AND NOT ( + vTicketStateCode IN ('CHECKED', 'CHECKING') + AND vStateCode IN ('PREPARED', 'ON_PREPARATION') + ); + + IF vCanChangeState THEN + INSERT INTO ticketTracking (stateFk, ticketFk, workerFk) + SELECT id, vSelf, account.myUser_getId() + FROM state + WHERE `code` = vStateCode COLLATE utf8_unicode_ci; + + IF vStateCode = 'PACKED' THEN + CALL ticket_doCmr(vSelf); + END IF; + ELSE + CALL util.throw('INCORRECT_TICKET_STATE'); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_split` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72476,8 +72978,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_split`(vTicketFk INT, vTicketFutureFk INT, vDated DATE) proc:BEGIN @@ -72496,40 +72996,40 @@ proc:BEGIN SELECT COUNT(*) INTO vProblemLines FROM tmp.salesToSplit WHERE ticketFk = vTicketFk; - + SELECT count(*) INTO vTotalLines - FROM vn.sale s + FROM vn.sale s WHERE s.ticketFk = vTicketFk; - + SET vHasFullProblem = (vTotalLines = vProblemLines); -- Ticket completo IF vHasFullProblem THEN - + UPDATE vn.ticket SET landed = vDated + INTERVAL 1 DAY, shipped = vDated, nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname ) WHERE id = vTicketFk; - + SELECT CONCAT("Se ha cambiado el ticket ", vTicketFk, " al dia ", vDated); LEAVE proc; - + END IF; -- Ticket a futuro existe IF vTicketFutureFk THEN - - UPDATE vn.sale s + + UPDATE vn.sale s JOIN tmp.salesToSplit ss ON s.id = ss.saleFk SET s.ticketFk = vTicketFutureFk, s.concept = CONCAT('(s) ', s.concept) WHERE ss.ticketFk = vTicketFk; - - SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, + + SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, " al ticket existente ", vTicketFutureFk,"(", vDated,")"); LEAVE proc; - + END IF; -- Ticket nuevo @@ -72541,18 +73041,18 @@ proc:BEGIN t.landed = vDated + INTERVAL 1 DAY, t.shipped = vDated, t.agencyModeFk = pc.defautlAgencyMode, - t.zoneFk = pc.defaultZone + t.zoneFk = pc.defaultZone WHERE t.id = vTicketFutureFk; - - UPDATE vn.sale s - JOIN tmp.salesToSplit sts ON sts.saleFk = s.id + + UPDATE vn.sale s + JOIN tmp.salesToSplit sts ON sts.saleFk = s.id SET s.ticketFk = vTicketFutureFk, s.concept = CONCAT('(s) ', s.concept) WHERE sts.ticketFk = vTicketFk; CALL vn.ticketStateUpdate(vTicketFutureFk, 'FIXING'); - SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, + SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, " al nuevo ticket ", vTicketFutureFk,"(", vDated,")"); END ;; DELIMITER ; @@ -72560,6 +73060,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_splitItemPackingType` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72567,8 +73069,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_splitItemPackingType`(vTicketFk INT, vOriginalItemPackingTypeFk VARCHAR(1)) proc:BEGIN @@ -72679,6 +73179,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_splitPackingComplete` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72686,54 +73188,54 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_splitPackingComplete`(vTicketFk INT, vSectorFk INT) BEGIN - + DECLARE vNeedToSplit BOOLEAN; DECLARE vNewTicketFk INT; - + DROP TEMPORARY TABLE IF EXISTS tmpSale; - + CREATE TEMPORARY TABLE tmpSale SELECT DISTINCT s.id - FROM vn.ticket t + FROM vn.ticket t JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk + JOIN vn.item i ON i.id = s.itemFk LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk AND iss.sectorFk = vSectorFk - JOIN vn.packagingConfig pc + JOIN vn.packagingConfig pc WHERE t.id = vTicketFk AND ( s.quantity MOD IFNULL(iss.packing,1) != 0 - OR + OR IFNULL(iss.packing,1) = 1 - OR + OR i.`size` <= pc.previousPreparationMinimumSize ); - - SELECT COUNT(*) + + SELECT COUNT(*) INTO vNeedToSplit - FROM tmpSale; - + FROM tmpSale; + IF vNeedToSplit THEN - + CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - + UPDATE vn.sale s - JOIN vn.tmpSale ts ON ts.id = s.id + JOIN vn.tmpSale ts ON ts.id = s.id SET s.ticketFk = vNewTicketFk; - + END IF; - + DROP TEMPORARY TABLE tmpSale; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_WeightDeclaration` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72741,8 +73243,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_WeightDeclaration`(vClientFk INT, vDated DATE) BEGIN @@ -72758,7 +73258,7 @@ BEGIN WHERE ot.description = 'Peso Aduana' AND t.clientFk = vClientFk AND t.shipped BETWEEN vDated AND util.dayend(vDated); - + SELECT sum(IF(sv.physicalWeight = 0, sv.weight, sv.physicalWeight)) INTO vTheorycalWeight FROM vn.ticket t JOIN vn.sale s ON s.ticketFk = t.id @@ -72767,9 +73267,9 @@ BEGIN JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk WHERE t.clientFk = vClientFk AND t.shipped BETWEEN vDated AND util.dayend(vDated); - + SET vRatio = vRealWeight / vTheorycalWeight; - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketWeight; CREATE TEMPORARY TABLE tmp.ticketWeight @@ -72790,13 +73290,15 @@ BEGIN AND t.shipped BETWEEN vDated AND util.dayend(vDated) GROUP BY ib.ediBotanic, o.code; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeBusiness_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72804,8 +73306,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN @@ -72839,7 +73339,7 @@ BEGIN isAllowedToWork FROM(SELECT t.dated, b.id businessFk, - w.userFk, + w.id, b.departmentFk, IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.started,5) ORDER BY bs.started ASC SEPARATOR ' - ')) hourStart , IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.ended,5) ORDER BY bs.ended ASC SEPARATOR ' - ')) hourEnd, @@ -72849,18 +73349,19 @@ BEGIN at2.permissionRate, at2.discountRate, ct.hoursWeek hoursWeek, - at2.isAllowedToWork + at2.isAllowedToWork, + u.userFk FROM time t LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo) LEFT JOIN worker w ON w.id = b.workerFk - JOIN tmp.`user` u ON u.userFK = w.userFK + JOIN tmp.`user` u ON u.userFK = w.id LEFT JOIN workCenter wc ON wc.id = b.workcenterFK LEFT JOIN calendarType ct ON ct.id = b.calendarTypeFk LEFT JOIN businessSchedule bs ON bs.businessFk = b.id AND bs.weekday = WEEKDAY(t.dated) + 1 LEFT JOIN calendar c ON c.businessFk = b.id AND c.dated = t.dated LEFT JOIN absenceType at2 ON at2.id = c.dayOffTypeFk WHERE t.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY w.userFk, t.dated + GROUP BY w.id, t.dated )sub; UPDATE tmp.timeBusinessCalculate t @@ -72895,6 +73396,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeBusiness_calculateAll` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72902,35 +73405,31 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /** - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl + * @param vDatedFrom Fecha desde + * @param vDatedTo Fecha hasta */ - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` - SELECT userFk - FROM vn.worker w - JOIN account.`user` u ON u.id = w.userFk - WHERE userFk IS NOT NULL; - + CREATE OR REPLACE TEMPORARY TABLE tmp.`user` + SELECT w.id userFk + FROM vn.worker w; + CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); DROP TEMPORARY TABLE tmp.`user`; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeBusiness_calculateByDepartment` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72938,27 +73437,25 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /** - * @param vDepartmentFk + * @param vDepartmentFk * @param vDatedFrom workerTimeControl * @param vDatedTo workerTimeControl */ DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - + CREATE TEMPORARY TABLE tmp.`user` SELECT DISTINCT b.workerFk userFk - FROM business AS b - WHERE (b.started BETWEEN vDatedFrom AND vDatedTo + FROM business AS b + WHERE (b.started BETWEEN vDatedFrom AND vDatedTo OR IFNULL(b.ended, vDatedTo) BETWEEN vDatedFrom AND vDatedTo OR (b.started <= vDatedFrom AND b.ended >= vDatedTo) ) AND b.departmentFk = vDepartmentFk ORDER BY b.ended DESC; - + CALL timeBusiness_calculate(vDatedFrom, vDatedTo); DROP TEMPORARY TABLE tmp.`user`; @@ -72969,6 +73466,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeBusiness_calculateByUser` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72976,26 +73475,24 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /** - * @param vUserFk + * @param vUserFk * @param vDatedFrom workerTimeControl * @param vDatedTo workerTimeControl */ - + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - + CREATE TEMPORARY TABLE tmp.`user` SELECT id userFk - FROM account.user - WHERE id = vUserFk; + FROM account.user + WHERE id = vUserFk; CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); - + DROP TEMPORARY TABLE tmp.`user`; END ;; @@ -73004,6 +73501,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeBusiness_calculateByWorker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73011,29 +73510,24 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /** * @param vWorkerFk - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl + * @param vDatedFrom Fecha desde + * @param vDatedTo Fecha hasta */ - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE tmp.`user` - SELECT u.id userFk - FROM account.user u - JOIN vn.worker w ON w.userFk = u.id - WHERE w.id = vWorkerFk; - - CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE tmp.`user`; + + CREATE OR REPLACE TEMPORARY TABLE tmp.`user` + SELECT w.id userFk + FROM worker w + WHERE w.id = vWorkerFk; + + CALL timeBusiness_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; END ;; DELIMITER ; @@ -73041,6 +73535,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeControl_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73048,34 +73544,32 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculate`( - vDatedFrom DATETIME, + vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /* * @param vDatedFrom - * @param vDatedTo - * Cálculo de horas trabajadas por empleado y día, + * @param vDatedTo + * Cálculo de horas trabajadas por empleado y día, * sin tener en cuenta los días con fichadas incorrectas (tabla tmp.timeControlError) - * En el caso de haber hecho descanso y trabajado un mínimo de tiempo (vTimeToBreakTime), + * En el caso de haber hecho descanso y trabajado un mínimo de tiempo (vTimeToBreakTime), * se añade al tiempo de trabajo efectivo el descanso (vBreakTime) - * @return tmp.timeControlCalculate + * @return tmp.timeControlCalculate * (workerFk, dated, timeWorkSeconds, timeWorkSexagesimal, timeWorkDecimal, timed) */ DECLARE vHourToSeconds INTEGER; DECLARE vDatedFromYesterday DATETIME; - DECLARE vDatedToTomorrow DATETIME; + DECLARE vDatedToTomorrow DATETIME; DECLARE vTimeToBreakTime INT; DECLARE vBreakTime INT; - - SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) + + SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) INTO vDatedFromYesterday, vDatedToTomorrow; - + SELECT timeToBreakTime, breakTime INTO vTimeToBreakTime, vBreakTime - FROM workerTimeControlConfig + FROM workerTimeControlConfig LIMIT 1; CALL timeControl_getError(vDatedFrom, vDatedTo); @@ -73084,9 +73578,9 @@ BEGIN CREATE TEMPORARY TABLE tmp.workerTimeControl (INDEX (userFk), INDEX (timed)) ENGINE = MEMORY - SELECT DISTINCT(wtc.id), - wtc.userFk, - wtc.timed, + SELECT DISTINCT(wtc.id), + wtc.userFk, + wtc.timed, wtc.direction, TRUE isReal FROM workerTimeControl wtc @@ -73096,10 +73590,10 @@ BEGIN AND tce.id IS NULL ORDER BY wtc.userFk, wtc.timed ASC; - SELECT MAX(id) INTO @vCont + SELECT MAX(id) INTO @vCont FROM tmp.workerTimeControl; - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; CREATE TEMPORARY TABLE tmp.workerTimeControlAux ( `id` int(11) , `userFk` int(10) unsigned , @@ -73112,14 +73606,14 @@ BEGIN -- Cambio de dia en medio de un descanso INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1 id, - userFk, - util.dayEnd(dated) timed, + SELECT @vCont:= @vCont + 1 id, + userFk, + util.dayEnd(dated) timed, 'middle' direction FROM(SELECT wtc.userFk, DATE(@lastTimed) dated, (@vIsOdd := NOT @vIsOdd) isOdd, - IF(@vIsOdd AND wtc.direction = 'middle' + IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, @lastTimed := wtc.timed FROM tmp.workerTimeControl wtc @@ -73132,14 +73626,14 @@ BEGIN SET @vIsOdd := FALSE; INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1, - userFk, - DATE_ADD(sub.dated, INTERVAL 1 DAY), + SELECT @vCont:= @vCont + 1, + userFk, + DATE_ADD(sub.dated, INTERVAL 1 DAY), 'middle' FROM(SELECT wtc.userFk, DATE(@lastTimed) dated, (@vIsOdd := NOT @vIsOdd) isOdd, - IF(@vIsOdd AND wtc.direction = 'middle' + IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, @lastTimed := wtc.timed FROM tmp.workerTimeControl wtc @@ -73150,9 +73644,9 @@ BEGIN -- Cambio de dia INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1 id, - sub.userFk, - util.dayEnd(sub.dated) timed, + SELECT @vCont:= @vCont + 1 id, + sub.userFk, + util.dayEnd(sub.dated) timed, 'out' direction FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated FROM workerTimeControl wtc @@ -73162,7 +73656,7 @@ BEGIN AND tce.id IS NULL GROUP BY wtc.userFk, DATE(wtc.timed) ) sub - JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed + JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk WHERE wtc.direction <> 'out'; @@ -73176,7 +73670,7 @@ BEGIN AND tce.id IS NULL GROUP BY wtc.userFk, DATE(wtc.timed) ) sub - JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed + JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk WHERE wtc.direction <> 'out'; @@ -73193,7 +73687,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.workerBreakDays (INDEX (userFk), INDEX (dated)) ENGINE = MEMORY - SELECT sub.userFk, + SELECT sub.userFk, sub.dated FROM (SELECT (@vIsOdd := NOT @vIsOdd), IF(wtc.direction = 'in', @vIsOdd := TRUE, NULL), @@ -73202,7 +73696,7 @@ BEGIN IF(direction='in', @vDated := DATE(wtc.timed), @vDated) dated, wtc.userFk FROM tmp.workerTimeControl wtc - ORDER BY wtc.userFk, wtc.timed, wtc.id + ORDER BY wtc.userFk, wtc.timed, wtc.id LIMIT 10000000000000000000 )sub GROUP BY sub.userFk, sub.dated @@ -73213,9 +73707,9 @@ BEGIN SET @vLastTimed := 0; DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux2; - CREATE TEMPORARY TABLE tmp.workerTimeControlAux2 + CREATE TEMPORARY TABLE tmp.workerTimeControlAux2 SELECT * - FROM tmp.workerTimeControl + FROM tmp.workerTimeControl WHERE timed BETWEEN vDatedFromYesterday AND vDatedTo ORDER BY userFk, timed, id; @@ -73228,7 +73722,7 @@ BEGIN IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork) timeWorkSeconds, SEC_TO_TIME(IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork)) timeWorkSexagesimal, (IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork)) / vHourToSeconds timeWorkDecimal, - CAST(GROUP_CONCAT(DATE_FORMAT(sub.realTimed, "%H:%i") + CAST(GROUP_CONCAT(DATE_FORMAT(sub.realTimed, "%H:%i") ORDER BY sub.timed ASC SEPARATOR ' - ') AS CHAR(256)) timed FROM (SELECT (@vIsOdd := NOT @vIsOdd), IF(direction='in', @vIsOdd := TRUE, 0), @@ -73255,6 +73749,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeControl_calculateAll` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73262,35 +73758,31 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /** - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl + * @param vDatedFrom Fecha desde + * @param vDatedTo Fecha hasta */ - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` - SELECT userFk - FROM vn.worker w - JOIN account.`user` u ON u.id = w.userFk - WHERE userFk IS NOT NULL; - + CREATE OR REPLACE TEMPORARY TABLE tmp.`user` + SELECT w.id userFk + FROM vn.worker w; + CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); DROP TEMPORARY TABLE tmp.`user`; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeControl_calculateByDepartment` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73298,27 +73790,25 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /** - * @param vDepartmentFk + * @param vDepartmentFk * @param vDatedFrom workerTimeControl * @param vDatedTo workerTimeControl */ DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - + CREATE TEMPORARY TABLE tmp.`user` SELECT DISTINCT b.workerFk userFk - FROM business AS b - WHERE (b.started BETWEEN vDatedFrom AND vDatedTo + FROM business AS b + WHERE (b.started BETWEEN vDatedFrom AND vDatedTo OR IFNULL(b.ended, vDatedTo) BETWEEN vDatedFrom AND vDatedTo OR (b.started <= vDatedFrom AND b.ended >= vDatedTo) ) AND b.departmentFk = vDepartmentFk ORDER BY b.ended DESC; - + CALL timeControl_calculate(vDatedFrom, vDatedTo); DROP TEMPORARY TABLE tmp.`user`; @@ -73329,6 +73819,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeControl_calculateByUser` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73336,26 +73828,24 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /** - * @param vUserFk + * @param vUserFk * @param vDatedFrom workerTimeControl * @param vDatedTo workerTimeControl */ - + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - + CREATE TEMPORARY TABLE tmp.`user` SELECT id userFk - FROM account.user - WHERE id = vUserFk; + FROM account.user + WHERE id = vUserFk; CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); - + DROP TEMPORARY TABLE tmp.`user`; END ;; @@ -73364,6 +73854,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeControl_calculateByWorker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73371,28 +73863,26 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /** - * @param vWorkerFk + * @param vWorkerFk * @param vDatedFrom workerTimeControl * @param vDatedTo workerTimeControl */ - + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - + CREATE TEMPORARY TABLE tmp.`user` SELECT u.id userFk FROM account.user u JOIN vn.worker w ON w.userFk = u.id WHERE w.id = vWorkerFk; - + CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); - + DROP TEMPORARY TABLE tmp.`user`; END ;; @@ -73401,6 +73891,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeControl_getError` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73408,19 +73900,17 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_getError`(vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /* * @param vDatedFrom - * @param vDatedTo + * @param vDatedTo * @table tmp.`user`(userFk) * Fichadas incorrectas de las cuales no se puede calcular horas trabajadas * @return tmp.timeControlError (id) */ - DECLARE vDayMaxTime INTEGER; + DECLARE vDayMaxTime INTEGER; SET @journeyCounter := 0; SET @lastUserFk := NULL; @@ -73428,16 +73918,16 @@ BEGIN SELECT dayMaxTime INTO vDayMaxTime FROM workerTimeControlConfig LIMIT 1; - DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; - CREATE TEMPORARY TABLE tmp.timeControl + DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; + CREATE TEMPORARY TABLE tmp.timeControl (INDEX(id), INDEX(journeyCounter)) ENGINE = MEMORY SELECT sub.id, - sub.direction, + sub.direction, sub.timed, IF(sub.direction = 'in' OR @hasOut OR sub.userFk <> @lastUserFk, @journeyCounter := @journeyCounter + 1, @journeyCounter) journeyCounter, - @lastUserFk := sub.userFk workerFk, - IF(sub.direction = 'out', @hasOut:= TRUE, @hasOut:= FALSE) + @lastUserFk := sub.userFk workerFk, + IF(sub.direction = 'out', @hasOut:= TRUE, @hasOut:= FALSE) FROM ( SELECT DISTINCT wtc.id, wtc.direction, @@ -73448,42 +73938,44 @@ BEGIN WHERE wtc.timed BETWEEN DATE_SUB(vDatedFrom, INTERVAL 1 DAY) AND DATE_ADD(vDatedTo, INTERVAL 1 DAY) ORDER BY wtc.userFk, wtc.timed ) sub; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; CREATE TEMPORARY TABLE tmp.timeControlAux (INDEX(id), INDEX(journeyCounter)) ENGINE = MEMORY SELECT * FROM tmp.timeControl; - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlError; - CREATE TEMPORARY TABLE tmp.timeControlError + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlError; + CREATE TEMPORARY TABLE tmp.timeControlError (INDEX(id)) ENGINE = MEMORY - SELECT id + SELECT id FROM tmp.timeControlAux tca JOIN ( - SELECT journeyCounter, + SELECT journeyCounter, UNIX_TIMESTAMP(MAX(timed)) - UNIX_TIMESTAMP(MIN(timed)) timeWork, - SUM(direction = 'in') totalIn, + SUM(direction = 'in') totalIn, SUM(direction = 'out') totalOut, timed FROM tmp.timeControl GROUP BY journeyCounter - HAVING COUNT(*) MOD 2 = 1 - OR totalIn <> 1 - OR totalOut <> 1 + HAVING COUNT(*) MOD 2 = 1 + OR totalIn <> 1 + OR totalOut <> 1 OR timeWork >= vDayMaxTime )sub ON sub.journeyCounter = tca.journeyCounter WHERE sub.timed BETWEEN vDatedFrom AND vDatedTo; - DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; + DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeWorkerControl_check` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73491,8 +73983,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeWorkerControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) proc: BEGIN @@ -73500,13 +73990,15 @@ proc: BEGIN * deprecated call workerTimeControl_check */ CALL vn.workerTimeControl_check(vUserFk,vDated,vTabletFk); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `tpvTransaction_checkStatus` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73514,8 +74006,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_checkStatus`() BEGIN @@ -73525,25 +74015,27 @@ BEGIN * trasladados a la ficha del cliente. * */ - INSERT INTO mail (receiver,replyTo,subject,body) - SELECT 'administracion@verdnatura.es', + INSERT INTO mail (receiver, replyTo, subject, body) + SELECT 'administracion@verdnatura.es, finanzas@verdnatura.es', 'noreply@verdnatura.es', - CONCAT('Cobro web no trasladado a la ficha del cliente ', t.clientFk), - CONCAT('Hay un importe de ', t.amount/100, '€ del cliente ', t.clientFk, ' con fecha ', t.created, + CONCAT('Cobro web no trasladado a la ficha del cliente ', clientFk), + CONCAT('Hay un importe de ', amount / 100, '€ del cliente ', clientFk, ' con fecha ', created, ', que no se ha trasladado a recibos. Si nos ha llegado el importe al banco confirme el pago en - - https://salix.verdnatura.es/#!/client/',t.clientFk,'/web-payment') - FROM hedera.tpvTransaction t - WHERE t.receiptFk IS NULL - AND t.status = 'ok' - AND t.created < DATE_ADD(util.VN_NOW(),INTERVAL - 2 DAY) - GROUP BY t.clientFk; + + https://salix.verdnatura.es/#!/client/', clientFk, '/web-payment') + FROM hedera.tpvTransaction + WHERE receiptFk IS NULL + AND status = 'ok' + AND created < (util.VN_NOW() - INTERVAL 2 DAY) + GROUP BY clientFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travelVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73551,17 +74043,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume`(vTravelFk INT) BEGIN - - SELECT w1.name AS ORI, - w2.name AS DES, + + SELECT w1.name AS ORI, + w2.name AS DES, tr.shipped shipment, tr.landed landing, - a.name Agencia, + a.name Agencia, s.name Proveedor, e.id Id_Entrada, e.invoiceNumber Referencia, @@ -73569,24 +74059,26 @@ BEGIN vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) AS CC, CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) AS espais - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.supplier s ON s.id = e.supplierFk - JOIN vn.travel tr ON tr.id = e.travelFk + FROM vn.buy b + JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.supplier s ON s.id = e.supplierFk + JOIN vn.travel tr ON tr.id = e.travelFk JOIN vn.agencyMode a ON a.id = tr.agencyModeFk - JOIN vn.warehouse w1 ON w1.id = tr.warehouseInFk - JOIN vn.warehouse w2 ON w2.id = tr.warehouseOutFk - JOIN vn.volumeConfig vc - JOIN vn.item i ON i.id = b.itemFk + JOIN vn.warehouse w1 ON w1.id = tr.warehouseInFk + JOIN vn.warehouse w2 ON w2.id = tr.warehouseOutFk + JOIN vn.volumeConfig vc + JOIN vn.item i ON i.id = b.itemFk JOIN vn.itemType it ON it.id = i.typeFk WHERE tr.id = vTravelFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travelVolume_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73594,8 +74086,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT) BEGIN @@ -73617,6 +74107,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_checkDates` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73624,8 +74116,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_checkDates`(vShipped DATE, vLanded DATE) BEGIN @@ -73636,17 +74126,19 @@ BEGIN * @param vShipped The shipment date * @param vLanded The landing date */ - + IF vLanded < vShipped THEN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Landing cannot be lesser than shipment'; - END IF; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_checkPackaging` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73654,8 +74146,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_checkPackaging`(vSelf INT) BEGIN @@ -73690,6 +74180,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_checkWarehouseIsFeedStock` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73697,14 +74189,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_checkWarehouseIsFeedStock`(vWarehouseFk INT) proc: BEGIN /* * Check that the warehouse is not Feed Stock - * + * * @vWarehouseFk param warehouse id */ IF vWarehouseFk IS NULL THEN @@ -73720,6 +74210,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_clone` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73727,8 +74219,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_clone`(vSelf INT, vDays INT, OUT vNewTravelFk INT) BEGIN @@ -73781,6 +74271,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_cloneWithEntries` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73788,17 +74280,15 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`( - IN vTravelFk INT, - IN vDateStart DATE, + IN vTravelFk INT, + IN vDateStart DATE, IN vDateEnd DATE, IN vWarehouseOutFk INT, - IN vWarehouseInFk INT, - IN vRef VARCHAR(255), - IN vAgencyModeFk INT, + IN vWarehouseInFk INT, + IN vRef VARCHAR(255), + IN vAgencyModeFk INT, OUT vNewTravelFk INT) BEGIN /** @@ -73822,29 +74312,29 @@ BEGIN FROM entry e JOIN travel t ON t.id = e.travelFk WHERE e.travelFk = vTravelFk; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN + BEGIN ROLLBACK; RESIGNAL; END; - + START TRANSACTION; INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom) SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk FROM travel WHERE id = vTravelFk; - + SET vNewTravelFk = LAST_INSERT_ID(); SET vDone = FALSE; SET @isModeInventory = TRUE; OPEN vRsEntry; - + l: LOOP SET vDone = FALSE; FETCH vRsEntry INTO vAuxEntryFk; @@ -73875,6 +74365,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_doRecalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73882,8 +74374,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET collation_connection = utf8mb3_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_doRecalc`() BEGIN @@ -73913,11 +74403,11 @@ BEGIN SELECT COUNT(*) INTO vTotalEntries FROM entry WHERE travelFk = vTravelFk; - + UPDATE travel SET totalEntries = vTotalEntries WHERE id = vTravelFk; - + DELETE FROM travelRecalc WHERE travelFk = vTravelFk; END LOOP; @@ -73928,6 +74418,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_getEntriesMissingPackage` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73935,8 +74427,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_getEntriesMissingPackage`(vSelf INT) BEGIN @@ -73948,10 +74438,10 @@ BEGIN WHERE id = vSelf; SELECT e.id entryFk - FROM travel t - JOIN entry e ON e.travelFk = t.id - JOIN buy b ON b.entryFk = e.id - WHERE t.id = vTravelFk + FROM travel t + JOIN entry e ON e.travelFk = t.id + JOIN buy b ON b.entryFk = e.id + WHERE t.id = vTravelFk AND (b.packing IS NULL OR b.packageFk IS NULL); END ;; DELIMITER ; @@ -73959,6 +74449,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_moveRaids` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73966,15 +74458,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_moveRaids`() BEGIN /* * Desplaza al dia siguiente los travels que contengan redadas y avisa a los compradores - * + * */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vWorkerName VARCHAR(50); @@ -73986,7 +74476,7 @@ BEGIN SELECT GROUP_CONCAT( DISTINCT CONCAT('https://salix.verdnatura.es/#!/travel/', ttr.id, '/summary ') ORDER BY ttr.id SEPARATOR '\n\r'), u.name FROM tmp.travel ttr - JOIN entry e ON e.travelFk = ttr.id + JOIN entry e ON e.travelFk = ttr.id JOIN buy b ON b.entryFk = e.id JOIN item i ON i.id = b.itemFk JOIN itemType it ON it.id = i.typeFk @@ -73994,19 +74484,19 @@ BEGIN GROUP BY u.name; DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; + SET vDone = TRUE; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN ROLLBACK; RESIGNAL; END; - + DROP TEMPORARY TABLE IF EXISTS tmp.travel; CREATE TEMPORARY TABLE tmp.travel SELECT tr.id,tr.landed FROM travel tr - JOIN entry e ON e.travelFk = tr.id + JOIN entry e ON e.travelFk = tr.id WHERE tr.landed = util.tomorrow() AND e.isRaid GROUP BY tr.id; @@ -74044,6 +74534,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_requestRecalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74051,8 +74543,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_requestRecalc`(vSelf INT) proc: BEGIN @@ -74064,7 +74554,7 @@ proc: BEGIN IF vSelf IS NULL THEN LEAVE proc; END IF; - + INSERT IGNORE INTO travelRecalc SET travelFk = vSelf; END ;; DELIMITER ; @@ -74072,6 +74562,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_updatePacking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74079,8 +74571,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_updatePacking`(vItemFk INT, vPacking INT) BEGIN @@ -74090,10 +74580,10 @@ BEGIN * @param vItemFk id del item * @param vPacking nuevo packing */ - + DECLARE vAuctionWarehouseFk INT; DECLARE vMainWarehouseFk INT; - + SELECT warehouseFk INTO vAuctionWarehouseFk FROM auctionConfig; @@ -74114,6 +74604,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_weeklyClone` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74121,8 +74613,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_weeklyClone`(vSinceWeek INT, vToWeek INT) BEGIN @@ -74153,7 +74643,7 @@ BEGIN FROM travelClonedWeekly WHERE travelFk; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; SET vCounter = vSinceWeek; @@ -74200,6 +74690,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `typeTagMake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74207,20 +74699,18 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `typeTagMake`(vTypeFk INT) BEGIN /* * Plantilla para modificar reemplazar todos los tags * por los valores que tienen los articulos - * + * * @param vTypeFk tipo a modificar - * + * */ - DELETE it.* - FROM itemTag it + DELETE it.* + FROM itemTag it JOIN item i ON i.id = it.itemFk WHERE i.typeFk = vTypeFk; @@ -74229,40 +74719,40 @@ BEGIN FROM item i JOIN tag t ON t.name = 'Longitud' COLLATE utf8_general_ci WHERE i.typeFk = vTypeFk; - + INSERT INTO itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id, i.category, 5 FROM item i JOIN tag t ON t.name = 'Categoria' COLLATE utf8_general_ci WHERE i.typeFk = vTypeFk; - + INSERT INTO itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id, ink.name, 2 FROM item i JOIN tag t ON t.name = 'Color' COLLATE utf8_general_ci JOIN ink ON ink.id = i.inkFk WHERE i.typeFk = vTypeFk; - + INSERT INTO itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id, p.name, 3 FROM item i JOIN tag t ON t.name = 'Productor' COLLATE utf8_general_ci JOIN producer p ON p.id = i.producerFk - WHERE i.typeFk = vTypeFk; - + WHERE i.typeFk = vTypeFk; + INSERT INTO itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id, o.name, 4 FROM item i JOIN tag t ON t.name = 'Origen' COLLATE utf8_general_ci JOIN origin o ON o.id = i.originFk WHERE i.typeFk = vTypeFk; - /* + /* INSERT INTO itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id, i.stems, 6 FROM item i JOIN tag t ON t.name = 'Tallos' COLLATE utf8_general_ci - WHERE i.typeFk = vTypeFk; - */ + WHERE i.typeFk = vTypeFk; + */ -- CALL itemTagArrangedUpdate(NULL); END ;; @@ -74271,6 +74761,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `updatePedidosInternos` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74278,14 +74770,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `updatePedidosInternos`(vItemFk INT) BEGIN UPDATE vn.item SET upToDown = 0 WHERE item.id = vItemFk; - + END ;; DELIMITER ; @@ -74293,6 +74783,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `vehicle_checkNumberPlate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74300,8 +74792,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2)) BEGIN @@ -74313,7 +74803,7 @@ BEGIN SELECT vp.regex INTO vRegex FROM vehiclePlateRegex vp WHERE vp.countryCodeFk = vCountryCodeFk; - + IF NOT vNumberPlate REGEXP BINARY (vRegex)THEN CALL util.throw(CONCAT('Error: la matricula ', vNumberPlate, ' no es valida para ',vCountryCodeFk)); END IF; @@ -74323,6 +74813,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `vehicle_notifyEvents` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74330,8 +74822,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `vehicle_notifyEvents`() proc:BEGIN @@ -74346,7 +74836,7 @@ proc:BEGIN ROLLBACK; RESIGNAL; END; - + SELECT eventEarlyDays INTO vEventEarlyDays FROM vehicleConfig; @@ -74364,7 +74854,7 @@ proc:BEGIN IF NOT vHasEvents THEN LEAVE proc; END IF; - + START TRANSACTION; SELECT util.notification_send('vehicle-event-expired', @@ -74387,6 +74877,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `visible_getMisfit` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74394,26 +74886,24 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `visible_getMisfit`(vSectorFk INT) BEGIN - + /* Devuelve una tabla temporal con los descuadres entre el visible teórico y lo ubicado en la práctica - * + * * @param vSectorFk Identificador de vn.sector - * + * * @return tmp.stockMisfit(itemFk, visible, parked) */ - + DECLARE vCalcVisibleFk INT; DECLARE vWarehouseFk INT; SELECT warehouseFk INTO vWarehouseFk - FROM vn.sector s + FROM vn.sector s WHERE s.id = vSectorFk; - + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, vWarehouseFk); DROP TEMPORARY TABLE IF EXISTS tmp.stockMisfit; @@ -74426,17 +74916,17 @@ BEGIN INSERT INTO tmp.stockMisfit(itemFk, parked) SELECT iss.itemFk , sum(iss.visible ) - FROM vn.itemShelvingStock iss - JOIN vn.sector s ON s.id = iss.sectorFk + FROM vn.itemShelvingStock iss + JOIN vn.sector s ON s.id = iss.sectorFk WHERE vSectorFk IN (s.id, s.sonFk) GROUP BY iss.itemFk; - + INSERT INTO tmp.stockMisfit(itemFk, visible) - SELECT v.item_id , v.visible - FROM cache.visible v - WHERE v.calc_id = vCalcVisibleFk + SELECT v.item_id , v.visible + FROM cache.visible v + WHERE v.calc_id = vCalcVisibleFk ON DUPLICATE KEY UPDATE visible = v.visible; - + DELETE FROM tmp.stockMisfit WHERE visible = parked; @@ -74446,6 +74936,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `warehouseFitting` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74453,24 +74945,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `warehouseFitting`(IN vWhOrigin INT , IN vWhDestiny INT) BEGIN DECLARE vCacheVisibleOriginFk INT; DECLARE vCacheVisibleDestinyFk INT; - + CALL cache.visible_refresh(vCacheVisibleOriginFk, FALSE, vWhOrigin); CALL cache.visible_refresh(vCacheVisibleDestinyFk, FALSE, vWhDestiny); - + SELECT i.id itemFk, i.longName, i.size, i.subName, vOrigin.visible AS Origen, vDestiny.visible Destino - + FROM vn.item i JOIN vn.itemType it ON it.id = i.typeFk LEFT JOIN cache.visible vOrigin ON vOrigin.calc_id = vCacheVisibleOriginFk AND vOrigin.item_id = i.id @@ -74484,6 +74974,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `warehouseFitting_byTravel` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74491,27 +74983,27 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `warehouseFitting_byTravel`(IN vTravelFk INT) BEGIN DECLARE vWhOrigin INT; DECLARE vWhDestiny INT; - + SELECT warehouseInFk, warehouseOutFk INTO vWhDestiny, vWhOrigin FROM vn.travel WHERE id = vTravelFk; - + CALL vn.warehouseFitting(vWhOrigin, vWhDestiny); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerCalculateBoss` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74519,8 +75011,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalculateBoss`(vWorker INT) BEGIN @@ -74553,6 +75043,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerCalendar_calculateBusiness` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74560,8 +75052,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateBusiness`(vYear INT, vBusinessFk INT) BEGIN @@ -74569,7 +75059,7 @@ BEGIN * Calcula los días y horas de vacaciones en función de un contrato y año * * @param vYear - * @param vBusinessFk + * @param vBusinessFk * @return tmp.workerCalendarCalculateBusiness (days, hours, daysEnjoyed, hoursEnjoyed) */ DECLARE vStarted DATE; @@ -74581,17 +75071,17 @@ BEGIN DECLARE vPayedHolidays DECIMAL(5,2); DECLARE vDifDays INT; - SELECT IF(b.started < CONCAT(vYear,"-01-01"), CONCAT(vYear,"-01-01"),b.started), - IF(b.ended IS NULL OR YEAR(b.ended)>vYear , CONCAT(vYear,"-12-31"), b.ended), + SELECT IF(b.started < CONCAT(vYear,"-01-01"), CONCAT(vYear,"-01-01"),b.started), + IF(b.ended IS NULL OR YEAR(b.ended)>vYear , CONCAT(vYear,"-12-31"), b.ended), IF(wbt.hasHolidayEntitlement, w.days, 0), c.hoursWeek, IF(YEAR(b.ended) = vYear, b.payedHolidays, 0) payedHolidays - INTO vStarted, - vEnded, - vDaysHoliday, + INTO vStarted, + vEnded, + vDaysHoliday, vHoursWeek, vPayedHolidays - FROM business b + FROM business b JOIN workerBusinessType wbt ON wbt.id = b.workerBusinessTypeFk JOIN workCenterHoliday w ON w.workcenterFk = b.workcenterFk LEFT JOIN calendarType c ON c.id = b.calendarTypeFk @@ -74599,23 +75089,23 @@ BEGIN AND w.year = vYear; DROP TEMPORARY TABLE IF EXISTS tmp.workerCalendarCalculateBusiness; - + IF vStarted < vEnded THEN SET vDifDays = DAYOFYEAR(vEnded) - DAYOFYEAR(vStarted) + 1; - SELECT IFNULL(SUM(a.holidayEntitlementRate), 0), + SELECT IFNULL(SUM(a.holidayEntitlementRate), 0), SUM(-(a.discountRate - 1)) + vPayedHolidays - INTO vDaysToSubtract, - vDaysHolidayEnjoyed + INTO vDaysToSubtract, + vDaysHolidayEnjoyed FROM calendar c JOIN absenceType a ON a.id = c.dayOffTypeFk JOIN business b ON b.id = c.businessFk - WHERE b.id = vBusinessFk + WHERE b.id = vBusinessFk AND YEAR(c.dated) = vYear; END IF; - CREATE TEMPORARY TABLE tmp.workerCalendarCalculateBusiness + CREATE TEMPORARY TABLE tmp.workerCalendarCalculateBusiness ENGINE = MEMORY SELECT @days := IFNULL(ROUND((vDaysHoliday * (vDifDays - vDaysToSubtract) / IF(util.isLeapYear(vYear) , 366, 365)), 1), 0) days, @days * (vHoursWeek / 5) hours, @@ -74627,6 +75117,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerCalendar_calculateYear` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74634,8 +75126,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateYear`(vYear INT, vWorkerFk INT) BEGIN @@ -74643,32 +75133,32 @@ BEGIN /** * Calcula los días y horas de vacaciones en función de un trabajador y año * - * @param vYear - * @param vWorkerFk + * @param vYear + * @param vWorkerFk * @return tmp.workerCalendarCalculateYear (days, hours, daysEnjoyed, hoursEnjoyed) - */ + */ DECLARE vDone BOOL; DECLARE vBusinessFk INT; DECLARE cur CURSOR FOR - SELECT b.id + SELECT b.id FROM business b - WHERE vYear BETWEEN YEAR(b.started) AND IFNULL(YEAR(b.ended), vYear) + WHERE vYear BETWEEN YEAR(b.started) AND IFNULL(YEAR(b.ended), vYear) AND b.workerFk = vWorkerFk; DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - + SET vDone = TRUE; + DROP TEMPORARY TABLE IF EXISTS tmp.workerCalendarCalculateYear; CREATE TEMPORARY TABLE tmp.workerCalendarCalculateYear - (days DEC(5,2), + (days DEC(5,2), hours DEC(5,2), - daysEnjoyed DEC(5,2), - hoursEnjoyed DEC(5,2)) + daysEnjoyed DEC(5,2), + hoursEnjoyed DEC(5,2)) ENGINE = MEMORY; INSERT INTO tmp.workerCalendarCalculateYear VALUES(0, 0, 0, 0); - + OPEN cur; l: LOOP @@ -74681,12 +75171,12 @@ BEGIN CALL workerCalendar_calculateBusiness(vYear, vBusinessFk); UPDATE tmp.workerCalendarCalculateYear w - JOIN tmp.workerCalendarCalculateBusiness wc + JOIN tmp.workerCalendarCalculateBusiness wc SET w.days = w.days + wc.days, w.hours = w.hours + wc.hours, w.daysEnjoyed = w.daysEnjoyed + wc.daysEnjoyed, w.hoursEnjoyed = w.hoursEnjoyed + wc.hoursEnjoyed; - + DROP TEMPORARY TABLE tmp.workerCalendarCalculateBusiness; END LOOP; @@ -74699,6 +75189,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerCreate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74706,12 +75198,10 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCreate`( vFirstname VARCHAR(50), - vLastName VARCHAR(50), + vLastName VARCHAR(50), vCode CHAR(3), vBossFk INT, vUserFk INT, @@ -74723,14 +75213,16 @@ BEGIN * Create new worker * */ - INSERT INTO worker(id, code, firstName, lastName, userFk, bossFk, fi, birth) - VALUES (vUserFk, vCode, vFirstname, vLastName, vUserFk, vBossFk, vFi, vBirth); + INSERT INTO worker(id, code, firstName, lastName, bossFk, fi, birth,userFk) + VALUES (vUserFk, vCode, vFirstname, vLastName, vBossFk, vFi, vBirth,vUserFk); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerCreateExternal` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74738,8 +75230,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCreateExternal`( vFirstName VARCHAR(50), @@ -74765,14 +75255,16 @@ BEGIN SET vSurnames = CONCAT(vSurname1, ' ', vSurname2); END IF; - INSERT INTO worker(id, firstName, lastName, code, userFk, isFreelance) - SELECT vUserId, vFirstName, vSurnames, vWorkerCode, vUserId, true; + INSERT INTO worker(id, firstName, lastName, code, isFreelance) + SELECT vUserId, vFirstName, vSurnames, vWorkerCode, true; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerDepartmentByDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74780,8 +75272,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDepartmentByDate`(vDate DATE) BEGIN @@ -74789,20 +75279,20 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.workerDepartmentByDate; CREATE TEMPORARY TABLE tmp.workerDepartmentByDate ENGINE = MEMORY - SELECT w.userFk, - w.lastName name, - w.firstName firstname, - d.name department, + SELECT w.id userFk, + w.lastName name, + w.firstName firstname, + d.name department, d.id departmentFk, - b.started, - d.isProduction, + b.started, + d.isProduction, CAST(12 * b.amount / ct.hoursWeek / 52 AS DECIMAL(10,2)) costeHora, w.fi nif FROM business b JOIN calendarType ct ON ct.id = b.calendarTypeFk JOIN department d ON d.id = b.departmentFk JOIN worker w ON w.id = b.workerFk - WHERE b.started <= vDate + WHERE b.started <= vDate AND (b.ended > vDate OR b.ended IS NULL); END ;; DELIMITER ; @@ -74810,6 +75300,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerDisable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74817,8 +75309,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDisable`(vUserId int) mainLabel:BEGIN @@ -74829,18 +75319,18 @@ mainLabel:BEGIN DELETE FROM account.account WHERE id = vUserId; - UPDATE account.user + UPDATE account.user SET role = 2 - WHERE id = vUserId; + WHERE id = vUserId; - DELETE FROM pbx.sip - WHERE user_id = vUserId; + DELETE FROM pbx.sip + WHERE user_id = vUserId; UPDATE `client` c JOIN payMethod p ON p.name = 'CONTADO' SET c.credit = 0, c.payMethodFk = p.id, hasCoreVnl = FALSE WHERE c.id = vUserId; - + UPDATE `client` c SET c.salesPersonFk = null WHERE c.salesPersonFk = vUserId; @@ -74850,6 +75340,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerDisableAll` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74857,8 +75349,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDisableAll`() BEGIN @@ -74869,12 +75359,12 @@ BEGIN SELECT b.workerFk FROM business b JOIN vn.worker w ON w.id = b.workerFk - JOIN account.account a ON a.id = b.workerFk - LEFT JOIN (SELECT b.workerFk + JOIN account.account a ON a.id = b.workerFk + LEFT JOIN (SELECT b.workerFk FROM business b WHERE (ended IS NULL OR ended >=util.VN_CURDATE()) )sub ON sub.workerFk = a.id - LEFT JOIN vn.workerDisableExcluded wd ON wd.workerFk = b.workerFk + LEFT JOIN vn.workerDisableExcluded wd ON wd.workerFk = b.workerFk WHERE sub.workerFk IS NULL AND wd.workerFk IS NULL GROUP BY w.id; @@ -74892,13 +75382,15 @@ BEGIN END WHILE; CLOSE rs; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerForAllCalculateBoss` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74906,8 +75398,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerForAllCalculateBoss`() BEGIN @@ -74945,6 +75435,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerJourney_replace` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74952,23 +75444,21 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerJourney_replace`( - vDatedFrom DATE, - vDatedTo DATE, + vDatedFrom DATE, + vDatedTo DATE, vWorkerFk INT) BEGIN /** - * Actualiza la tabla workerJourney para que actue como caché permanente revisable + * Actualiza la tabla workerJourney para que actue como caché permanente revisable * de las jornadas laborales. * @param vDatedFrom workerTimeControl * @param vDatedTo workerTimeControl * @param vWorkerFk, en caso de pasar 0 ó NULL se aplica a todos - */ + */ DECLARE vDatedTimeTo DATETIME; - DECLARE vMaxTimePerDay INT; + DECLARE vMaxTimePerDay INT; DECLARE vMinHoursToBreak DECIMAL(10,2); DECLARE vBreakHours DECIMAL(10,2); DECLARE vMonthByYear INT; @@ -74976,57 +75466,57 @@ BEGIN DECLARE vMonthsByYear INT DEFAULT 12; DECLARE vDaysByWeek INT DEFAULT 5; DECLARE vDatedFromYesterday DATETIME; - DECLARE vDatedToTomorrow DATETIME; - - SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) + DECLARE vDatedToTomorrow DATETIME; + + SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) INTO vDatedFromYesterday, vDatedToTomorrow; SET vDatedTimeTo = util.dayEnd(vDatedTo); - - SELECT minHoursToBreak, breakHours, maxTimePerDay + + SELECT minHoursToBreak, breakHours, maxTimePerDay INTO vMinHoursToBreak, vBreakHours, vMaxTimePerDay FROM workerTimeControlConfig; DELETE FROM workerJourney - WHERE dated BETWEEN vDatedFrom AND vDatedTo + WHERE dated BETWEEN vDatedFrom AND vDatedTo AND NOT isPaid AND NOT isUpdated - AND (vWorkerFk IS NULL OR userFK = vWorkerFk); + AND (vWorkerFk IS NULL OR userFK = vWorkerFk); - -- Se inserta todos los días del periodo por worker y business en el rango de fechas. + -- Se inserta todos los días del periodo por worker y business en el rango de fechas. INSERT IGNORE INTO workerJourney(userFk, dated, businessFk) SELECT b.workerFk, t.dated, b.id - FROM business b + FROM business b JOIN time t ON t.dated BETWEEN b.started AND IFNULL(b.ended,util.VN_CURDATE()) WHERE t.dated BETWEEN vDatedFrom AND vDatedTo AND (vWorkerFk IS NULL OR b.workerFk = vWorkerFk) ORDER BY b.workerFk, t.dated, b.id; - + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; IF vWorkerFk THEN CALL timeControl_calculateByUser(vWorkerFk, vDatedFrom , vDatedTimeTo); - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` - SELECT vWorkerFk userFk; + CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` + SELECT vWorkerFk userFk; ELSE CALL timeControl_calculateAll(vDatedFrom, vDatedTimeTo); - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` + CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` SELECT id userFk FROM worker w; - END IF; + END IF; UPDATE workerJourney wj JOIN tmp.timeControlCalculate t ON wj.dated = t.dated AND wj.userFk = t.userFk - SET wj.total = CAST(IF(t.timeWorkDecimal >= vMinHoursToBreak, - t.timeWorkDecimal - vBreakHours, + SET wj.total = CAST(IF(t.timeWorkDecimal >= vMinHoursToBreak, + t.timeWorkDecimal - vBreakHours, t.timeWorkDecimal) AS DECIMAL (10,2)), wj.lunch = IF(t.timeWorkDecimal >= vMinHoursToBreak , vBreakHours , 0) WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo AND NOT wj.isPaid AND NOT wj.isUpdated AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk); - - -- NOCTURNIDAD + + -- NOCTURNIDAD CALL timeControl_getError(vDatedFrom, vDatedTimeTo); SET @vIsOdd := TRUE; @@ -75036,9 +75526,9 @@ BEGIN CREATE TEMPORARY TABLE tmp.workerTimeControl (INDEX (userFk), INDEX (timed)) ENGINE = MEMORY - SELECT DISTINCT(wtc.id), - wtc.userFk, - wtc.timed, + SELECT DISTINCT(wtc.id), + wtc.userFk, + wtc.timed, wtc.direction FROM workerTimeControl wtc JOIN tmp.`user` w ON w.userFk = wtc.userFk @@ -75048,10 +75538,10 @@ BEGIN AND (vWorkerFk IS NULL OR wtc.userFk = vWorkerFk) ORDER BY wtc.userFk, wtc.timed ASC; - SELECT MAX(id) INTO @vCont + SELECT MAX(id) INTO @vCont FROM tmp.workerTimeControl; - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; CREATE TEMPORARY TABLE tmp.workerTimeControlAux ( `id` int(11) , `userFk` int(10) unsigned , @@ -75073,9 +75563,9 @@ BEGIN DATE(@lastTimed) dated, @lastUserFk lastUserFk, IF(direction ='middle', @vIsOdd := NOT @vIsOdd, FALSE) isOdd, - IF(@vIsOdd - AND @lastDirection = 'middle' - AND (DATE(@lastTimed) <> date(timed) + IF(@vIsOdd + AND @lastDirection = 'middle' + AND (DATE(@lastTimed) <> date(timed) OR @lastUserFk <> userFk), TRUE, FALSE) hasBreak, @lastTimed := wtc.timed, @lastUserFk := userFk, @@ -75089,16 +75579,16 @@ BEGIN SET @lastDirection := NULL; INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1, - lastUserFk, - DATE_ADD(sub.dated, INTERVAL 1 DAY), + SELECT @vCont:= @vCont + 1, + lastUserFk, + DATE_ADD(sub.dated, INTERVAL 1 DAY), 'middle' FROM (SELECT IF(@lastUserFk <> userFk, @vIsOdd := TRUE, NULL), DATE(@lastTimed) dated, @lastUserFk lastUserFk, IF(direction ='middle', @vIsOdd := NOT @vIsOdd, FALSE) isOdd, - IF(@vIsOdd - AND @lastDirection = 'middle' + IF(@vIsOdd + AND @lastDirection = 'middle' AND (DATE(@lastTimed)<>date(timed) OR @lastUserFk<>userFk), TRUE, FALSE) hasBreak, @lastTimed := wtc.timed, @@ -75111,7 +75601,7 @@ BEGIN -- Cambio de dia INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) SELECT @vCont:= @vCont + 1, - wtc.userFk, + wtc.userFk, util.dayEnd(date(wtc.timed)), 'out' FROM workerTimeControl wtc @@ -75122,8 +75612,8 @@ BEGIN GROUP BY wtc.userFk, DATE(wtc.timed); INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1, - wtc.userFk, + SELECT @vCont:= @vCont + 1, + wtc.userFk, DATE_ADD(date(wtc.timed), INTERVAL 1 DAY), 'in' FROM workerTimeControl wtc @@ -75149,8 +75639,8 @@ BEGIN IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed), IF(direction='in', @vDated := DATE(wtc.timed), @vDated ) dated, wtc.userFk, - IF(UNIX_TIMESTAMP(timed)- @vLastTimed < vMaxTimePerDay, - workerNigthlyHours_calculate(FROM_UNIXTIME(@vLastTimed), wtc.timed), + IF(UNIX_TIMESTAMP(timed)- @vLastTimed < vMaxTimePerDay, + workerNigthlyHours_calculate(FROM_UNIXTIME(@vLastTimed), wtc.timed), 0) NigthlyHours, @lastUserFk := userFk FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction @@ -75163,7 +75653,7 @@ BEGIN ) wtc ORDER BY wtc.userFk, wtc.timed )sub - WHERE sub.dated BETWEEN vDatedFrom AND vDatedTo + WHERE sub.dated BETWEEN vDatedFrom AND vDatedTo GROUP BY userFk, sub.dated )night ON night.userFk = wj.userFk AND night.dated = wj.dated SET wj.nocturn = night.NigthlyHours @@ -75175,8 +75665,8 @@ BEGIN UPDATE workerJourney wj JOIN business b ON b.id = wj.businessFk JOIN calendarType ct ON ct.id = b.calendarTypeFk - SET wj.priceOrdinaryHour = - (vMonthsByYear * b.amount) / + SET wj.priceOrdinaryHour = + (vMonthsByYear * b.amount) / (vWeeksByYear * ct.hoursWeek), wj.contractJourney = ct.hoursWeek / vDaysByWeek WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo @@ -75184,7 +75674,7 @@ BEGIN AND NOT wj.isPaid AND NOT isUpdated; - -- Precio Extras, Vacaciones y Nocturnas + -- Precio Extras, Vacaciones y Nocturnas UPDATE workerJourney wj JOIN(SELECT MAX(w.dated), t.dated, w.holidayInc, w.nightInc, w.extraInc FROM time t @@ -75208,12 +75698,12 @@ BEGIN WHERE ct.isPartial AND wj.dated BETWEEN vDatedFrom AND vDatedTo AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid + AND NOT wj.isPaid AND NOT wj.isUpdated; -- Ausencias UPDATE workerJourney wj - JOIN businessCalendar bc ON bc.businessFk = wj.businessFk + JOIN businessCalendar bc ON bc.businessFk = wj.businessFk AND bc.dated = wj.dated JOIN absenceType ab ON ab.id = bc.absenceTypeFk SET wj.permission = ab.permissionRate * wj.contractJourney, @@ -75228,7 +75718,7 @@ BEGIN UPDATE workerJourney SET holiday = IF(DAYNAME(dated)='sábado', 0, total), contractJourney = 0 - WHERE DAYNAME(dated) IN ('sábado', 'domingo') + WHERE DAYNAME(dated) IN ('sábado', 'domingo') AND dated BETWEEN vDatedFrom AND vDatedTo AND (vWorkerFk IS NULL OR userFk = vWorkerFk) AND NOT isPaid @@ -75237,8 +75727,8 @@ BEGIN -- Festivos por centro de trabajo UPDATE workerJourney wj JOIN calendarHolidays ch ON ch.dated = wj.dated - JOIN business b ON b.id = wj.businessFk - AND b.workcenterFk = ch.workcenterFk + JOIN business b ON b.id = wj.businessFk + AND b.workcenterFk = ch.workcenterFk SET wj.holiday = wj.total, wj.permission = wj.contractJourney, wj.contractJourney = 0 @@ -75248,7 +75738,7 @@ BEGIN AND NOT wj.isUpdated; -- Horas extras - UPDATE workerJourney + UPDATE workerJourney SET extra = lunch + total - contractJourney WHERE dated BETWEEN vDatedFrom AND vDatedTo AND (vWorkerFk IS NULL OR userFk = vWorkerFk) @@ -75266,6 +75756,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerMistakeType_get` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75273,26 +75765,26 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistakeType_get`() BEGIN - + /** * Obtiene los tipos de error para los trabajadores */ - - SELECT code, description - FROM workerMistakeType + + SELECT code, description + FROM workerMistakeType ORDER BY description; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerMistake_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75300,8 +75792,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistake_add`(vWorkerFk INT, vWorkerMistakeTypeFk VARCHAR(10)) BEGIN @@ -75313,7 +75803,7 @@ BEGIN * */ INSERT INTO vn.workerMistake(userFk, workerMistakeTypeFk) - VALUES(vWorkerFk, vWorkerMistakeTypeFk); + VALUES(vWorkerFk, vWorkerMistakeTypeFk); END ;; DELIMITER ; @@ -75321,6 +75811,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlAdd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75328,19 +75820,17 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlAdd`(IN vUserFk INT, IN vWarehouseFk INT, IN vDated DATETIME) BEGIN /*INSERT INTO workerTimeControl(userFk, timed, manual, warehouseFk) VALUES(vUserFk, vDated, FALSE, vWarehouseFk); - + CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/ - + CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,util.VN_NOW(),FALSE); - + END ;; DELIMITER ; @@ -75348,6 +75838,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlPinGenerate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75355,8 +75847,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlPinGenerate`( vWorkerFk INT) @@ -75366,14 +75856,16 @@ BEGIN * */ - - + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlSetOrder` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75381,8 +75873,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSetOrder`() BEGIN @@ -75403,6 +75893,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlSOWP` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75410,25 +75902,25 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSOWP`(IN vUserFk INT, IN vDated DATE) BEGIN SET @order := 0; - - UPDATE workerTimeControl - SET `order` = @order := @order + 1 - WHERE vUserFk =userFk + + UPDATE workerTimeControl + SET `order` = @order := @order + 1 + WHERE vUserFk =userFk AND vDated = DATE(timed) ORDER BY timed; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75436,13 +75928,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_add`(IN vUserFk INT, IN vWarehouseFk INT, IN vTimed DATETIME, IN vIsManual BOOL) BEGIN - - + + SELECT workerTimeControl_add(vUserFk,vWarehouseFk,vTimed,vIsManual); END ;; DELIMITER ; @@ -75450,6 +75940,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_calculateOddDays` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75457,8 +75949,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_calculateOddDays`() BEGIN @@ -75490,14 +75980,15 @@ BEGIN LIMIT 10000000000000000000)sub GROUP BY cont HAVING cont2 MOD 2 = 1 - )sub2 - JOIN worker w ON w.userFk = sub2.userFk; + )sub2; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_check` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75505,8 +75996,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) proc: BEGIN @@ -75531,73 +76020,73 @@ proc: BEGIN DECLARE vTo VARCHAR(50) DEFAULT NULL; DECLARE vUserName VARCHAR(50) DEFAULT NULL; DECLARE vBody VARCHAR(255) DEFAULT NULL; - - SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax + + SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax INTO vDayBreak, vWeekBreak, vWeekScope, vDayWorkMax, vDayStayMax FROM workerTimeControlParams; SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk + FROM workerTimeControl + WHERE userFk = vUserFk AND direction = 'in'; - + SELECT MAX(timed) INTO vLastOut - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'out'; + FROM workerTimeControl + WHERE userFk = vUserFk + AND direction = 'out'; SELECT CONCAT(u.name,'@verdnatura.es') INTO vTo FROM account.user u - WHERE u.id = (SELECT bossFk FROM worker WHERE id = vUserFk); - + WHERE u.id = (SELECT bossFk FROM worker WHERE id = vUserFk); + SELECT CONCAT(firstName,' ',lastName) INTO vUserName FROM worker w WHERE w.id = vUserFk; IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA - - -- VERIFICAR DESCANSO DIARIO - IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN + + -- VERIFICAR DESCANSO DIARIO + IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN SELECT "Descansos 12 h" AS problem; -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 12 h") INTO vBody; CALL mail_insert(vTo,vTo,'error al fichar',vBody); LEAVE proc; - END IF; - + END IF; + -- VERIFICAR FICHADAS IMPARES DEL ÚLTIMO DÍA QUE SE FICHÓ - IF (SELECT MOD(COUNT(*),2) -- <>0 - FROM workerTimeControl + IF (SELECT MOD(COUNT(*),2) -- <>0 + FROM workerTimeControl WHERE userFk = vUserFk AND timed >= vLastIn - ) THEN + ) THEN SELECT "Dias con fichadas impares" AS problem; -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Dias con fichadas impares") INTO vBody; CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; + LEAVE proc; END IF; - + -- VERIFICAR VACACIONES SELECT at2.name INTO vCalendarStateType - FROM calendar c + FROM calendar c JOIN business b ON b.id = c.businessFk JOIN absenceType at2 ON at2.id = c.dayOffTypeFk WHERE c.dated = util.VN_CURDATE() AND at2.isAllowedToWork = FALSE AND b.workerFk = vUserFk LIMIT 1; - + IF(LENGTH(vCalendarStateType)) THEN SELECT vCalendarStateType AS problem; -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Vacaciones") INTO vBody; CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - + LEAVE proc; + END IF; - + -- VERIFICAR CONTRATO EN VIGOR IF (SELECT COUNT(*) FROM business b @@ -75609,44 +76098,44 @@ proc: BEGIN -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody; CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - + LEAVE proc; + END IF; -- VERIFICAR DESCANSO SEMANAL SET @vHasBreakWeek:= FALSE; - SET @vLastTimed:= UNIX_TIMESTAMP((util.VN_NOW() - INTERVAL vWeekScope SECOND)); - + SET @vLastTimed:= UNIX_TIMESTAMP((util.VN_NOW() - INTERVAL vWeekScope SECOND)); + DROP TEMPORARY TABLE IF EXISTS tmp.trash; CREATE TEMPORARY TABLE tmp.trash SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, @vLastTimed:= UNIX_TIMESTAMP(timed) - FROM workerTimeControl + FROM workerTimeControl WHERE timed>= (util.VN_NOW() - INTERVAL vWeekScope SECOND) AND userFk= vUserFk AND direction IN ('in','out') - ORDER BY timed ASC; - - IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA + ORDER BY timed ASC; + + IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA SELECT "Descansos 36 h" AS problem; -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 36 h") INTO vBody; CALL mail_insert(vTo,vTo,'error al fichar',vBody); LEAVE proc; END IF; + + DROP TEMPORARY TABLE tmp.trash; - DROP TEMPORARY TABLE tmp.trash; - - ELSE -- DIA ACTUAL - + ELSE -- DIA ACTUAL + -- VERIFICA QUE EL TIEMPO EFECTIVO NO SUPERE EL MÁXIMO - SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(util.VN_NOW()), 0) INTO vTimedWorked + SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(util.VN_NOW()), 0) INTO vTimedWorked FROM workerTimeControl wtc - WHERE userFk = vUserFk + WHERE userFk = vUserFk AND timed >= vLastIn ORDER BY timed; - IF vTimedWorked > vDayWorkMax THEN + IF vTimedWorked > vDayWorkMax THEN SELECT "Jornadas" AS problem; -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Jornadas") INTO vBody; @@ -75669,16 +76158,18 @@ proc: BEGIN -- ENVIAMOS CORREO AL BOSSFK SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"No perteneces a este departamento.") INTO vBody; CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; + LEAVE proc; END IF; END IF;*/ - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_checkBreak` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75686,13 +76177,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_checkBreak`(vStarted DATE) BEGIN /** - * Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas + * Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas * El sistema verificará el descanso corto en la siguiente semana * o el largo en las 2 siguientes semanas a partir de la fecha dada * @param vStarted día inicio de la semana en el que se quiere verificar @@ -75703,27 +76192,27 @@ BEGIN DECLARE vShortWeekBreak INT; DECLARE vLongWeekBreak INT; - SELECT util.dayEnd(DATE_ADD(vStarted, INTERVAL shortWeekDays DAY)), + SELECT util.dayEnd(DATE_ADD(vStarted, INTERVAL shortWeekDays DAY)), util.dayEnd(DATE_ADD(vStarted, INTERVAL longWeekDays DAY)), - shortWeekBreak, + shortWeekBreak, longWeekBreak INTO vShortEnded, vLongEnded, vShortWeekBreak, vLongWeekBreak FROM workerTimeControlConfig; - + SET @previousTimed:= UNIX_TIMESTAMP(vStarted); SET @lastUserFk := NULL; - + -- Descanso corto en la semana - + DROP TEMPORARY TABLE IF EXISTS tmp.worker; CREATE TEMPORARY TABLE tmp.worker (PRIMARY KEY(workerFk)) ENGINE = MEMORY SELECT DISTINCT userFk workerFk - FROM workerTimeControl + FROM workerTimeControl WHERE timed BETWEEN vStarted AND vShortEnded AND direction IN ('in', 'out'); - + DROP TEMPORARY TABLE IF EXISTS tmp.worker2; CREATE TEMPORARY TABLE tmp.worker2 (PRIMARY KEY(workerFk)) @@ -75736,28 +76225,28 @@ BEGIN SELECT sub2.userFk workerFk FROM(SELECT sub.userFk, IF(sub.userFk <> @lastUserFk, - @previousTimed:= sub.timed, + @previousTimed:= sub.timed, FALSE), - IF(sub.timed - @previousTimed >= vShortWeekBreak, - TRUE, + IF(sub.timed - @previousTimed >= vShortWeekBreak, + TRUE, FALSE) hasShortWeekBreak, @previousTimed:= sub.timed, @lastUserFk:= sub.userFk FROM ( SELECT userFk, UNIX_TIMESTAMP(timed) timed - FROM workerTimeControl + FROM workerTimeControl WHERE timed BETWEEN vStarted AND vShortEnded AND direction IN ('in', 'out') - UNION + UNION SELECT w.workerFk, UNIX_TIMESTAMP(IFNULL( - MIN(wtc.timed), + MIN(wtc.timed), DATE_ADD(vShortEnded, INTERVAL vShortWeekBreak SECOND))) FROM tmp.worker w - LEFT JOIN workerTimeControl wtc - ON wtc.userFk = w.workerFk - AND wtc.timed BETWEEN vShortEnded - AND DATE_ADD(vShortEnded, INTERVAL vShortWeekBreak SECOND) + LEFT JOIN workerTimeControl wtc + ON wtc.userFk = w.workerFk + AND wtc.timed BETWEEN vShortEnded + AND DATE_ADD(vShortEnded, INTERVAL vShortWeekBreak SECOND) GROUP BY w.workerFk UNION SELECT w.workerFk, @@ -75765,10 +76254,10 @@ BEGIN MAX(wtc.timed), DATE_SUB(vStarted, INTERVAL vShortWeekBreak SECOND))) FROM tmp.worker2 w - LEFT JOIN workerTimeControl wtc - ON wtc.userFk = w.workerFk - AND wtc.timed BETWEEN - DATE_SUB(vStarted, INTERVAL vShortWeekBreak SECOND) + LEFT JOIN workerTimeControl wtc + ON wtc.userFk = w.workerFk + AND wtc.timed BETWEEN + DATE_SUB(vStarted, INTERVAL vShortWeekBreak SECOND) AND vStarted GROUP BY w.workerFk ORDER BY userFk, timed @@ -75778,7 +76267,7 @@ BEGIN GROUP BY sub2.userFk HAVING NOT SUM(hasShortWeekBreak); - -- Descanso largo en las 2 siguientes semanas + -- Descanso largo en las 2 siguientes semanas DROP TEMPORARY TABLE tmp.worker; CREATE TEMPORARY TABLE tmp.worker (PRIMARY KEY(workerFk)) @@ -75798,12 +76287,12 @@ BEGIN (PRIMARY KEY(workerFk)) ENGINE = MEMORY SELECT sub2.userFk workerFk - FROM(SELECT userFk, + FROM(SELECT userFk, IF(userFk <> @lastUserFk, - @previousTimed:= timed, + @previousTimed:= timed, TRUE), - IF(timed - @previousTimed >= vLongWeekBreak, - TRUE, + IF(timed - @previousTimed >= vLongWeekBreak, + TRUE, FALSE) hasLongWeekBreak, @previousTimed:= timed, @lastUserFk:= userFk @@ -75812,24 +76301,24 @@ BEGIN JOIN tmp.workerWithoutShortWeekBreak wws ON wws.workerFk = wtc.userFk WHERE timed BETWEEN vStarted AND vLongEnded AND direction IN ('in', 'out') - UNION + UNION SELECT w.workerFk, - UNIX_TIMESTAMP(IFNULL(MIN(wtc.timed), + UNIX_TIMESTAMP(IFNULL(MIN(wtc.timed), DATE_ADD(vLongEnded, INTERVAL vLongWeekBreak SECOND))) FROM tmp.worker w - LEFT JOIN workerTimeControl wtc - ON wtc.userFk = w.workerFk - AND timed BETWEEN vLongEnded - AND DATE_ADD(vLongEnded, INTERVAL vLongWeekBreak SECOND) + LEFT JOIN workerTimeControl wtc + ON wtc.userFk = w.workerFk + AND timed BETWEEN vLongEnded + AND DATE_ADD(vLongEnded, INTERVAL vLongWeekBreak SECOND) GROUP BY w.workerFk UNION - SELECT w.workerFk, - UNIX_TIMESTAMP(IFNULL(MAX(wtc.timed), + SELECT w.workerFk, + UNIX_TIMESTAMP(IFNULL(MAX(wtc.timed), DATE_SUB(vStarted, INTERVAL vLongWeekBreak SECOND))) FROM tmp.worker2 w - LEFT JOIN workerTimeControl wtc - ON wtc.userFk = w.workerFk - AND timed BETWEEN DATE_SUB(vStarted, INTERVAL vLongWeekBreak SECOND) + LEFT JOIN workerTimeControl wtc + ON wtc.userFk = w.workerFk + AND timed BETWEEN DATE_SUB(vStarted, INTERVAL vLongWeekBreak SECOND) AND vStarted GROUP BY w.workerFk ORDER BY userFk, timed @@ -75846,6 +76335,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_clockIn` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75853,8 +76344,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_clockIn`( vWorker INT, @@ -76190,6 +76679,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_direction` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76197,8 +76688,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_direction`(vWorkerFk VARCHAR(10), vTimed DATETIME) BEGIN @@ -76206,27 +76695,27 @@ BEGIN * Devuelve que direcciones de fichadas son lógicas a partir de la anterior fichada * @param vWorkerFk Identificador del trabajador * @return (option1, option2) - * Los valores posibles de retorno son ('in', 'inMiddle', 'outMiddle', 'out') + * Los valores posibles de retorno son ('in', 'inMiddle', 'outMiddle', 'out') */ DECLARE vLastIn DATETIME ; DECLARE vIsMiddleOdd BOOLEAN ; - IF (vTimed IS NULL) THEN + IF (vTimed IS NULL) THEN SET vTimed = util.VN_NOW(); END IF; - + SELECT timed INTO vLastIn - FROM workerTimeControl + FROM workerTimeControl WHERE userFk = vWorkerFk - AND direction = 'in' + AND direction = 'in' AND timed < vTimed ORDER BY timed DESC LIMIT 1; - + SELECT (COUNT(*)mod 2 = 1) INTO vIsMiddleOdd - FROM workerTimeControl + FROM workerTimeControl WHERE userFk = vWorkerFk - AND direction = 'middle' + AND direction = 'middle' AND timed BETWEEN vLastIn AND util.VN_NOW(); DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection; @@ -76264,6 +76753,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_getClockIn` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76271,11 +76762,9 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_getClockIn`( - vUserFk INT, + vUserFk INT, vDated DATE) BEGIN /** @@ -76285,9 +76774,9 @@ BEGIN * @param vDated Fecha proporcionada */ CALL timeControl_calculateByWorker( - vUserFk, + vUserFk, DATE_SUB(vDated, INTERVAL 6 DAY), util.dayEnd(vDated)); - + SET @position := 0; SET @lastDated := NULL; @@ -76304,7 +76793,7 @@ BEGIN MAX(2daysAgoDirection) 2daysAgoDirection, MAX(1daysAgo) 1daysAgo, MAX(1daysAgoDirection) 1daysAgoDirection, - MAX(0daysAgo) 0daysAgo, + MAX(0daysAgo) 0daysAgo, MAX(0daysAgoDirection) 0daysAgoDirection FROM(SELECT IF(daysAgo = 6, timed, '') 6daysAgo, IF(daysAgo = 5, timed, '') 5daysAgo, @@ -76324,7 +76813,7 @@ BEGIN direction, position FROM(SELECT DATEDIFF(vDated, timed) daysAgo, - TIME_FORMAT(timed,'%H:%i') timed, + TIME_FORMAT(timed,'%H:%i') timed, IF(DATE(timed) <> @lastDated, @position := 0, NULL), @position := @position+1 position, @lastDated := DATE(timed), @@ -76336,18 +76825,18 @@ BEGIN LIMIT 10000000000000000000 )sub )sub2 - GROUP BY position) sub3 + GROUP BY position) sub3 JOIN (SELECT MAX(IF(daysAgo = 6, timeWorkSeconds, 0)) 6daysAgoTotal, MAX(IF(daysAgo = 5, timeWorkSeconds, 0)) 5daysAgoTotal, MAX(IF(daysAgo = 4, timeWorkSeconds, 0)) 4daysAgoTotal, MAX(IF(daysAgo = 3, timeWorkSeconds, 0)) 3daysAgoTotal, MAX(IF(daysAgo = 2, timeWorkSeconds, 0)) 2daysAgoTotal, MAX(IF(daysAgo = 1, timeWorkSeconds, 0)) 1daysAgoTotal, - MAX(IF(daysAgo = 0, timeWorkSeconds, 0)) 0daysAgoTotal + MAX(IF(daysAgo = 0, timeWorkSeconds, 0)) 0daysAgoTotal FROM (SELECT DATEDIFF(vDated, dated) daysAgo, timeWorkSeconds FROM tmp.timeControlCalculate) sub4)sub5 ON TRUE; - + DROP TEMPORARY TABLE tmp.timeControlCalculate; END ;; DELIMITER ; @@ -76355,6 +76844,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_login` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76362,8 +76853,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_login`(vWorkerFk VARCHAR(10)) BEGIN @@ -76394,6 +76883,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_remove` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76401,8 +76892,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_remove`(IN vUserFk INT, IN vTimed DATETIME) BEGIN @@ -76411,51 +76900,53 @@ BEGIN DECLARE vDirectionPrevious VARCHAR(6); DECLARE vTimedPrevious DATETIME; - SELECT direction INTO vDirectionRemove - FROM vn.workerTimeControl - WHERE userFk = vUserFk + SELECT direction INTO vDirectionRemove + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND timed = vTimed ; IF vDirectionRemove = 'out' THEN - + SELECT timed, direction INTO vTimedPrevious, vDirectionPrevious - FROM vn.workerTimeControl - WHERE userFk = vUserFk + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND timed < vTimed ORDER BY timed DESC - LIMIT 1; - + LIMIT 1; + IF vDirectionPrevious = "middle" THEN - UPDATE vn.workerTimeControl + UPDATE vn.workerTimeControl SET direction = "out" WHERE userFk = vUserFk AND timed = vTimedPrevious; END IF; - + ELSE IF vDirectionRemove = 'in' THEN - UPDATE vn.workerTimeControl + UPDATE vn.workerTimeControl SET direction = "in" WHERE userFk = vUserFk AND timed > vTimed ORDER BY timed ASC - LIMIT 1; + LIMIT 1; END IF; - + END IF; - + DELETE FROM vn.workerTimeControl - WHERE userFk = vUserFk + WHERE userFk = vUserFk AND timed = vTimed; - + CALL vn.workerTimeControlSOWP(vUserFk, vTimed); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_repair` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76463,8 +76954,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_repair`() proc: BEGIN @@ -76477,37 +76966,39 @@ proc: BEGIN UPDATE vn.workerTimeControl SET direction = 'middle'; /*2- poner los out*/ -UPDATE vn.workerTimeControl wtc - JOIN +UPDATE vn.workerTimeControl wtc + JOIN (SELECT userFk,MAX(timed) maxTimed FROM (SELECT id, userFk, timed, date(timed) dated - FROM vn.workerTimeControl - ) sub + FROM vn.workerTimeControl + ) sub GROUP BY userFk,dated )sub SET direction = "out" - WHERE wtc.userFk = sub.userFk + WHERE wtc.userFk = sub.userFk AND wtc.timed = sub.maxTimed; - - /*3- poner los in*/ -UPDATE vn.workerTimeControl wtc - JOIN + + /*3- poner los in*/ +UPDATE vn.workerTimeControl wtc + JOIN (SELECT userFk,MIN(timed) maxTimed FROM (SELECT id, userFk, timed, date(timed) dated - FROM vn.workerTimeControl - ) sub + FROM vn.workerTimeControl + ) sub GROUP BY userFk,dated )sub SET direction = "in" - WHERE wtc.userFk = sub.userFk - AND wtc.timed = sub.maxTimed ; - + WHERE wtc.userFk = sub.userFk + AND wtc.timed = sub.maxTimed ; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_sendMailByDepartment` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76515,8 +77006,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartment`(IN vDatedFrom DATETIME, IN vDatedTo DATETIME, IN vWorkerFk INT) BEGIN @@ -76550,10 +77039,10 @@ BEGIN w.lastName, w.firstname, c.fi, - w.id, + w.id userFk, MONTHNAME(t.dated) mes, YEAR(t.dated) año, - w.userFk, + w.id, tm.hoursWeek, tm.type, b.started, @@ -76574,7 +77063,7 @@ BEGIN AND w.businessFk GROUP BY tm.userFk,t.dated ORDER BY tm.userFk,t.dated; - + INSERT INTO vn.mail (receiver, replyTo, subject, body) SELECT eu.email, 'laboral@verdnatura.es', CONCAT('Registro de horas semana ', WEEK(vDatedFrom), ' año ', YEAR(vDatedFrom)) , CONCAT(' @@ -76650,6 +77139,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_sendMailByDepartmentLauncher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76657,8 +77148,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartmentLauncher`() BEGIN @@ -76666,7 +77155,7 @@ BEGIN IF (DAYNAME(util.VN_CURDATE()) = 'miércoles') THEN SELECT DATE_SUB(util.VN_CURDATE(), INTERVAL 9 DAY), CONCAT(DATE_SUB(util.VN_CURDATE(), INTERVAL 3 DAY), ' 23:59:59') INTO vDatedFrom, vDatedTo; - + CALL vn.workerTimeControl_sendMailByDepartment(vDatedFrom, vDatedTo, NULL); END IF; END ;; @@ -76675,6 +77164,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_setOrder` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76682,8 +77173,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_setOrder`(vUserFk INT, vStarted DATE, vFinished DATE) BEGIN @@ -76703,6 +77192,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_weekCheckBreak` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76710,15 +77201,13 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_weekCheckBreak`(vStarted DATE, vEnded DATE) BEGIN /** - * Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas - * El sistema verificará el descanso corto en la siguiente semana - * o el largo en las 2 siguientes semanas a partir de las fechas dadas + * Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas + * El sistema verificará el descanso corto en la siguiente semana + * o el largo en las 2 siguientes semanas a partir de las fechas dadas * @param vStarted día inicio para verificar * @param vEnded día final para verificar * @return tmp.workerWithoutWeekBreak (workerFk) @@ -76740,10 +77229,10 @@ BEGIN CALL workerTimeControl_checkBreak(vStarted); INSERT IGNORE INTO tmp.workerWithoutWeekBreakInWeek - SELECT workerFk + SELECT workerFk FROM tmp.workerWithoutWeekBreak; DROP TEMPORARY TABLE IF EXISTS tmp.workerWithoutWeekBreak; - SET vStarted = DATE_ADD(vStarted, INTERVAL 1 DAY); + SET vStarted = DATE_ADD(vStarted, INTERVAL 1 DAY); END WHILE; END ;; @@ -76752,6 +77241,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerWeekControl` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76759,8 +77250,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerWeekControl`(vUserFk INT, vDated DATE, vTabletFk VARCHAR(100)) BEGIN @@ -76781,7 +77270,7 @@ BEGIN DECLARE vDepartmentFk INT; DECLARE isEnabled BOOLEAN DEFAULT TRUE; - SELECT COUNT(*) INTO vHasSignedToday + SELECT COUNT(*) INTO vHasSignedToday FROM workerTimeControl WHERE timed >= vDated AND userFk = vUserFk; SET @day := 0; @@ -76794,16 +77283,16 @@ BEGIN SELECT fichada_anterior, fichada_actual, interval_in_minutes, jornadas FROM ( - SELECT @lastTimed fichada_anterior, + SELECT @lastTimed fichada_anterior, timed, CAST(time_to_sec(timediff(timed,@lastTimed )) / 60 AS UNSIGNED) as interval_in_minutes, IF(day(timed) != @day, 1, 0) as jornadas, @day := day(timed) dia_del_mes, - @lastTimed := timed fichada_actual + @lastTimed := timed fichada_actual FROM ( SELECT day(timed) as dayNumber, dayname(timed) as dayName, timed - FROM + FROM (SELECT TIMESTAMPADD(DAY, -11, util.VN_NOW()) as timed, vUserFk as userFk -- Fichada virtual para los en los que no se ha trabajado la semana anterior UNION ALL SELECT timed, userFk @@ -76811,18 +77300,18 @@ BEGIN WHERE userFk = vUserFk AND timed >= TIMESTAMPADD(DAY, -10,vDated) UNION ALL - SELECT IF(vHasSignedToday, '2000-01-01 00:00', util.VN_NOW()) as timed, vUserFk + SELECT IF(vHasSignedToday, '2000-01-01 00:00', util.VN_NOW()) as timed, vUserFk ) sub4 ORDER BY timed ) sub - + ) sub2 WHERE fichada_actual >= TIMESTAMPADD(WEEK, -1, vDated) ) sub3 ; SELECT IFNULL(SUM(impar),0) into vImpares FROM ( - SELECT day(timed) as dayNumber, + SELECT day(timed) as dayNumber, count(*) mod 2 as impar FROM vn.workerTimeControl wtc WHERE userFk = vUserFk @@ -76839,29 +77328,29 @@ BEGIN AND at2.isAllowedToWork = FALSE AND b.workerFk = vUserFk LIMIT 1; - + -- Contrato en vigor SELECT IF(COUNT(*),vCantWork,'Sin contrato') INTO vCantWork FROM business b WHERE b.workerFk = vUserFk AND b.started <= vDated AND IFNULL(b.ended, vDated) >= vDated; - + -- Departamento si vTabletFk es 0 no hacemos comprobacion (Madrid y Vilassar) IF vTabletFk <> '0' THEN -- 1 Obtener el departamento del usuario SELECT wtcu.departmentFk INTO vDepartmentFk FROM workerTimeControlUserInfo wtcu WHERE wtcu.userFk = vUserFk; - -- 2 Comprobar si la tablet pertenece al departamento + -- 2 Comprobar si la tablet pertenece al departamento SELECT COUNT(td.tabletFk) INTO isEnabled FROM tabletDepartment td WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk; - + END IF; - + IF vJornadas IS NOT NULL THEN - + SELECT 'Jornadas' as Item, vJornadas as Cantidad, 'Correcto' AS Análisis UNION ALL SELECT 'Descansos 12 h' as Item, vDescansos12h as Cantidad, IF(vDescansos12h >= vJornadas, 'Correcto','Error: 1 por jornada') as Análisis @@ -76870,9 +77359,9 @@ BEGIN UNION ALL SELECT 'Dias con fichadas impares' as Item, vImpares as Cantidad, IF(vImpares = 0, 'Correcto','Error') as Análisis UNION ALL - SELECT IF (LENGTH(vCantWork),CONCAT('Dia no laborable: ', vCantWork),'Dia laborable') as Item, - '' as Cantidad, - IF(LENGTH(vCantWork),'Error', 'Correcto') as Análisis + SELECT IF (LENGTH(vCantWork),CONCAT('Dia no laborable: ', vCantWork),'Dia laborable') as Item, + '' as Cantidad, + IF(LENGTH(vCantWork),'Error', 'Correcto') as Análisis UNION ALL SELECT 'El fichador no pertenece a tu departamento.' as Item, '' as Cantidad, IF(isEnabled, 'Correcto','Error') as Análisis; @@ -76886,7 +77375,7 @@ BEGIN UNION ALL SELECT 'Dias con fichadas impares' as Item, vImpares as Cantidad, 'Correcto' as Análisis UNION ALL - SELECT IF (LENGTH(vCantWork),CONCAT('Dia no laborable: ', vCantWork),'Dia laborable') as Item, + SELECT IF (LENGTH(vCantWork),CONCAT('Dia no laborable: ', vCantWork),'Dia laborable') as Item, '' as Cantidad, IF(LENGTH(vCantWork),'Error', 'Correcto') as Análisis UNION ALL SELECT 'El fichador no pertenece a tu departamento.' as Item, '' as Cantidad, IF(isEnabled, 'Correcto','Error') as Análisis; @@ -76898,6 +77387,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `worker_getFromHasMistake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76905,8 +77396,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getFromHasMistake`(vDepartmentFk INT) BEGIN @@ -76916,11 +77405,11 @@ BEGIN * @param vDepartmentFk id del departamento * */ - - SELECT w.id,w.firstName, w.lastName,d.name - FROM worker w - JOIN workerDepartment wd ON wd.workerFk = w.id - JOIN department d ON d.id = wd.departmentFk + + SELECT w.id,w.firstName, w.lastName,d.name + FROM worker w + JOIN workerDepartment wd ON wd.workerFk = w.id + JOIN department d ON d.id = wd.departmentFk WHERE d.id = vDepartmentFk ORDER BY firstName; @@ -76930,6 +77419,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `worker_getHierarchy` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76937,8 +77428,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getHierarchy`(vBoss INT) BEGIN @@ -76951,7 +77440,7 @@ BEGIN (PRIMARY KEY (workerFk)) ENGINE = MEMORY SELECT vBoss AS workerFk; - + DROP TEMPORARY TABLE IF EXISTS tmp.workerHierarchyList; CREATE TEMPORARY TABLE tmp.workerHierarchyList (PRIMARY KEY (workerFk)) @@ -76962,7 +77451,7 @@ BEGIN WHILE (SELECT COUNT(*) FROM tmp.workerHierarchyList WHERE NOT isChecked) > 0 DO INSERT INTO tmp.workerHierarchyList - SELECT w.id, 0 + SELECT w.id, 0 FROM worker w JOIN workerHierarchy wh ON wh.workerFk = w.bossFk; @@ -76973,12 +77462,12 @@ BEGIN TRUNCATE workerHierarchy; INSERT INTO workerHierarchy - SELECT workerFk + SELECT workerFk FROM tmp.workerHierarchyList WHERE NOT isChecked; END WHILE; - + DROP TEMPORARY TABLE IF EXISTS workerHierarchy; END ;; DELIMITER ; @@ -76986,6 +77475,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `worker_getSector` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -76993,8 +77484,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getSector`() BEGIN @@ -77005,8 +77494,8 @@ BEGIN SELECT s.id,s.description,s.warehouseFk FROM sector s - JOIN worker w ON w.sectorFk = s.id - WHERE w.id = account.myUser_getId(); + JOIN operator o ON o.sectorFk = s.id + WHERE o.workerFk = account.myUser_getId(); END ;; DELIMITER ; @@ -77014,6 +77503,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `worker_updateBalance` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77021,8 +77512,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_updateBalance`(vSelfFk INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2)) BEGIN @@ -77040,6 +77529,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `worker_updateBusiness` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77047,8 +77538,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_updateBusiness`(vSelf INT) BEGIN @@ -77068,6 +77557,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `worker_updateChangedBusiness` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77075,8 +77566,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_updateChangedBusiness`() BEGIN @@ -77090,8 +77579,8 @@ BEGIN DECLARE vDone BOOL; DECLARE vCursor CURSOR FOR - SELECT DISTINCT b.workerFk - FROM business b + SELECT DISTINCT b.workerFk + FROM business b WHERE b.started > vBusinessUpdated AND b.started <= vCurdate OR b.ended >= vBusinessUpdated AND b.ended < vCurdate; @@ -77121,33 +77610,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `worker_updateSector` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_updateSector`(vSectorFk INT) -BEGIN -/** - * Actualiza el sector del usuario conectado y borra la impresora asociada al usuario - * - * @param vSectorFk id del sector - */ - UPDATE worker - SET sectorFk = vSectorFk, - labelerFk = NULL - WHERE id = account.myUser_getId(); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `workingHours` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77155,16 +77619,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHours`(username varchar(255), logon boolean) BEGIN DECLARE userid int(11); - + SELECT vn.getUserId(username) INTO userid; SELECT username, userid; - IF userid IS NOT NULL THEN + IF userid IS NOT NULL THEN IF (logon) THEN CALL vn.workingHoursTimeIn(userid); ELSE @@ -77177,6 +77639,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workingHoursTimeIn` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77184,8 +77648,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeIn`(vUserId INT(11)) BEGIN @@ -77197,6 +77659,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workingHoursTimeOut` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77204,8 +77668,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeOut`(vUserId INT(11)) BEGIN @@ -77219,6 +77681,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `wrongEqualizatedClient` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77226,24 +77690,22 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `wrongEqualizatedClient`() BEGIN SELECT clientFk, c.name, c.isActive, c.isTaxDataChecked, count(ie) as num FROM vn.client c - JOIN + JOIN ( - SELECT DISTINCT + SELECT DISTINCT `a`.`clientFk` , a.isEqualizated = 0 as ie - + FROM `vn`.`address` `a` ) sub ON sub.clientFk = c.id WHERE c.hasToInvoiceByAddress = FALSE - + GROUP BY clientFk HAVING num > 1 UNION ALL @@ -77259,6 +77721,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `XDiario_checkDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77266,8 +77730,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_checkDate`(vDate DATE) proc: BEGIN @@ -77296,6 +77758,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zoneClosure_recalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77303,8 +77767,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneClosure_recalc`() proc: BEGIN @@ -77327,27 +77789,27 @@ proc: BEGIN SELECT scope INTO vScope FROM zoneConfig; - + DROP TEMPORARY TABLE IF EXISTS tmp.zone; CREATE TEMPORARY TABLE tmp.zone (INDEX (id)) ENGINE = MEMORY SELECT id FROM zone; - + TRUNCATE TABLE zoneClosure; - + WHILE vCounter <= vScope DO - + CALL zone_getOptionsForShipment(vShipped, TRUE); - + REPLACE zoneClosure(zoneFk, dated, `hour`) - SELECT zoneFk, vShipped, `hour` + SELECT zoneFk, vShipped, `hour` FROM tmp.zoneOption; - + SET vCounter = vCounter + 1; SET vShipped = TIMESTAMPADD(DAY, 1, vShipped); END WHILE; - + -- DROP TEMPORARY TABLE tmp.zone; DO RELEASE_LOCK('vn.zoneClosure_recalc'); END ;; @@ -77356,6 +77818,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zoneGeo_calcTree` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77363,8 +77827,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_calcTree`() BEGIN @@ -77400,6 +77862,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zoneGeo_calcTreeRec` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77407,8 +77871,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_calcTreeRec`( vSelf INT, @@ -77441,7 +77903,7 @@ BEGIN OR (vSelf IS NOT NULL AND parentFk = vSelf); DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SET vSons = 0; OPEN vChildren; @@ -77452,11 +77914,11 @@ BEGIN IF vDone THEN LEAVE myLoop; END IF; - + SET vIndex = vIndex + 1; SET vLft = vIndex; SET vSons = vSons + 1; - + CALL zoneGeo_calcTreeRec( vChildFk, CONCAT(vPath, vChildFk, '/'), @@ -77482,6 +77944,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zoneGeo_checkName` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77489,8 +77953,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_checkName`(vName VARCHAR(255)) BEGIN @@ -77504,6 +77966,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zoneGeo_delete` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77511,8 +77975,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_delete`(vSelf INT) BEGIN @@ -77530,6 +77992,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zoneGeo_doCalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77537,8 +78001,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_doCalc`() proc: BEGIN @@ -77559,7 +78021,7 @@ proc: BEGIN SELECT isChanged INTO vIsChanged FROM zoneGeoRecalc; - + IF vIsChanged THEN UPDATE zoneGeoRecalc SET isChanged = FALSE; CALL vn.zoneGeo_calcTree; @@ -77572,6 +78034,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zoneGeo_setParent` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77579,8 +78043,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_setParent`(vSelf INT, vParentFk INT) BEGIN @@ -77601,6 +78063,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zoneGeo_throwNotEditable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77608,8 +78072,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_throwNotEditable`() BEGIN @@ -77621,6 +78083,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_excludeFromGeo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77628,8 +78092,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_excludeFromGeo`(vZoneGeo INT) BEGIN @@ -77654,6 +78116,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getAgency` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77661,8 +78125,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAgency`(vAddress INT, vLanded DATE) BEGIN @@ -77703,6 +78165,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getAvailable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77710,8 +78174,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAvailable`(vAddress INT, vLanded DATE) BEGIN @@ -77729,6 +78191,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getClosed` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77736,8 +78200,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getClosed`() proc:BEGIN @@ -77747,7 +78209,7 @@ proc:BEGIN * @table tmp.closedZones(zoneFk, warehouseFk); */ DROP TEMPORARY TABLE IF EXISTS tmp.closedZones; - + CREATE TEMPORARY TABLE tmp.closedZones ( `zoneFk` int(11) NOT NULL, `warehouseFk` smallint(6) unsigned NOT NULL, @@ -77776,6 +78238,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getCollisions` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77783,13 +78247,11 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getCollisions`() BEGIN /** - * Calcula si para un mismo codigo postal y dia + * Calcula si para un mismo codigo postal y dia * hay mas de una zona configurada y manda correo * */ @@ -77798,16 +78260,16 @@ BEGIN DECLARE vIsDone INT DEFAULT FALSE; DECLARE vTableCollisions TEXT; DECLARE cur1 CURSOR FOR SELECT zoneFk from tmp.zoneOption; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE; DROP TEMPORARY TABLE IF EXISTS tmp.zone; CREATE TEMPORARY TABLE tmp.zone - SELECT z.id + SELECT z.id FROM zone z JOIN agencyMode am ON am.id = z.agencyModeFk JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE dm.code IN ('AGENCY','DELIVERY'); + WHERE dm.code IN ('AGENCY','DELIVERY'); CALL zone_getOptionsForShipment(util.VN_CURDATE(),FALSE); @@ -77822,7 +78284,7 @@ BEGIN PRIMARY KEY zoneFkk (zoneFk, geoFk), INDEX(geoFk)) ENGINE = MyISAM; - + OPEN cur1; cur1Loop: LOOP SET vIsDone = FALSE; @@ -77830,40 +78292,40 @@ BEGIN IF vIsDone THEN LEAVE cur1Loop; END IF; - + CALL zone_getLeaves(vZoneFk, NULL, NULL, TRUE); - myLoop: LOOP + myLoop: LOOP SET vGeoFk = NULL; - SELECT geoFk INTO vGeoFk + SELECT geoFk INTO vGeoFk FROM tmp.zoneNodes zn WHERE NOT isChecked LIMIT 1; - + IF vGeoFk IS NULL THEN LEAVE myLoop; END IF; - + CALL zone_getLeaves(vZoneFk, vGeoFk, NULL, TRUE); UPDATE tmp.zoneNodes - SET isChecked = TRUE + SET isChecked = TRUE WHERE geoFk = vGeoFk; END LOOP; END LOOP; CLOSE cur1; - DELETE FROM tmp.zoneNodes + DELETE FROM tmp.zoneNodes WHERE sons > 0; - + DROP TEMPORARY TABLE IF EXISTS geoCollision; CREATE TEMPORARY TABLE geoCollision SELECT z.agencyModeFk, zn.geoFk, zw.warehouseFk FROM tmp.zoneNodes zn JOIN zone z ON z.id = zn.zoneFk - JOIN zoneWarehouse zw ON z.id = zw.zoneFk + JOIN zoneWarehouse zw ON z.id = zw.zoneFk GROUP BY z.agencyModeFk, zn.geoFk, zw.warehouseFk HAVING count(*) > 1; - + SELECT ' @@ -77873,39 +78335,39 @@ BEGIN ' INTO vTableCollisions; - - INSERT INTO mail (receiver,replyTo,subject,body) + + INSERT INTO mail (receiver,replyTo,subject,body) SELECT 'pepe@verdnatura.es' receiver, 'noreply@verdnatura.es' replyTo, CONCAT('Colisiones en zonas ', util.VN_CURDATE()) subject, CONCAT(vTableCollisions, GROUP_CONCAT(sub.td SEPARATOR ''), '
C.PostalAlmacén Salix
') body - FROM(SELECT + FROM(SELECT CONCAT(' ', zn.name, ' ', zoneFk,' ', z.price,' ', z.name,' ', w.name, ' - ', CONCAT('' - 'https://salix.verdnatura.es/#!/zone/', + 'https://salix.verdnatura.es/#!/zone/', zoneFk, '/location?q=%7B%22search%22:%22', - zn.name, + zn.name, '%22%7D'),' ') td FROM tmp.zoneNodes zn JOIN zone z ON z.id = zn.zoneFk JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk JOIN warehouse w ON w.id = gc.warehouseFk) sub; - - DROP TEMPORARY TABLE - geoCollision, + + DROP TEMPORARY TABLE + geoCollision, tmp.zone, tmp.zoneNodes; END ;; @@ -77914,6 +78376,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getEvents` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77921,8 +78385,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getEvents`( vGeoFk INT, @@ -77980,7 +78442,7 @@ BEGIN FROM tZone t JOIN zoneExclusion e ON e.zoneFk = t.id LEFT JOIN zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id - JOIN zoneGeo zg1 ON zg1.id = eg.geoFk + LEFT JOIN zoneGeo zg1 ON zg1.id = eg.geoFk JOIN zoneGeo zg2 ON zg2.id = vGeoFk WHERE eg.zoneExclusionFk IS NULL OR zg2.`path` LIKE CONCAT(zg1.`path`,'%'); @@ -77991,6 +78453,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getFromGeo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77998,8 +78462,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getFromGeo`(vGeoFk INT) BEGIN @@ -78012,18 +78474,18 @@ BEGIN DECLARE vChildFk INT DEFAULT vGeoFk; DECLARE vParentFk INT; DECLARE vLevel INT DEFAULT 1; - + DROP TEMPORARY TABLE IF EXISTS tNodes; CREATE TEMPORARY TABLE tNodes (PRIMARY KEY (id)) ENGINE = MEMORY SELECT vGeoFk id, vLevel `level`; - + myLoop: LOOP SELECT parentFk INTO vParentFk FROM zoneGeo WHERE id = vChildFk; - + SET vChildFk = vParentFk; SET vLevel = vLevel + 1; @@ -78031,7 +78493,7 @@ BEGIN SELECT vChildFk, vLevel FROM DUAL WHERE vChildFk IS NOT NULL; - + IF ROW_COUNT() = 0 THEN LEAVE myLoop; END IF; @@ -78060,6 +78522,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getLanded` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78067,8 +78531,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN) BEGIN @@ -78120,6 +78582,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getLeaves` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78127,252 +78591,135 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getLeaves`( - vSelf INT, - vParentFk INT, - vSearch VARCHAR(255), - vHasInsert BOOL +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves`( + vSelf INT, + vParentFk INT, + vSearch VARCHAR(255), + vHasInsert BOOL ) -BEGIN -/** - * Devuelve las ubicaciones incluidas en la ruta y que sean hijos de parentFk. - * @param vSelf Id de la zona - * @param vParentFk Id del geo a calcular - * @param vSearch Cadena a buscar - * @param vHasInsert Indica si inserta en tmp.zoneNodes - * Optional @table tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - */ - DECLARE vIsNumber BOOL; - DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch <> ''; - - CREATE OR REPLACE TEMPORARY TABLE tNodes - (UNIQUE (id)) - ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; - - IF vIsSearch THEN - SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - - INSERT INTO tNodes - SELECT id - FROM zoneGeo - WHERE (vIsNumber AND `name` = vSearch) - OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) - LIMIT 1000; - - ELSEIF vParentFk IS NULL THEN - INSERT INTO tNodes - SELECT geoFk - FROM zoneIncluded - WHERE zoneFk = vSelf; - END IF; - - IF vParentFk IS NULL THEN - CREATE OR REPLACE TEMPORARY TABLE tChilds - (INDEX(id)) - ENGINE = MEMORY - SELECT id FROM tNodes; - - CREATE OR REPLACE TEMPORARY TABLE tParents - (INDEX(id)) - ENGINE = MEMORY - SELECT id FROM zoneGeo LIMIT 0; - - myLoop: LOOP - DELETE FROM tParents; - INSERT INTO tParents - SELECT parentFk id - FROM zoneGeo g - JOIN tChilds c ON c.id = g.id - WHERE g.parentFk IS NOT NULL; - - INSERT IGNORE INTO tNodes - SELECT id FROM tParents; - - IF NOT ROW_COUNT() THEN - LEAVE myLoop; - END IF; - - DELETE FROM tChilds; - INSERT INTO tChilds - SELECT id FROM tParents; - END LOOP; - - DROP TEMPORARY TABLE tChilds, tParents; - END IF; - - IF NOT vIsSearch THEN - INSERT IGNORE INTO tNodes - SELECT id - FROM zoneGeo - WHERE parentFk <=> vParentFk; - END IF; - - CREATE OR REPLACE TEMPORARY TABLE tZones - SELECT g.id, - g.name, - g.parentFk, - g.sons, - NOT g.sons OR `type` = 'country' isChecked, - i.isIncluded selected, - g.`depth`, - vSelf - FROM zoneGeo g - JOIN tNodes n ON n.id = g.id - LEFT JOIN zoneIncluded i ON i.geoFk = g.id - AND i.zoneFk = vSelf - ORDER BY g.`depth`, selected DESC, g.name; - - IF vHasInsert THEN - INSERT IGNORE INTO tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - SELECT id, - name, - parentFk, - sons, - isChecked, - vSelf - FROM tZones - WHERE selected - OR (selected IS NULL AND vParentFk IS NOT NULL); - ELSE - SELECT id, - name, - parentFk, - sons, - selected - FROM tZones - ORDER BY `depth`, selected DESC, name; - END IF; - - DROP TEMPORARY TABLE tNodes, tZones; +BEGIN +/** + * Devuelve las ubicaciones incluidas en la ruta y que sean hijos de parentFk. + * @param vSelf Id de la zona + * @param vParentFk Id del geo a calcular + * @param vSearch Cadena a buscar + * @param vHasInsert Indica si inserta en tmp.zoneNodes + * Optional @table tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) + */ + DECLARE vIsNumber BOOL; + DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch <> ''; + + CREATE OR REPLACE TEMPORARY TABLE tNodes + (UNIQUE (id)) + ENGINE = MEMORY + SELECT id + FROM zoneGeo + LIMIT 0; + + IF vIsSearch THEN + SET vIsNumber = vSearch REGEXP '^[0-9]+$'; + + INSERT INTO tNodes + SELECT id + FROM zoneGeo + WHERE (vIsNumber AND `name` = vSearch) + OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) + LIMIT 1000; + + ELSEIF vParentFk IS NULL THEN + INSERT INTO tNodes + SELECT geoFk + FROM zoneIncluded + WHERE zoneFk = vSelf; + END IF; + + IF vParentFk IS NULL THEN + CREATE OR REPLACE TEMPORARY TABLE tChilds + (INDEX(id)) + ENGINE = MEMORY + SELECT id FROM tNodes; + + CREATE OR REPLACE TEMPORARY TABLE tParents + (INDEX(id)) + ENGINE = MEMORY + SELECT id FROM zoneGeo LIMIT 0; + + myLoop: LOOP + DELETE FROM tParents; + INSERT INTO tParents + SELECT parentFk id + FROM zoneGeo g + JOIN tChilds c ON c.id = g.id + WHERE g.parentFk IS NOT NULL; + + INSERT IGNORE INTO tNodes + SELECT id FROM tParents; + + IF NOT ROW_COUNT() THEN + LEAVE myLoop; + END IF; + + DELETE FROM tChilds; + INSERT INTO tChilds + SELECT id FROM tParents; + END LOOP; + + DROP TEMPORARY TABLE tChilds, tParents; + END IF; + + IF NOT vIsSearch THEN + INSERT IGNORE INTO tNodes + SELECT id + FROM zoneGeo + WHERE parentFk <=> vParentFk; + END IF; + + CREATE OR REPLACE TEMPORARY TABLE tZones + SELECT g.id, + g.name, + g.parentFk, + g.sons, + NOT g.sons OR `type` = 'country' isChecked, + i.isIncluded selected, + g.`depth`, + vSelf + FROM zoneGeo g + JOIN tNodes n ON n.id = g.id + LEFT JOIN zoneIncluded i ON i.geoFk = g.id + AND i.zoneFk = vSelf + ORDER BY g.`depth`, selected DESC, g.name; + + IF vHasInsert THEN + INSERT IGNORE INTO tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) + SELECT id, + name, + parentFk, + sons, + isChecked, + vSelf + FROM tZones + WHERE selected + OR (selected IS NULL AND vParentFk IS NOT NULL); + ELSE + SELECT id, + name, + parentFk, + sons, + selected + FROM tZones + ORDER BY `depth`, selected DESC, name; + END IF; + + DROP TEMPORARY TABLE tNodes, tZones; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `zone_getLeaves2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves2`(vSelf INT, vParentFk INT, vSearch VARCHAR(255)) -BEGIN -/** - * Devuelve los geoFk incluidos en la ruta y que sean hijos de parentFk - * @param vSelf Id de la zona - * @param vParentFk Id del geo a calcular - * @param vSearch cadena a buscar - * - * @return tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - * - */ - DECLARE vIsNumber BOOL; - DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; - - DROP TEMPORARY TABLE IF EXISTS tNodes; - CREATE TEMPORARY TABLE tNodes - (UNIQUE (id)) - ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; - - IF vIsSearch THEN - SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - - INSERT INTO tNodes - SELECT id - FROM zoneGeo - WHERE (vIsNumber AND `name` = vSearch) - OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) - LIMIT 1000; - - ELSEIF vParentFk IS NULL THEN - INSERT INTO tNodes - SELECT geoFk - FROM zoneIncluded - WHERE zoneFk = vSelf; - END IF; - - IF vParentFk IS NULL THEN - DROP TEMPORARY TABLE IF EXISTS tChilds; - CREATE TEMPORARY TABLE tChilds - (INDEX(id)) - ENGINE = MEMORY - SELECT id - FROM tNodes; - - DROP TEMPORARY TABLE IF EXISTS tParents; - CREATE TEMPORARY TABLE tParents - (INDEX(id)) - ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; - - myLoop: LOOP - DELETE FROM tParents; - INSERT INTO tParents - SELECT parentFk id - FROM zoneGeo g - JOIN tChilds c ON c.id = g.id - WHERE g.parentFk IS NOT NULL; - - INSERT IGNORE INTO tNodes - SELECT id - FROM tParents; - - IF ROW_COUNT() = 0 THEN - LEAVE myLoop; - END IF; - - DELETE FROM tChilds; - INSERT INTO tChilds - SELECT id - FROM tParents; - END LOOP; - - DROP TEMPORARY TABLE tChilds, tParents; - END IF; - - IF !vIsSearch THEN - INSERT IGNORE INTO tNodes - SELECT id - FROM zoneGeo - WHERE parentFk <=> vParentFk; - END IF; - - INSERT IGNORE INTO tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - SELECT g.id, - g.`name`, - g.parentFk, - g.sons, - NOT g.sons OR type = 'country', - vSelf - FROM zoneGeo g - JOIN tNodes n ON n.id = g.id - LEFT JOIN zoneIncluded i ON i.geoFk = g.id AND i.zoneFk = vSelf - WHERE i.isIncluded = TRUE - OR (i.isIncluded IS NULL AND vParentFk IS NOT NULL); - - DROP TEMPORARY TABLE tNodes; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getOptionsForLanding` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78380,8 +78727,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getOptionsForLanding`(vLanded DATE, vShowExpiredZones BOOLEAN) BEGIN @@ -78391,7 +78736,7 @@ BEGIN * @table tmp.zone(id) The zones ids * @param vLanded The delivery date * @return tmp.zoneOption The computed options - */ + */ DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; CREATE TEMPORARY TABLE tmp.zoneOption ENGINE = MEMORY @@ -78432,13 +78777,13 @@ BEGIN END LIMIT 10000000000000000000 ) t - GROUP BY zoneFk; - + GROUP BY zoneFk; + DELETE t FROM tmp.zoneOption t JOIN zoneExclusion e ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed LEFT JOIN zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id WHERE eg.zoneExclusionFk IS NULL; - + IF NOT vShowExpiredZones THEN DELETE FROM tmp.zoneOption WHERE shipped < util.VN_CURDATE() @@ -78450,6 +78795,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getOptionsForShipment` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78457,8 +78804,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getOptionsForShipment`(vShipped DATE, vShowExpiredZones BOOLEAN) BEGIN @@ -78470,7 +78815,7 @@ BEGIN * @return tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, specificity) The computed options */ DECLARE vHour TIME DEFAULT TIME(util.VN_NOW()); - + DROP TEMPORARY TABLE IF EXISTS tLandings; CREATE TEMPORARY TABLE tLandings (INDEX (eventFk)) @@ -78538,6 +78883,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getPostalCode` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78545,63 +78892,63 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getPostalCode`(vSelf INT) -BEGIN -/** - * Devuelve los códigos postales incluidos en una zona - */ - DECLARE vGeoFk INT DEFAULT NULL; - - DROP TEMPORARY TABLE IF EXISTS tmp.zoneNodes; - CREATE TEMPORARY TABLE tmp.zoneNodes ( - geoFk INT, - name VARCHAR(100), - parentFk INT, - sons INT, - isChecked BOOL DEFAULT 0, - zoneFk INT, - PRIMARY KEY zoneNodesPk (zoneFk, geoFk), - INDEX(geoFk)) - ENGINE = MEMORY; - - CALL zone_getLeaves(vSelf, NULL , NULL, TRUE); - - UPDATE tmp.zoneNodes zn - SET isChecked = 0 - WHERE parentFk IS NULL; - - myLoop: LOOP - SET vGeoFk = NULL; - SELECT geoFk INTO vGeoFk - FROM tmp.zoneNodes zn - WHERE NOT isChecked - LIMIT 1; - - CALL zone_getLeaves(vSelf, vGeoFk, NULL, TRUE); - UPDATE tmp.zoneNodes - SET isChecked = TRUE - WHERE geoFk = vGeoFk; - - IF vGeoFk IS NULL THEN - LEAVE myLoop; - END IF; - END LOOP; - - DELETE FROM tmp.zoneNodes - WHERE sons > 0; - - SELECT zn.geoFk, zn.name - FROM tmp.zoneNodes zn - JOIN zone z ON z.id = zn.zoneFk; +BEGIN +/** + * Devuelve los códigos postales incluidos en una zona + */ + DECLARE vGeoFk INT DEFAULT NULL; + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneNodes; + CREATE TEMPORARY TABLE tmp.zoneNodes ( + geoFk INT, + name VARCHAR(100), + parentFk INT, + sons INT, + isChecked BOOL DEFAULT 0, + zoneFk INT, + PRIMARY KEY zoneNodesPk (zoneFk, geoFk), + INDEX(geoFk)) + ENGINE = MEMORY; + + CALL zone_getLeaves(vSelf, NULL , NULL, TRUE); + + UPDATE tmp.zoneNodes zn + SET isChecked = 0 + WHERE parentFk IS NULL; + + myLoop: LOOP + SET vGeoFk = NULL; + SELECT geoFk INTO vGeoFk + FROM tmp.zoneNodes zn + WHERE NOT isChecked + LIMIT 1; + + CALL zone_getLeaves(vSelf, vGeoFk, NULL, TRUE); + UPDATE tmp.zoneNodes + SET isChecked = TRUE + WHERE geoFk = vGeoFk; + + IF vGeoFk IS NULL THEN + LEAVE myLoop; + END IF; + END LOOP; + + DELETE FROM tmp.zoneNodes + WHERE sons > 0; + + SELECT zn.geoFk, zn.name + FROM tmp.zoneNodes zn + JOIN zone z ON z.id = zn.zoneFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getShipped` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78609,8 +78956,6 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getShipped`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT, vShowExpiredZones BOOLEAN) BEGIN @@ -78626,7 +78971,7 @@ BEGIN DECLARE vZoneGeo INT; SELECT address_getGeo(vAddressFk) INTO vZoneGeo; - + CALL vn.zone_getFromGeo(vZoneGeo); CALL vn.zone_getOptionsForLanding(vLanded, vShowExpiredZones); CALL vn.zone_excludeFromGeo(vZoneGeo); @@ -78646,7 +78991,7 @@ BEGIN FROM tmp.zoneOption zo JOIN vn.zoneWarehouse zw ON zw.zoneFk = zo.zoneFk JOIN vn.`zone` z ON z.id = zo.zoneFk - LEFT JOIN tmp.closedZones cz + LEFT JOIN tmp.closedZones cz ON cz.warehouseFk = zw.warehouseFk AND cz.zoneFk = zw.zoneFk AND zo.shipped = util.VN_CURDATE() @@ -78666,6 +79011,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getState` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78673,16 +79020,14 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getState`(vDated DATE) BEGIN /** * Devuelve las zonas y el estado para la fecha solicitada - * + * * @param vDated Fecha en cuestión - */ + */ DROP TEMPORARY TABLE IF EXISTS tmp.zone; CREATE TEMPORARY TABLE tmp.zone ( @@ -78696,7 +79041,7 @@ BEGIN CALL vn.zone_getOptionsForShipment(vDated, TRUE); CALL vn.zone_getClosed(); - + SELECT zo.zoneFk, zo.`hour`etd, (zo.`hour` <= TIME(util.VN_NOW())) isLate, @@ -78706,11 +79051,11 @@ BEGIN FROM tmp.zoneOption zo JOIN vn.zone z ON z.id = zo.zoneFk JOIN vn.zoneWarehouse zw ON zw.zoneFk = z.id - LEFT JOIN tmp.closedZones cz - ON cz.warehouseFk = zw.warehouseFk + LEFT JOIN tmp.closedZones cz + ON cz.warehouseFk = zw.warehouseFk AND cz.zoneFk = zo.zoneFk; - - DROP TEMPORARY TABLE + + DROP TEMPORARY TABLE tmp.closedZones, tmp.zoneOption, tmp.zone; @@ -78721,6 +79066,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_getWarehouse` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78728,29 +79075,27 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT) BEGIN /** * Devuelve el listado de agencias disponibles para la fecha, * dirección y almacén pasados. - * + * * @param vAddress * @param vWarehouse warehouse * @param vLanded Fecha de recogida * @select Listado de agencias disponibles */ - + CALL zone_getFromGeo(address_getGeo(vAddress)); CALL zone_getOptionsForLanding(vLanded, FALSE); - - SELECT am.id agencyModeFk, - am.name agencyMode, - am.description, + + SELECT am.id agencyModeFk, + am.name agencyMode, + am.description, am.deliveryMethodFk, - TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped, + TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped, zw.warehouseFk, z.id zoneFk FROM tmp.zoneOption zo @@ -78760,17 +79105,19 @@ BEGIN WHERE zw.warehouseFk = vWarehouse GROUP BY z.agencyModeFk ORDER BY agencyMode; - + DROP TEMPORARY TABLE tmp.zone, tmp.zoneOption; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `zone_upcomingDeliveries` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78778,14 +79125,12 @@ DELIMITER ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_upcomingDeliveries`() BEGIN DECLARE vForwardDays INT; - + SELECT forwardDays INTO vForwardDays FROM zoneConfig; CALL util.time_createTable(util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL vForwardDays DAY)); @@ -78801,7 +79146,7 @@ BEGIN JOIN zoneEvent e ON e.zoneFk = z.id JOIN tmp.time ti ON ti.dated BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY, vForwardDays, util.VN_CURDATE()); - DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; + DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; CREATE TEMPORARY TABLE tmp.zoneOption ENGINE = MEMORY SELECT * @@ -78842,7 +79187,7 @@ BEGIN JOIN zoneExclusion e ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed LEFT JOIN zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id WHERE eg.zoneExclusionFk IS NULL; - + SELECT MAX(zo.`hour`) `hour`, zg.`name`, zo.shipped, zo.zoneFk FROM tmp.zoneOption zo JOIN `zone` z ON z.id = zo.zoneFk @@ -78853,7 +79198,7 @@ BEGIN WHERE dm.code = 'DELIVERY' GROUP BY shipped, zg.`name` ORDER BY shipped, zg.`name`; - + DROP TEMPORARY TABLE tmp.time, tLandings; END ;; DELIMITER ; @@ -78872,7 +79217,6 @@ USE `account`; -- Final view structure for view `accountDovecot` -- -/*!50001 DROP TABLE IF EXISTS `accountDovecot`*/; /*!50001 DROP VIEW IF EXISTS `accountDovecot`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -78891,7 +79235,6 @@ USE `account`; -- Final view structure for view `emailUser` -- -/*!50001 DROP TABLE IF EXISTS `emailUser`*/; /*!50001 DROP VIEW IF EXISTS `emailUser`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -78910,7 +79253,6 @@ USE `account`; -- Final view structure for view `myRole` -- -/*!50001 DROP TABLE IF EXISTS `myRole`*/; /*!50001 DROP VIEW IF EXISTS `myRole`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -78929,7 +79271,6 @@ USE `account`; -- Final view structure for view `myUser` -- -/*!50001 DROP TABLE IF EXISTS `myUser`*/; /*!50001 DROP VIEW IF EXISTS `myUser`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -78955,7 +79296,6 @@ USE `bs`; -- Final view structure for view `bajasLaborales` -- -/*!50001 DROP TABLE IF EXISTS `bajasLaborales`*/; /*!50001 DROP VIEW IF EXISTS `bajasLaborales`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -78974,7 +79314,6 @@ USE `bs`; -- Final view structure for view `lastIndicators` -- -/*!50001 DROP TABLE IF EXISTS `lastIndicators`*/; /*!50001 DROP VIEW IF EXISTS `lastIndicators`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -78993,7 +79332,6 @@ USE `bs`; -- Final view structure for view `packingSpeed` -- -/*!50001 DROP TABLE IF EXISTS `packingSpeed`*/; /*!50001 DROP VIEW IF EXISTS `packingSpeed`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79012,7 +79350,6 @@ USE `bs`; -- Final view structure for view `s1_ticketDetail` -- -/*!50001 DROP TABLE IF EXISTS `s1_ticketDetail`*/; /*!50001 DROP VIEW IF EXISTS `s1_ticketDetail`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79031,7 +79368,6 @@ USE `bs`; -- Final view structure for view `s21_saleDetail` -- -/*!50001 DROP TABLE IF EXISTS `s21_saleDetail`*/; /*!50001 DROP VIEW IF EXISTS `s21_saleDetail`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79050,7 +79386,6 @@ USE `bs`; -- Final view structure for view `ventas` -- -/*!50001 DROP TABLE IF EXISTS `ventas`*/; /*!50001 DROP VIEW IF EXISTS `ventas`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79081,7 +79416,6 @@ USE `edi`; -- Final view structure for view `ektRecent` -- -/*!50001 DROP TABLE IF EXISTS `ektRecent`*/; /*!50001 DROP VIEW IF EXISTS `ektRecent`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79100,7 +79434,6 @@ USE `edi`; -- Final view structure for view `errorList` -- -/*!50001 DROP TABLE IF EXISTS `errorList`*/; /*!50001 DROP VIEW IF EXISTS `errorList`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79119,7 +79452,6 @@ USE `edi`; -- Final view structure for view `supplyOffer` -- -/*!50001 DROP TABLE IF EXISTS `supplyOffer`*/; /*!50001 DROP VIEW IF EXISTS `supplyOffer`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79144,7 +79476,6 @@ USE `hedera`; -- Final view structure for view `mainAccountBank` -- -/*!50001 DROP TABLE IF EXISTS `mainAccountBank`*/; /*!50001 DROP VIEW IF EXISTS `mainAccountBank`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79163,7 +79494,6 @@ USE `hedera`; -- Final view structure for view `messageL10n` -- -/*!50001 DROP TABLE IF EXISTS `messageL10n`*/; /*!50001 DROP VIEW IF EXISTS `messageL10n`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79182,7 +79512,6 @@ USE `hedera`; -- Final view structure for view `myAddress` -- -/*!50001 DROP TABLE IF EXISTS `myAddress`*/; /*!50001 DROP VIEW IF EXISTS `myAddress`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79202,7 +79531,6 @@ USE `hedera`; -- Final view structure for view `myBasketDefaults` -- -/*!50001 DROP TABLE IF EXISTS `myBasketDefaults`*/; /*!50001 DROP VIEW IF EXISTS `myBasketDefaults`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79221,7 +79549,6 @@ USE `hedera`; -- Final view structure for view `myClient` -- -/*!50001 DROP TABLE IF EXISTS `myClient`*/; /*!50001 DROP VIEW IF EXISTS `myClient`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79241,7 +79568,6 @@ USE `hedera`; -- Final view structure for view `myInvoice` -- -/*!50001 DROP TABLE IF EXISTS `myInvoice`*/; /*!50001 DROP VIEW IF EXISTS `myInvoice`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79260,7 +79586,6 @@ USE `hedera`; -- Final view structure for view `myMenu` -- -/*!50001 DROP TABLE IF EXISTS `myMenu`*/; /*!50001 DROP VIEW IF EXISTS `myMenu`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79279,7 +79604,6 @@ USE `hedera`; -- Final view structure for view `myOrder` -- -/*!50001 DROP TABLE IF EXISTS `myOrder`*/; /*!50001 DROP VIEW IF EXISTS `myOrder`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79299,7 +79623,6 @@ USE `hedera`; -- Final view structure for view `myOrderRow` -- -/*!50001 DROP TABLE IF EXISTS `myOrderRow`*/; /*!50001 DROP VIEW IF EXISTS `myOrderRow`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79319,7 +79642,6 @@ USE `hedera`; -- Final view structure for view `myOrderTicket` -- -/*!50001 DROP TABLE IF EXISTS `myOrderTicket`*/; /*!50001 DROP VIEW IF EXISTS `myOrderTicket`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79338,7 +79660,6 @@ USE `hedera`; -- Final view structure for view `myTicket` -- -/*!50001 DROP TABLE IF EXISTS `myTicket`*/; /*!50001 DROP VIEW IF EXISTS `myTicket`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79357,7 +79678,6 @@ USE `hedera`; -- Final view structure for view `myTicketRow` -- -/*!50001 DROP TABLE IF EXISTS `myTicketRow`*/; /*!50001 DROP VIEW IF EXISTS `myTicketRow`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79377,7 +79697,6 @@ USE `hedera`; -- Final view structure for view `myTicketService` -- -/*!50001 DROP TABLE IF EXISTS `myTicketService`*/; /*!50001 DROP VIEW IF EXISTS `myTicketService`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79397,7 +79716,6 @@ USE `hedera`; -- Final view structure for view `myTicketState` -- -/*!50001 DROP TABLE IF EXISTS `myTicketState`*/; /*!50001 DROP VIEW IF EXISTS `myTicketState`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79416,7 +79734,6 @@ USE `hedera`; -- Final view structure for view `myTpvTransaction` -- -/*!50001 DROP TABLE IF EXISTS `myTpvTransaction`*/; /*!50001 DROP VIEW IF EXISTS `myTpvTransaction`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79435,7 +79752,6 @@ USE `hedera`; -- Final view structure for view `orderTicket` -- -/*!50001 DROP TABLE IF EXISTS `orderTicket`*/; /*!50001 DROP VIEW IF EXISTS `orderTicket`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79454,7 +79770,6 @@ USE `hedera`; -- Final view structure for view `order_component` -- -/*!50001 DROP TABLE IF EXISTS `order_component`*/; /*!50001 DROP VIEW IF EXISTS `order_component`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79473,7 +79788,6 @@ USE `hedera`; -- Final view structure for view `order_row` -- -/*!50001 DROP TABLE IF EXISTS `order_row`*/; /*!50001 DROP VIEW IF EXISTS `order_row`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79498,7 +79812,6 @@ USE `pbx`; -- Final view structure for view `cdrConf` -- -/*!50001 DROP TABLE IF EXISTS `cdrConf`*/; /*!50001 DROP VIEW IF EXISTS `cdrConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79517,7 +79830,6 @@ USE `pbx`; -- Final view structure for view `followmeConf` -- -/*!50001 DROP TABLE IF EXISTS `followmeConf`*/; /*!50001 DROP VIEW IF EXISTS `followmeConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79536,7 +79848,6 @@ USE `pbx`; -- Final view structure for view `followmeNumberConf` -- -/*!50001 DROP TABLE IF EXISTS `followmeNumberConf`*/; /*!50001 DROP VIEW IF EXISTS `followmeNumberConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79555,7 +79866,6 @@ USE `pbx`; -- Final view structure for view `queueConf` -- -/*!50001 DROP TABLE IF EXISTS `queueConf`*/; /*!50001 DROP VIEW IF EXISTS `queueConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79574,7 +79884,6 @@ USE `pbx`; -- Final view structure for view `queueMemberConf` -- -/*!50001 DROP TABLE IF EXISTS `queueMemberConf`*/; /*!50001 DROP VIEW IF EXISTS `queueMemberConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79593,7 +79902,6 @@ USE `pbx`; -- Final view structure for view `sipConf` -- -/*!50001 DROP TABLE IF EXISTS `sipConf`*/; /*!50001 DROP VIEW IF EXISTS `sipConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79608,12 +79916,6 @@ USE `pbx`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Current Database: `postgresql` --- - -USE `postgresql`; - -- -- Current Database: `sage` -- @@ -79624,7 +79926,6 @@ USE `sage`; -- Final view structure for view `clientLastTwoMonths` -- -/*!50001 DROP TABLE IF EXISTS `clientLastTwoMonths`*/; /*!50001 DROP VIEW IF EXISTS `clientLastTwoMonths`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79643,7 +79944,6 @@ USE `sage`; -- Final view structure for view `supplierLastThreeMonths` -- -/*!50001 DROP TABLE IF EXISTS `supplierLastThreeMonths`*/; /*!50001 DROP VIEW IF EXISTS `supplierLastThreeMonths`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79668,7 +79968,6 @@ USE `salix`; -- Final view structure for view `Account` -- -/*!50001 DROP TABLE IF EXISTS `Account`*/; /*!50001 DROP VIEW IF EXISTS `Account`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79687,7 +79986,6 @@ USE `salix`; -- Final view structure for view `Role` -- -/*!50001 DROP TABLE IF EXISTS `Role`*/; /*!50001 DROP VIEW IF EXISTS `Role`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79706,7 +80004,6 @@ USE `salix`; -- Final view structure for view `RoleMapping` -- -/*!50001 DROP TABLE IF EXISTS `RoleMapping`*/; /*!50001 DROP VIEW IF EXISTS `RoleMapping`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79725,7 +80022,6 @@ USE `salix`; -- Final view structure for view `User` -- -/*!50001 DROP TABLE IF EXISTS `User`*/; /*!50001 DROP VIEW IF EXISTS `User`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79756,7 +80052,6 @@ USE `util`; -- Final view structure for view `eventLogGrouped` -- -/*!50001 DROP TABLE IF EXISTS `eventLogGrouped`*/; /*!50001 DROP VIEW IF EXISTS `eventLogGrouped`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79781,7 +80076,6 @@ USE `vn`; -- Final view structure for view `NewView` -- -/*!50001 DROP TABLE IF EXISTS `NewView`*/; /*!50001 DROP VIEW IF EXISTS `NewView`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79800,7 +80094,6 @@ USE `vn`; -- Final view structure for view `__coolerPathDetail` -- -/*!50001 DROP TABLE IF EXISTS `__coolerPathDetail`*/; /*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79819,7 +80112,6 @@ USE `vn`; -- Final view structure for view `agencyTerm` -- -/*!50001 DROP TABLE IF EXISTS `agencyTerm`*/; /*!50001 DROP VIEW IF EXISTS `agencyTerm`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79838,7 +80130,6 @@ USE `vn`; -- Final view structure for view `annualAverageInvoiced` -- -/*!50001 DROP TABLE IF EXISTS `annualAverageInvoiced`*/; /*!50001 DROP VIEW IF EXISTS `annualAverageInvoiced`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79857,7 +80148,6 @@ USE `vn`; -- Final view structure for view `awbVolume` -- -/*!50001 DROP TABLE IF EXISTS `awbVolume`*/; /*!50001 DROP VIEW IF EXISTS `awbVolume`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79876,7 +80166,6 @@ USE `vn`; -- Final view structure for view `bank` -- -/*!50001 DROP TABLE IF EXISTS `bank`*/; /*!50001 DROP VIEW IF EXISTS `bank`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79895,7 +80184,6 @@ USE `vn`; -- Final view structure for view `bankPolicy` -- -/*!50001 DROP TABLE IF EXISTS `bankPolicy`*/; /*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79914,7 +80202,6 @@ USE `vn`; -- Final view structure for view `businessCalendar` -- -/*!50001 DROP TABLE IF EXISTS `businessCalendar`*/; /*!50001 DROP VIEW IF EXISTS `businessCalendar`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79933,7 +80220,6 @@ USE `vn`; -- Final view structure for view `buyer` -- -/*!50001 DROP TABLE IF EXISTS `buyer`*/; /*!50001 DROP VIEW IF EXISTS `buyer`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79952,7 +80238,6 @@ USE `vn`; -- Final view structure for view `buyerSales` -- -/*!50001 DROP TABLE IF EXISTS `buyerSales`*/; /*!50001 DROP VIEW IF EXISTS `buyerSales`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79971,7 +80256,6 @@ USE `vn`; -- Final view structure for view `clientLost` -- -/*!50001 DROP TABLE IF EXISTS `clientLost`*/; /*!50001 DROP VIEW IF EXISTS `clientLost`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -79990,7 +80274,6 @@ USE `vn`; -- Final view structure for view `clientPhoneBook` -- -/*!50001 DROP TABLE IF EXISTS `clientPhoneBook`*/; /*!50001 DROP VIEW IF EXISTS `clientPhoneBook`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80009,7 +80292,6 @@ USE `vn`; -- Final view structure for view `cmr_list` -- -/*!50001 DROP TABLE IF EXISTS `cmr_list`*/; /*!50001 DROP VIEW IF EXISTS `cmr_list`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80028,7 +80310,6 @@ USE `vn`; -- Final view structure for view `companyL10n` -- -/*!50001 DROP TABLE IF EXISTS `companyL10n`*/; /*!50001 DROP VIEW IF EXISTS `companyL10n`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80047,7 +80328,6 @@ USE `vn`; -- Final view structure for view `defaulter` -- -/*!50001 DROP TABLE IF EXISTS `defaulter`*/; /*!50001 DROP VIEW IF EXISTS `defaulter`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80066,7 +80346,6 @@ USE `vn`; -- Final view structure for view `departmentTree` -- -/*!50001 DROP TABLE IF EXISTS `departmentTree`*/; /*!50001 DROP VIEW IF EXISTS `departmentTree`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80085,7 +80364,6 @@ USE `vn`; -- Final view structure for view `ediGenus` -- -/*!50001 DROP TABLE IF EXISTS `ediGenus`*/; /*!50001 DROP VIEW IF EXISTS `ediGenus`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80104,7 +80382,6 @@ USE `vn`; -- Final view structure for view `ediSpecie` -- -/*!50001 DROP TABLE IF EXISTS `ediSpecie`*/; /*!50001 DROP VIEW IF EXISTS `ediSpecie`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80123,7 +80400,6 @@ USE `vn`; -- Final view structure for view `ektSubAddress` -- -/*!50001 DROP TABLE IF EXISTS `ektSubAddress`*/; /*!50001 DROP VIEW IF EXISTS `ektSubAddress`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80142,7 +80418,6 @@ USE `vn`; -- Final view structure for view `exchangeInsuranceEntry` -- -/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceEntry`*/; /*!50001 DROP VIEW IF EXISTS `exchangeInsuranceEntry`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80161,7 +80436,6 @@ USE `vn`; -- Final view structure for view `exchangeInsuranceIn` -- -/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceIn`*/; /*!50001 DROP VIEW IF EXISTS `exchangeInsuranceIn`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80180,7 +80454,6 @@ USE `vn`; -- Final view structure for view `exchangeInsuranceOut` -- -/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceOut`*/; /*!50001 DROP VIEW IF EXISTS `exchangeInsuranceOut`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80199,7 +80472,6 @@ USE `vn`; -- Final view structure for view `exchangeReportSourcePrevious` -- -/*!50001 DROP TABLE IF EXISTS `exchangeReportSourcePrevious`*/; /*!50001 DROP VIEW IF EXISTS `exchangeReportSourcePrevious`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80218,7 +80490,6 @@ USE `vn`; -- Final view structure for view `expeditionCommon` -- -/*!50001 DROP TABLE IF EXISTS `expeditionCommon`*/; /*!50001 DROP VIEW IF EXISTS `expeditionCommon`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80237,7 +80508,6 @@ USE `vn`; -- Final view structure for view `expeditionPallet_Print` -- -/*!50001 DROP TABLE IF EXISTS `expeditionPallet_Print`*/; /*!50001 DROP VIEW IF EXISTS `expeditionPallet_Print`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80256,7 +80526,6 @@ USE `vn`; -- Final view structure for view `expeditionRoute_Monitor` -- -/*!50001 DROP TABLE IF EXISTS `expeditionRoute_Monitor`*/; /*!50001 DROP VIEW IF EXISTS `expeditionRoute_Monitor`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80275,7 +80544,6 @@ USE `vn`; -- Final view structure for view `expeditionRoute_freeTickets` -- -/*!50001 DROP TABLE IF EXISTS `expeditionRoute_freeTickets`*/; /*!50001 DROP VIEW IF EXISTS `expeditionRoute_freeTickets`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80294,7 +80562,6 @@ USE `vn`; -- Final view structure for view `expeditionScan_Monitor` -- -/*!50001 DROP TABLE IF EXISTS `expeditionScan_Monitor`*/; /*!50001 DROP VIEW IF EXISTS `expeditionScan_Monitor`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80313,7 +80580,6 @@ USE `vn`; -- Final view structure for view `expeditionSticker` -- -/*!50001 DROP TABLE IF EXISTS `expeditionSticker`*/; /*!50001 DROP VIEW IF EXISTS `expeditionSticker`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80332,7 +80598,6 @@ USE `vn`; -- Final view structure for view `expeditionTicket_NoBoxes` -- -/*!50001 DROP TABLE IF EXISTS `expeditionTicket_NoBoxes`*/; /*!50001 DROP VIEW IF EXISTS `expeditionTicket_NoBoxes`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80351,7 +80616,6 @@ USE `vn`; -- Final view structure for view `expeditionTimeExpended` -- -/*!50001 DROP TABLE IF EXISTS `expeditionTimeExpended`*/; /*!50001 DROP VIEW IF EXISTS `expeditionTimeExpended`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80370,7 +80634,6 @@ USE `vn`; -- Final view structure for view `expeditionTruck_Control` -- -/*!50001 DROP TABLE IF EXISTS `expeditionTruck_Control`*/; /*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80389,7 +80652,6 @@ USE `vn`; -- Final view structure for view `expeditionTruck_Control_Detail` -- -/*!50001 DROP TABLE IF EXISTS `expeditionTruck_Control_Detail`*/; /*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control_Detail`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80408,7 +80670,6 @@ USE `vn`; -- Final view structure for view `expeditionTruck_Control_Detail_Pallet` -- -/*!50001 DROP TABLE IF EXISTS `expeditionTruck_Control_Detail_Pallet`*/; /*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control_Detail_Pallet`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80427,7 +80688,6 @@ USE `vn`; -- Final view structure for view `firstTicketShipped` -- -/*!50001 DROP TABLE IF EXISTS `firstTicketShipped`*/; /*!50001 DROP VIEW IF EXISTS `firstTicketShipped`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80446,7 +80706,6 @@ USE `vn`; -- Final view structure for view `floraHollandBuyedItems` -- -/*!50001 DROP TABLE IF EXISTS `floraHollandBuyedItems`*/; /*!50001 DROP VIEW IF EXISTS `floraHollandBuyedItems`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80465,7 +80724,6 @@ USE `vn`; -- Final view structure for view `inkL10n` -- -/*!50001 DROP TABLE IF EXISTS `inkL10n`*/; /*!50001 DROP VIEW IF EXISTS `inkL10n`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80484,7 +80742,6 @@ USE `vn`; -- Final view structure for view `invoiceCorrectionDataSource` -- -/*!50001 DROP TABLE IF EXISTS `invoiceCorrectionDataSource`*/; /*!50001 DROP VIEW IF EXISTS `invoiceCorrectionDataSource`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80503,7 +80760,6 @@ USE `vn`; -- Final view structure for view `itemBotanicalWithGenus` -- -/*!50001 DROP TABLE IF EXISTS `itemBotanicalWithGenus`*/; /*!50001 DROP VIEW IF EXISTS `itemBotanicalWithGenus`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80522,7 +80778,6 @@ USE `vn`; -- Final view structure for view `itemCategoryL10n` -- -/*!50001 DROP TABLE IF EXISTS `itemCategoryL10n`*/; /*!50001 DROP VIEW IF EXISTS `itemCategoryL10n`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80541,7 +80796,6 @@ USE `vn`; -- Final view structure for view `itemColor` -- -/*!50001 DROP TABLE IF EXISTS `itemColor`*/; /*!50001 DROP VIEW IF EXISTS `itemColor`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80560,7 +80814,6 @@ USE `vn`; -- Final view structure for view `itemEntryIn` -- -/*!50001 DROP TABLE IF EXISTS `itemEntryIn`*/; /*!50001 DROP VIEW IF EXISTS `itemEntryIn`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80579,7 +80832,6 @@ USE `vn`; -- Final view structure for view `itemEntryOut` -- -/*!50001 DROP TABLE IF EXISTS `itemEntryOut`*/; /*!50001 DROP VIEW IF EXISTS `itemEntryOut`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80598,7 +80850,6 @@ USE `vn`; -- Final view structure for view `itemInk` -- -/*!50001 DROP TABLE IF EXISTS `itemInk`*/; /*!50001 DROP VIEW IF EXISTS `itemInk`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80617,7 +80868,6 @@ USE `vn`; -- Final view structure for view `itemPlacementSupplyList` -- -/*!50001 DROP TABLE IF EXISTS `itemPlacementSupplyList`*/; /*!50001 DROP VIEW IF EXISTS `itemPlacementSupplyList`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80627,7 +80877,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,ifnull(`isps`.`created`,`ips`.`created`) AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0)) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,`ips`.`sectorFk` AS `sectorFk` from ((((`itemPlacementSupply` `ips` join `item` `i` on(`i`.`id` = `ips`.`itemFk`)) left join `worker` `w` on(`w`.`userFk` = `ips`.`userFk`)) left join `worker` `rw` on(`rw`.`userFk` = `ips`.`repoUserFk`)) left join `itemShelvingPlacementSupply` `isps` on(`isps`.`itemPlacementSupplyFk` = `ips`.`id`)) where `ips`.`created` >= `util`.`VN_CURDATE`() group by `ips`.`priority`,`ips`.`id`,`ips`.`sectorFk` */; +/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,ifnull(`isps`.`created`,`ips`.`created`) AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0)) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,`ips`.`sectorFk` AS `sectorFk` from ((((`itemPlacementSupply` `ips` join `item` `i` on(`i`.`id` = `ips`.`itemFk`)) left join `worker` `w` on(`w`.`id` = `ips`.`userFk`)) left join `worker` `rw` on(`rw`.`id` = `ips`.`repoUserFk`)) left join `itemShelvingPlacementSupply` `isps` on(`isps`.`itemPlacementSupplyFk` = `ips`.`id`)) where `ips`.`created` >= `util`.`VN_CURDATE`() group by `ips`.`priority`,`ips`.`id`,`ips`.`sectorFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -80636,7 +80886,6 @@ USE `vn`; -- Final view structure for view `itemProductor` -- -/*!50001 DROP TABLE IF EXISTS `itemProductor`*/; /*!50001 DROP VIEW IF EXISTS `itemProductor`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80655,7 +80904,6 @@ USE `vn`; -- Final view structure for view `itemSearch` -- -/*!50001 DROP TABLE IF EXISTS `itemSearch`*/; /*!50001 DROP VIEW IF EXISTS `itemSearch`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80674,7 +80922,6 @@ USE `vn`; -- Final view structure for view `itemShelvingAvailable` -- -/*!50001 DROP TABLE IF EXISTS `itemShelvingAvailable`*/; /*!50001 DROP VIEW IF EXISTS `itemShelvingAvailable`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80693,7 +80940,6 @@ USE `vn`; -- Final view structure for view `itemShelvingList` -- -/*!50001 DROP TABLE IF EXISTS `itemShelvingList`*/; /*!50001 DROP VIEW IF EXISTS `itemShelvingList`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80712,7 +80958,6 @@ USE `vn`; -- Final view structure for view `itemShelvingPlacementSupplyStock` -- -/*!50001 DROP TABLE IF EXISTS `itemShelvingPlacementSupplyStock`*/; /*!50001 DROP VIEW IF EXISTS `itemShelvingPlacementSupplyStock`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80731,7 +80976,6 @@ USE `vn`; -- Final view structure for view `itemShelvingSaleSum` -- -/*!50001 DROP TABLE IF EXISTS `itemShelvingSaleSum`*/; /*!50001 DROP VIEW IF EXISTS `itemShelvingSaleSum`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80750,7 +80994,6 @@ USE `vn`; -- Final view structure for view `itemShelvingStock` -- -/*!50001 DROP TABLE IF EXISTS `itemShelvingStock`*/; /*!50001 DROP VIEW IF EXISTS `itemShelvingStock`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80769,7 +81012,6 @@ USE `vn`; -- Final view structure for view `itemShelvingStockFull` -- -/*!50001 DROP TABLE IF EXISTS `itemShelvingStockFull`*/; /*!50001 DROP VIEW IF EXISTS `itemShelvingStockFull`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80788,7 +81030,6 @@ USE `vn`; -- Final view structure for view `itemShelvingStockRemoved` -- -/*!50001 DROP TABLE IF EXISTS `itemShelvingStockRemoved`*/; /*!50001 DROP VIEW IF EXISTS `itemShelvingStockRemoved`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80807,7 +81048,6 @@ USE `vn`; -- Final view structure for view `itemShelvingStock_byWarehouse` -- -/*!50001 DROP TABLE IF EXISTS `itemShelvingStock_byWarehouse`*/; /*!50001 DROP VIEW IF EXISTS `itemShelvingStock_byWarehouse`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80826,7 +81066,6 @@ USE `vn`; -- Final view structure for view `itemTagged` -- -/*!50001 DROP TABLE IF EXISTS `itemTagged`*/; /*!50001 DROP VIEW IF EXISTS `itemTagged`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80845,7 +81084,6 @@ USE `vn`; -- Final view structure for view `itemTicketOut` -- -/*!50001 DROP TABLE IF EXISTS `itemTicketOut`*/; /*!50001 DROP VIEW IF EXISTS `itemTicketOut`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80864,7 +81102,6 @@ USE `vn`; -- Final view structure for view `itemTypeL10n` -- -/*!50001 DROP TABLE IF EXISTS `itemTypeL10n`*/; /*!50001 DROP VIEW IF EXISTS `itemTypeL10n`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80883,7 +81120,6 @@ USE `vn`; -- Final view structure for view `item_Free_Id` -- -/*!50001 DROP TABLE IF EXISTS `item_Free_Id`*/; /*!50001 DROP VIEW IF EXISTS `item_Free_Id`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80902,7 +81138,6 @@ USE `vn`; -- Final view structure for view `labelInfo` -- -/*!50001 DROP TABLE IF EXISTS `labelInfo`*/; /*!50001 DROP VIEW IF EXISTS `labelInfo`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80921,7 +81156,6 @@ USE `vn`; -- Final view structure for view `lastHourProduction` -- -/*!50001 DROP TABLE IF EXISTS `lastHourProduction`*/; /*!50001 DROP VIEW IF EXISTS `lastHourProduction`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80940,7 +81174,6 @@ USE `vn`; -- Final view structure for view `lastPurchases` -- -/*!50001 DROP TABLE IF EXISTS `lastPurchases`*/; /*!50001 DROP VIEW IF EXISTS `lastPurchases`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80959,7 +81192,6 @@ USE `vn`; -- Final view structure for view `lastTopClaims` -- -/*!50001 DROP TABLE IF EXISTS `lastTopClaims`*/; /*!50001 DROP VIEW IF EXISTS `lastTopClaims`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80978,7 +81210,6 @@ USE `vn`; -- Final view structure for view `mistake` -- -/*!50001 DROP TABLE IF EXISTS `mistake`*/; /*!50001 DROP VIEW IF EXISTS `mistake`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -80997,7 +81228,6 @@ USE `vn`; -- Final view structure for view `mistakeRatio` -- -/*!50001 DROP TABLE IF EXISTS `mistakeRatio`*/; /*!50001 DROP VIEW IF EXISTS `mistakeRatio`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81016,7 +81246,6 @@ USE `vn`; -- Final view structure for view `newBornSales` -- -/*!50001 DROP TABLE IF EXISTS `newBornSales`*/; /*!50001 DROP VIEW IF EXISTS `newBornSales`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81035,7 +81264,6 @@ USE `vn`; -- Final view structure for view `operatorWorkerCode` -- -/*!50001 DROP TABLE IF EXISTS `operatorWorkerCode`*/; /*!50001 DROP VIEW IF EXISTS `operatorWorkerCode`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81054,7 +81282,6 @@ USE `vn`; -- Final view structure for view `originL10n` -- -/*!50001 DROP TABLE IF EXISTS `originL10n`*/; /*!50001 DROP VIEW IF EXISTS `originL10n`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81073,7 +81300,6 @@ USE `vn`; -- Final view structure for view `packageEquivalentItem` -- -/*!50001 DROP TABLE IF EXISTS `packageEquivalentItem`*/; /*!50001 DROP VIEW IF EXISTS `packageEquivalentItem`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81092,7 +81318,6 @@ USE `vn`; -- Final view structure for view `personMedia` -- -/*!50001 DROP TABLE IF EXISTS `personMedia`*/; /*!50001 DROP VIEW IF EXISTS `personMedia`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81111,7 +81336,6 @@ USE `vn`; -- Final view structure for view `phoneBook` -- -/*!50001 DROP TABLE IF EXISTS `phoneBook`*/; /*!50001 DROP VIEW IF EXISTS `phoneBook`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81130,7 +81354,6 @@ USE `vn`; -- Final view structure for view `productionVolume` -- -/*!50001 DROP TABLE IF EXISTS `productionVolume`*/; /*!50001 DROP VIEW IF EXISTS `productionVolume`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81149,7 +81372,6 @@ USE `vn`; -- Final view structure for view `productionVolume_LastHour` -- -/*!50001 DROP TABLE IF EXISTS `productionVolume_LastHour`*/; /*!50001 DROP VIEW IF EXISTS `productionVolume_LastHour`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81168,7 +81390,6 @@ USE `vn`; -- Final view structure for view `role` -- -/*!50001 DROP TABLE IF EXISTS `role`*/; /*!50001 DROP VIEW IF EXISTS `role`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81187,7 +81408,6 @@ USE `vn`; -- Final view structure for view `routesReduced` -- -/*!50001 DROP TABLE IF EXISTS `routesReduced`*/; /*!50001 DROP VIEW IF EXISTS `routesReduced`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81206,7 +81426,6 @@ USE `vn`; -- Final view structure for view `saleCost` -- -/*!50001 DROP TABLE IF EXISTS `saleCost`*/; /*!50001 DROP VIEW IF EXISTS `saleCost`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81225,7 +81444,6 @@ USE `vn`; -- Final view structure for view `saleLabel` -- -/*!50001 DROP TABLE IF EXISTS `saleLabel`*/; /*!50001 DROP VIEW IF EXISTS `saleLabel`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81244,7 +81462,6 @@ USE `vn`; -- Final view structure for view `saleMistakeList` -- -/*!50001 DROP TABLE IF EXISTS `saleMistakeList`*/; /*!50001 DROP VIEW IF EXISTS `saleMistakeList`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81263,7 +81480,6 @@ USE `vn`; -- Final view structure for view `saleMistake_list__2` -- -/*!50001 DROP TABLE IF EXISTS `saleMistake_list__2`*/; /*!50001 DROP VIEW IF EXISTS `saleMistake_list__2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81282,7 +81498,6 @@ USE `vn`; -- Final view structure for view `saleSaleTracking` -- -/*!50001 DROP TABLE IF EXISTS `saleSaleTracking`*/; /*!50001 DROP VIEW IF EXISTS `saleSaleTracking`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81301,7 +81516,6 @@ USE `vn`; -- Final view structure for view `saleValue` -- -/*!50001 DROP TABLE IF EXISTS `saleValue`*/; /*!50001 DROP VIEW IF EXISTS `saleValue`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81320,7 +81534,6 @@ USE `vn`; -- Final view structure for view `saleVolume` -- -/*!50001 DROP TABLE IF EXISTS `saleVolume`*/; /*!50001 DROP VIEW IF EXISTS `saleVolume`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81330,7 +81543,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,round(`ic`.`cm3delivery` * `s`.`quantity` / 1000,0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `volume`,`s`.`quantity` * `ic`.`grams` / 1000 AS `physicalWeight`,`s`.`quantity` * `ic`.`cm3delivery` * greatest(`ic`.`grams` / `ic`.`cm3delivery`,`vc`.`aerealVolumetricDensity`) / 1000000 AS `weight`,`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `physicalVolume`,`s`.`quantity` * `ic`.`cm3delivery` * ifnull(`t`.`zonePrice` - ifnull(`t`.`zoneBonus`,0),`z`.`price` - `z`.`bonus`) / (`vc`.`standardFlowerBox` * 1000) AS `freight`,`t`.`zoneFk` AS `zoneFk`,`t`.`clientFk` AS `clientFk`,`s`.`isPicked` AS `isPicked`,`s`.`quantity` * `s`.`price` * (100 - `s`.`discount`) / 100 AS `eurosValue`,`i`.`itemPackingTypeFk` AS `itemPackingTypeFk` from (((((`sale` `s` join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) join `volumeConfig` `vc`) join `itemCost` `ic` on(`ic`.`itemFk` = `s`.`itemFk` and `ic`.`warehouseFk` = `t`.`warehouseFk`)) where `s`.`quantity` > 0 */; +/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,round(`ic`.`cm3delivery` * `s`.`quantity` / 1000,0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `volume`,`s`.`quantity` * `ic`.`grams` / 1000 AS `physicalWeight`,`s`.`quantity` * `ic`.`cm3delivery` * greatest(`ic`.`grams` / `ic`.`cm3delivery`,`vc`.`aerealVolumetricDensity`) / 1000000 AS `weight`,`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `physicalVolume`,`s`.`quantity` * `ic`.`cm3delivery` * ifnull(`t`.`zonePrice` - ifnull(`t`.`zoneBonus`,0),`z`.`price` - `z`.`bonus`) / (`vc`.`standardFlowerBox` * 1000) * `z`.`inflation` AS `freight`,`t`.`zoneFk` AS `zoneFk`,`t`.`clientFk` AS `clientFk`,`s`.`isPicked` AS `isPicked`,`s`.`quantity` * `s`.`price` * (100 - `s`.`discount`) / 100 AS `eurosValue`,`i`.`itemPackingTypeFk` AS `itemPackingTypeFk` from (((((`sale` `s` join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) join `volumeConfig` `vc`) join `itemCost` `ic` on(`ic`.`itemFk` = `s`.`itemFk` and `ic`.`warehouseFk` = `t`.`warehouseFk`)) where `s`.`quantity` > 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -81339,7 +81552,6 @@ USE `vn`; -- Final view structure for view `saleVolume_Today_VNH` -- -/*!50001 DROP TABLE IF EXISTS `saleVolume_Today_VNH`*/; /*!50001 DROP VIEW IF EXISTS `saleVolume_Today_VNH`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81358,7 +81570,6 @@ USE `vn`; -- Final view structure for view `sale_freightComponent` -- -/*!50001 DROP TABLE IF EXISTS `sale_freightComponent`*/; /*!50001 DROP VIEW IF EXISTS `sale_freightComponent`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81377,7 +81588,6 @@ USE `vn`; -- Final view structure for view `salesPersonSince` -- -/*!50001 DROP TABLE IF EXISTS `salesPersonSince`*/; /*!50001 DROP VIEW IF EXISTS `salesPersonSince`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81396,7 +81606,6 @@ USE `vn`; -- Final view structure for view `salesPreparedLastHour` -- -/*!50001 DROP TABLE IF EXISTS `salesPreparedLastHour`*/; /*!50001 DROP VIEW IF EXISTS `salesPreparedLastHour`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81415,7 +81624,6 @@ USE `vn`; -- Final view structure for view `salesPreviousPreparated` -- -/*!50001 DROP TABLE IF EXISTS `salesPreviousPreparated`*/; /*!50001 DROP VIEW IF EXISTS `salesPreviousPreparated`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81434,7 +81642,6 @@ USE `vn`; -- Final view structure for view `supplierPackaging` -- -/*!50001 DROP TABLE IF EXISTS `supplierPackaging`*/; /*!50001 DROP VIEW IF EXISTS `supplierPackaging`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81453,7 +81660,6 @@ USE `vn`; -- Final view structure for view `tagL10n` -- -/*!50001 DROP TABLE IF EXISTS `tagL10n`*/; /*!50001 DROP VIEW IF EXISTS `tagL10n`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81472,7 +81678,6 @@ USE `vn`; -- Final view structure for view `ticketLastUpdated` -- -/*!50001 DROP TABLE IF EXISTS `ticketLastUpdated`*/; /*!50001 DROP VIEW IF EXISTS `ticketLastUpdated`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81491,7 +81696,6 @@ USE `vn`; -- Final view structure for view `ticketLastUpdatedList` -- -/*!50001 DROP TABLE IF EXISTS `ticketLastUpdatedList`*/; /*!50001 DROP VIEW IF EXISTS `ticketLastUpdatedList`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81510,7 +81714,6 @@ USE `vn`; -- Final view structure for view `ticketMRW` -- -/*!50001 DROP TABLE IF EXISTS `ticketMRW`*/; /*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81529,7 +81732,6 @@ USE `vn`; -- Final view structure for view `ticketNotInvoiced` -- -/*!50001 DROP TABLE IF EXISTS `ticketNotInvoiced`*/; /*!50001 DROP VIEW IF EXISTS `ticketNotInvoiced`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81548,7 +81750,6 @@ USE `vn`; -- Final view structure for view `ticketPackingList` -- -/*!50001 DROP TABLE IF EXISTS `ticketPackingList`*/; /*!50001 DROP VIEW IF EXISTS `ticketPackingList`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81567,7 +81768,6 @@ USE `vn`; -- Final view structure for view `ticketPreviousPreparingList` -- -/*!50001 DROP TABLE IF EXISTS `ticketPreviousPreparingList`*/; /*!50001 DROP VIEW IF EXISTS `ticketPreviousPreparingList`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81586,7 +81786,6 @@ USE `vn`; -- Final view structure for view `ticketState` -- -/*!50001 DROP TABLE IF EXISTS `ticketState`*/; /*!50001 DROP VIEW IF EXISTS `ticketState`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81605,7 +81804,6 @@ USE `vn`; -- Final view structure for view `ticketStateToday` -- -/*!50001 DROP TABLE IF EXISTS `ticketStateToday`*/; /*!50001 DROP VIEW IF EXISTS `ticketStateToday`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81624,7 +81822,6 @@ USE `vn`; -- Final view structure for view `tr2` -- -/*!50001 DROP TABLE IF EXISTS `tr2`*/; /*!50001 DROP VIEW IF EXISTS `tr2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81643,7 +81840,6 @@ USE `vn`; -- Final view structure for view `traceabilityBuy` -- -/*!50001 DROP TABLE IF EXISTS `traceabilityBuy`*/; /*!50001 DROP VIEW IF EXISTS `traceabilityBuy`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81662,7 +81858,6 @@ USE `vn`; -- Final view structure for view `traceabilitySale` -- -/*!50001 DROP TABLE IF EXISTS `traceabilitySale`*/; /*!50001 DROP VIEW IF EXISTS `traceabilitySale`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81681,7 +81876,6 @@ USE `vn`; -- Final view structure for view `workerBusinessDated` -- -/*!50001 DROP TABLE IF EXISTS `workerBusinessDated`*/; /*!50001 DROP VIEW IF EXISTS `workerBusinessDated`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81700,7 +81894,6 @@ USE `vn`; -- Final view structure for view `workerDepartment` -- -/*!50001 DROP TABLE IF EXISTS `workerDepartment`*/; /*!50001 DROP VIEW IF EXISTS `workerDepartment`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81719,7 +81912,6 @@ USE `vn`; -- Final view structure for view `workerLabour` -- -/*!50001 DROP TABLE IF EXISTS `workerLabour`*/; /*!50001 DROP VIEW IF EXISTS `workerLabour`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81738,7 +81930,6 @@ USE `vn`; -- Final view structure for view `workerMedia` -- -/*!50001 DROP TABLE IF EXISTS `workerMedia`*/; /*!50001 DROP VIEW IF EXISTS `workerMedia`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81757,7 +81948,6 @@ USE `vn`; -- Final view structure for view `workerSpeedExpedition` -- -/*!50001 DROP TABLE IF EXISTS `workerSpeedExpedition`*/; /*!50001 DROP VIEW IF EXISTS `workerSpeedExpedition`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81776,7 +81966,6 @@ USE `vn`; -- Final view structure for view `workerSpeedSaleTracking` -- -/*!50001 DROP TABLE IF EXISTS `workerSpeedSaleTracking`*/; /*!50001 DROP VIEW IF EXISTS `workerSpeedSaleTracking`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81795,7 +81984,6 @@ USE `vn`; -- Final view structure for view `workerTeamCollegues` -- -/*!50001 DROP TABLE IF EXISTS `workerTeamCollegues`*/; /*!50001 DROP VIEW IF EXISTS `workerTeamCollegues`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81814,17 +82002,16 @@ USE `vn`; -- Final view structure for view `workerTimeControlUserInfo` -- -/*!50001 DROP TABLE IF EXISTS `workerTimeControlUserInfo`*/; /*!50001 DROP VIEW IF EXISTS `workerTimeControlUserInfo`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb3 */; -/*!50001 SET character_set_results = utf8mb3 */; -/*!50001 SET collation_connection = utf8mb3_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeControlUserInfo` AS select `u`.`id` AS `userFk`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`u`.`name` AS `user`,`u`.`password` AS `password`,`wd`.`departmentFk` AS `departmentFk`,left(`c`.`fi`,8) AS `dni` from (((`account`.`user` `u` join `vn`.`worker` `w` on(`w`.`userFk` = `u`.`id`)) join `vn`.`client` `c` on(`c`.`id` = `u`.`id`)) left join `vn`.`workerDepartment` `wd` on(`wd`.`workerFk` = `w`.`id`)) */; +/*!50001 VIEW `workerTimeControlUserInfo` AS select `u`.`id` AS `userFk`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`u`.`name` AS `user`,`u`.`password` AS `password`,`wd`.`departmentFk` AS `departmentFk`,left(`c`.`fi`,8) AS `dni` from (((`account`.`user` `u` join `vn`.`worker` `w` on(`w`.`id` = `u`.`id`)) join `vn`.`client` `c` on(`c`.`id` = `u`.`id`)) left join `vn`.`workerDepartment` `wd` on(`wd`.`workerFk` = `w`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -81833,7 +82020,6 @@ USE `vn`; -- Final view structure for view `workerTimeJourneyNG` -- -/*!50001 DROP TABLE IF EXISTS `workerTimeJourneyNG`*/; /*!50001 DROP VIEW IF EXISTS `workerTimeJourneyNG`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81843,7 +82029,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeJourneyNG` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,if(`wtc`.`order` MOD 2,-1,1) * (hour(`wtc`.`timed`) + minute(`wtc`.`timed`) / 60) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on(`w`.`userFk` = `wtc`.`userFk`)) */; +/*!50001 VIEW `workerTimeJourneyNG` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,if(`wtc`.`order` MOD 2,-1,1) * (hour(`wtc`.`timed`) + minute(`wtc`.`timed`) / 60) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on(`w`.`id` = `wtc`.`userFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -81852,7 +82038,6 @@ USE `vn`; -- Final view structure for view `workerWithoutTractor` -- -/*!50001 DROP TABLE IF EXISTS `workerWithoutTractor`*/; /*!50001 DROP VIEW IF EXISTS `workerWithoutTractor`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81871,7 +82056,6 @@ USE `vn`; -- Final view structure for view `zoneEstimatedDelivery` -- -/*!50001 DROP TABLE IF EXISTS `zoneEstimatedDelivery`*/; /*!50001 DROP VIEW IF EXISTS `zoneEstimatedDelivery`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -81895,4 +82079,4 @@ USE `vn`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-06-26 8:39:32 +-- Dump completed on 2023-08-30 15:59:19 From 92789ba3de0327c75cb9631b4079bbed2a31bf51 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 31 Aug 2023 10:04:28 +0200 Subject: [PATCH 296/311] refs #6173 fixed backTest --- db/dump/fixtures.sql | 12 +++++++----- modules/entry/back/methods/entry/addFromBuy.js | 3 ++- modules/entry/back/methods/entry/lastItemBuys.js | 7 ++----- .../methods/route/specs/updateWorkCenter.spec.js | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index b01c07461..9c37881e5 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1965,6 +1965,8 @@ INSERT INTO `vn`.`calendarType` (`id`, `description`, `hoursWeek`, `isPartial`) VALUES (1, 'General schedule', 40, 0); +INSERT INTO `vn`.`workerBusinessAgreement` (`id`, `name`, `monthHolidays`, `yearHours`, `started`, `ended`) + VALUES(1, 'flowers', 2.5, 1830, '2001-01-01', NULL); DROP TEMPORARY TABLE IF EXISTS tmp.worker; CREATE TEMPORARY TABLE tmp.worker @@ -2896,11 +2898,11 @@ INSERT INTO `vn`.`deviceProductionState` (`code`, `description`) ('retired', 'retirada'); INSERT INTO `vn`.`deviceProduction` (`imei`, `modelFk`, `macWifi`, `serialNumber`, `android_id`, `purchased`, `stateFk`, `isInScalefusion`, `description`) - VALUES - ('ime1', 'BLACKVIEW', 'macWifi1', 'serialNumber1', 'android_id1', util.VN_NOW(), 'active', 0, NULL), - ('ime2', 'DODGEE', 'macWifi2', 'serialNumber2', 'android_id2', util.VN_NOW(), 'idle', 0, NULL), - ('ime3', 'ZEBRA', 'macWifi3', 'serialNumber3', 'android_id3', util.VN_NOW(), 'active', 0, NULL), - ('ime4', 'BLACKVIEW', 'macWifi4', 'serialNumber4', 'android_id4', util.VN_NOW(), 'idle', 0, NULL); +VALUES + ('ime1', 'BLACKVIEW', 'macWifi1', 'serialNumber1', 'androidid11234567890', util.VN_NOW(), 'active', 0, NULL), + ('ime2', 'DODGEE', 'macWifi2', 'serialNumber2', 'androidid21234567890', util.VN_NOW(), 'idle', 0, NULL), + ('ime3', 'ZEBRA', 'macWifi3', 'serialNumber3', 'androidid31234567890', util.VN_NOW(), 'active', 0, NULL), + ('ime4', 'BLACKVIEW', 'macWifi4', 'serialNumber4', 'androidid41234567890', util.VN_NOW(), 'idle', 0, NULL); INSERT INTO `vn`.`deviceProductionUser` (`deviceProductionFk`, `userFk`, `created`) VALUES diff --git a/modules/entry/back/methods/entry/addFromBuy.js b/modules/entry/back/methods/entry/addFromBuy.js index bfbd1b416..82645b166 100644 --- a/modules/entry/back/methods/entry/addFromBuy.js +++ b/modules/entry/back/methods/entry/addFromBuy.js @@ -85,7 +85,6 @@ module.exports = Self => { price2: buyUltimate.price2, price3: buyUltimate.price3, minPrice: buyUltimate.minPrice, - printedStickers: args.printedStickers, workerFk: buyUltimate.workerFk, isChecked: buyUltimate.isChecked, isPickedOff: buyUltimate.isPickedOff, @@ -95,6 +94,8 @@ module.exports = Self => { deliveryFk: buyUltimate.deliveryFk, itemOriginalFk: buyUltimate.itemOriginalFk }, myOptions); + if (buy) + await buy.updateAttribute('printedStickers', args.printedStickers, myOptions); } if (tx) await tx.commit(); diff --git a/modules/entry/back/methods/entry/lastItemBuys.js b/modules/entry/back/methods/entry/lastItemBuys.js index 87b99c229..077798e8a 100644 --- a/modules/entry/back/methods/entry/lastItemBuys.js +++ b/modules/entry/back/methods/entry/lastItemBuys.js @@ -33,7 +33,6 @@ module.exports = Self => { const models = Self.app.models; const where = {isActive: true}; const myOptions = {}; - if (typeof options == 'object') Object.assign(myOptions, options); @@ -47,12 +46,10 @@ module.exports = Self => { } }] }, myOptions); - const travel = entry.travel(); const stmts = []; let stmt; - stmt = new ParameterizedSQL(`CALL buyUltimate(?, ?)`, [ travel.warehouseInFk, travel.landed @@ -63,7 +60,7 @@ module.exports = Self => { stmt = new ParameterizedSQL( `CREATE TEMPORARY TABLE tmp.item (PRIMARY KEY (id)) - SELECT + SELECT i.*, p.name AS producerName, nk.name AS inkName @@ -84,7 +81,7 @@ module.exports = Self => { const sql = ParameterizedSQL.join(stmts, ';'); const result = await conn.executeStmt(sql, myOptions); - + console.log(result); return result[itemsIndex]; }; }; diff --git a/modules/route/back/methods/route/specs/updateWorkCenter.spec.js b/modules/route/back/methods/route/specs/updateWorkCenter.spec.js index baa63f226..a1c716299 100644 --- a/modules/route/back/methods/route/specs/updateWorkCenter.spec.js +++ b/modules/route/back/methods/route/specs/updateWorkCenter.spec.js @@ -40,7 +40,7 @@ describe('route updateWorkCenter()', () => { } }); - it(`shoul set the default commision work center if that worker didn't have one yet`, async() => { + it(`should set the default commision work center if that worker didn't have one yet`, async() => { const tx = await models.Route.beginTransaction({}); try { const userWithoutWorkCenter = 2; From b1978b07bd513b82058892bd84084168b0719539 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 31 Aug 2023 11:06:47 +0200 Subject: [PATCH 297/311] changes path desactualizado --- db/changes/{233201 => 233601}/00-saleGroupDetail.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{233201 => 233601}/00-saleGroupDetail.sql (100%) diff --git a/db/changes/233201/00-saleGroupDetail.sql b/db/changes/233601/00-saleGroupDetail.sql similarity index 100% rename from db/changes/233201/00-saleGroupDetail.sql rename to db/changes/233601/00-saleGroupDetail.sql From 4eeae466831541f07ef1b8b0f2443383802753de Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 31 Aug 2023 11:28:37 +0200 Subject: [PATCH 298/311] post subida --- CHANGELOG.md | 8 ++++++++ db/changes/233801/.gitkeep | 0 package.json | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 db/changes/233801/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b3c43005..0cb94fc66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2338.01] - 2023-09-21 + +### Added + +### Changed + +### Fixed + ## [2336.01] - 2023-09-07 ### Added diff --git a/db/changes/233801/.gitkeep b/db/changes/233801/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/package.json b/package.json index dd833a8ad..44a651af4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.36.01", + "version": "23.38.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From e7cd052199f1df73342d47631c8fd8ea5c4e2110 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 31 Aug 2023 13:49:00 +0200 Subject: [PATCH 299/311] refs #6132 add messageError --- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 46b48e2ea..5d2b7ab03 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -185,5 +185,6 @@ "You don't have enough privileges.": "You don't have enough privileges.", "This ticket is locked.": "This ticket is locked.", "This ticket is not editable.": "This ticket is not editable.", - "The ticket doesn't exist.": "The ticket doesn't exist." + "The ticket doesn't exist.": "The ticket doesn't exist.", + "Ticket without Route": "Ticket without route" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 195b683ad..ccd63e0ff 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -315,5 +315,6 @@ "This ticket is not editable.": "Este ticket no es editable.", "The ticket doesn't exist.": "No existe el ticket.", "Social name should be uppercase": "La razón social debe ir en mayúscula", - "Street should be uppercase": "La dirección fiscal debe ir en mayúscula" + "Street should be uppercase": "La dirección fiscal debe ir en mayúscula", + "Ticket without Route": "Ticket sin ruta" } From 7d8828e6043a8e97ef28108907c7485b2fdcb822 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 31 Aug 2023 13:50:31 +0200 Subject: [PATCH 300/311] refs #6132 fix: saveSign without route --- modules/ticket/back/methods/ticket/saveSign.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 55d2e3281..9888328e7 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -93,6 +93,8 @@ module.exports = Self => { }, myOptions); const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); const ctxUploadFile = Object.assign({}, ctx); + if (ticket.route() === null) + throw new UserError('Ticket without route'); ctxUploadFile.args = { warehouseId: ticket.warehouseFk, companyId: ticket.companyFk, From 281ae0eb0477e8c55a84f58024e4fa038b47bdc7 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 1 Sep 2023 07:21:15 +0200 Subject: [PATCH 301/311] refs #4815 feat:DeviceLogModel --- db/changes/233401/01-deviceLog_acl.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/changes/233401/01-deviceLog_acl.sql b/db/changes/233401/01-deviceLog_acl.sql index dd8bc936b..7b7becf58 100644 --- a/db/changes/233401/01-deviceLog_acl.sql +++ b/db/changes/233401/01-deviceLog_acl.sql @@ -1,6 +1,6 @@ -ALTER TABLE vn.deviceLog ADD serialNumber varchar(45) DEFAULT NULL NULL; +ALTER TABLE `vn`.`deviceLog`ADD serialNumber varchar(45) DEFAULT NULL NULL; INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId) -VALUES( 'DeviceLog', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'); +VALUES( 'DeviceLog', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee'); From 473e710d1b825f229ee940e36625794323dcfc22 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 1 Sep 2023 07:22:15 +0200 Subject: [PATCH 302/311] refs #4815 feat:DeviceLogModel --- db/changes/233401/01-deviceLog_acl.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/233401/01-deviceLog_acl.sql b/db/changes/233401/01-deviceLog_acl.sql index 7b7becf58..ebe3f8ed5 100644 --- a/db/changes/233401/01-deviceLog_acl.sql +++ b/db/changes/233401/01-deviceLog_acl.sql @@ -1,5 +1,5 @@ -ALTER TABLE `vn`.`deviceLog`ADD serialNumber varchar(45) DEFAULT NULL NULL; +ALTER TABLE `vn`.`deviceLog` ADD serialNumber varchar(45) DEFAULT NULL NULL; INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId) VALUES( 'DeviceLog', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee'); From 9b971abb55772b4d5e96c42202d5db309bb5ba6a Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 1 Sep 2023 11:49:08 +0200 Subject: [PATCH 303/311] refs #6044 class scss --- modules/worker/front/calendar/index.html | 3 ++- modules/worker/front/calendar/style.scss | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index 08f63ddf9..d64c22408 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -84,7 +84,8 @@

- + + {{absenceType.name}} diff --git a/modules/worker/front/calendar/style.scss b/modules/worker/front/calendar/style.scss index d92c54806..e99f64689 100644 --- a/modules/worker/front/calendar/style.scss +++ b/modules/worker/front/calendar/style.scss @@ -9,7 +9,7 @@ vn-worker-calendar { align-items: center; box-sizing: border-box; padding: $spacing-md; - + & > vn-calendar { border: $border-thin; margin: $spacing-md; @@ -32,7 +32,7 @@ vn-worker-calendar { } vn-icon[icon="info"] { - position: absolute; + position: absolute; top: 16px; right: 16px } @@ -40,7 +40,7 @@ vn-worker-calendar { vn-side-menu div > .input { border-bottom: $border-thin; } - + .festive, vn-avatar.today { color: $color-font; @@ -56,4 +56,10 @@ vn-worker-calendar { vn-avatar.today { border: 2px solid $color-font-link } + + .check { + margin-top: 0.5px; + margin-left: -3px; + font-size: 125%; + } } From 734b948aac13a316fdad5284dd2e36c2c875a840 Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 1 Sep 2023 11:52:48 +0200 Subject: [PATCH 304/311] refs #6173 back test fixed and fixtures refactored --- db/dump/fixtures.sql | 136 +++++++++--------- e2e/paths/04-item/01_summary.spec.js | 4 +- e2e/paths/04-item/03_tax.spec.js | 2 +- e2e/paths/04-item/04_tags.spec.js | 2 +- e2e/paths/04-item/06_barcode.spec.js | 2 +- e2e/paths/04-item/12_request.spec.js | 4 +- .../05-ticket/01-sale/01_list_sales.spec.js | 2 +- e2e/paths/05-ticket/04_packages.spec.js | 6 +- e2e/paths/12-entry/07_buys.spec.js | 8 +- loopback/locale/en.json | 7 +- .../entry/back/methods/entry/lastItemBuys.js | 1 - .../entry/specs/editLatestBuys.spec.js | 2 +- .../entry/specs/latestBuysFilter.spec.js | 6 +- .../supplier/specs/getItemsPackaging.spec.js | 2 +- .../packaging/specs/listPackaging.spec.js | 2 +- .../sale/specs/getClaimableFromTicket.spec.js | 2 +- 16 files changed, 95 insertions(+), 93 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 9c37881e5..7a126d4cc 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -871,7 +871,9 @@ INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`) ('SLV', 'Silver', 1, 4, 'CACFD2'), ('BRW', 'Brown', 1, 5, 'DC7633'), ('BLK', 'Black', 1, 6, '000000'), - ('BAS', 'Blue/Silver', 1, 7, '5DADE2'); + ('BAS', 'Blue/Silver', 1, 7, '5DADE2'), + ('GRN', 'Green', 1, 8, '28A745'), + ('WHT', 'White', 1, 9, 'FFFFFF'); INSERT INTO `vn`.`origin`(`id`,`code`, `name`) VALUES @@ -918,26 +920,26 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`) ('SER', 'Services'), ('VT', 'Sales'); -INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, +INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`) VALUES - (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'EMB', 0, NULL, 'V', 0, 15,3), - (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2), - (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5), - (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL), - (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL), - (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL), - (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL), - (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL), - (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL), - (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL); + (1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'EMB', 0, NULL, 'V', 0, 15,3), + (2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2), + (3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5), + (4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL), + (10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL), + (14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL), + (15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL), + (16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL), + (71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL); -- Update the taxClass after insert of the items UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 @@ -1005,45 +1007,45 @@ INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`) VALUES - (1, 1, 1, 'Ranged weapon longbow 2m', 5, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (1, 1, 1, 'Ranged weapon longbow 200cm', 5, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), (2, 2, 1, 'Melee weapon combat fist 15cm', 10, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (3, 1, 1, 'Ranged weapon longbow 2m', 2, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (5, 1, 2, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (6, 1, 3, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), + (3, 1, 1, 'Ranged weapon longbow 200cm', 2, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (4, 4, 1, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (5, 1, 2, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (6, 1, 3, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), (7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.44, 0, 0, 0, util.VN_CURDATE()), - (8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 1.79, 0, 0, 0, util.VN_CURDATE()), - (9, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, util.VN_CURDATE()), + (8, 4, 11, 'Melee weapon heavy shield 100cm', 10, 1.79, 0, 0, 0, util.VN_CURDATE()), + (9, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()), (10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, util.VN_CURDATE()), - (11, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, util.VN_CURDATE()), - (12, 4, 16, 'Melee weapon heavy shield 1x0.5m', 20, 1.71, 0, 0, 0, util.VN_CURDATE()), + (11, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()), + (12, 4, 16, 'Melee weapon heavy shield 100cm', 20, 1.71, 0, 0, 0, util.VN_CURDATE()), (13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, util.VN_CURDATE()), - (14, 1, 8, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, util.VN_CURDATE()), - (15, 1, 19, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, util.VN_CURDATE()), + (14, 1, 8, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE()), + (15, 1, 19, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()), (16, 2, 20, 'Melee weapon combat fist 15cm', 20, 7.07, 0, 0, 0, util.VN_CURDATE()), (17, 2, 22, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), - (18, 4, 22, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), - (19, 1, 4, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)), - (20, 1, 5, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)), - (21, 1, 6, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (22, 1, 7, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, util.VN_CURDATE()), - (23, 1, 9, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, util.VN_CURDATE()), - (24, 1, 10, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, util.VN_CURDATE()), - (25, 4, 12, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), - (26, 4, 13, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), - (27, 4, 14, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), - (28, 4, 15, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), - (29, 4, 17, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), - (30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (18, 4, 22, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (19, 1, 4, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)), + (20, 1, 5, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)), + (21, 1, 6, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (22, 1, 7, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()), + (23, 1, 9, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()), + (24, 1, 10, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()), + (25, 4, 12, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (26, 4, 13, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (27, 4, 14, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (28, 4, 15, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (29, 4, 17, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (30, 4, 18, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), (31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, util.VN_CURDATE()), - (32, 1, 24, 'Ranged weapon longbow 2m', -1, 8.07, 0, 0, 0, util.VN_CURDATE()), + (32, 1, 24, 'Ranged weapon longbow 200cm', -1, 8.07, 0, 0, 0, util.VN_CURDATE()), (33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE()), - (34, 4, 28, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), - (35, 4, 29, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), - (37, 4, 31, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), - (36, 4, 30, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (34, 4, 28, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (35, 4, 29, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (37, 4, 31, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (36, 4, 30, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), (38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), - (39, 1, 32, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, util.VN_CURDATE()); + (39, 1, 32, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE()); INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) VALUES @@ -1259,7 +1261,7 @@ INSERT INTO `vn`.`tag`(`id`, `code`, `name`, `isFree`, `isQuantitatif`, `sourceT (5, NULL, 'Diámetro', 1, 1, NULL, 'mm',NULL, 'diameter'), (7, NULL, 'Ancho de la base', 1, 1, NULL, 'mm',NULL, NULL), (23, 'stems', 'Tallos', 1, 1, NULL, NULL, NULL, 'stems'), - (27, NULL, 'Longitud(cm)', 1, 1, NULL, 'cm', NULL, NULL), + (27, NULL, 'Longitud(cm)', 1, 1, NULL, 'cm', NULL, 'size'), (36, 'producer', 'Proveedor', 1, 0, NULL, NULL, NULL, 'producer'), (56, NULL, 'Genero', 1, 0, NULL, NULL, NULL, NULL), (58, NULL, 'Variedad', 1, 0, NULL, NULL, NULL, NULL), @@ -1270,7 +1272,7 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`) VALUES (1, 1, 56, 'Ranged weapon', 1), (2, 1, 58, 'longbow', 2), - (3, 1, 27, '2m', 3), + (3, 1, 27, '200cm', 3), (4, 1, 36, 'Stark Industries', 4), (5, 1, 1, 'Brown', 5), (6, 1, 67, '+1 precission', 6), @@ -1284,42 +1286,42 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`) (14, 2, 23, '2', 7), (15, 3, 56, 'Ranged weapon', 1), (16, 3, 58, 'sniper rifle', 2), - (17, 3, 4, '300mm', 3), + (17, 3, 4, '113cm', 3), (18, 3, 36, 'Stark Industries', 4), (19, 3, 1, 'Green', 5), (20, 3, 67, 'precission', 6), (21, 3, 23, '3', 7), (22, 4, 56, 'Melee weapon', 1), (23, 4, 58, 'heavy shield', 2), - (24, 4, 4, '1x0.5m', 3), + (24, 4, 4, '100cm', 3), (25, 4, 36, 'Stark Industries', 4), (26, 4, 1, 'Black', 5), (27, 4, 67, 'containtment', 6), (28, 4, 23, '4', 7), (29, 5, 56, 'Ranged weapon', 1), (30, 5, 58, 'pistol', 2), - (31, 5, 27, '9mm', 3), + (31, 5, 67, '9mm', 3), (32, 5, 36, 'Stark Industries', 4), (33, 5, 1, 'Silver', 5), - (34, 5, 67, 'rapid fire', 6), + (34, 5, 27, '15cm', 6), (35, 5, 23, '5', 7), (36, 6, 56, 'Container', 1), (37, 6, 58, 'ammo box', 2), - (38, 6, 27, '1m', 3), + (38, 6, 27, '100cm', 3), (39, 6, 36, 'Stark Industries', 4), (40, 6, 1, 'Green', 5), (41, 6, 67, 'supply', 6), (42, 6, 23, '6', 7), (43, 7, 56, 'Container', 1), (44, 7, 58, 'medical box', 2), - (45, 7, 27, '1m', 3), + (45, 7, 27, '100cm', 3), (46, 7, 36, 'Stark Industries', 4), (47, 7, 1, 'White', 5), (48, 7, 67, 'supply', 6), (49, 7, 23, '7', 7), (50, 8, 56, 'Ranged Reinforced weapon', 1), (51, 8, 58, '+1 longbow', 2), - (52, 8, 27, '2m', 3), + (52, 8, 27, '200cm', 3), (53, 8, 36, 'Stark Industries', 4), (54, 8, 1, 'Brown', 5), (55, 8, 67, 'precission', 6), @@ -1333,14 +1335,14 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`) (63, 9, 23, '9', 7), (64, 10, 56, 'Ranged Reinforced weapon', 1), (65, 10, 58, 'sniper rifle', 2), - (66, 10, 4, '300mm', 3), + (66, 10, 67, '700mm', 3), (67, 10, 36, 'Stark Industries', 4), (68, 10, 1, 'Green', 5), - (69, 10, 67, 'precission', 6), + (69, 10, 27, '130cm', 6), (70, 10, 23, '10', 7), (71, 11, 56, 'Melee Reinforced weapon', 1), (72, 11, 58, 'heavy shield', 2), - (73, 11, 4, '1x0.5m', 3), + (73, 11, 4, '120cm', 3), (74, 11, 36, 'Stark Industries', 4), (75, 11, 1, 'Black', 5), (76, 11, 67, 'containtment', 6), @@ -1350,18 +1352,18 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`) (80, 12, 27, '9mm', 3), (81, 12, 36, 'Stark Industries', 4), (82, 12, 1, 'Silver', 5), - (83, 12, 67, 'rapid fire', 6), + (83, 12, 67, '23cm', 6), (84, 12, 23, '12', 7), (85, 13, 56, 'Chest', 1), (86, 13, 58, 'ammo box', 2), - (87, 13, 27, '1m', 3), + (87, 13, 27, '100cm', 3), (88, 13, 36, 'Stark Industries', 4), (89, 13, 1, 'Green', 5), (90, 13, 67, 'supply', 6), (91, 13, 23, '13', 7), (92, 14, 56, 'Chest', 1), (93, 14, 58, 'medical box', 2), - (94, 14, 27, '1m', 3), + (94, 14, 27, '100cm', 3), (95, 14, 36, 'Stark Industries', 4), (96, 14, 1, 'White', 5), (97, 14, 67, 'supply', 6), @@ -1927,9 +1929,9 @@ INSERT INTO `vn`.`workerTeam`(`id`, `team`, `workerFk`) INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `attenderFk`, `quantity`, `itemFk`, `price`, `isOk`, `saleFk`, `ticketFk`, `created`) VALUES - (1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY)), + (1, 'Ranged weapon longbow 200cm', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY)), (2, 'Melee weapon combat first 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY)), - (3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, NULL, 3.06, NULL, NULL, 23, util.VN_CURDATE()), + (3, 'Melee weapon heavy shield 100cm', 18, 35, 20, NULL, 3.06, NULL, NULL, 23, util.VN_CURDATE()), (4, 'Melee weapon combat first 15cm', 18, 35, 15, NULL, 1.30, NULL, NULL, 11, util.VN_CURDATE()), (5, 'Melee weapon combat first 15cm', 18, 35, 15, 4, 1.30, 0, NULL, 18, util.VN_CURDATE()); @@ -2832,7 +2834,7 @@ INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldIns (7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 1, NULL), (7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 1, NULL), (7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 1, NULL), - (7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 1x0.5m de '5' a '10'"), + (7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 100cm de '5' a '10'"), (16, 9, 'update', 'Sale', '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', '{"quantity":8,"concept":"Shield", "price": 10.5, "itemFk": 1}' , 5689, 'Shield'); diff --git a/e2e/paths/04-item/01_summary.spec.js b/e2e/paths/04-item/01_summary.spec.js index e09ecb778..51195be48 100644 --- a/e2e/paths/04-item/01_summary.spec.js +++ b/e2e/paths/04-item/01_summary.spec.js @@ -27,10 +27,10 @@ describe('Item summary path', () => { }); it(`should check the item summary preview shows fields from basic data`, async() => { - await page.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m'); + await page.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 200cm'); const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); - expect(result).toContain('Ranged weapon longbow 2m'); + expect(result).toContain('Ranged weapon longbow 200cm'); }); it(`should check the item summary preview shows fields from tags`, async() => { diff --git a/e2e/paths/04-item/03_tax.spec.js b/e2e/paths/04-item/03_tax.spec.js index 16cc1667d..6013094e9 100644 --- a/e2e/paths/04-item/03_tax.spec.js +++ b/e2e/paths/04-item/03_tax.spec.js @@ -8,7 +8,7 @@ describe('Item edit tax path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'item'); - await page.accessToSearchResult('Ranged weapon longbow 2m'); + await page.accessToSearchResult('Ranged weapon longbow 200cm'); await page.accessToSection('item.card.tax'); }); diff --git a/e2e/paths/04-item/04_tags.spec.js b/e2e/paths/04-item/04_tags.spec.js index 574ff7562..f13cf9aa4 100644 --- a/e2e/paths/04-item/04_tags.spec.js +++ b/e2e/paths/04-item/04_tags.spec.js @@ -8,7 +8,7 @@ describe('Item create tags path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'item'); - await page.accessToSearchResult('Ranged weapon longbow 2m'); + await page.accessToSearchResult('Ranged weapon longbow 200cm'); await page.accessToSection('item.card.tags'); }); diff --git a/e2e/paths/04-item/06_barcode.spec.js b/e2e/paths/04-item/06_barcode.spec.js index 7fed5ea0c..36c9c39ae 100644 --- a/e2e/paths/04-item/06_barcode.spec.js +++ b/e2e/paths/04-item/06_barcode.spec.js @@ -8,7 +8,7 @@ describe('Item Create barcodes path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'item'); - await page.accessToSearchResult('Ranged weapon longbow 2m'); + await page.accessToSearchResult('Ranged weapon longbow 200cm'); await page.accessToSection('item.card.itemBarcode'); }); diff --git a/e2e/paths/04-item/12_request.spec.js b/e2e/paths/04-item/12_request.spec.js index 19838883e..e0f3a1b45 100644 --- a/e2e/paths/04-item/12_request.spec.js +++ b/e2e/paths/04-item/12_request.spec.js @@ -22,10 +22,10 @@ describe('Item request path', () => { it('should fill the id and quantity then check the concept was updated', async() => { await page.writeOnEditableTD(selectors.itemRequest.firstRequestItemID, '4'); await page.writeOnEditableTD(selectors.itemRequest.firstRequestQuantity, '10'); - await page.waitForTextInElement(selectors.itemRequest.firstRequestConcept, 'Melee weapon heavy shield 1x0.5m'); + await page.waitForTextInElement(selectors.itemRequest.firstRequestConcept, 'Melee weapon heavy shield 100cm'); let filledConcept = await page.waitToGetProperty(selectors.itemRequest.firstRequestConcept, 'innerText'); - expect(filledConcept).toContain('Melee weapon heavy shield 1x0.5m'); + expect(filledConcept).toContain('Melee weapon heavy shield 100cm'); }); it('should check the status of the request should now be accepted', async() => { diff --git a/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js b/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js index 44f2b6947..5c8eba571 100644 --- a/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js +++ b/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js @@ -54,7 +54,7 @@ describe('Ticket List sale path', () => { }); it('should select a valid item to be added as the second item in the sales list', async() => { - let searchValue = 'Melee weapon heavy shield 1x0.5m'; + let searchValue = 'Melee weapon heavy shield 100cm'; await page.autocompleteSearch(selectors.ticketSales.secondSaleIdAutocomplete, searchValue); await page.waitToClick(selectors.ticketSales.secondSaleQuantityCell); await page.type(selectors.ticketSales.secondSaleQuantity, '1'); diff --git a/e2e/paths/05-ticket/04_packages.spec.js b/e2e/paths/05-ticket/04_packages.spec.js index 2b79e9cb6..1e6a0a173 100644 --- a/e2e/paths/05-ticket/04_packages.spec.js +++ b/e2e/paths/05-ticket/04_packages.spec.js @@ -36,7 +36,7 @@ describe('Ticket Create packages path', () => { it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => { await page.clearInput($.firstQuantity); - await page.autocompleteSearch($.firstPackage, 'Container medical box 1m'); + await page.autocompleteSearch($.firstPackage, 'Container medical box 100cm'); await page.waitToClick($.savePackagesButton); const message = await page.waitForSnackbar(); @@ -63,10 +63,10 @@ describe('Ticket Create packages path', () => { it(`should confirm the first select is the expected one`, async() => { await page.reloadSection('ticket.card.package'); - await page.waitForTextInField($.firstPackage, 'Container medical box 1m'); + await page.waitForTextInField($.firstPackage, 'Container medical box 100cm'); const result = await page.waitToGetProperty($.firstPackage, 'value'); - expect(result).toEqual('Container medical box 1m'); + expect(result).toEqual('Container medical box 100cm'); }); it(`should confirm quantity is just a number and the string part was ignored by the imput number`, async() => { diff --git a/e2e/paths/12-entry/07_buys.spec.js b/e2e/paths/12-entry/07_buys.spec.js index 28d39fb1d..b960673ec 100644 --- a/e2e/paths/12-entry/07_buys.spec.js +++ b/e2e/paths/12-entry/07_buys.spec.js @@ -41,10 +41,10 @@ describe('Entry import, create and edit buys path', () => { await page.waitForTextInField(selectors.entryBuys.ref, '200573095, 200573106, 200573117, 200573506'); await page.waitForTextInField(selectors.entryBuys.observation, '729-6340 2846'); - await page.autocompleteSearch(selectors.entryBuys.firstImportedItem, 'Ranged weapon longbow 2m'); - await page.autocompleteSearch(selectors.entryBuys.secondImportedItem, 'Ranged weapon longbow 2m'); - await page.autocompleteSearch(selectors.entryBuys.thirdImportedItem, 'Ranged weapon sniper rifle 300mm'); - await page.autocompleteSearch(selectors.entryBuys.fourthImportedItem, 'Melee weapon heavy shield 1x0.5m'); + await page.autocompleteSearch(selectors.entryBuys.firstImportedItem, 'Ranged weapon longbow 200cm'); + await page.autocompleteSearch(selectors.entryBuys.secondImportedItem, 'Ranged weapon longbow 200cm'); + await page.autocompleteSearch(selectors.entryBuys.thirdImportedItem, 'Ranged weapon sniper rifle 113cm'); + await page.autocompleteSearch(selectors.entryBuys.fourthImportedItem, 'Melee weapon heavy shield 100cm'); await page.waitToClick(selectors.entryBuys.importBuysButton); diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 46b48e2ea..a9e7d1df6 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -179,11 +179,12 @@ "You can not use the same password": "You can not use the same password", "Valid priorities": "Valid priorities: %d", "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}", - "This ticket cannot be left empty.": "This ticket cannot be left empty. %s", + "This ticket cannot be left empty.": "This ticket cannot be left empty. %s", "Social name should be uppercase": "Social name should be uppercase", "Street should be uppercase": "Street should be uppercase", "You don't have enough privileges.": "You don't have enough privileges.", "This ticket is locked.": "This ticket is locked.", "This ticket is not editable.": "This ticket is not editable.", - "The ticket doesn't exist.": "The ticket doesn't exist." -} + "The ticket doesn't exist.": "The ticket doesn't exist.", + "The sales do not exists": "The sales do not exists" +} \ No newline at end of file diff --git a/modules/entry/back/methods/entry/lastItemBuys.js b/modules/entry/back/methods/entry/lastItemBuys.js index 077798e8a..514052e4b 100644 --- a/modules/entry/back/methods/entry/lastItemBuys.js +++ b/modules/entry/back/methods/entry/lastItemBuys.js @@ -81,7 +81,6 @@ module.exports = Self => { const sql = ParameterizedSQL.join(stmts, ';'); const result = await conn.executeStmt(sql, myOptions); - console.log(result); return result[itemsIndex]; }; }; diff --git a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js index a4dd185fd..885171ed5 100644 --- a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js +++ b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js @@ -24,7 +24,7 @@ describe('Buy editLatestsBuys()', () => { try { const ctx = { args: { - search: 'Ranged weapon longbow 2m' + search: 'Ranged weapon longbow 200cm' }, req: {accessToken: {userId: 1}} }; diff --git a/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js b/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js index 0578fcdd4..c1867c291 100644 --- a/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js +++ b/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js @@ -8,7 +8,7 @@ describe('Entry latests buys filter()', () => { try { const ctx = { args: { - search: 'Ranged weapon longbow 2m' + search: 'Ranged weapon longbow 200cm' }, req: {accessToken: {userId: 1}} }; @@ -17,7 +17,7 @@ describe('Entry latests buys filter()', () => { const firstBuy = results[0]; expect(results.length).toEqual(1); - expect(firstBuy.size).toEqual(70); + expect(firstBuy.size).toEqual(200); await tx.rollback(); } catch (e) { @@ -57,7 +57,7 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { tags: [ - {tagFk: 27, value: '2m'} + {tagFk: 27, value: '200cm'} ] }, req: {accessToken: {userId: 1}} diff --git a/modules/supplier/back/methods/supplier/specs/getItemsPackaging.spec.js b/modules/supplier/back/methods/supplier/specs/getItemsPackaging.spec.js index 8e4cc9145..66b328bb0 100644 --- a/modules/supplier/back/methods/supplier/specs/getItemsPackaging.spec.js +++ b/modules/supplier/back/methods/supplier/specs/getItemsPackaging.spec.js @@ -5,7 +5,7 @@ describe('Supplier getItemsPackaging()', () => { const [item] = await app.models.Supplier.getItemsPackaging(1, 1); expect(item.id).toEqual(1); - expect(item.name).toEqual('Ranged weapon longbow 2m'); + expect(item.name).toEqual('Ranged weapon longbow 200cm'); expect(item.quantity).toEqual(5000); expect(item.quantityTotal).toEqual(5100); }); diff --git a/modules/ticket/back/methods/packaging/specs/listPackaging.spec.js b/modules/ticket/back/methods/packaging/specs/listPackaging.spec.js index 1b5892e04..d73ba7386 100644 --- a/modules/ticket/back/methods/packaging/specs/listPackaging.spec.js +++ b/modules/ticket/back/methods/packaging/specs/listPackaging.spec.js @@ -10,7 +10,7 @@ describe('ticket listPackaging()', () => { const filter = {where: {packagingFk: 1}}; const [response] = await models.Packaging.listPackaging(filter, options); - expect(response.name).toEqual('Container ammo box 1m'); + expect(response.name).toEqual('Container ammo box 100cm'); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/sale/specs/getClaimableFromTicket.spec.js b/modules/ticket/back/methods/sale/specs/getClaimableFromTicket.spec.js index d7eda9965..7939c0bbe 100644 --- a/modules/ticket/back/methods/sale/specs/getClaimableFromTicket.spec.js +++ b/modules/ticket/back/methods/sale/specs/getClaimableFromTicket.spec.js @@ -9,7 +9,7 @@ describe('sale getClaimableFromTicket()', () => { const claimableFromTicket = await models.Sale.getClaimableFromTicket(16, options); - expect(claimableFromTicket[0].concept).toBe('Ranged weapon longbow 2m'); + expect(claimableFromTicket[0].concept).toBe('Ranged weapon longbow 200cm'); expect(claimableFromTicket.length).toBe(3); await tx.rollback(); From 89a0ae243f04cfe887d09d44a1df3fc7362650b8 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 1 Sep 2023 11:55:39 +0200 Subject: [PATCH 305/311] refs #6044 changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cb94fc66..1dbc270b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed +- (Trabajadores -> Calendario) Icono de check arreglado cuando pulsas un tipo de dia ### Fixed From ed25bd93d6164ebc58f1c3dda7578ba06e734468 Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 4 Sep 2023 11:13:29 +0200 Subject: [PATCH 306/311] fixes #6173 lastItemBuy muestra articulos sin podu --- modules/entry/back/methods/entry/lastItemBuys.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/entry/back/methods/entry/lastItemBuys.js b/modules/entry/back/methods/entry/lastItemBuys.js index 514052e4b..525e24fdc 100644 --- a/modules/entry/back/methods/entry/lastItemBuys.js +++ b/modules/entry/back/methods/entry/lastItemBuys.js @@ -55,7 +55,6 @@ module.exports = Self => { travel.landed ]); stmts.push(stmt); - stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.item'); stmt = new ParameterizedSQL( `CREATE TEMPORARY TABLE tmp.item @@ -65,13 +64,12 @@ module.exports = Self => { p.name AS producerName, nk.name AS inkName FROM item i - JOIN producer p ON p.id = i.producerFk - JOIN ink nk ON nk.id = i.inkFk - JOIN tmp.buyUltimate bu ON i.id = bu.itemFk + LEFT JOIN producer p ON p.id = i.producerFk + LEFT JOIN ink nk ON nk.id = i.inkFk + LEFT JOIN tmp.buyUltimate bu ON i.id = bu.itemFk AND bu.warehouseFk = ? `, [travel.warehouseInFk]); stmts.push(stmt); - stmt = new ParameterizedSQL('SELECT * FROM tmp.item'); stmt.merge(conn.makeSuffix(filter)); From 40468b70e69815dfe847aabcc940c624d7eebb11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 4 Sep 2023 11:59:55 +0200 Subject: [PATCH 307/311] refs #6176 book entry deleted --- .../233801/00-notificationBookEntry.sql | 14 +++++++++++ .../back/methods/invoiceOut/delete.js | 24 ++++++++++++++++--- .../book-entry-deleted/assets/css/import.js | 12 ++++++++++ .../book-entry-deleted.html | 8 +++++++ .../book-entry-deleted/book-entry-deleted.js | 19 +++++++++++++++ .../email/book-entry-deleted/locale/en.yml | 5 ++++ .../email/book-entry-deleted/locale/es.yml | 5 ++++ 7 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 db/changes/233801/00-notificationBookEntry.sql create mode 100644 print/templates/email/book-entry-deleted/assets/css/import.js create mode 100644 print/templates/email/book-entry-deleted/book-entry-deleted.html create mode 100644 print/templates/email/book-entry-deleted/book-entry-deleted.js create mode 100644 print/templates/email/book-entry-deleted/locale/en.yml create mode 100644 print/templates/email/book-entry-deleted/locale/es.yml diff --git a/db/changes/233801/00-notificationBookEntry.sql b/db/changes/233801/00-notificationBookEntry.sql new file mode 100644 index 000000000..4b8320450 --- /dev/null +++ b/db/changes/233801/00-notificationBookEntry.sql @@ -0,0 +1,14 @@ + +INSERT IGNORE INTO util.`notification` (id, `name`, description) + SELECT MAX(id) + 1, 'book-entry-deleted', 'accounting entries deleted' + FROM util.`notification`; + +INSERT IGNORE INTO util.`notificationAcl` (notificationFk, roleFk) + VALUES( + (SELECT id FROM util.`notification` WHERE `name` = 'book-entry-deleted'), + (SELECT id FROM vn.`role` r WHERE `name` = 'administrative')); + +INSERT IGNORE INTO util.`notificationSubscription` (notificationFk, userFk) + VALUES( + (SELECT id FROM util.`notification` WHERE `name` = 'book-entry-deleted'), + (SELECT id FROM account.`user` WHERE `name` = 'admon')); diff --git a/modules/invoiceOut/back/methods/invoiceOut/delete.js b/modules/invoiceOut/back/methods/invoiceOut/delete.js index d8b9d309b..726e455ab 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/delete.js +++ b/modules/invoiceOut/back/methods/invoiceOut/delete.js @@ -1,5 +1,4 @@ - -module.exports = Self => { +export default Self => { Self.remoteMethod('delete', { description: 'Delete a invoiceOut', accessType: 'WRITE', @@ -37,7 +36,12 @@ module.exports = Self => { const tickets = await Self.app.models.Ticket.find({ where: {refFk: invoiceOut.ref} }, myOptions); - + const bookEntry = await Self.app.models.XDiario.find({ + where: { + SERIE: invoiceOut.ref[0], + FACTURA: invoiceOut.miCadena.slice(1) + } + }, myOptions); const promises = []; for (let ticket of tickets) @@ -47,6 +51,20 @@ module.exports = Self => { await invoiceOut.destroy(myOptions); + if (bookEntry) { + const params = { + bookEntries: bookEntry.ASIEN, + invoiceOutRef: invoiceOut.ref + }; + + await Self.rawSql('SELECT util.notification_send(?, ?, NULL)', + 'book-entry-deleted', + params, + myOptions); + + await bookEntry.destroy(myOptions); + } + if (tx) await tx.commit(); return tickets; diff --git a/print/templates/email/book-entry-deleted/assets/css/import.js b/print/templates/email/book-entry-deleted/assets/css/import.js new file mode 100644 index 000000000..1582b82c5 --- /dev/null +++ b/print/templates/email/book-entry-deleted/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); + diff --git a/print/templates/email/book-entry-deleted/book-entry-deleted.html b/print/templates/email/book-entry-deleted/book-entry-deleted.html new file mode 100644 index 000000000..9a9f2a93e --- /dev/null +++ b/print/templates/email/book-entry-deleted/book-entry-deleted.html @@ -0,0 +1,8 @@ + +
+
+

{{ $t('title') }}

+

+
+
+
diff --git a/print/templates/email/book-entry-deleted/book-entry-deleted.js b/print/templates/email/book-entry-deleted/book-entry-deleted.js new file mode 100644 index 000000000..f7e7ffab4 --- /dev/null +++ b/print/templates/email/book-entry-deleted/book-entry-deleted.js @@ -0,0 +1,19 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component(); + +module.exports = { + name: 'book-entries-deleted', + components: { + 'email-body': emailBody.build(), + }, + props: { + bookEntries: { + type: Number, + required: true + }, + invoiceOutRef: { + type: String, + required: true + } + } +}; diff --git a/print/templates/email/book-entry-deleted/locale/en.yml b/print/templates/email/book-entry-deleted/locale/en.yml new file mode 100644 index 000000000..c7408f114 --- /dev/null +++ b/print/templates/email/book-entry-deleted/locale/en.yml @@ -0,0 +1,5 @@ +Subject: Linked Accounting Entry Deleted +Title: Linked Accounting Entry Deleted +Description: The linked accounting entry that was associated with SAGE has been deleted.

+Entry No. {0}

+This entry has been deleted because the associated invoice {0} has been removed. diff --git a/print/templates/email/book-entry-deleted/locale/es.yml b/print/templates/email/book-entry-deleted/locale/es.yml new file mode 100644 index 000000000..ff2073b64 --- /dev/null +++ b/print/templates/email/book-entry-deleted/locale/es.yml @@ -0,0 +1,5 @@ +subject: Asiento contable enlazado eliminado +title: Asiento contable enlazado eliminado +description: Se ha borrado el asiento contable que se encuentraba enlazado a SAGE

+ Asientos nº {0}

+ Este asiento se ha borrado porque se ha eliminado la factura asociada {0} From c2d8e1c002e369bc1a862a7b83dbddba96e075da Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 4 Sep 2023 12:14:52 +0200 Subject: [PATCH 308/311] fixes #6173 show just buyUltimate items --- modules/entry/back/methods/entry/lastItemBuys.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/entry/back/methods/entry/lastItemBuys.js b/modules/entry/back/methods/entry/lastItemBuys.js index 525e24fdc..63e6d38f2 100644 --- a/modules/entry/back/methods/entry/lastItemBuys.js +++ b/modules/entry/back/methods/entry/lastItemBuys.js @@ -66,7 +66,7 @@ module.exports = Self => { FROM item i LEFT JOIN producer p ON p.id = i.producerFk LEFT JOIN ink nk ON nk.id = i.inkFk - LEFT JOIN tmp.buyUltimate bu ON i.id = bu.itemFk + JOIN tmp.buyUltimate bu ON i.id = bu.itemFk AND bu.warehouseFk = ? `, [travel.warehouseInFk]); stmts.push(stmt); From 0d2db7749f5a1c8a9f5825c41a73bd50f79ad91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 6 Sep 2023 21:22:10 +0200 Subject: [PATCH 309/311] refs #6176 book entry deleted --- db/dump/fixtures.sql | 20 ++- modules/client/back/model-config.json | 3 + modules/client/back/models/XDiario.json | 13 +- modules/entry/back/locale/entry/es.yml | 6 +- .../back/methods/invoiceOut/delete.js | 31 +++-- .../methods/invoiceOut/specs/delete.spec.js | 122 +++++++++++++++++- .../book-entry-deleted/book-entry-deleted.js | 4 +- 7 files changed, 166 insertions(+), 33 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index b01c07461..24496098d 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2776,11 +2776,13 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`) (2, 'invoice-electronic', 'A electronic invoice has been generated'), (3, 'not-main-printer-configured', 'A printer distinct than main has been configured'), (4, 'supplier-pay-method-update', 'A supplier pay method has been updated'), - (5, 'modified-entry', 'An entry has been modified'); + (5, 'modified-entry', 'An entry has been modified'), + (6, 'book-entry-deleted', 'accounting entries deleted'); INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`) VALUES - (1, 9); + (1, 9), + (6, 9); INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`) VALUES @@ -2793,8 +2795,9 @@ INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`) (1, 1109), (1, 1110), (2, 1109), - (1,9), - (1,3); + (1, 9), + (1, 3), + (6, 9); INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`) @@ -2958,3 +2961,12 @@ INSERT INTO `vn`.`invoiceInSerial` (`code`, `description`, `cplusTerIdNifFk`, `t INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`) VALUES (1, 0, 0, 'marvel.com'); + +INSERT INTO vn.XDiario (id, ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EUROHABER, BASEEURO, SERIE, FACTURA, IVA, RECEQUIV, CLAVE, CAMBIO, DEBEME, HABERME, AUXILIAR, MONEDAUSO, TIPOOPE, NFACTICK, TERIDNIF, TERNIF, TERNOM, OPBIENES, L340, enlazado, FECHA_EX, LRECT349, empresa_id, LDIFADUAN, METAL, METALIMP, CLIENTE, METALEJE, FECHA_OP, FACTURAEX, TIPOCLAVE, TIPOEXENCI, TIPONOSUJE, TIPOFACT, TIPORECTIF, SERIE_RT, FACTU_RT, BASEIMP_RT, BASEIMP_RF, RECTIFICA, FECHA_RT, FECREGCON, enlazadoSage) + VALUES + (1, 1.0, util.VN_CURDATE(), '4300001104', NULL, 'n/fra T3333333', 8.88, NULL, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 1), + (2, 1.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T3333333 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 1), + (3, 1.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T3333333 Tony Stark', NULL, 0.81, 8.07, 'T', '3333333', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 1), + (4, 2.0, util.VN_CURDATE(), '4300001104', NULL, 'n/fra T4444444', 8.88, NULL, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0), + (5, 2.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T4444444 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0), + (6, 2.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T4444444 Tony Stark', NULL, 0.81, 8.07, 'T', '4444444', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0); \ No newline at end of file diff --git a/modules/client/back/model-config.json b/modules/client/back/model-config.json index bc48ec360..296b5e6a7 100644 --- a/modules/client/back/model-config.json +++ b/modules/client/back/model-config.json @@ -136,5 +136,8 @@ }, "Incoterms": { "dataSource": "vn" + }, + "Xdiario": { + "dataSource": "vn" } } diff --git a/modules/client/back/models/XDiario.json b/modules/client/back/models/XDiario.json index be2d258f9..be543393d 100644 --- a/modules/client/back/models/XDiario.json +++ b/modules/client/back/models/XDiario.json @@ -1,5 +1,5 @@ { - "name": "XDiario", + "name": "Xdiario", "base": "VnModel", "options": { "mysql": { @@ -7,10 +7,12 @@ } }, "properties": { - "ASIEN": { + "id": { "type": "number", - "id": true, - "description": "Identifier" + "id": true + }, + "ASIEN": { + "type": "number" }, "FECHA": { "type": "date" @@ -71,6 +73,9 @@ }, "MONEDAUSO": { "type": "string" + }, + "enlazadoSage": { + "type": "boolean" } }, "relations": { diff --git a/modules/entry/back/locale/entry/es.yml b/modules/entry/back/locale/entry/es.yml index 3a0c3d9c1..a892b05d2 100644 --- a/modules/entry/back/locale/entry/es.yml +++ b/modules/entry/back/locale/entry/es.yml @@ -4,14 +4,14 @@ columns: dated: fecha reference: referencia invoiceNumber: número factura - isBooked: reservado + isBooked: contabilizado isExcludedFromAvailable: excluido del disponible notes: notas isConfirmed: confirmado isVirtual: virtual - isRaid: incursión + isRaid: redada commission: comisión - isOrdered: precio3 + isOrdered: pedida created: creado observation: observación isBlocked: bloqueado diff --git a/modules/invoiceOut/back/methods/invoiceOut/delete.js b/modules/invoiceOut/back/methods/invoiceOut/delete.js index 726e455ab..d6efd9961 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/delete.js +++ b/modules/invoiceOut/back/methods/invoiceOut/delete.js @@ -1,4 +1,4 @@ -export default Self => { +module.exports = Self => { Self.remoteMethod('delete', { description: 'Delete a invoiceOut', accessType: 'WRITE', @@ -33,13 +33,15 @@ export default Self => { try { const invoiceOut = await Self.findById(id, {}, myOptions); - const tickets = await Self.app.models.Ticket.find({ + const models = Self.app.models; + const tickets = await models.Ticket.find({ where: {refFk: invoiceOut.ref} }, myOptions); - const bookEntry = await Self.app.models.XDiario.find({ + + const [bookEntry] = await models.Xdiario.find({ where: { SERIE: invoiceOut.ref[0], - FACTURA: invoiceOut.miCadena.slice(1) + FACTURA: invoiceOut.ref.slice(1) } }, myOptions); const promises = []; @@ -48,21 +50,22 @@ export default Self => { promises.push(ticket.updateAttribute('refFk', null, myOptions)); await Promise.all(promises); - await invoiceOut.destroy(myOptions); if (bookEntry) { - const params = { - bookEntries: bookEntry.ASIEN, - invoiceOutRef: invoiceOut.ref + if (bookEntry.enlazadoSage) { + const params = { + bookEntry: bookEntry.ASIEN, + invoiceOutRef: invoiceOut.ref + } + await Self.rawSql(`SELECT util.notification_send('book-entry-deleted', ?, NULL)`, + [JSON.stringify(params)], + myOptions); }; - await Self.rawSql('SELECT util.notification_send(?, ?, NULL)', - 'book-entry-deleted', - params, - myOptions); - - await bookEntry.destroy(myOptions); + await models.Xdiario.destroyAll({ + ASIEN: bookEntry.ASIEN + }); } if (tx) await tx.commit(); diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js index a662cb318..b9084d8d2 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js @@ -2,8 +2,8 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); describe('invoiceOut delete()', () => { - const invoiceOutId = 2; - const userId = 1106; + const invoiceId = 2; + const userId = 106; const activeCtx = { accessToken: {userId: userId}, }; @@ -13,7 +13,7 @@ describe('invoiceOut delete()', () => { const options = {transaction: tx}; try { - const invoiceOut = await models.InvoiceOut.findById(invoiceOutId, {}, options); + const invoiceOut = await models.InvoiceOut.findById(invoiceId, {}, options); const tickets = await models.Ticket.find({where: {refFk: invoiceOut.ref}}, options); expect(tickets.length).toEqual(1); @@ -35,11 +35,10 @@ describe('invoiceOut delete()', () => { active: activeCtx }); - await models.InvoiceOut.delete(invoiceOutId, options); - + await models.InvoiceOut.delete(invoiceId, options); const originalTicket = await models.Ticket.findById(3, {}, options); - const deletedInvoiceOut = await models.InvoiceOut.findById(invoiceOutId, {}, options); + const deletedInvoiceOut = await models.InvoiceOut.findById(invoiceId, {}, options); expect(deletedInvoiceOut).toBeNull(); expect(originalTicket.refFk).toBeNull(); @@ -50,4 +49,115 @@ describe('invoiceOut delete()', () => { throw e; } }); + + it('should delete the corresponding bookEntry and not notify', async () => { + const tx = await models.InvoiceOut.beginTransaction({}); + const options = {transaction: tx}; + + try { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + + const filter = { + where: { + ASIEN: 2 + }, + fields: ['id', 'enlazadoSage'] + }; + + const [beforeXdiario] = await models.Xdiario.find(filter, options) + + const [beforeNotification] = await models.NotificationQueue.find({ + where: { + notificationFk: 'book-entry-deleted', + status: 'pending' + } + }, options); + + expect(beforeXdiario).toBeDefined(); + expect(beforeXdiario.enlazadoSage).toBeFalsy; + expect(beforeNotification).not.toBeDefined(); + + await models.InvoiceOut.delete(4, options); + + const [afterXdiario] = await models.Xdiario.find({ + where: { + ASIEN: 2 + } + }, options); + + const [afterNotification] = await models.NotificationQueue.find({ + where: { + notificationFk: 'book-entry-deleted', + params: '{"bookEntry":2,"invoiceOutRef":"T4444444"}', + status: 'pending' + } + }, options); + + expect(afterXdiario).not.toBeDefined(); + expect(afterNotification).not.toBeDefined(); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should delete the corresponding bookEntry and notify', async () => { + const tx = await models.InvoiceOut.beginTransaction({}); + const options = {transaction: tx}; + + try { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + + const filter = { + where: { + ASIEN: 1 + }, + fields: ['id', 'enlazadoSage'] + }; + + const [beforeXdiario] = await models.Xdiario.find(filter, options) + + const [beforeNotification] = await models.NotificationQueue.find({ + where: { + notificationFk: 'book-entry-deleted', + status: 'pending' + } + }, options); + + expect(beforeXdiario).toBeDefined(); + expect(beforeXdiario.enlazadoSage).toBeTruthy(); + expect(beforeNotification).not.toBeDefined(); + + await models.InvoiceOut.delete(3, options); + + const [afterXdiario] = await models.Xdiario.find({ + where: { + ASIEN: 1 + } + }, options); + + const [afterNotification] = await models.NotificationQueue.find({ + where: { + notificationFk: 'book-entry-deleted', + params: '{"bookEntry":1,"invoiceOutRef":"T3333333"}', + status: 'pending' + } + }, options); + + expect(afterXdiario).not.toBeDefined(); + expect(afterNotification).toBeDefined(); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + }); diff --git a/print/templates/email/book-entry-deleted/book-entry-deleted.js b/print/templates/email/book-entry-deleted/book-entry-deleted.js index f7e7ffab4..cd29f5ddb 100644 --- a/print/templates/email/book-entry-deleted/book-entry-deleted.js +++ b/print/templates/email/book-entry-deleted/book-entry-deleted.js @@ -2,12 +2,12 @@ const Component = require(`vn-print/core/component`); const emailBody = new Component(); module.exports = { - name: 'book-entries-deleted', + name: 'book-entry-deleted', components: { 'email-body': emailBody.build(), }, props: { - bookEntries: { + bookEntry: { type: Number, required: true }, From ea771cb910f5956dc9b28c74f224a3c301cd7e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 7 Sep 2023 11:30:01 +0200 Subject: [PATCH 310/311] refs #6176 book entry deleted --- db/changes/233801/00-notificationBookEntry.sql | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 db/changes/233801/00-notificationBookEntry.sql diff --git a/db/changes/233801/00-notificationBookEntry.sql b/db/changes/233801/00-notificationBookEntry.sql deleted file mode 100644 index 4b8320450..000000000 --- a/db/changes/233801/00-notificationBookEntry.sql +++ /dev/null @@ -1,14 +0,0 @@ - -INSERT IGNORE INTO util.`notification` (id, `name`, description) - SELECT MAX(id) + 1, 'book-entry-deleted', 'accounting entries deleted' - FROM util.`notification`; - -INSERT IGNORE INTO util.`notificationAcl` (notificationFk, roleFk) - VALUES( - (SELECT id FROM util.`notification` WHERE `name` = 'book-entry-deleted'), - (SELECT id FROM vn.`role` r WHERE `name` = 'administrative')); - -INSERT IGNORE INTO util.`notificationSubscription` (notificationFk, userFk) - VALUES( - (SELECT id FROM util.`notification` WHERE `name` = 'book-entry-deleted'), - (SELECT id FROM account.`user` WHERE `name` = 'admon')); From 4784e71350d0d586b01bb5da90850b8a8bc583d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 7 Sep 2023 13:21:03 +0200 Subject: [PATCH 311/311] refs #6176 book entry deleted --- .../methods/invoiceOut/specs/delete.spec.js | 28 ++++++++----------- .../email/book-entry-deleted/locale/en.yml | 2 +- .../email/book-entry-deleted/locale/es.yml | 2 +- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js index b9084d8d2..9d638ecf4 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js @@ -2,18 +2,24 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); describe('invoiceOut delete()', () => { - const invoiceId = 2; + const invoiceOutId = 2; const userId = 106; const activeCtx = { accessToken: {userId: userId}, }; + + beforeEach(() => { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); it('should check that there is one ticket in the target invoiceOut', async() => { const tx = await models.InvoiceOut.beginTransaction({}); const options = {transaction: tx}; try { - const invoiceOut = await models.InvoiceOut.findById(invoiceId, {}, options); + const invoiceOut = await models.InvoiceOut.findById(invoiceOutId , {}, options); const tickets = await models.Ticket.find({where: {refFk: invoiceOut.ref}}, options); expect(tickets.length).toEqual(1); @@ -31,14 +37,10 @@ describe('invoiceOut delete()', () => { const options = {transaction: tx}; try { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); - - await models.InvoiceOut.delete(invoiceId, options); + await models.InvoiceOut.delete(invoiceOutId, options); const originalTicket = await models.Ticket.findById(3, {}, options); - const deletedInvoiceOut = await models.InvoiceOut.findById(invoiceId, {}, options); + const deletedInvoiceOut = await models.InvoiceOut.findById(invoiceOutId, {}, options); expect(deletedInvoiceOut).toBeNull(); expect(originalTicket.refFk).toBeNull(); @@ -54,11 +56,7 @@ describe('invoiceOut delete()', () => { const tx = await models.InvoiceOut.beginTransaction({}); const options = {transaction: tx}; - try { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); - + try { const filter = { where: { ASIEN: 2 @@ -110,10 +108,6 @@ describe('invoiceOut delete()', () => { const options = {transaction: tx}; try { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); - const filter = { where: { ASIEN: 1 diff --git a/print/templates/email/book-entry-deleted/locale/en.yml b/print/templates/email/book-entry-deleted/locale/en.yml index c7408f114..11c18f2c9 100644 --- a/print/templates/email/book-entry-deleted/locale/en.yml +++ b/print/templates/email/book-entry-deleted/locale/en.yml @@ -2,4 +2,4 @@ Subject: Linked Accounting Entry Deleted Title: Linked Accounting Entry Deleted Description: The linked accounting entry that was associated with SAGE has been deleted.

Entry No. {0}

-This entry has been deleted because the associated invoice {0} has been removed. +This entry has been deleted because the associated invoice {1} has been removed. diff --git a/print/templates/email/book-entry-deleted/locale/es.yml b/print/templates/email/book-entry-deleted/locale/es.yml index ff2073b64..c40cf25fd 100644 --- a/print/templates/email/book-entry-deleted/locale/es.yml +++ b/print/templates/email/book-entry-deleted/locale/es.yml @@ -2,4 +2,4 @@ subject: Asiento contable enlazado eliminado title: Asiento contable enlazado eliminado description: Se ha borrado el asiento contable que se encuentraba enlazado a SAGE

Asientos nº {0}

- Este asiento se ha borrado porque se ha eliminado la factura asociada {0} + Este asiento se ha borrado porque se ha eliminado la factura asociada {1}