#6321 - Negative tickets #1945
|
@ -121,7 +121,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
}
|
}
|
||||||
sh 'docker-compose build back'
|
sh 'docker-compose build back'
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
}
|
}
|
||||||
sh 'gulp build'
|
sh 'gulp build'
|
||||||
sh 'docker-compose build front'
|
sh 'docker-compose build front'
|
||||||
|
@ -179,7 +179,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
}
|
}
|
||||||
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
||||||
sh 'docker-compose push'
|
sh 'docker-compose push'
|
||||||
|
@ -210,7 +210,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
}
|
}
|
||||||
withKubeConfig([
|
withKubeConfig([
|
||||||
serverUrl: "$KUBERNETES_API",
|
serverUrl: "$KUBERNETES_API",
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimRatio_afterUpdate`
|
||||||
|
AFTER UPDATE ON `claimRatio`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO clientRate(clientFk, `value`)
|
||||||
|
VALUES(NEW.clientFk, NEW.priceIncreasing)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`value` = VALUES(`value`);
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
INSERT INTO salix.ACL
|
||||||
|
SET
|
||||||
|
model = 'Ticket',
|
||||||
|
property = 'editZone',
|
||||||
|
accessType = 'WRITE',
|
||||||
|
permission = 'ALLOW',
|
||||||
|
principalType = 'ROLE',
|
||||||
|
principalId = 'buyer';
|
|
@ -48,7 +48,8 @@ module.exports = Self => {
|
||||||
'weight',
|
'weight',
|
||||||
'buyingValue',
|
'buyingValue',
|
||||||
'price2',
|
'price2',
|
||||||
'price3'
|
'price3',
|
||||||
|
'printedStickers'
|
||||||
],
|
],
|
||||||
include: {
|
include: {
|
||||||
relation: 'item',
|
relation: 'item',
|
||||||
|
|
|
@ -11,7 +11,7 @@ export default class Controller extends Section {
|
||||||
fields: ['id', 'countryFk', 'taxClassFk'],
|
fields: ['id', 'countryFk', 'taxClassFk'],
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'country',
|
relation: 'country',
|
||||||
scope: {fields: ['country']}
|
scope: {fields: ['name']}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -72,16 +72,20 @@ module.exports = Self => {
|
||||||
const salesPerson = sale.ticket().client().salesPersonUser();
|
const salesPerson = sale.ticket().client().salesPersonUser();
|
||||||
if (salesPerson) {
|
if (salesPerson) {
|
||||||
const url = await Self.app.models.Url.getUrl();
|
const url = await Self.app.models.Url.getUrl();
|
||||||
const message = $t('Changed sale quantity', {
|
const change = $t('Changes in sales', {
|
||||||
ticketId: sale.ticket().id,
|
|
||||||
itemId: sale.itemFk,
|
itemId: sale.itemFk,
|
||||||
concept: sale.concept,
|
concept: sale.concept,
|
||||||
oldQuantity: oldQuantity,
|
oldQuantity: oldQuantity,
|
||||||
newQuantity: newQuantity,
|
newQuantity: newQuantity,
|
||||||
ticketUrl: `${url}ticket/${sale.ticket().id}/sale`,
|
|
||||||
itemUrl: `${url}item/${sale.itemFk}/summary`
|
itemUrl: `${url}item/${sale.itemFk}/summary`
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const message = $t('Changed sale quantity', {
|
||||||
|
ticketId: sale.ticket().id,
|
||||||
|
changes: change,
|
||||||
|
ticketUrl: `${url}ticket/${sale.ticket().id}/sale`,
|
||||||
|
});
|
||||||
|
|
||||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
|
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ module.exports = Self => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
let tx;
|
let tx;
|
||||||
|
let newStateOrder;
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -40,11 +41,16 @@ module.exports = Self => {
|
||||||
throw new UserError('State cannot be blank');
|
throw new UserError('State cannot be blank');
|
||||||
|
|
||||||
if (params.stateFk) {
|
if (params.stateFk) {
|
||||||
const {code} = await models.State.findById(params.stateFk, {fields: ['code']}, myOptions);
|
const {code, order} = await models.State.findById(
|
||||||
|
params.stateFk,
|
||||||
|
{fields: ['code', 'order']},
|
||||||
|
myOptions);
|
||||||
params.code = code;
|
params.code = code;
|
||||||
|
newStateOrder = order;
|
||||||
} else {
|
} else {
|
||||||
const {id} = await models.State.findOne({where: {code: params.code}}, myOptions);
|
const {id, order} = await models.State.findOne({where: {code: params.code}}, myOptions);
|
||||||
params.stateFk = id;
|
params.stateFk = id;
|
||||||
|
newStateOrder = order;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.userFk) {
|
if (!params.userFk) {
|
||||||
|
@ -75,7 +81,9 @@ module.exports = Self => {
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const salesPersonFk = ticket.client().salesPersonFk;
|
const salesPersonFk = ticket.client().salesPersonFk;
|
||||||
if (salesPersonFk) {
|
const stateChecked = await models.State.findOne({fields: ['order'], where: {code: 'CHECKED'}});
|
||||||
|
|
||||||
|
if (salesPersonFk && newStateOrder >= stateChecked.order) {
|
||||||
const sales = await Self.rawSql(`
|
const sales = await Self.rawSql(`
|
||||||
SELECT DISTINCT s.id,
|
SELECT DISTINCT s.id,
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
|
@ -83,19 +91,12 @@ module.exports = Self => {
|
||||||
s.originalQuantity AS oldQuantity,
|
s.originalQuantity AS oldQuantity,
|
||||||
s.quantity AS newQuantity
|
s.quantity AS newQuantity
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
JOIN vn.saleTracking st ON st.saleFk = s.id
|
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN vn.client c ON c.id = t.clientFk
|
|
||||||
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
|
||||||
JOIN vn.state s2 ON s2.id = ts.stateFk
|
|
||||||
WHERE s.ticketFk = ?
|
WHERE s.ticketFk = ?
|
||||||
AND st.isChecked
|
|
||||||
AND s.originalQuantity IS NOT NULL
|
AND s.originalQuantity IS NOT NULL
|
||||||
AND s.originalQuantity <> s.quantity
|
AND s.originalQuantity <> s.quantity
|
||||||
AND s2.\`order\` < (SELECT \`order\` FROM vn.state WHERE code = 'CHECKED')
|
|
||||||
ORDER BY st.created DESC
|
|
||||||
`, [params.ticketFk], myOptions);
|
`, [params.ticketFk], myOptions);
|
||||||
|
|
||||||
|
if (sales.length) {
|
||||||
let changes = '';
|
let changes = '';
|
||||||
const url = await models.Url.getUrl();
|
const url = await models.Url.getUrl();
|
||||||
const $t = ctx.req.__;
|
const $t = ctx.req.__;
|
||||||
|
@ -120,6 +121,7 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
await models.Chat.sendCheckingPresence(ctx, salesPersonFk, message, myOptions);
|
await models.Chat.sendCheckingPresence(ctx, salesPersonFk, message, myOptions);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [ticket.id, params.code], myOptions);
|
await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [ticket.id, params.code], myOptions);
|
||||||
|
|
||||||
const ticketTracking = await models.TicketTracking.findOne({
|
const ticketTracking = await models.TicketTracking.findOne({
|
||||||
|
|
|
@ -56,6 +56,7 @@ module.exports = Self => {
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
{relation: 'warehouse', scope: {fields: ['name']}},
|
{relation: 'warehouse', scope: {fields: ['name']}},
|
||||||
|
{relation: 'ticketCollections', scope: {fields: ['collectionFk']}},
|
||||||
{relation: 'agencyMode', scope: {fields: ['name']}},
|
{relation: 'agencyMode', scope: {fields: ['name']}},
|
||||||
{relation: 'zone', scope: {fields: ['name']}},
|
{relation: 'zone', scope: {fields: ['name']}},
|
||||||
{relation: 'client',
|
{relation: 'client',
|
||||||
|
|
|
@ -152,6 +152,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Cmr",
|
"model": "Cmr",
|
||||||
"foreignKey": "cmrFk"
|
"foreignKey": "cmrFk"
|
||||||
|
},
|
||||||
|
"ticketCollections": {
|
||||||
|
"type": "hasMany",
|
||||||
|
"model": "TicketCollection",
|
||||||
|
"foreignKey": "ticketFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue