Pull from dev
gitea/salix/1921-claim_detail_discount This commit looks good
Details
gitea/salix/1921-claim_detail_discount This commit looks good
Details
This commit is contained in:
commit
7bbb9fa321
|
@ -1,4 +1,4 @@
|
|||
FROM mysql:5.6.42
|
||||
FROM mysql:8.0.18
|
||||
|
||||
ENV MYSQL_ROOT_PASSWORD root
|
||||
ENV TZ Europe/Madrid
|
||||
|
@ -7,36 +7,33 @@ ARG DEBIAN_FRONTEND=noninteractive
|
|||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends curl ca-certificates \
|
||||
&& curl -sL https://apt.verdnatura.es/conf/verdnatura.gpg | apt-key add - \
|
||||
&& echo "deb http://apt.verdnatura.es/ jessie main" > /etc/apt/sources.list.d/vn.list \
|
||||
&& echo "deb http://apt.verdnatura.es/ stretch main" > /etc/apt/sources.list.d/vn.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --allow-unauthenticated vn-mysql \
|
||||
&& apt-get install -y vn-mysql libmysqlclient21 \
|
||||
&& apt-get purge -y --auto-remove curl ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# XXX: Removes the last script line to avoid daemon to be started
|
||||
RUN cp /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-init.sh \
|
||||
&& sed -i '$ d' /usr/local/bin/docker-init.sh
|
||||
|
||||
WORKDIR /docker-entrypoint-initdb.d
|
||||
ARG STAMP=unknown
|
||||
|
||||
COPY import-changes.sh config.ini /docker-entrypoint-initdb.d/import/
|
||||
COPY docker.cnf /etc/mysql/mysql.conf.d/
|
||||
COPY changes /docker-entrypoint-initdb.d/import/changes
|
||||
|
||||
COPY docker-boot.sh /docker-entrypoint-initdb.d/
|
||||
COPY dump /docker-entrypoint-initdb.d/dump
|
||||
COPY docker/docker.cnf /etc/mysql/conf.d/
|
||||
COPY docker/docker-init.sh docker/docker-start.sh /usr/local/bin/
|
||||
|
||||
RUN mkdir /mysql-data \
|
||||
&& /usr/local/bin/docker-init.sh mysqld --datadir /mysql-data \
|
||||
&& chown -R mysql:mysql /mysql-data \
|
||||
&& chown -R mysql:mysql /mysql-data
|
||||
|
||||
WORKDIR /docker-entrypoint-initdb.d
|
||||
|
||||
COPY dump dump
|
||||
COPY docker/docker-boot.sh /docker-entrypoint-initdb.d/
|
||||
COPY changes import/changes
|
||||
COPY import-changes.sh config.ini import/
|
||||
|
||||
ARG STAMP=unknown
|
||||
RUN gosu mysql docker-init.sh mysqld \
|
||||
&& rm -rf /docker-entrypoint-initdb.d/*
|
||||
|
||||
COPY docker-start.sh /usr/local/bin/
|
||||
USER mysql
|
||||
ENTRYPOINT ["docker-start.sh"]
|
||||
|
||||
USER mysql
|
||||
CMD ["mysqld", "--datadir", "/mysql-data"]
|
||||
CMD ["mysqld"]
|
||||
|
||||
#HEALTHCHECK --interval=5s --timeout=10s --retries=200 \
|
||||
# CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1
|
||||
|
|
|
@ -6,8 +6,8 @@ USE `vn`$$
|
|||
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve el listado de agencias disponibles para la fecha,
|
||||
* dirección y warehouse pasadas
|
||||
* Devuelve el listado de agencias disponibles para la fecha,
|
||||
* dirección y almacén pasados.
|
||||
*
|
||||
* @param vAddress
|
||||
* @param vWarehouse warehouse
|
||||
|
@ -30,7 +30,8 @@ BEGIN
|
|||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
||||
JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk
|
||||
WHERE zw.warehouseFk
|
||||
GROUP BY z.agencyModeFk;
|
||||
GROUP BY z.agencyModeFk
|
||||
ORDER BY agencyMode;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.zone,
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[mysqld]
|
||||
innodb_log_file_size = 4M
|
||||
innodb_autoextend_increment = 4
|
||||
innodb_page_size = 8K
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
mysql_check_config "$@"
|
||||
docker_setup_env "$@"
|
||||
docker_create_db_directories
|
||||
|
||||
docker_verify_minimum_env
|
||||
docker_init_database_dir "$@"
|
||||
docker_temp_server_start "$@"
|
||||
docker_setup_db
|
||||
|
||||
docker_process_init_files /docker-entrypoint-initdb.d/*
|
||||
|
||||
mysql_expire_root_user
|
||||
docker_temp_server_stop
|
|
@ -0,0 +1,10 @@
|
|||
[mysqld]
|
||||
innodb_log_file_size = 4M
|
||||
innodb_autoextend_increment = 4
|
||||
innodb_page_size = 8K
|
||||
innodb_default_row_format = COMPACT
|
||||
log_bin_trust_function_creators = ON
|
||||
datadir = /mysql-data
|
||||
sql_mode = NO_ENGINE_SUBSTITUTION
|
||||
innodb_temp_data_file_path = /tmp/ibtmp1:12M:autoextend
|
||||
skip-log-bin
|
|
@ -1,10 +1,13 @@
|
|||
-- FIXME: cuando se eliminen los procedimientos de la cache, se podra eliminar esta linea
|
||||
CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
||||
CREATE SCHEMA IF NOT EXISTS `tmp`;
|
||||
|
||||
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
|
||||
|
||||
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
|
||||
ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1;
|
||||
ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1;
|
||||
ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1;
|
||||
|
||||
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
|
||||
VALUES
|
||||
|
@ -1499,13 +1502,13 @@ INSERT INTO `vn`.`ticketServiceType`(`id`, `name`)
|
|||
(4, 'Cargo FITOSANITARIO'),
|
||||
(5, 'Documentos');
|
||||
|
||||
INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`)
|
||||
INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`, `ticketServiceTypeFk`)
|
||||
VALUES
|
||||
(1, 'Documentos', 1, 2.00, 1, 1),
|
||||
(2, 'Porte Agencia', 1, 10.00, 1, 2),
|
||||
(3, 'Documentos', 1, 5.50, 1, 11),
|
||||
(4, 'Documentos', 1, 2.00, 1, 9),
|
||||
(5, 'Documentos', 1, 2.00, 1, 8);
|
||||
(1, 'Documentos', 1, 2.00, 1, 1, 1),
|
||||
(2, 'Porte Agencia', 1, 10.00, 1, 2, 1),
|
||||
(3, 'Documentos', 1, 5.50, 1, 11, 1),
|
||||
(4, 'Documentos', 1, 2.00, 1, 9, 1),
|
||||
(5, 'Documentos', 1, 2.00, 1, 8, 1);
|
||||
|
||||
INSERT INTO `pbx`.`sip`(`user_id`, `extension`)
|
||||
VALUES
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
-- Import compiled functions
|
||||
CREATE AGGREGATE FUNCTION minacum RETURNS INT SONAME 'minacum.so';
|
||||
CREATE AGGREGATE FUNCTION multimax RETURNS INT SONAME 'multimax.so';
|
||||
CREATE AGGREGATE FUNCTION multimax RETURNS INT SONAME 'multimax.so';
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,6 +17,83 @@ SCHEMAS=(
|
|||
vncontrol
|
||||
)
|
||||
|
||||
IGNORETABLES=(
|
||||
--ignore-table=bi.last_Id_Cubo
|
||||
--ignore-table=bi.v_clientes_jerarquia
|
||||
--ignore-table=bi.v_ventas_contables
|
||||
--ignore-table=bs.horasSilla
|
||||
--ignore-table=bs.productionIndicators
|
||||
--ignore-table=bs.VentasPorCliente
|
||||
--ignore-table=bs.v_ventas
|
||||
--ignore-table=edi.supplyOffer
|
||||
--ignore-table=postgresql.currentWorkersStats
|
||||
--ignore-table=vn.accounting__
|
||||
--ignore-table=vn.agencyModeZone
|
||||
--ignore-table=vn.agencyProvince
|
||||
--ignore-table=vn.agencyWarehouse
|
||||
--ignore-table=vn.awb
|
||||
--ignore-table=vn.botanicExport__
|
||||
--ignore-table=vn.clientDefaultCompany
|
||||
--ignore-table=vn.color
|
||||
--ignore-table=vn.comparative
|
||||
--ignore-table=vn.comparativeFilter
|
||||
--ignore-table=vn.coolerPath
|
||||
--ignore-table=vn.coolerPathDetail
|
||||
--ignore-table=vn.department__
|
||||
--ignore-table=vn.doc
|
||||
--ignore-table=vn.entity
|
||||
--ignore-table=vn.especialPrice
|
||||
--ignore-table=vn.exchangeInsurance
|
||||
--ignore-table=vn.exchangeInsuranceInPrevious
|
||||
--ignore-table=vn.exchangeReportSource
|
||||
--ignore-table=vn.grant
|
||||
--ignore-table=vn.grantGroup
|
||||
--ignore-table=vn.invoiceCorrection__
|
||||
--ignore-table=vn.invoiceIn
|
||||
--ignore-table=vn.invoiceInAwb
|
||||
--ignore-table=vn.invoiceInDueDay
|
||||
--ignore-table=vn.invoiceInEntry
|
||||
--ignore-table=vn.invoiceInIntrastat
|
||||
--ignore-table=vn.invoiceInTax
|
||||
--ignore-table=vn.itemTaxCountrySpain
|
||||
--ignore-table=vn.mail__
|
||||
--ignore-table=vn.manaSpellers
|
||||
--ignore-table=vn.outgoingInvoiceKk
|
||||
--ignore-table=vn.payment
|
||||
--ignore-table=vn.paymentExchangeInsurance
|
||||
--ignore-table=vn.payrollCenter
|
||||
--ignore-table=vn.plantpassport
|
||||
--ignore-table=vn.plantpassportAuthority
|
||||
--ignore-table=vn.preparationException
|
||||
--ignore-table=vn.priceFixed__
|
||||
--ignore-table=vn.printer
|
||||
--ignore-table=vn.printingQueue
|
||||
--ignore-table=vn.printServerQueue__
|
||||
--ignore-table=vn.promissoryNote
|
||||
--ignore-table=vn.rate
|
||||
--ignore-table=vn.referenceRate__
|
||||
--ignore-table=vn.routesControl
|
||||
--ignore-table=vn.salesToPrePrepare
|
||||
--ignore-table=vn.specialPrice__
|
||||
--ignore-table=vn.ticketDownBuffer
|
||||
--ignore-table=vn.ticketeToPreparePrepared
|
||||
--ignore-table=vn.ticketObservation__
|
||||
--ignore-table=vn.ticketRequest__
|
||||
--ignore-table=vn.ticketToPrepare
|
||||
--ignore-table=vn.till__
|
||||
--ignore-table=vn.time
|
||||
--ignore-table=vn.travelThermograph__
|
||||
--ignore-table=vn.travel_cloneWeekly
|
||||
--ignore-table=vn.unary
|
||||
--ignore-table=vn.unaryScan
|
||||
--ignore-table=vn.unaryScanLine
|
||||
--ignore-table=vn.unaryScanLineBuy
|
||||
--ignore-table=vn.unaryScanLineExpedition
|
||||
--ignore-table=vn.warehouseAlias__
|
||||
--ignore-table=vn.warehouseJoined
|
||||
--ignore-table=vn.workerTeam__
|
||||
--ignore-table=vn.XDiario__
|
||||
)
|
||||
mysqldump \
|
||||
--defaults-file=config.production.ini \
|
||||
--default-character-set=utf8 \
|
||||
|
@ -25,4 +102,5 @@ mysqldump \
|
|||
--triggers --routines --events \
|
||||
--databases \
|
||||
${SCHEMAS[@]} \
|
||||
${IGNORETABLES[@]} \
|
||||
> dump/structure.sql
|
||||
|
|
|
@ -19,4 +19,4 @@ services:
|
|||
volumes:
|
||||
- /containers/salix:/etc/salix
|
||||
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
||||
- /mnt/storage/dms:/var/lib/salix/dms
|
||||
- /mnt/storage/dms:/var/lib/salix/dms
|
||||
|
|
|
@ -116,16 +116,12 @@ describe('Claim development', () => {
|
|||
const responsible = await nightmare
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResponsibleAutocomplete} input`, 'value');
|
||||
|
||||
const worker = await nightmare
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimWorkerAutocomplete} input`, 'value');
|
||||
|
||||
const redelivery = await nightmare
|
||||
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimRedeliveryAutocomplete} input`, 'value');
|
||||
|
||||
expect(reason).toEqual('Prisas');
|
||||
expect(result).toEqual('Otros daños');
|
||||
expect(responsible).toEqual('Compradores');
|
||||
expect(worker).toEqual('managerNick');
|
||||
expect(redelivery).toEqual('Cliente');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
/**
|
||||
* Returns a set of allowed values defined on table scheme
|
||||
|
@ -7,7 +9,6 @@ module.exports = Self => {
|
|||
Self.getSetValues = async function(column) {
|
||||
let model = this.app.models[this.modelName].definition;
|
||||
let properties = model.properties;
|
||||
let columnName;
|
||||
let tableName = this.modelName;
|
||||
let schema = null;
|
||||
|
||||
|
@ -17,35 +18,32 @@ module.exports = Self => {
|
|||
schema = tableSplit.pop() || null;
|
||||
}
|
||||
|
||||
if (properties[column]) {
|
||||
columnName = column;
|
||||
let property = properties[column];
|
||||
|
||||
if (properties[column].mysql)
|
||||
columnName = properties[column].mysql.columnName;
|
||||
}
|
||||
if (!property)
|
||||
throw new UserError(`Column does not exist`);
|
||||
|
||||
let findColumn = Object.keys(properties).find(prop => {
|
||||
return properties[prop].mysql && properties[prop].mysql.columnName === column;
|
||||
});
|
||||
let columnName = property.mysql
|
||||
? property.mysql.columnName
|
||||
: column;
|
||||
|
||||
if (findColumn)
|
||||
columnName = properties[findColumn].mysql.columnName;
|
||||
|
||||
let type = await this.rawSql(
|
||||
`SELECT DISTINCT column_type FROM information_schema.columns
|
||||
let columnInfo = await this.rawSql(
|
||||
`SELECT column_type columnType
|
||||
FROM information_schema.columns
|
||||
WHERE table_name = ?
|
||||
AND table_schema = IFNULL(?, DATABASE())
|
||||
AND column_name = ?`,
|
||||
[tableName, schema, columnName]
|
||||
);
|
||||
|
||||
if (!type) return;
|
||||
if (!columnInfo || !columnInfo[0])
|
||||
throw new UserError(`Cannot fetch column values`);
|
||||
|
||||
let setValues;
|
||||
setValues = type[0].column_type;
|
||||
setValues = setValues.replace(/set\((.*)\)/i, '$1');
|
||||
setValues = setValues.replace(/'/g, '');
|
||||
setValues = setValues.match(new RegExp(/(\w+)+/, 'ig'));
|
||||
setValues = columnInfo[0].columnType
|
||||
.replace(/^set\((.*)\)$/i, '$1')
|
||||
.replace(/'/g, '')
|
||||
.match(new RegExp(/(\w+)+/, 'ig'));
|
||||
|
||||
let values = [];
|
||||
setValues.forEach(setValue => {
|
||||
|
|
|
@ -13,11 +13,4 @@ describe('Model getSetValues()', () => {
|
|||
expect(result.length).toEqual(6);
|
||||
expect(result[5].value).toEqual('TABLET_VN');
|
||||
});
|
||||
|
||||
it('should return an array of set values from table column source_app', async() => {
|
||||
let result = await app.models.Order.getSetValues('source_app');
|
||||
|
||||
expect(result.length).toEqual(6);
|
||||
expect(result[5].value).toEqual('TABLET_VN');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -35,7 +35,11 @@ xdescribe('Worker absences()', () => {
|
|||
let workerFk = 106;
|
||||
let worker = await app.models.WorkerLabour.findById(workerFk);
|
||||
let endedDate = worker.ended;
|
||||
await worker.updateAttributes({ended: null});
|
||||
|
||||
await app.models.WorkerLabour.rawSql(
|
||||
`UPDATE postgresql.business SET date_end = ? WHERE business_id = ?`,
|
||||
[null, worker.businessFk]
|
||||
);
|
||||
|
||||
let ctx = {req: {accessToken: {userId: 9}}};
|
||||
|
||||
|
@ -64,7 +68,10 @@ xdescribe('Worker absences()', () => {
|
|||
expect(sixthType).toEqual('Holidays');
|
||||
|
||||
// restores the contract end date
|
||||
await worker.updateAttributes({ended: endedDate});
|
||||
await app.models.WorkerLabour.rawSql(
|
||||
`UPDATE postgresql.business SET date_end = ? WHERE business_id = ?`,
|
||||
[endedDate, worker.businessFk]
|
||||
);
|
||||
});
|
||||
|
||||
it('should give the same holidays as worked days since the holidays amount matches the amount of days in a year', async() => {
|
||||
|
@ -113,7 +120,10 @@ xdescribe('Worker absences()', () => {
|
|||
startingContract.setMonth(today.getMonth());
|
||||
startingContract.setDate(1);
|
||||
|
||||
await contract.updateAttributes({started: startingContract});
|
||||
await app.models.WorkerLabour.rawSql(
|
||||
`UPDATE postgresql.business SET date_start = ? WHERE business_id = ?`,
|
||||
[startingContract, contract.businessFk]
|
||||
);
|
||||
|
||||
let ctx = {req: {accessToken: {userId: 106}}};
|
||||
let workerFk = 106;
|
||||
|
@ -149,6 +159,10 @@ xdescribe('Worker absences()', () => {
|
|||
days: originalHolidaysValue
|
||||
}
|
||||
);
|
||||
await contract.updateAttributes({started: contractStartDate});
|
||||
|
||||
await app.models.WorkerLabour.rawSql(
|
||||
`UPDATE postgresql.business SET date_start = ? WHERE business_id = ?`,
|
||||
[contractStartDate, contract.businessFk]
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue