Re: problem with global var in server
ok. this is my project
Control: ctrl_access
Tab: coord_ctrl
Form: form_confirmar
Grid: coord_prel_lim
Menu: menu_ca
ctrl_access
Events: onValidate: sc_lookup(rec_set,“Select count(*), usu_id, usu_nombre, usu_paterno, usu_tipo, usu_nivel from usuario where usu_login=’{user}’ and usu_passwd=’{passwd}’ GROUP BY usu_id, usu_nombre, usu_paterno, usu_tipo, usu_nivel”);
if({rec_set[0][0]}<=0)
{
sc_error_message(“Usuario o Contrase?a incorrectos.”);
}else{
[usu_id]={rec_set[0][1]};
[usu_nombre]={rec_set[0][2]};
[usu_paterno]={rec_set[0][3]};
[usu_tipo]={rec_set[0][4]};
[usu_nivel]={rec_set[0][5]};
sc_redir(menu_ca,usu_id=[usu_id]; usu_nombre=[usu_nombre]; usu_paterno=[usu_paterno]; usu_tipo=[usu_tipo]; usu_nivel=[usu_nivel]
…
form_confirmar
atribute values: on update: est_mod_user: [usu_id]
events: onAfterUpdate: sc_redir(coord_ctrl);
coord_prel_lim
SQL:
SELECT e.est_id, i.inv_id, s.sol_id, i.inv_nombre, i.inv_paterno, i.inv_materno, e.est_responsable, e.est_fech_sol, e.est_fech_prel_lim, a.emp_codigo, d.tipo_inst
FROM
public.investigado i, public.estudio e, public.solicitud s, public.empresa a, public.tipo_instrumento d
WHERE
e.est_confirmada=‘1’ and s.sol_inv_id=i.inv_id and e.est_sol_id=s.sol_id and d.tipo_id=e.est_tipo_id and a.emp_id=i.inv_emp_id and e.est_id_coord=[usu_id] and e.est_fech_prel IS NULL and e.est_sts_id<>10 and e.est_sts2_id<>13
Events: onRecord: … sc_lookup(exist, “SELECT count(*) FROM atrasos WHERE atr_usu_id=[usu_id] and atr_sol_id={s.sol_id}”); …
Link: Aplication . form_confirmar (parameters: usu_id - var usu_id)
the process:
1.- Access the system by ctrl_access, redirect to menu_ca
2.- menu_ca execute coord_ctrl
3.- coord_ctrl execute coord_prel_lim (Global variable: attribute:usu_id ; scope: SESSION ; Type: in ; defined in: SQL command,
PHP formula (onLoadRecord) ) and works fine
4.- click to edit row with aplication link (form_confirmar)
5.- open form_confirmar with data
6.- click update button (give me an error on update but i can see wich one, only appear some times, only appear “procesing” leyend on top of page and don’t execute the redir function)
7.- when return to coord_ctrl tab the grid doesn’t work, give me this error:
Error al acceder el banco de datos
ERROR: syntax error at or near “[” at character 279
select count(*) from public.investigado i, public.estudio e, public.solicitud s, public.empresa a, public.tipo_instrumento d where e.est_confirmada=‘1’ and s.sol_inv_id=i.inv_id and e.est_sol_id=s.sol_id and d.tipo_id=e.est_tipo_id and a.emp_id=i.inv_emp_id and e.est_id_coord=[usu_id] and e.est_fech_prel IS NULL and e.est_sts_id<>10 and e.est_sts2_id<>13
if delete this part:
form_confirmar
atribute values: on update: est_mod_user: [usu_id]
events: onUpdate: sc_redir(coord_ctrl);
form_confirmar works fine in step 6
but grid give me the same error
the grid error only occurs when return of form_confirm
I have other form:
form_estudio
atribute values: on insert: est_ingr_user: [usu_id]
events: onAfterInsert: sc_redir(coord_ctrl);
and works fine. after insert the grid works fine to. BUT in this form [usu_id] don’t appear in Aplication- Global Variable
the project works in local machine, no errors (win 7, wamp server(apache 2.2.11, php 5.2.5) , postgres)
but in server doesn’t work (linux, apache 1.3.41, php 5.2.9, postgres)
in coord_prel_lim.php line 542:
if (!isset($_SESSION[‘usu_id’]))
{
$this->nm_falta_var .= "usu_id; ";
}
i added:
else{echo "exists session var: ".$_SESSION[‘usu_id’];}
on load the var have numeric data (id of my table) but after error var have “[usu_id]” as text.
I hope having explained
Thanks a lot!