#7897 - masterTest_24_36 #2909

Merged
jsegarra merged 132 commits from 7897_masterTest_24_36 into master 2024-09-03 06:37:54 +00:00
3 changed files with 30 additions and 9 deletions
Showing only changes of commit 32d36cda21 - Show all commits

View File

@ -0,0 +1,24 @@
DELETE FROM `salix`.`ACL`
WHERE `model` = 'Ticket'
AND `property` = 'refund'
AND `accessType` = 'WRITE'
AND `permission` = 'ALLOW'
AND `principalType` = 'ROLE'
AND `principalId` = 'salesAssistant';
UPDATE `salix`.`ACL`
SET `property` = 'cloneAll'
WHERE `model` = 'Ticket'
AND `property` = 'refund'
AND `accessType` = 'WRITE'
AND `permission` = 'ALLOW'
AND `principalType` = 'ROLE'
AND `principalId` IN ('invoicing', 'claimManager', 'logistic');
DELETE FROM `salix`.`ACL`
WHERE `model` = 'Ticket'
AND `property` = 'clone'
AND `accessType` = 'WRITE'
AND `permission` = 'ALLOW'
AND `principalType` = 'ROLE'
AND `principalId` = 'administrative';

View File

@ -82,7 +82,7 @@ module.exports = Self => {
myOptions.transaction = tx;
}
try {
const tickets = await models.Ticket.find({where: {refFk: refFk}}, myOptions);
const tickets = await models.Ticket.find({where: {refFk}}, myOptions);
const ticketsIds = tickets.map(ticket => ticket.id);
const refundTickets = await models.Ticket.cloneAll(ctx, ticketsIds, false, true, myOptions);

View File

@ -19,7 +19,7 @@ module.exports = Self => {
arg: 'negative',
type: 'boolean',
required: true,
description: 'Whether to invert quantities (for credit notes)'
description: 'true: invert quantities; false: keep as is.'
}
],
returns: {
@ -35,12 +35,9 @@ module.exports = Self => {
Self.cloneAll = async(ctx, ticketsIds, withWarehouse, negative, options) => {
const models = Self.app.models;
const myOptions = {};
const myOptions = typeof options == 'object' ? {...options} : {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
@ -55,9 +52,9 @@ module.exports = Self => {
models.TicketPackaging.find(filter, myOptions)
]);
const salesIds = sales.map(sale => sale.id);
const servicesIds = services.map(service => service.id);
const ticketPackagingIds = ticketPackaging.map(packaging => packaging.id);
const salesIds = sales.map(({id}) => id);
const servicesIds = services.map(({id}) => id);
const ticketPackagingIds = ticketPackaging.map(({id}) => id);
const clonedTickets = await models.Sale.clone(
ctx,