diff --git a/src/Objects/HTML.php b/src/Objects/HTML.php index 1908b0f..3e2054d 100644 --- a/src/Objects/HTML.php +++ b/src/Objects/HTML.php @@ -66,7 +66,8 @@ if($usuario->tieneRol("3") ||$usuario->tieneRol("1")){ echo ''.$this->locale['1008'].''; } - echo ''.$this->locale['1009'].''; + + //echo ''.$this->locale['1009'].''; // Buscar candidatos /*if(substr_count($_SERVER['REQUEST_URI'],"/pedido.php?idPedido")==1){ echo ''.$this->locale['820'].''; diff --git a/src/Objects/ListaPedido.php b/src/Objects/ListaPedido.php index b73f7ba..7ede248 100644 --- a/src/Objects/ListaPedido.php +++ b/src/Objects/ListaPedido.php @@ -72,7 +72,7 @@ include_once("Objects/Pedido.php"); $estado = $this->tipo; if($this->pedidos == null){ //Modificamos la consulta en función del rol. - if($this->gestor->tieneRol(4) || $this->gestor->tieneRol(1)){ + if($this->gestor->tieneRol(4) || $this->gestor->tieneRol(1) || $this->gestor->tieneRol(7)){ if($this->sql != ""){ // metemos el tipo si es >0 if($estado > 0){ @@ -94,9 +94,23 @@ include_once("Objects/Pedido.php"); $consulta = $sqlNueva." ".$this->order_by; }else{ if($estado > 0){ - $consulta = "SELECT * from pedidos WHERE estado='".$estado."'".$this->orden ; + $consulta = "SELECT * from pedidos WHERE estado='".$estado."'"; + + //En el caso de ser un usuario de cliente para ver sus pedidos filtramos por cliente + if (($this->gestor->tieneRol(7)) && ($this->gestor->getValor("cliente_actual")>0)){ + $consulta .= " and cliente = ". $this->gestor->getValor("cliente_actual") . " "; + } + + $consulta .= $this->orden; }else{ - $consulta = "SELECT * from pedidos ".$this->orden.""; + $consulta = "SELECT * from pedidos "; + + //En el caso de ser un usuario de cliente para ver sus pedidos filtramos por cliente + if (($this->gestor->tieneRol(7)) && ($this->gestor->getValor("cliente_actual")>0)){ + $consulta .= " where cliente = ". $this->gestor->getValor("cliente_actual") . " "; + } + + $consulta .= $this->orden; } } }else if($this->gestor->tieneRol(3)){ @@ -132,6 +146,7 @@ include_once("Objects/Pedido.php"); } $bd=new BD(); + $resultado = $bd->execQuery($consulta); //Procesamos los pedidos. if(mysql_num_rows($resultado) == 0){ diff --git a/src/aplicacion.php b/src/aplicacion.php index 1c59046..ce1aa8d 100644 --- a/src/aplicacion.php +++ b/src/aplicacion.php @@ -13,7 +13,7 @@ if(!$usuario->tieneRol("7")) { include("tablero.php"); } else { - header("Location: lista_ofertas.php"); + header("Location: lista_pedidos.php"); } if($_SESSION["oid"]){ diff --git a/src/lista_pedidos.php b/src/lista_pedidos.php index 59c3a75..5704f31 100644 --- a/src/lista_pedidos.php +++ b/src/lista_pedidos.php @@ -4,7 +4,8 @@ include("seguridad.php"); include("functions.php"); if(!$usuario->tieneRol("4") && !$usuario->tieneRol("1") - && !$usuario->tieneRol("3")){ + && !$usuario->tieneRol("3") + && !$usuario->tieneRol("7")){ header("Location: aplicacion.php?e=permiso&rol=".$usuario->getValor("rol")); exit; } @@ -34,7 +35,6 @@ $tipoPedidos = (isset($_GET["byEstado"]) && ($_GET['byEstado'] != "")) ? $_GET[' $listaPedidos=new ListaPedido($usuario,$order_by,"",$tipoPedidos); - include_once("ver_lista_pedidos.php"); diff --git a/src/ver_lista_pedidos.php b/src/ver_lista_pedidos.php index 9b7725a..6b81f6a 100644 --- a/src/ver_lista_pedidos.php +++ b/src/ver_lista_pedidos.php @@ -32,7 +32,7 @@ if (!isset($variablesExtra)) $variablesExtra = ""; ?>