diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index 98aa8be39..e96d6d694 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -24,12 +24,13 @@ module.exports = Self => { Self.cancelShipment = async expeditionFk => { const models = Self.app.models; - const mrw = await models.MrwConfig.findOne(); const {externalId} = await models.Expedition.findById(expeditionFk); const clientType = await models.MrwConfig.getClientType(expeditionFk); const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8'); const renderedXml = ejs.render(template, {mrw, externalId, clientType}); + + await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', renderedXml]); const response = await axios.post(mrw.url, renderedXml, { headers: { 'Content-Type': 'application/soap+xml; charset=utf-8' @@ -37,12 +38,11 @@ module.exports = Self => { }); const xmlString = response.data; + await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipmentResponse', xmlString]); const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); - await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]); - const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; - return result.toLowerCase().includes('se ha cancelado correctamente'); + return ['no se ha encontrado', 'se ha cancelado correctamente'].some(res => result.toLowerCase().includes(res)); }; }; diff --git a/back/model-config.json b/back/model-config.json index b543071c9..e0bc92200 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -133,6 +133,9 @@ "Postcode": { "dataSource": "vn" }, + "Prefix": { + "dataSource": "vn" + }, "ReferenceRate": { "dataSource": "vn" }, diff --git a/back/models/prefix.json b/back/models/prefix.json new file mode 100644 index 000000000..762354caa --- /dev/null +++ b/back/models/prefix.json @@ -0,0 +1,27 @@ +{ + "name": "Prefix", + "base": "VnModel", + "options": { + "mysql": { + "table": "pbx.prefix" + } + }, + "properties": { + "country": { + "type": "string", + "id": true + }, + "prefix": { + "type": "string" + } + }, + "acls": [ + { + "property": "*", + "accessType": "READ", + "principalType": "ROLE", + "principalId": "employee", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/db/versions/11369-azureChrysanthemum/00-firstScript.sql b/db/versions/11369-azureChrysanthemum/00-firstScript.sql new file mode 100644 index 000000000..3a86c0c59 --- /dev/null +++ b/db/versions/11369-azureChrysanthemum/00-firstScript.sql @@ -0,0 +1,5 @@ +ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaFk_UNIQUE; +ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaInvoiceIn_unique; +ALTER TABLE vn.duaInvoiceIn ADD CONSTRAINT duaInvoiceIn_unique + UNIQUE KEY (invoiceInFk); + diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index 9242fbd44..9c1420b61 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -54,7 +54,7 @@ module.exports = Self => { { relation: 'country', scope: { - fields: ['id', 'name'], + fields: ['id', 'name', 'code'], include: { relation: 'saySimpleCountry', } diff --git a/modules/entry/back/methods/entry/print.js b/modules/entry/back/methods/entry/labelSupplier.js similarity index 87% rename from modules/entry/back/methods/entry/print.js rename to modules/entry/back/methods/entry/labelSupplier.js index 5b9de9a69..32d80c427 100644 --- a/modules/entry/back/methods/entry/print.js +++ b/modules/entry/back/methods/entry/labelSupplier.js @@ -1,6 +1,6 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('print', { + Self.remoteMethodCtx('labelSupplier', { description: 'Print stickers of all entries', accessType: 'READ', accepts: [ @@ -28,13 +28,13 @@ module.exports = Self => { } ], http: { - path: '/:id/print', + path: '/:id/labelSupplier', verb: 'GET' }, accessScopes: ['DEFAULT', 'read:multimedia'] }); - Self.print = async function(ctx, id, options) { + Self.labelSupplier = async function(ctx, id, options) { const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') @@ -48,7 +48,8 @@ module.exports = Self => { for (const buy of buys) { if (buy.stickers < 1) continue; ctx.args.id = buy.id; - const pdfBuffer = await models.Entry.buyLabel(ctx, myOptions); + ctx.args.copies = buy.stickers; + const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions); await merger.add(new Uint8Array(pdfBuffer[0])); } diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 593f3fdcc..55a23bb0a 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -12,7 +12,8 @@ module.exports = Self => { require('../methods/entry/addFromPackaging')(Self); require('../methods/entry/addFromBuy')(Self); require('../methods/entry/buyLabel')(Self); - require('../methods/entry/print')(Self); + require('../methods/entry/labelSupplier')(Self); + require('../methods/entry/buyLabelSupplier')(Self); Self.observe('before save', async function(ctx, options) { if (ctx.isNewInstance) return; diff --git a/modules/item/back/methods/item-shelving/getListItemNewer.js b/modules/item/back/methods/item-shelving/getListItemNewer.js index 5c4ca277d..c806c0a7e 100644 --- a/modules/item/back/methods/item-shelving/getListItemNewer.js +++ b/modules/item/back/methods/item-shelving/getListItemNewer.js @@ -51,7 +51,7 @@ module.exports = Self => { JOIN vn.productionConfig pc WHERE sh.code = ? AND s.code = pc.sectorFromCode ), tItemInSector AS ( - SELECT is2.itemFk, is2.created, is2.shelvingFk + SELECT is2.itemFk, is2.created, sh.code FROM vn.itemShelving is2 JOIN vn.shelving sh ON sh.id = is2.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk @@ -59,7 +59,7 @@ module.exports = Self => { JOIN vn.productionConfig pc WHERE sh.code <> ? AND s.code = pc.sectorFromCode) - SELECT ti.itemFK, tis.shelvingFk + SELECT ti.itemFK, tis.code shelvingFk FROM tItemShelving ti JOIN tItemInSector tis ON tis.itemFk = ti.itemFk JOIN vn.productionConfig pc diff --git a/modules/ticket/back/methods/expedition/deleteExpeditions.js b/modules/ticket/back/methods/expedition/deleteExpeditions.js index 75993a485..267811d25 100644 --- a/modules/ticket/back/methods/expedition/deleteExpeditions.js +++ b/modules/ticket/back/methods/expedition/deleteExpeditions.js @@ -52,7 +52,8 @@ module.exports = Self => { const deletedExpedition = await models.Expedition.destroyById(expeditionId); deletedExpeditions.push(deletedExpedition); - } catch (e) { + } catch (error) { + console.error('error: ', error); notDeletedExpeditions.push(expeditionId); } } diff --git a/print/templates/reports/buy-label-barcode/assets/css/style.css b/print/templates/reports/buy-label-barcode/assets/css/style.css index fabecd28e..ce1924878 100644 --- a/print/templates/reports/buy-label-barcode/assets/css/style.css +++ b/print/templates/reports/buy-label-barcode/assets/css/style.css @@ -32,6 +32,11 @@ td { .md-txt { font-size: 26px; } +.lg-txt { + font-size: 40px; + padding: 0px; + line-height: 1; +} .xl-txt { font-size: 50px; } diff --git a/print/templates/reports/buy-label-barcode/buy-label-barcode.html b/print/templates/reports/buy-label-barcode/buy-label-barcode.html index c787942c4..ebddb60ec 100644 --- a/print/templates/reports/buy-label-barcode/buy-label-barcode.html +++ b/print/templates/reports/buy-label-barcode/buy-label-barcode.html @@ -36,12 +36,12 @@