Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
14| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_accion | varchar | 30 | |
| @p_app_id | tinyint | 1 | |
| @p_blade | varchar | 200 | |
| @p_app_key | varchar | 500 | |
| @p_spa | varchar | 4096 | |
| @p_por | varchar | 4096 | |
| @p_eng | varchar | 4096 | |
| @p_user_id | int | 4 | |
| @p_lang | varchar | 20 | |
| @p_texto | varchar | 4096 | |
| @p_terminada_eng | bit | 1 | |
| @p_terminada_por | bit | 1 | |
| @p_traduccion | int | 4 | |
| @p_cliente | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/* SP TRADUCCIONES_WEB */
/*
exec traducciones_web 'LOTEBYAPPID',99,NULL,'INQUIRO'
SELECT DISTINCT APP_ID FROM traducciones
*/
CREATE OR ALTER PROCEDURE dbo.traducciones_web
@p_accion varchar(30) = null,
@p_app_id tinyint = null,
@p_blade varchar(200) = null,
@p_app_key varchar(500) = null,
@p_spa varchar(4096) = null,
@p_por varchar(4096) = null,
@p_eng varchar(4096) = null,
@p_user_id int = null,
@p_lang varchar(20) = null,
@p_texto varchar(4096) = null,
@p_terminada_eng bit = 0,
@p_terminada_por bit = 0,
@p_traduccion int = null,
@p_cliente int = null
AS
BEGIN
SET NOCOUNT ON;
DECLARE @V_accion varchar(30) = @p_accion
DECLARE @V_app_id tinyint = @p_app_id
DECLARE @V_blade varchar(200) = @p_blade
DECLARE @V_app_key varchar(500) = @p_app_key
DECLARE @V_spa varchar(4096) = @p_spa
DECLARE @V_por varchar(4096) = @p_por
DECLARE @V_eng varchar(4096) = @p_eng
DECLARE @V_user_id int = @p_user_id
DECLARE @V_lang varchar(20) = @p_lang
DECLARE @V_texto varchar(4096) = @p_texto
DECLARE @V_terminada_eng bit = @p_terminada_eng
DECLARE @V_terminada_por bit = @p_terminada_por
DECLARE @V_traduccion int = @p_traduccion
DECLARE @V_cliente int = @p_cliente
set @V_spa=replace(@V_spa,'''','')
set @V_por=replace(@V_por,'''','')
set @V_eng=replace(@V_eng,'''','')
if (@V_accion = 'insert') begin
insert into traducciones
(app_id, blade, app_key, spa, por, eng, created, created_by,terminada_eng,terminada_por)
values
(@V_app_id, @V_blade, @V_app_key, @V_spa, @V_spa, @V_spa, GETDATE(), @V_user_id,0,0)
end else begin
create table #apps (app_id tinyint, app_name varchar(50))
insert into #apps values (1, 'Backend Fidelitas')
insert into #apps values (2, 'Clientes Inquiro')
insert into #apps values (3, 'Web Fidelitas')
insert into #apps values (4, 'Web de Legajos')
insert into #apps values (5, 'Contratista Imperium')
if (@V_accion = 'get') begin
if (@V_app_id > 0 AND @V_blade is not null)
begin
if (@V_app_key is null)
SELECT traducciones.*, clientes.nombre_cliente FROM traducciones left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.app_id = @V_app_id
AND traducciones.blade = @V_blade
else
SELECT traducciones.*, clientes.nombre_cliente FROM traducciones left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.app_id = @V_app_id
AND traducciones.blade = @V_blade
AND traducciones.app_key = @V_app_key
end
else
begin
if (@V_app_id is null) begin
if(@V_terminada_eng = 1)
begin
select #apps.app_name, traducciones.*, clientes.nombre_cliente from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.terminada_eng = @V_lang
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
if(@V_terminada_por = 1)
begin
select #apps.app_name, traducciones.*, clientes.nombre_cliente from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.terminada_por = @V_lang
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
end else begin
if(@V_terminada_eng = 1)
begin
select #apps.app_name, traducciones.*, clientes.nombre_cliente from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.terminada_eng = @V_lang
and traducciones.app_id = @V_app_id
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
if(@V_terminada_por = 1)
begin
select #apps.app_name, traducciones.*, clientes.nombre_cliente from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.terminada_por = @V_lang
and traducciones.app_id = @V_app_id
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
end
end
end
if (@V_accion = 'search') begin
select #apps.app_name, traducciones.* from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
drop table #apps
declare @dinamico bit = 0
select @dinamico = valor_dinamico from traducciones
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
if (@V_accion = 'update') begin
if (@V_spa is not null)
if (@dinamico = 0)
if (@V_traduccion is null)
update traducciones set
spa = @V_spa,
modified = GETDATE(),
modified_by = @V_user_id
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
else
update traducciones set
spa = @V_spa,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@V_traduccion is null)
update traducciones set
spa = @V_spa,
modified = GETDATE(),
modified_by = @V_user_id
where app_key = @V_app_key
else
update traducciones set
spa = @V_spa,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@V_por is not null)
if (@dinamico = 0)
if (@V_traduccion is null)
update traducciones set
por = @V_por,
modified = GETDATE(),
modified_by = @V_user_id
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
else
update traducciones set
por = @V_por,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@V_traduccion is null)
update traducciones set
por = @V_por,
modified = GETDATE(),
modified_by = @V_user_id
where app_key = @V_app_key
else
update traducciones set
por = @V_por,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@dinamico = 0)
if (@V_traduccion is null)
update traducciones set
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
else
update traducciones set
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@V_traduccion is null)
update traducciones set
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id
where app_key = @V_app_key
else
update traducciones set
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
end
if (@V_accion = 'update-all') begin
if (@dinamico = 0)
update traducciones set
spa = @V_spa,
por = @V_por,
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id,
terminada_eng = iif(terminada_eng = 0 and @V_terminada_eng = 0,0,@V_terminada_eng),
terminada_por = iif(terminada_por = 0 and @V_terminada_por = 0,0,@V_terminada_por)
where /*app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
*/
id_traduccion = @V_traduccion
else
update traducciones set
spa = @V_spa,
por = @V_por,
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id,
terminada_eng = iif(terminada_eng = 0 and @V_terminada_eng = 0,0,@V_terminada_eng),
terminada_por = iif(terminada_por = 0 and @V_terminada_por = 0,0,@V_terminada_por)
where-- app_key = @V_app_key
id_traduccion = @V_traduccion
end
if (@V_accion = 'select') begin
if (@V_cliente is null)
select traducciones.* from traducciones
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
else
select traducciones.* from traducciones
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
and cliente = @V_cliente
end
if (UPPER(@V_accion) = 'LOTEBYAPPID') begin
select traducciones.* from traducciones where app_id = @V_app_id /*AND app_key=@p_app_key*/
end
if (UPPER(@V_accion) = 'LOTEBYAPPKEY') begin
select traducciones.* from traducciones where app_key=@p_app_key
end
if (@V_accion = 'selectkey') begin
if (@V_traduccion > 0)
SELECT traducciones.*, clientes.nombre_cliente FROM traducciones left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.id_traduccion= @V_traduccion
end
end
END
GO
GO
/* SP TRADUCCIONES_WEB */
/*
exec traducciones_web 'LOTEBYAPPID',99,NULL,'INQUIRO'
SELECT DISTINCT APP_ID FROM traducciones
*/
CREATE OR ALTER PROCEDURE dbo.traducciones_web
@p_accion varchar(30) = null,
@p_app_id tinyint = null,
@p_blade varchar(200) = null,
@p_app_key varchar(500) = null,
@p_spa varchar(4096) = null,
@p_por varchar(4096) = null,
@p_eng varchar(4096) = null,
@p_user_id int = null,
@p_lang varchar(20) = null,
@p_texto varchar(4096) = null,
@p_terminada_eng bit = 0,
@p_terminada_por bit = 0,
@p_traduccion int = null,
@p_cliente int = null
AS
BEGIN
SET NOCOUNT ON;
DECLARE @V_accion varchar(30) = @p_accion
DECLARE @V_app_id tinyint = @p_app_id
DECLARE @V_blade varchar(200) = @p_blade
DECLARE @V_app_key varchar(500) = @p_app_key
DECLARE @V_spa varchar(4096) = @p_spa
DECLARE @V_por varchar(4096) = @p_por
DECLARE @V_eng varchar(4096) = @p_eng
DECLARE @V_user_id int = @p_user_id
DECLARE @V_lang varchar(20) = @p_lang
DECLARE @V_texto varchar(4096) = @p_texto
DECLARE @V_terminada_eng bit = @p_terminada_eng
DECLARE @V_terminada_por bit = @p_terminada_por
DECLARE @V_traduccion int = @p_traduccion
DECLARE @V_cliente int = @p_cliente
set @V_spa=replace(@V_spa,'''','')
set @V_por=replace(@V_por,'''','')
set @V_eng=replace(@V_eng,'''','')
if (@V_accion = 'insert') begin
insert into traducciones
(app_id, blade, app_key, spa, por, eng, created, created_by,terminada_eng,terminada_por)
values
(@V_app_id, @V_blade, @V_app_key, @V_spa, @V_spa, @V_spa, GETDATE(), @V_user_id,0,0)
end else begin
create table #apps (app_id tinyint, app_name varchar(50))
insert into #apps values (1, 'Backend Fidelitas')
insert into #apps values (2, 'Clientes Inquiro')
insert into #apps values (3, 'Web Fidelitas')
insert into #apps values (4, 'Web de Legajos')
insert into #apps values (5, 'Contratista Imperium')
if (@V_accion = 'get') begin
if (@V_app_id > 0 AND @V_blade is not null)
begin
if (@V_app_key is null)
SELECT traducciones.*, clientes.nombre_cliente FROM traducciones left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.app_id = @V_app_id
AND traducciones.blade = @V_blade
else
SELECT traducciones.*, clientes.nombre_cliente FROM traducciones left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.app_id = @V_app_id
AND traducciones.blade = @V_blade
AND traducciones.app_key = @V_app_key
end
else
begin
if (@V_app_id is null) begin
if(@V_terminada_eng = 1)
begin
select #apps.app_name, traducciones.*, clientes.nombre_cliente from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.terminada_eng = @V_lang
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
if(@V_terminada_por = 1)
begin
select #apps.app_name, traducciones.*, clientes.nombre_cliente from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.terminada_por = @V_lang
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
end else begin
if(@V_terminada_eng = 1)
begin
select #apps.app_name, traducciones.*, clientes.nombre_cliente from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.terminada_eng = @V_lang
and traducciones.app_id = @V_app_id
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
if(@V_terminada_por = 1)
begin
select #apps.app_name, traducciones.*, clientes.nombre_cliente from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.terminada_por = @V_lang
and traducciones.app_id = @V_app_id
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
end
end
end
if (@V_accion = 'search') begin
select #apps.app_name, traducciones.* from traducciones
inner join #apps on traducciones.app_id = #apps.app_id
order by #apps.app_name, traducciones.blade, traducciones.app_key
end
drop table #apps
declare @dinamico bit = 0
select @dinamico = valor_dinamico from traducciones
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
if (@V_accion = 'update') begin
if (@V_spa is not null)
if (@dinamico = 0)
if (@V_traduccion is null)
update traducciones set
spa = @V_spa,
modified = GETDATE(),
modified_by = @V_user_id
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
else
update traducciones set
spa = @V_spa,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@V_traduccion is null)
update traducciones set
spa = @V_spa,
modified = GETDATE(),
modified_by = @V_user_id
where app_key = @V_app_key
else
update traducciones set
spa = @V_spa,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@V_por is not null)
if (@dinamico = 0)
if (@V_traduccion is null)
update traducciones set
por = @V_por,
modified = GETDATE(),
modified_by = @V_user_id
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
else
update traducciones set
por = @V_por,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@V_traduccion is null)
update traducciones set
por = @V_por,
modified = GETDATE(),
modified_by = @V_user_id
where app_key = @V_app_key
else
update traducciones set
por = @V_por,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@dinamico = 0)
if (@V_traduccion is null)
update traducciones set
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
else
update traducciones set
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
else
if (@V_traduccion is null)
update traducciones set
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id
where app_key = @V_app_key
else
update traducciones set
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id
where id_traduccion= @V_traduccion
end
if (@V_accion = 'update-all') begin
if (@dinamico = 0)
update traducciones set
spa = @V_spa,
por = @V_por,
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id,
terminada_eng = iif(terminada_eng = 0 and @V_terminada_eng = 0,0,@V_terminada_eng),
terminada_por = iif(terminada_por = 0 and @V_terminada_por = 0,0,@V_terminada_por)
where /*app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
*/
id_traduccion = @V_traduccion
else
update traducciones set
spa = @V_spa,
por = @V_por,
eng = @V_eng,
modified = GETDATE(),
modified_by = @V_user_id,
terminada_eng = iif(terminada_eng = 0 and @V_terminada_eng = 0,0,@V_terminada_eng),
terminada_por = iif(terminada_por = 0 and @V_terminada_por = 0,0,@V_terminada_por)
where-- app_key = @V_app_key
id_traduccion = @V_traduccion
end
if (@V_accion = 'select') begin
if (@V_cliente is null)
select traducciones.* from traducciones
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
else
select traducciones.* from traducciones
where app_id = @V_app_id
and blade = @V_blade
and app_key = @V_app_key
and cliente = @V_cliente
end
if (UPPER(@V_accion) = 'LOTEBYAPPID') begin
select traducciones.* from traducciones where app_id = @V_app_id /*AND app_key=@p_app_key*/
end
if (UPPER(@V_accion) = 'LOTEBYAPPKEY') begin
select traducciones.* from traducciones where app_key=@p_app_key
end
if (@V_accion = 'selectkey') begin
if (@V_traduccion > 0)
SELECT traducciones.*, clientes.nombre_cliente FROM traducciones left outer join clientes on traducciones.cliente = clientes.cliente
WHERE traducciones.id_traduccion= @V_traduccion
end
end
END
GO
Depends On
2Used By
No items found