feat: enviar sms con cambios en las líneas
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
c02be35e1c
commit
6f2a7a5cef
|
@ -2728,6 +2728,11 @@ UPDATE `account`.`user`
|
|||
SET `hasGrant` = 1
|
||||
WHERE `id` = 66;
|
||||
|
||||
INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId)
|
||||
VALUES
|
||||
(7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 22);
|
||||
|
||||
|
||||
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');
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('getChanges', {
|
||||
description: 'Get item id and quantity changes on the sales of a ticket',
|
||||
accessType: 'WRITE',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'ticketId',
|
||||
description: 'the ticket id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
http: {source: 'body'}
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/:id/getChanges`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.getChanges = async(ctx, ticketId, 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 ticketLogs = await models.TicketLog.find({where: {originFk: ticketId}}, myOptions);
|
||||
|
||||
for (const ticketLog of ticketLogs) {
|
||||
if (ticketLog)
|
||||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return state;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -0,0 +1,46 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('ticket setDelivered()', () => {
|
||||
const userId = 50;
|
||||
const activeCtx = {
|
||||
accessToken: {userId: userId},
|
||||
};
|
||||
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the state which has been applied to the given tickets', async() => {
|
||||
const tx = await models.TicketTracking.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 49}}};
|
||||
|
||||
const originalTicketOne = await models.Ticket.findById(8, null, options);
|
||||
const originalTicketTwo = await models.Ticket.findById(10, null, options);
|
||||
|
||||
originalTicketOne.id = null;
|
||||
originalTicketTwo.id = null;
|
||||
|
||||
const ticketOne = await models.Ticket.create(originalTicketOne, options);
|
||||
const ticketTwo = await models.Ticket.create(originalTicketTwo, options);
|
||||
|
||||
const delivered = await models.State.findOne({where: {code: 'delivered'}, fields: ['id']}, options);
|
||||
|
||||
const params = [ticketOne.id, ticketTwo.id];
|
||||
const state = await models.TicketTracking.setDelivered(ctx, params, options);
|
||||
|
||||
expect(state.id).toEqual(delivered.id);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/ticket-log/getChanges')(Self);
|
||||
};
|
|
@ -43,7 +43,7 @@
|
|||
ng-if="!$ctrl.hasDocuwareFile"
|
||||
ng-click="$ctrl.showPdfDeliveryNote('withoutPrices')"
|
||||
translate>
|
||||
as PDF without prices
|
||||
as PDF without prices
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-click="$ctrl.showCsvDeliveryNote()"
|
||||
|
@ -110,6 +110,12 @@
|
|||
translate>
|
||||
SMS Minimum import
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-click="$ctrl.sendChangesSms()"
|
||||
name="sendChangesSms"
|
||||
translate>
|
||||
SMS Notify changes
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-click="makeInvoiceConfirmation.show()"
|
||||
ng-show="$ctrl.isEditable"
|
||||
|
@ -150,31 +156,31 @@
|
|||
</h5>
|
||||
<vn-tool-bar class="vn-mt-md">
|
||||
<vn-button
|
||||
label="Monday"
|
||||
label="Monday"
|
||||
ng-click="$ctrl.addTurn(0)">
|
||||
</vn-button>
|
||||
<vn-button
|
||||
label="Tuesday"
|
||||
label="Tuesday"
|
||||
ng-click="$ctrl.addTurn(1)">
|
||||
</vn-button>
|
||||
<vn-button
|
||||
label="Wednesday"
|
||||
label="Wednesday"
|
||||
ng-click="$ctrl.addTurn(2)">
|
||||
</vn-button>
|
||||
<vn-button
|
||||
label="Thursday"
|
||||
label="Thursday"
|
||||
ng-click="$ctrl.addTurn(3)">
|
||||
</vn-button>
|
||||
<vn-button
|
||||
label="Friday"
|
||||
label="Friday"
|
||||
ng-click="$ctrl.addTurn(4)">
|
||||
</vn-button>
|
||||
<vn-button
|
||||
label="Saturday"
|
||||
label="Saturday"
|
||||
ng-click="$ctrl.addTurn(5)">
|
||||
</vn-button>
|
||||
<vn-button
|
||||
label="Sunday"
|
||||
label="Sunday"
|
||||
ng-click="$ctrl.addTurn(6)">
|
||||
</vn-button>
|
||||
</vn-tool-bar>
|
||||
|
@ -251,13 +257,13 @@
|
|||
|
||||
<!-- Transfer Client popup -->
|
||||
|
||||
<vn-dialog
|
||||
vn-id="transferClient"
|
||||
<vn-dialog
|
||||
vn-id="transferClient"
|
||||
title="transferClient"
|
||||
size="sm"
|
||||
on-accept="$ctrl.transferClient($client)">
|
||||
<tpl-body>
|
||||
<vn-autocomplete
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
vn-id="client"
|
||||
required="true"
|
||||
|
@ -315,4 +321,4 @@
|
|||
on-accept="$ctrl.refund()"
|
||||
question="Are you sure you want to refund all?"
|
||||
message="Refund all">
|
||||
</vn-confirm>
|
||||
</vn-confirm>
|
||||
|
|
|
@ -224,6 +224,12 @@ class Controller extends Section {
|
|||
});
|
||||
}
|
||||
|
||||
sendChangesSms() {
|
||||
this.showSMSDialog({
|
||||
message: this.$t('Send changes')
|
||||
});
|
||||
}
|
||||
|
||||
showSMSDialog(params) {
|
||||
const address = this.ticket.address;
|
||||
const client = this.ticket.client;
|
||||
|
|
|
@ -10,4 +10,5 @@ Send PDF Delivery Note: Enviar albarán en PDF
|
|||
Show Proforma: Ver proforma
|
||||
Refund all: Abonar todo
|
||||
The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}"
|
||||
Transfer client: Transferir cliente
|
||||
Transfer client: Transferir cliente
|
||||
SMS Notify changes: SMS Notificar cambios
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
Make a payment: "Verdnatura communicates:\rYour order is pending of payment.\rPlease, enter the web page and make the payment with card.\rThank you."
|
||||
Minimum is needed: "Verdnatura communicates:\rA minimum import of 50€ (Without BAT) is needed for your order {{ticketId}} from date {{created | date: 'dd/MM/yyyy'}} to receive it with no extra fees."
|
||||
Send changes: "Verdnatura communicates:\rOrder {{ticketId}} date {{created | date: 'dd/MM/yyyy'}}\r{{changes}}"
|
||||
|
|
Loading…
Reference in New Issue