Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6942-improveInvoiceIn
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-05-21 09:03:48 +02:00
commit c914199415
11 changed files with 169 additions and 28 deletions

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`client_userDisable`
ON SCHEDULE EVERY 1 MONTH
STARTS '2023-06-01 00:00:00.000'
ON COMPLETION PRESERVE
ENABLE
DO CALL client_userDisable()$$
DELIMITER ;

View File

@ -1,25 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable`
ON SCHEDULE EVERY 1 MONTH
STARTS '2023-06-01 00:00:00.000'
ON COMPLETION PRESERVE
ENABLE
DO BEGIN
UPDATE account.user u
JOIN client c ON c.id = u.id
LEFT JOIN account.account a ON a.id = u.id
SET u.active = FALSE
WHERE c.typeFk = 'normal'
AND a.id IS NULL
AND u.active
AND c.created < util.VN_CURDATE() - INTERVAL 12 MONTH
AND u.id NOT IN (
SELECT DISTINCT c.id
FROM client c
LEFT JOIN ticket t ON t.clientFk = c.id
WHERE c.salesPersonFk IS NOT NULL
OR t.created > util.VN_CURDATE() - INTERVAL 12 MONTH
OR shipped > util.VN_CURDATE() - INTERVAL 12 MONTH
);
END$$
DELIMITER ;

View File

@ -0,0 +1,33 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_userDisable`()
BEGIN
/**
* Desactiva los clientes inactivos en los últimos X meses.
*/
DECLARE vMonths INT;
SELECT monthsToDisableUser INTO vMonths
FROM clientConfig;
IF vMonths IS NULL THEN
CALL util.throw('Config parameter not set');
END IF;
UPDATE account.user u
JOIN client c ON c.id = u.id
LEFT JOIN account.account a ON a.id = u.id
SET u.active = FALSE
WHERE c.typeFk = 'normal'
AND a.id IS NULL
AND u.active
AND c.created < util.VN_CURDATE() - INTERVAL vMonths MONTH
AND u.id NOT IN (
SELECT DISTINCT c.id
FROM client c
LEFT JOIN ticket t ON t.clientFk = c.id
WHERE c.salesPersonFk IS NOT NULL
OR t.created > util.VN_CURDATE() - INTERVAL vMonths MONTH
OR shipped > util.VN_CURDATE() - INTERVAL vMonths MONTH
);
END$$
DELIMITER ;

View File

@ -151,8 +151,8 @@ BEGIN
supplier,
entryFk,
landed,
`in`,
`out`,
CAST(`in` AS DECIMAL(10,0)) `in`,
CAST(`out` AS DECIMAL(10,0)) `out`,
warehouse,
buyingValue,
balance

View File

@ -28,6 +28,5 @@ AS SELECT `c`.`id` AS `Id_Compra`,
`c`.`workerFk` AS `Id_Trabajador`,
`c`.`weight` AS `weight`,
`c`.`dispatched` AS `dispatched`,
`c`.`containerFk` AS `container_id`,
`c`.`itemOriginalFk` AS `itemOriginalFk`
FROM `vn`.`buy` `c`

View File

@ -0,0 +1,5 @@
ALTER TABLE vn.clientConfig
ADD monthsToDisableUser int(10) unsigned DEFAULT NULL NULL;
UPDATE IGNORE vn.clientConfig
SET monthsToDisableUser = 12;

View File

@ -0,0 +1,26 @@
DROP TABLE IF EXISTS vn2008.scanTree__;
DROP TABLE IF EXISTS vn2008.payroll_embargos__;
DROP TABLE IF EXISTS vn2008.unary_source__;
DROP TABLE IF EXISTS vn2008.unary_scan__;
DROP TABLE IF EXISTS vn2008.unary_scan_line_buy__;
DROP TABLE IF EXISTS vn2008.unary_scan_line__;
DROP TABLE IF EXISTS vn2008.scan_line__;
DROP TABLE IF EXISTS vn2008.Familias__;
DROP TABLE IF EXISTS vn2008.language__;
DROP TABLE IF EXISTS vn2008.Clientes_dits__;
DROP TABLE IF EXISTS vn2008.unary_scan_line_expedition__;
DROP TABLE IF EXISTS vn2008.warehouse_group__;
DROP TABLE IF EXISTS vn2008.Espionajes__;
DROP TABLE IF EXISTS vn2008.jerarquia__;
DROP TABLE IF EXISTS vn2008.wks__;
DROP TABLE IF EXISTS vn2008.Proveedores_comunicados__;
DROP TABLE IF EXISTS vn2008.integra2_escala__;
DROP TABLE IF EXISTS vn2008.cp__;
DROP TABLE IF EXISTS vn2008.unary__;
DROP TABLE IF EXISTS vn2008.Estados__;
DROP TABLE IF EXISTS vn2008.agency_hour__;
DROP TABLE IF EXISTS vn2008.Reservas__;
DROP TABLE IF EXISTS vn2008.cyc_declaration__;
DROP TABLE IF EXISTS vn2008.route__;
DROP TABLE IF EXISTS vn2008.Proveedores_escritos__;
DROP TABLE IF EXISTS vn2008.config__;

View File

@ -0,0 +1,41 @@
DROP TABLE IF EXISTS vn2008.form_query__;
DROP TABLE IF EXISTS vn2008.filtros__;
DROP TABLE IF EXISTS vn2008.Objetivos__;
UPDATE IGNORE vn.province
SET zoneFk = NULL
WHERE zoneFk IN (
SELECT zoneFk
FROM vn.province
WHERE zoneFk IS NOT NULL AND zoneFk NOT IN (SELECT id FROM vn.`zone`)
);
ALTER TABLE vn.province DROP FOREIGN KEY province_zone_fk;
ALTER TABLE vn.province MODIFY COLUMN zoneFk int(11) DEFAULT NULL NULL;
ALTER TABLE vn.province ADD CONSTRAINT
province_zone_FK FOREIGN KEY (zoneFk) REFERENCES vn.`zone`(id) ON DELETE CASCADE ON UPDATE CASCADE;
DROP TABLE IF EXISTS vn2008.zones__;
DROP TABLE IF EXISTS vn2008.rec_translator__;
DROP TABLE IF EXISTS vn2008.warehouse_joined__;
DROP TABLE IF EXISTS vn2008.warehouse_filtro__;
DROP TABLE IF EXISTS vn2008.viaxpress__;
DROP TABLE IF EXISTS vn2008.cl_que__;
DROP TABLE IF EXISTS vn2008.Recibos_recorded__;
RENAME TABLE vn.coolerPathDetail TO vn.coolerPathDetail__;
ALTER TABLE vn.coolerPathDetail__ DROP FOREIGN KEY coolerPathDetail_FK;
DROP TABLE IF EXISTS vn2008.cooler_path__;
DROP TABLE IF EXISTS vn2008.payrroll_apEmpresarial__;
DROP TABLE IF EXISTS vn2008.Compres_ok__;
DROP TABLE IF EXISTS vn2008.Movimientos_avisar__;
DROP TABLE IF EXISTS vn2008.Clases__;
DROP TABLE IF EXISTS vn2008.payroll_basess__;
DROP TABLE IF EXISTS vn2008.payroll_tipobasess__;
DROP TABLE IF EXISTS vn2008.guillen__;
DROP TABLE IF EXISTS vn2008.guillen_carry__;
DROP TABLE IF EXISTS vn2008.Series__;
DROP TABLE IF EXISTS vn2008.Permisos__;
ALTER TABLE vn.buy DROP FOREIGN KEY buy_FK_1;
DROP TABLE IF EXISTS vn2008.container__;
DROP TABLE IF EXISTS vn2008.travel_reserve__;
DROP TABLE IF EXISTS vn2008.tmpNEWTARIFAS__;
DROP TABLE IF EXISTS vn2008.Clientes_potenciales__;
DROP TABLE IF EXISTS vn2008.duaDismissed__;
DROP TABLE IF EXISTS vn2008.cl_pet__;

View File

@ -0,0 +1,27 @@
DROP TABLE IF EXISTS vn2008.expeditions_deleted__;
DROP TABLE IF EXISTS vn2008.Tipos_f11__;
DROP TABLE IF EXISTS vn2008.commission__;
DROP TABLE IF EXISTS vn2008.Movimientos_revisar__;
DROP TABLE IF EXISTS vn2008.recibida_agricola__;
DROP TABLE IF EXISTS vn2008.tipsa__;
DROP TABLE IF EXISTS vn2008.rounding__;
DROP TABLE IF EXISTS vn2008.Informes__;
DROP TABLE IF EXISTS vn2008.Monitoring__;
DROP TABLE IF EXISTS vn2008.Forms__;
DROP TABLE IF EXISTS vn2008.Clientes_event__;
DROP TABLE IF EXISTS vn2008.wh_selection__;
DROP TABLE IF EXISTS vn2008.template_bionic_component__;
DROP TABLE IF EXISTS vn2008.Agencias_province__;
DROP TABLE IF EXISTS vn2008.travel_pattern__;
DROP TABLE IF EXISTS vn2008.sort_merge_results_ernesto__;
DROP TABLE IF EXISTS vn2008.Conteo__;
DROP TABLE IF EXISTS vn2008.Consignatarios_devices__;
DROP TABLE IF EXISTS vn2008.link__;
DROP TABLE IF EXISTS vn2008.agency_warehouse__;
DROP TABLE IF EXISTS vn2008.warehouse_lc__;
DROP TABLE IF EXISTS vn2008.emp_day_pay__;
DROP TABLE IF EXISTS vn2008.Entradas_kop__;
DROP TABLE IF EXISTS vn2008.dock__;
DROP TABLE IF EXISTS vn2008.unaryScanFilter__;
DROP TABLE IF EXISTS vn2008.Grupos__;
DROP TABLE IF EXISTS vn2008.nichos__;

View File

@ -0,0 +1,26 @@
DROP TABLE IF EXISTS vn2008.preparation_exception__;
DROP TABLE IF EXISTS vn2008.Clientes_empresa__;
DROP TABLE IF EXISTS vn2008.call_information__;
DROP TABLE IF EXISTS vn2008.template_bionic_price__;
DROP TABLE IF EXISTS vn2008.invoice_observation__;
DROP TABLE IF EXISTS vn2008.edi_testigos__;
DROP TABLE IF EXISTS vn2008.cl_dep__;
DROP TABLE IF EXISTS vn2008.agencia_descuadre__;
DROP TABLE IF EXISTS vn2008.payroll_datos__;
DROP TABLE IF EXISTS vn2008.tblIVA__;
DROP TABLE IF EXISTS vn2008.cyc__;
DROP TABLE IF EXISTS vn2008.Tickets_stack__;
DROP TABLE IF EXISTS vn2008.config_host_forms__;
DROP TABLE IF EXISTS vn2008.template_bionic_lot__;
DROP TABLE IF EXISTS vn2008.payroll_bonificaciones__;
DROP TABLE IF EXISTS vn2008.widget__;
DROP TABLE IF EXISTS vn2008.accion_dits__;
DROP TABLE IF EXISTS vn2008.credit_card__;
DROP TABLE IF EXISTS vn2008.Brasa__;
DROP TABLE IF EXISTS vn2008.Jefes__;
DROP TABLE IF EXISTS vn2008.call_option__;
DROP TABLE IF EXISTS vn2008.expeditions_pictures__;
DROP TABLE IF EXISTS vn2008.scan__;
DROP TABLE IF EXISTS vn2008.trolley__;
DROP TABLE IF EXISTS vn2008.transport__;
DROP TABLE IF EXISTS vn2008.Baldas__;

View File

@ -0,0 +1 @@
ALTER TABLE vn.buy CHANGE containerFk containerFk__ smallint(5) unsigned DEFAULT NULL NULL;