Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4077-login_recover-password
gitea/salix/pipeline/head This commit is unstable
Details
gitea/salix/pipeline/head This commit is unstable
Details
This commit is contained in:
commit
9c671ed3a4
|
@ -1,12 +1,13 @@
|
|||
const jsdom = require('jsdom');
|
||||
const mysql = require('mysql');
|
||||
const FormData = require('form-data');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('closeTicket', {
|
||||
description: 'Close tickets without response from the user',
|
||||
accessType: 'READ',
|
||||
returns: {
|
||||
type: 'Object',
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
|
@ -54,9 +55,9 @@ module.exports = Self => {
|
|||
});
|
||||
});
|
||||
|
||||
await requestToken();
|
||||
await getRequestToken();
|
||||
|
||||
async function requestToken() {
|
||||
async function getRequestToken() {
|
||||
const response = await fetch(ostUri);
|
||||
|
||||
const result = response.headers.get('set-cookie');
|
||||
|
@ -93,24 +94,45 @@ module.exports = Self => {
|
|||
await close(token, secondCookie);
|
||||
}
|
||||
|
||||
async function close(token, secondCookie) {
|
||||
for (const ticketId of ticketsId) {
|
||||
const ostUri = `${config.host}/ajax.php/tickets/${ticketId}/status`;
|
||||
const data = {
|
||||
status_id: config.newStatusId,
|
||||
comments: config.comment,
|
||||
undefined: config.action
|
||||
};
|
||||
async function getLockCode(token, secondCookie, ticketId) {
|
||||
const ostUri = `${config.host}/ajax.php/lock/ticket/${ticketId}`;
|
||||
const params = {
|
||||
method: 'POST',
|
||||
body: new URLSearchParams(data),
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'X-CSRFToken': token,
|
||||
'Cookie': secondCookie
|
||||
}
|
||||
};
|
||||
const response = await fetch(ostUri, params);
|
||||
const body = await response.text();
|
||||
const json = JSON.parse(body);
|
||||
|
||||
return json.code;
|
||||
}
|
||||
|
||||
async function close(token, secondCookie) {
|
||||
for (const ticketId of ticketsId) {
|
||||
const lockCode = await getLockCode(token, secondCookie, ticketId);
|
||||
let form = new FormData();
|
||||
form.append('__CSRFToken__', token);
|
||||
form.append('id', ticketId);
|
||||
form.append('a', config.responseType);
|
||||
form.append('lockCode', lockCode);
|
||||
form.append('from_email_id', config.fromEmailId);
|
||||
form.append('reply-to', config.replyTo);
|
||||
form.append('cannedResp', 0);
|
||||
form.append('response', config.comment);
|
||||
form.append('signature', 'none');
|
||||
form.append('reply_status_id', config.newStatusId);
|
||||
|
||||
const ostUri = `${config.host}/tickets.php?id=${ticketId}`;
|
||||
const params = {
|
||||
method: 'POST',
|
||||
body: form,
|
||||
headers: {
|
||||
'Cookie': secondCookie
|
||||
}
|
||||
};
|
||||
return fetch(ostUri, params);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
"newStatusId": {
|
||||
"type": "number"
|
||||
},
|
||||
"action": {
|
||||
"type": "string"
|
||||
},
|
||||
"day": {
|
||||
"type": "number"
|
||||
},
|
||||
|
@ -47,6 +44,15 @@
|
|||
},
|
||||
"portDb": {
|
||||
"type": "number"
|
||||
},
|
||||
"responseType": {
|
||||
"type": "string"
|
||||
},
|
||||
"fromEmailId": {
|
||||
"type": "number"
|
||||
},
|
||||
"replyTo": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,3 @@ CREATE TABLE `vn`.`osTicketConfig` (
|
|||
`portDb` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
|
||||
INSERT INTO `vn`.`osTicketConfig`(`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `action`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`)
|
||||
VALUES
|
||||
(0, 'https://cau.verdnatura.es/scp', NULL, NULL, 'open', 3, 'Cerrar', 60, 'Este CAU se ha cerrado automáticamente', NULL, NULL, NULL, NULL);
|
|
@ -0,0 +1,8 @@
|
|||
ALTER TABLE `vn`.`osTicketConfig` DROP COLUMN `action`;
|
||||
ALTER TABLE `vn`.`osTicketConfig` ADD responseType varchar(100) NULL;
|
||||
ALTER TABLE `vn`.`osTicketConfig` ADD fromEmailId INT NULL;
|
||||
ALTER TABLE `vn`.`osTicketConfig` ADD replyTo varchar(100) NULL;
|
||||
|
||||
UPDATE `vn`.`osTicketConfig`
|
||||
SET responseType='reply', fromEmailId=5, replyTo='all'
|
||||
WHERE id=0;
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `vn`.`claimConfig` DROP COLUMN `pickupContact`;
|
|
@ -1778,10 +1778,10 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina
|
|||
(1, 31, 4, 21, 2),
|
||||
(2, 32, 3, 21, 3);
|
||||
|
||||
INSERT INTO `vn`.`claimConfig`(`id`, `pickupContact`, `maxResponsibility`)
|
||||
INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`)
|
||||
VALUES
|
||||
(1, 'Contact description', 50),
|
||||
(2, 'Contact description', 30);
|
||||
(1, 50),
|
||||
(2, 30);
|
||||
|
||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||
VALUES
|
||||
|
@ -1791,7 +1791,7 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa
|
|||
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
||||
|
||||
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
|
||||
VALUES
|
||||
VALUES
|
||||
(1, '02676A049183', DEFAULT, 1106),
|
||||
(2, '02676A049183', DEFAULT, 1106),
|
||||
(3, '02676A049183', DEFAULT, 1107),
|
||||
|
@ -2710,3 +2710,7 @@ INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `lev
|
|||
UPDATE `account`.`user`
|
||||
SET `hasGrant` = 1
|
||||
WHERE `id` = 66;
|
||||
|
||||
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
|
||||
VALUES
|
||||
(0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', 'open', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all');
|
|
@ -136,7 +136,8 @@
|
|||
"Password does not meet requirements": "Password does not meet requirements",
|
||||
"You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
|
||||
"Not enough privileges to edit a client": "Not enough privileges to edit a client",
|
||||
"Email verify": "Email verify",
|
||||
"Claim pickup order sent": "Claim pickup order sent [({{claimId}})]({{{claimUrl}}}) to client *{{clientName}}*",
|
||||
"You don't have grant privilege": "You don't have grant privilege",
|
||||
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user"
|
||||
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
|
||||
"Email verify": "Email verify"
|
||||
}
|
||||
|
|
|
@ -240,7 +240,8 @@
|
|||
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
|
||||
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
|
||||
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
|
||||
"Email verify": "Correo de verificación",
|
||||
"Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*",
|
||||
"You don't have grant privilege": "No tienes privilegios para dar privilegios",
|
||||
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario"
|
||||
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
|
||||
"Email verify": "Correo de verificación"
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = Self => {
|
|||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The client id',
|
||||
description: 'The claim id',
|
||||
http: {source: 'path'}
|
||||
},
|
||||
{
|
||||
|
@ -42,6 +42,11 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.claimPickupEmail = async ctx => {
|
||||
const models = Self.app.models;
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const $t = ctx.req.__; // $translate
|
||||
const origin = ctx.req.headers.origin;
|
||||
|
||||
const args = Object.assign({}, ctx.args);
|
||||
const params = {
|
||||
recipient: args.recipient,
|
||||
|
@ -52,6 +57,34 @@ module.exports = Self => {
|
|||
for (const param in args)
|
||||
params[param] = args[param];
|
||||
|
||||
const claim = await models.Claim.findById(args.id, {
|
||||
fields: ['id', 'clientFk'],
|
||||
include: {
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['name', 'salesPersonFk']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const message = $t('Claim pickup order sent', {
|
||||
claimId: args.id,
|
||||
clientName: claim.client().name,
|
||||
claimUrl: `${origin}/#!/claim/${args.id}/summary`,
|
||||
});
|
||||
|
||||
const salesPersonId = claim.client().salesPersonFk;
|
||||
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();
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
label="Pick up"
|
||||
ng-model="$ctrl.claim.hasToPickUp"
|
||||
vn-acl="claimManager"
|
||||
info="When checked will notify to the salesPerson">
|
||||
title="{{'When checked will notify to the salesPerson' | translate}}">
|
||||
</vn-check>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
|
|
|
@ -5,5 +5,5 @@ Responsability: Responsabilidad
|
|||
Company: Empresa
|
||||
Sales/Client: Comercial/Cliente
|
||||
Pick up: Recoger
|
||||
When checked will notify a pickup to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial
|
||||
When checked will notify to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial
|
||||
Packages received: Bultos recibidos
|
|
@ -25,7 +25,14 @@
|
|||
</vn-button-menu>
|
||||
</h5>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<vn-auto>
|
||||
<h4>
|
||||
<a
|
||||
ui-sref="claim.card.basicData({id:$ctrl.claim.id})"
|
||||
target="_self">
|
||||
<span translate vn-tooltip="Go to">Basic data</span>
|
||||
</a>
|
||||
</h4>
|
||||
<vn-label-value
|
||||
label="Created"
|
||||
value="{{$ctrl.summary.claim.created | date: 'dd/MM/yyyy'}}">
|
||||
|
@ -42,7 +49,14 @@
|
|||
label="Attended by"
|
||||
value="{{$ctrl.summary.claim.worker.user.nickname}}">
|
||||
</vn-label-value>
|
||||
</vn-one>
|
||||
<vn-check
|
||||
class="vn-mr-md"
|
||||
label="Pick up"
|
||||
ng-model="$ctrl.summary.claim.hasToPickUp"
|
||||
title="{{'When checked will notify to the salesPerson' | translate}}"
|
||||
disabled="true">
|
||||
</vn-check>
|
||||
</vn-auto>
|
||||
<vn-auto>
|
||||
<h4 ng-show="$ctrl.isSalesPerson && $ctrl.summary.observations.length">
|
||||
<a
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"bcrypt": "^5.0.1",
|
||||
"bmp-js": "^0.1.0",
|
||||
"compression": "^1.7.3",
|
||||
"form-data": "^4.0.0",
|
||||
"fs-extra": "^5.0.0",
|
||||
"ftps": "^1.2.0",
|
||||
"got": "^10.7.0",
|
||||
|
|
|
@ -23,9 +23,10 @@
|
|||
<!-- Block -->
|
||||
<div class="grid-row">
|
||||
<div class="grid-block vn-pa-ml">
|
||||
<h1>{{ $t('title') }}</h1>
|
||||
<p>{{$t('description.dear')}},</p>
|
||||
<p>{{$t('description.instructions')}}</p>
|
||||
<h1>{{ $t('title', [id]) }}</h1>
|
||||
<p>{{ $t('description.dear') }},</p>
|
||||
<p v-html="instructions"></p>
|
||||
<p>{{ $t('description.conclusion') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer block -->
|
||||
|
|
|
@ -8,6 +8,19 @@ module.exports = {
|
|||
'email-header': emailHeader.build(),
|
||||
'email-footer': emailFooter.build()
|
||||
},
|
||||
async serverPrefetch() {
|
||||
this.ticket = await this.fetchTicket(this.id);
|
||||
|
||||
if (!this.ticket)
|
||||
throw new Error('Something went wrong');
|
||||
|
||||
this.instructions = this.$t('description.instructions', [this.id, this.ticket.id]);
|
||||
},
|
||||
methods: {
|
||||
fetchTicket(id) {
|
||||
return this.findOneFromDef('ticket', [id]);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
subject: Orden de recogida
|
||||
title: Orden de recogida
|
||||
subject: Reclamación Verdnatura
|
||||
title: Reclamación Verdnatura {0}
|
||||
description:
|
||||
dear: Estimado cliente
|
||||
instructions: Aqui tienes tu orden de recogida.
|
||||
instructions: 'Le informamos que se ha aceptado su solicitud de reclamación <strong>nº {0}</strong> correspondiente al pedido <strong>{1}</strong>.
|
||||
Para tramitar la recogida, rellene el <a href="https://form.jotform.com/verdnatura/recogida-verdnatura"
|
||||
title="Formulario Recogida" target="_blank" style="color: #8dba25">SIGUIENTE FORMULARIO</a> en un <strong>plazo máximo de 24h.</strong>
|
||||
<br/><br/>Cuando recibamos el género en nuestras instalaciones emitiremos el abono correspondiente.
|
||||
Debe imprimir el archivo adjunto e incluirlo en la caja. En el caso de no poder imprimirlo, <strong>identifique la caja con el número de reclamación CLARAMENTE LEGIBLE.</strong>'
|
||||
conclusion: Un saludo
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
SELECT
|
||||
c.ticketFk as id
|
||||
FROM claim c
|
||||
WHERE c.id = ?
|
|
@ -78,9 +78,6 @@
|
|||
<h3>{{client.name}}</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-html="$t('sections.agency.description')"></p>
|
||||
<p>{{claimConfig.pickupContact}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer block -->
|
||||
|
|
|
@ -7,7 +7,6 @@ module.exports = {
|
|||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.id);
|
||||
this.sales = await this.fetchSales(this.id);
|
||||
this.claimConfig = await this.fetchClaimConfig();
|
||||
|
||||
if (!this.client)
|
||||
throw new Error('Something went wrong');
|
||||
|
@ -25,10 +24,7 @@ module.exports = {
|
|||
},
|
||||
fetchSales(id) {
|
||||
return this.rawSqlFromDef('sales', [id]);
|
||||
},
|
||||
fetchClaimConfig() {
|
||||
return this.findOneFromDef('claimConfig');
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-header': reportHeader.build(),
|
||||
|
|
|
@ -11,7 +11,3 @@ concept: Concepto
|
|||
clientSignature: Firma del cliente
|
||||
claim: Reclamación {0}
|
||||
phone: Teléfono
|
||||
sections:
|
||||
agency:
|
||||
description: 'Para agilizar su recogida, por favor, póngase en contacto con la oficina
|
||||
de Logista Parcel.'
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
SELECT pickupContact
|
||||
FROM claimConfig;
|
Loading…
Reference in New Issue