This topic is locked

Menu modify

2/1/2023 6:15:08 AM
PHPRunner General questions
R
RAMGestion author

I have this code on "Menu Modify" but it doesn't run:
echo "Empresa= ".$_SESSION['empresa'];echo "</br>";echo "</br>";echo "</br>";
if( $menu->name() == "empresa" ) {
$menuItem=$menu->getItem(2);
// if ($menuItem->getTitle()=="Fiestas")
$menuItem->setParams("mastertable=empresas&masterkey1=".$_SESSION['empresa']);
}

img alt
This image shows the result.
What could be happening?

S
sfuente 2/1/2023

Hola buen día yo suelo usar así:

podemos compartir ideas, en español mi whatsapp 8135 95 3637

img alt

$strSQLExists = "select * from usuarios where user='".$_SESSION["UserID"]."'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data){
$_SESSION['k_usuario'] =$data["id"];
$_SESSION['sucursal'] =($data["sucursal"]==NULL||$data["sucursal"]==0?1:$data["sucursal"]);
}else{
$_SESSION['sucursal'] =0;
}
$hoy = date("d/m/Y",strtotime("-0 hour"));
$hoy = date("d/m/Y");
$desde = date("d/m/Y",strtotime("-6 day"));

if ($menuItem->getTitle()=="Editar Rápido Productos") {
$menuItem->setParams( str_replace("k_sucursal",$_SESSION['sucursal'], $menuItem->getParams()) );
}

if ($menuItem->getTitle()=="Ventas Semanales Todas las Sucursales ( Gráfica )") {
$menuItem->setUrl("ventas_semanales_servicios_grafica_chart.php?q=(date~between~".$desde."~date11~".$hoy.")");
}

if ($menuItem->getTitle()=="Ventas Semanales Gráfica") {
$menuItem->setUrl("Ventas_Semanales_Grafica_chart.php?q=(proveedor~equals~".$_SESSION['sucursal'].")(date~between~".$desde."~date11~".$hoy.")");
}

admin 2/1/2023

This is really strange, it looks like it should be working but it doesn't, like the session variable loses its value.

In either case it would be benefitical to upload your project to Demo Account and contact support directly. It must be something really simple.

R
RAMGestion author 2/1/2023

Gracias sfuente pero no era eso lo que yo preguntaba, yo estoy usando el nuevo "Menu Modify" no el antiguo, en el antiguo sí me funciona más o menos bien pero desde que he pasado a la versión 10.9 estoy teniendo problemas de este tipo.
Es como si perdiera en algún momento el valor de la variable de sesión o que no lo usara correctamente porque antes de la instrucción sí funciona.
Esto ocurre cuando pulso por primera vez en alguna opción del menú, cuando pulso por segunda vez, ya me funciona.
He abierto un ticket a ver qué me contestan.