Merge branch 'master' into 6147-transferInvoice_split
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
6e17f3dca3
|
@ -102,7 +102,7 @@ pipeline {
|
|||
NODE_ENV = ''
|
||||
}
|
||||
steps {
|
||||
sh 'node back/tests.js --ci --junit --network jenkins'
|
||||
sh 'node back/tests.js --junit'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
@ -120,7 +120,7 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
||||
}
|
||||
sh 'docker-compose build back'
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
||||
}
|
||||
sh 'gulp build'
|
||||
sh 'docker-compose build front'
|
||||
|
@ -178,7 +178,7 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
||||
}
|
||||
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
||||
sh 'docker-compose push'
|
||||
|
@ -212,7 +212,7 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
||||
}
|
||||
withKubeConfig([
|
||||
serverUrl: "$KUBERNETES_API",
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
<mrw:Nif><%= expeditionData.fi %></mrw:Nif>
|
||||
<mrw:Nombre><%= expeditionData.clientName %></mrw:Nombre>
|
||||
<mrw:Telefono><%= expeditionData.phone %></mrw:Telefono>
|
||||
<mrw:Observaciones><%= expeditionData.deliveryObservation %></mrw:Observaciones>
|
||||
</mrw:DatosEntrega>
|
||||
<mrw:DatosServicio>
|
||||
<mrw:Fecha><%= expeditionData.created %></mrw:Fecha>
|
||||
<mrw:Referencia><%= expeditionData.expeditionDataId %></mrw:Referencia>
|
||||
<mrw:Referencia><%= expeditionData.reference %></mrw:Referencia>
|
||||
<mrw:CodigoServicio><%= expeditionData.serviceType %></mrw:CodigoServicio>
|
||||
<mrw:NumeroBultos>1</mrw:NumeroBultos>
|
||||
<mrw:EntregaSabado><%= expeditionData.weekDays %></mrw:EntregaSabado>
|
||||
|
|
|
@ -45,7 +45,7 @@ module.exports = Self => {
|
|||
`SELECT
|
||||
CASE co.code
|
||||
WHEN 'ES' THEN a.postalCode
|
||||
WHEN 'PT' THEN LEFT(a.postalCode, 4)
|
||||
WHEN 'PT' THEN LEFT(a.postalCode, mc.portugalPostCodeTrim)
|
||||
WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00')
|
||||
END postalCode,
|
||||
a.city,
|
||||
|
@ -56,18 +56,23 @@ module.exports = Self => {
|
|||
c.phone,
|
||||
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
||||
t.shipped,
|
||||
e.id expeditionId,
|
||||
LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType,
|
||||
IF(mw.weekdays, 'S', 'N') weekDays
|
||||
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
||||
LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth,'0') serviceType,
|
||||
IF(mw.weekdays, 'S', 'N') weekDays,
|
||||
oa.description deliveryObservation
|
||||
FROM expedition e
|
||||
JOIN ticket t ON e.ticketFk = t.id
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN mrwService ms ON ms.agencyModeCodeFk = am.code
|
||||
LEFT JOIN mrwServiceWeekday mw ON mw.weekdays = DATE_FORMAT(t.shipped, '%a')
|
||||
LEFT JOIN mrwServiceWeekday mw ON mw.weekdays | 1 << WEEKDAY(t.landed)
|
||||
JOIN client c ON t.clientFk = c.id
|
||||
JOIN address a ON t.addressFk = a.id
|
||||
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
|
||||
LEFT JOIN observationType ot ON ot.id = oa.observationTypeFk
|
||||
AND ot.code = 'delivery'
|
||||
JOIN province p ON a.provinceFk = p.id
|
||||
JOIN country co ON co.id = p.countryFk
|
||||
JOIN mrwConfig mc
|
||||
WHERE e.id = ?
|
||||
LIMIT 1`;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(isTx BOOL)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(vIsTx BOOL)
|
||||
BEGIN
|
||||
/**
|
||||
* Confirma los cambios asociados a una transacción.
|
||||
*
|
||||
* @param isTx es true si existe transacción asociada
|
||||
* @param vIsTx es true si existe transacción asociada
|
||||
*/
|
||||
IF isTx THEN
|
||||
IF vIsTx THEN
|
||||
COMMIT;
|
||||
END IF;
|
||||
END$$
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(isTx BOOL)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(vIsTx BOOL)
|
||||
BEGIN
|
||||
/**
|
||||
* Deshace los cambios asociados a una transacción.
|
||||
*
|
||||
* @param isTx es true si existe transacción asociada
|
||||
* @param vIsTx es true si existe transacción asociada
|
||||
*/
|
||||
IF isTx THEN
|
||||
IF vIsTx THEN
|
||||
ROLLBACK;
|
||||
END IF;
|
||||
END$$
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(isTx BOOL)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(vIsTx BOOL)
|
||||
BEGIN
|
||||
/**
|
||||
* Inicia una transacción.
|
||||
*
|
||||
* @param isTx es true si existe transacción asociada
|
||||
* @param vIsTx es true si existe transacción asociada
|
||||
*/
|
||||
IF isTx THEN
|
||||
IF vIsTx THEN
|
||||
START TRANSACTION;
|
||||
END IF;
|
||||
END$$
|
||||
|
|
|
@ -11,10 +11,7 @@ BEGIN
|
|||
*/
|
||||
DECLARE vClient INT DEFAULT NULL;
|
||||
|
||||
-- SET vPhone = vPhone COLLATE 'utf8_unicode_ci';
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tClient;
|
||||
CREATE TEMPORARY TABLE tClient
|
||||
CREATE OR REPLACE TEMPORARY TABLE tClient
|
||||
ENGINE = MEMORY
|
||||
SELECT id clientFk
|
||||
FROM `client`
|
||||
|
@ -27,13 +24,14 @@ BEGIN
|
|||
OR mobile = vPhone
|
||||
UNION
|
||||
SELECT clientFk
|
||||
FROM vn.clientContact
|
||||
FROM clientContact
|
||||
WHERE phone = vPhone;
|
||||
|
||||
SELECT t.clientFk INTO vClient
|
||||
FROM tClient t
|
||||
JOIN `client` c ON c.id = t.clientFk
|
||||
WHERE c.isActive
|
||||
AND c.salesPersonFk
|
||||
LIMIT 1;
|
||||
|
||||
DROP TEMPORARY TABLE tClient;
|
||||
|
|
|
@ -44,7 +44,7 @@ BEGIN
|
|||
JOIN dua d ON d.id = de.duaFk
|
||||
WHERE d.id = vDuaFk
|
||||
LIMIT 1;
|
||||
CALL ledger_next(vFiscalYear, FALSE, vBookEntry);
|
||||
CALL ledger_nextTx(vFiscalYear, vBookEntry);
|
||||
END IF;
|
||||
|
||||
OPEN vInvoicesIn;
|
||||
|
|
|
@ -12,7 +12,7 @@ BEGIN
|
|||
WHERE id = vDuaFk;
|
||||
|
||||
IF vBookNumber IS NULL OR NOT vBookNumber THEN
|
||||
CALL ledger_next(YEAR(vBookDated), FALSE, vBookNumber);
|
||||
CALL ledger_nextTx(YEAR(vBookDated), vBookNumber);
|
||||
END IF;
|
||||
|
||||
-- Apunte de la aduana
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_checkBooked`(
|
||||
vSelf INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Comprueba si una entrada está contabilizada,
|
||||
* y si lo está retorna un throw.
|
||||
*
|
||||
* @param vSelf Id de entrada
|
||||
*/
|
||||
DECLARE vIsBooked BOOL;
|
||||
|
||||
SELECT isBooked INTO vIsBooked
|
||||
FROM `entry`
|
||||
WHERE id = vSelf;
|
||||
|
||||
IF vIsBooked AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
||||
CALL util.throw('Entry is already booked');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,24 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_isEditable`(
|
||||
vSelf INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Comprueba si una entrada se puede actualizar
|
||||
* si no se puede retorna un throw.
|
||||
*
|
||||
* @param vSelf Id de entrada
|
||||
*/
|
||||
DECLARE vIsEditable BOOL;
|
||||
|
||||
SELECT e.isBooked INTO vIsEditable
|
||||
FROM `entry` e
|
||||
JOIN entryType et ON et.code = e.typeFk
|
||||
WHERE NOT et.isInformal
|
||||
AND e.id = vSelf;
|
||||
|
||||
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
||||
CALL util.throw('Entry is not editable');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -23,7 +23,8 @@ BEGIN
|
|||
JOIN vn.travel t ON t.id = e.travelFk
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseInFk
|
||||
WHERE t.shipped >= util.VN_CURDATE()
|
||||
AND e.currencyFk = vCurrency;
|
||||
AND e.currencyFk = vCurrency
|
||||
AND NOT e.isBooked;
|
||||
|
||||
SET vComission = currency_getCommission(vCurrency);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ BEGIN
|
|||
SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1;
|
||||
|
||||
IF vBookNumber IS NULL THEN
|
||||
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
|
||||
CALL ledger_nextTx(vFiscalYear, vBookNumber);
|
||||
END IF;
|
||||
|
||||
-- Apunte del proveedor
|
||||
|
|
|
@ -61,7 +61,7 @@ BEGIN
|
|||
WHERE io.id = vInvoice;
|
||||
|
||||
SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1;
|
||||
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
|
||||
CALL ledger_nextTx(vFiscalYear, vBookNumber);
|
||||
-- Linea del cliente
|
||||
INSERT INTO XDiario(
|
||||
ASIEN,
|
||||
|
|
|
@ -28,7 +28,7 @@ BEGIN
|
|||
DECLARE vIsOriginalAClient BOOL;
|
||||
DECLARE vPayMethodCompensation INT;
|
||||
|
||||
CALL ledger_next(YEAR(vDated), FALSE, vNewBookEntry);
|
||||
CALL ledger_nextTx(YEAR(vDated), vNewBookEntry);
|
||||
|
||||
SELECT COUNT(id) INTO vIsOriginalAClient
|
||||
FROM client
|
||||
|
|
|
@ -1,38 +1,21 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
|
||||
IN vFiscalYear INT,
|
||||
IN vIsManageTransaction BOOLEAN,
|
||||
OUT vLastBookEntry INT
|
||||
)
|
||||
/**
|
||||
* Devuelve un número de asiento válido, según el contador de asientos
|
||||
* tabla vn.ledgerConfig, si no existe lo inicializa a 1
|
||||
* No inicia transacción, para transaccionar usar vn.ledger_nextTx
|
||||
*
|
||||
* @param vFiscalYear Id del año contable
|
||||
* @return vLastBookEntry Id del asiento
|
||||
*/
|
||||
BEGIN
|
||||
DECLARE vHasStartTransaction BOOLEAN;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
|
||||
IF vHasStartTransaction THEN
|
||||
ROLLBACK TO sp;
|
||||
RESIGNAL;
|
||||
ELSE
|
||||
ROLLBACK;
|
||||
CALL util.throw ('It has not been possible to generate a new ledger');
|
||||
END IF;
|
||||
END;
|
||||
|
||||
IF vFiscalYear IS NULL THEN
|
||||
CALL util.throw('Fiscal year is required');
|
||||
END IF;
|
||||
|
||||
IF NOT vIsManageTransaction THEN
|
||||
SELECT @@in_transaction INTO vHasStartTransaction;
|
||||
|
||||
IF NOT vHasStartTransaction THEN
|
||||
START TRANSACTION;
|
||||
ELSE
|
||||
SAVEPOINT sp;
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
SELECT bookEntry + 1 INTO vLastBookEntry
|
||||
FROM ledgerCompany
|
||||
WHERE fiscalYear = vFiscalYear
|
||||
|
@ -48,13 +31,5 @@ BEGIN
|
|||
UPDATE ledgerCompany
|
||||
SET bookEntry = vLastBookEntry
|
||||
WHERE fiscalYear = vFiscalYear;
|
||||
|
||||
IF NOT vIsManageTransaction THEN
|
||||
IF vHasStartTransaction THEN
|
||||
RELEASE SAVEPOINT sp;
|
||||
ELSE
|
||||
COMMIT;
|
||||
END IF;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,30 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_nextTx`(
|
||||
IN vFiscalYear INT,
|
||||
OUT vLastBookEntry INT
|
||||
)
|
||||
/**
|
||||
* Devuelve un número de asiento válido, según el contador de asientos
|
||||
* tabla vn.ledgerConfig, si no existe lo inicializa a 1
|
||||
* Lo hace transaccionando el proceso
|
||||
*
|
||||
* @param vFiscalYear Id del año contable
|
||||
* @return vLastBookEntry Id del asiento
|
||||
*/
|
||||
BEGIN
|
||||
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
CALL util.tx_rollback(vIsRequiredTx);
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
IF vFiscalYear IS NULL THEN
|
||||
CALL util.throw('Fiscal year is required');
|
||||
END IF;
|
||||
|
||||
CALL util.tx_start(vIsRequiredTx);
|
||||
CALL ledger_next(vFiscalYear, vLastBookEntry);
|
||||
CALL util.tx_commit(vIsRequiredTx);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -24,7 +24,7 @@ BEGIN
|
|||
DECLARE vEvaNotes VARCHAR(255);
|
||||
DECLARE vDone BOOL;
|
||||
DECLARE vAuxEntryFk INT;
|
||||
DECLARE vTx BOOLEAN DEFAULT @@in_transaction;
|
||||
DECLARE vIsRequiredTx BOOLEAN DEFAULT NOT @@in_transaction;
|
||||
DECLARE vRsEntry CURSOR FOR
|
||||
SELECT e.id
|
||||
FROM entry e
|
||||
|
@ -35,11 +35,11 @@ BEGIN
|
|||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
CALL util.tx_rollback(vTx);
|
||||
CALL util.tx_rollback(vIsRequiredTx);
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
CALL util.tx_start(vTx);
|
||||
CALL util.tx_start(vIsRequiredTx);
|
||||
|
||||
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
|
||||
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
|
||||
|
@ -76,6 +76,6 @@ BEGIN
|
|||
SET @isModeInventory = FALSE;
|
||||
CLOSE vRsEntry;
|
||||
|
||||
CALL util.tx_commit(vTx);
|
||||
CALL util.tx_commit(vIsRequiredTx);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -39,7 +39,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`xdiario_new`(
|
|||
*/
|
||||
BEGIN
|
||||
IF vBookNumber IS NULL THEN
|
||||
CALL ledger_next(YEAR(vDated), FALSE, vBookNumber);
|
||||
CALL ledger_nextTx(YEAR(vDated), vBookNumber);
|
||||
END IF;
|
||||
|
||||
INSERT INTO XDiario
|
||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_beforeDelete`
|
|||
BEFORE DELETE ON `buy`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL entry_checkBooked(OLD.entryFk);
|
||||
CALL entry_isEditable(OLD.entryFk);
|
||||
IF OLD.printedStickers <> 0 THEN
|
||||
CALL util.throw("it is not possible to delete buys with printed labels ");
|
||||
END IF;
|
||||
|
|
|
@ -15,7 +15,7 @@ trig: BEGIN
|
|||
LEAVE trig;
|
||||
END IF;
|
||||
|
||||
CALL entry_checkBooked(NEW.entryFk);
|
||||
CALL entry_isEditable(NEW.entryFk);
|
||||
IF NEW.printedStickers <> 0 THEN
|
||||
CALL util.throw('it is not possible to create buy lines with printedstickers other than 0');
|
||||
END IF;
|
||||
|
|
|
@ -13,7 +13,7 @@ trig:BEGIN
|
|||
LEAVE trig;
|
||||
END IF;
|
||||
|
||||
CALL entry_checkBooked(OLD.entryFk);
|
||||
CALL entry_isEditable(OLD.entryFk);
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
SELECT defaultEntry INTO vDefaultEntry
|
||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entry_beforeDelete`
|
|||
BEFORE DELETE ON `entry`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL entry_checkBooked(OLD.id);
|
||||
CALL entry_isEditable(OLD.id);
|
||||
DELETE FROM buy WHERE entryFk = OLD.id;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -9,7 +9,7 @@ BEGIN
|
|||
DECLARE vTotalBuy INT;
|
||||
|
||||
IF NEW.isBooked = OLD.isBooked THEN
|
||||
CALL entry_checkBooked(OLD.id);
|
||||
CALL entry_isEditable(OLD.id);
|
||||
ELSE
|
||||
IF NEW.isBooked THEN
|
||||
SELECT COUNT(*) INTO vTotalBuy
|
||||
|
|
|
@ -23,7 +23,7 @@ BEGIN
|
|||
FROM supplier
|
||||
WHERE id = NEW.supplierFk;
|
||||
|
||||
CALL ledger_next(YEAR(NEW.received), TRUE, vNewBookEntry);
|
||||
CALL ledger_next(YEAR(NEW.received), vNewBookEntry);
|
||||
|
||||
INSERT INTO XDiario (
|
||||
ASIEN,
|
||||
|
|
|
@ -8,7 +8,9 @@ BEGIN
|
|||
SET hasNewRoute = TRUE
|
||||
WHERE ticketFk = NEW.id;
|
||||
|
||||
IF NEW.cmrFk THEN
|
||||
CALL ticket_doCmr(NEW.id);
|
||||
END IF;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
-- Place your SQL code here
|
||||
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS expeditionDeadLine TIME NULL
|
||||
COMMENT 'This field stores the latest time by which expeditions can be generated to be sent today';
|
|
@ -0,0 +1,9 @@
|
|||
-- Place your SQL code here
|
||||
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS counterWidth INT UNSIGNED NULL
|
||||
COMMENT 'If it does not reach the required value, it will be padded with zeros on the left to meet the specified length.';
|
||||
|
||||
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS serviceTypeWidth INT UNSIGNED NULL
|
||||
COMMENT 'If it does not reach the required value, it will be padded with zeros on the left to meet the specified length.';
|
||||
|
||||
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS portugalPostCodeTrim INT UNSIGNED NULL
|
||||
COMMENT 'It will trim the last characters of the postal code';
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||
VALUES ('Ticket','refund','WRITE','ALLOW','ROLE','logistic');
|
|
@ -0,0 +1 @@
|
|||
CREATE INDEX ticketLog_creationDate_IDX USING BTREE ON vn.ticketLog (creationDate,changedModel,`action`);
|
|
@ -1,5 +1,6 @@
|
|||
import ngModule from '../module';
|
||||
import ModuleCard from 'salix/components/module-card';
|
||||
import UserError from 'core/lib/user-error';
|
||||
|
||||
class Controller extends ModuleCard {
|
||||
reload() {
|
||||
|
@ -59,6 +60,10 @@ class Controller extends ModuleCard {
|
|||
],
|
||||
};
|
||||
|
||||
if (!this.$params.id) {
|
||||
this.$state.go('ticket.index');
|
||||
throw new UserError(`You must select a ticket`);
|
||||
}
|
||||
return this.$http.get(`Tickets/${this.$params.id}`, {filter})
|
||||
.then(res => this.onData(res.data));
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
</vn-item>
|
||||
<vn-item class="dropdown"
|
||||
vn-click-stop="refundMenu.show($event, 'left')"
|
||||
vn-acl="invoicing, claimManager, salesAssistant"
|
||||
vn-acl="invoicing, claimManager, salesAssistant, logistic"
|
||||
vn-acl-action="remove"
|
||||
vn-tooltip="Create a single ticket with all the content of the current ticket"
|
||||
translate>
|
||||
|
|
|
@ -64,6 +64,7 @@ You are going to delete this ticket: Vas a eliminar este ticket
|
|||
Ticket deleted. You can undo this action within the first hour: Ticket eliminado. Puedes deshacer esta acción durante la primera hora
|
||||
Search ticket by id or alias: Buscar tickets por identificador o alias
|
||||
ticket: ticket
|
||||
You must select a ticket: Debes seleccionar un ticket
|
||||
|
||||
#sections
|
||||
List: Listado
|
||||
|
|
|
@ -26,10 +26,9 @@ module.exports = Self => {
|
|||
|
||||
Self.cloneWithEntries = async(ctx, id, options) => {
|
||||
const conn = Self.dataSource.connector;
|
||||
let tx;
|
||||
const myOptions = {};
|
||||
let tx = options?.transaction;
|
||||
|
||||
try {
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
|
@ -37,7 +36,7 @@ module.exports = Self => {
|
|||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
try {
|
||||
const travel = await Self.findById(id, {
|
||||
fields: [
|
||||
'id',
|
||||
|
@ -89,6 +88,8 @@ module.exports = Self => {
|
|||
'ref'
|
||||
]
|
||||
}, myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
return newTravel.id;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
|
|
|
@ -7,19 +7,22 @@ describe('Travel cloneWithEntries()', () => {
|
|||
const ctx = {req: {accessToken: {userId: currentUserId}}};
|
||||
let newTravelId;
|
||||
it(`should clone the travel and the containing entries`, async() => {
|
||||
const tx = await models.Travel.beginTransaction({
|
||||
});
|
||||
const tx = await models.Travel.beginTransaction({});
|
||||
const warehouseThree = 3;
|
||||
const agencyModeOne = 1;
|
||||
let travelRemoved;
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
newTravelId = await models.Travel.cloneWithEntries(ctx, travelId, options);
|
||||
const travelEntries = await models.Entry.find({
|
||||
where: {
|
||||
travelFk: newTravelId
|
||||
}
|
||||
}, options);
|
||||
const newTravel = await models.Travel.findById(travelId);
|
||||
const newTravel = await models.Travel.findById(travelId, null, options);
|
||||
travelRemoved = await models.Travel.findById(newTravelId);
|
||||
|
||||
expect(newTravelId).not.toEqual(travelId);
|
||||
expect(newTravel.ref).toEqual('fifth travel');
|
||||
|
@ -27,14 +30,9 @@ describe('Travel cloneWithEntries()', () => {
|
|||
expect(newTravel.warehouseOutFk).toEqual(warehouseThree);
|
||||
expect(newTravel.agencyModeFk).toEqual(agencyModeOne);
|
||||
expect(travelEntries.length).toBeGreaterThan(0);
|
||||
await models.Entry.destroyAll({
|
||||
travelFk: newTravelId
|
||||
}, options);
|
||||
await models.Travel.destroyById(newTravelId, options);
|
||||
await tx.rollback();
|
||||
const travelRemoved = await models.Travel.findById(newTravelId, options);
|
||||
|
||||
expect(travelRemoved).toBeNull();
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = Self => {
|
|||
const notifications = await models.NotificationQueue.find(
|
||||
{where: {created: {gte: new Date(Date.vnNow() - (backupPrinterNotificationDelay * 1000))},
|
||||
notificationFk: notificationName,
|
||||
status: 'sent'
|
||||
status: {neq: 'error'}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
<vn-autocomplete
|
||||
ng-model="$ctrl.worker.originCountryFk"
|
||||
url="Countries"
|
||||
fields="['id', 'country', 'code']"
|
||||
show-field="country"
|
||||
fields="['id', 'name', 'code']"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Origin country">
|
||||
</vn-autocomplete>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-back",
|
||||
"version": "24.22.4",
|
||||
"version": "24.22.10",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix backend",
|
||||
"license": "GPL-3.0",
|
||||
|
|
Loading…
Reference in New Issue