#4457 implement notification system, @1h 30m
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pau 2022-11-08 12:26:01 +01:00
parent f21907855f
commit e85505ee8e
5 changed files with 20 additions and 7 deletions

View File

@ -0,0 +1,2 @@
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('notificationQueue','*','*','ALLOW','ROLE','invoicing');

View File

@ -0,0 +1 @@
insert into `util`.`notification` (`id`, `name`,`description`) values (2, 'invoiceElectronic', 'A electronic invoice has been generated');

View File

@ -0,0 +1,3 @@
UPDATE `vn`.`client`
set hasInvoiceElectronic = TRUE
where buisnessTypeFk = 'officialOrganism'

View File

@ -161,16 +161,10 @@ module.exports = Self => {
delete args.ctx; delete args.ctx;
delete args.id; delete args.id;
console.log(args);
const updatedClient = await client.updateAttributes(args, myOptions); const updatedClient = await client.updateAttributes(args, myOptions);
console.log('10');
if (tx) await tx.commit(); if (tx) await tx.commit();
console.log('11');
return updatedClient; return updatedClient;
} catch (e) { } catch (e) {
if (tx) await tx.rollback(); if (tx) await tx.rollback();

View File

@ -224,8 +224,21 @@ class Controller extends Section {
this.$.sms.open(); this.$.sms.open();
} }
makeInvoice() { async makeInvoice() {
const params = {ticketsIds: [this.id]}; const params = {ticketsIds: [this.id]};
const clientData = await this.$http.get(`Clients/${this.ticket.client.id}`);
console.log('invoiceE', clientData);
if (clientData.data.hasInvoiceElectronic) {
this.$http.post(`NotificationQueuesAdd`, {
notificationFk: 'invoiceElectronic'
});
/* This should call the notification sistem to insert a new notification
in te queue, yet to check how to handle user permissions */
}
return this.$http.post(`Tickets/makeInvoice`, params) return this.$http.post(`Tickets/makeInvoice`, params)
.then(() => this.reload()) .then(() => this.reload())
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));