From 7a8dbc2420dc40490d2ab70c5ab7e4f93e87f350 Mon Sep 17 00:00:00 2001 From: roberto Date: Mon, 11 Jun 2012 14:48:47 +0000 Subject: [PATCH] =?UTF-8?q?Cambios=20para=20usuario=20ISBAN,=20los=20usuar?= =?UTF-8?q?ios=20de=20cliente,=20solo=20ver=C3=A1n=20las=20solicitudes=20d?= =?UTF-8?q?e=20ofertas=20suyas,=20el=20campo=20que=20establece=20en=20el?= =?UTF-8?q?=20usuario=20a=20que=20cliente=20pertenece=20es=20cliente=5Fact?= =?UTF-8?q?ual?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk@147 e2b1556b-49f8-d141-9351-52d6861a72d9 --- src/Objects/HTML.php | 3 ++- src/Objects/ListaPedido.php | 21 +++++++++++++++++--- src/aplicacion.php | 2 +- src/lista_pedidos.php | 4 ++-- src/ver_lista_pedidos.php | 39 +++++++++++++++++++++++++------------ src/ver_oferta.php | 13 ++++++++----- 6 files changed, 58 insertions(+), 24 deletions(-) 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 = ""; ?>