protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->ppage = $this->page->get('ventas_servicios'); $this->agente = FALSE; $this->estado = new estados_servicios(); $servicio = new servicio_cliente(); $this->servicio = FALSE; $this->cliente = new cliente(); $this->cliente_s = FALSE; $this->divisa = new divisa(); $this->ejercicio = new ejercicio(); $this->familia = new familia(); $this->forma_pago = new forma_pago(); $this->impuesto = new impuesto(); $this->nuevo_servicio_url = FALSE; $this->nueva_marca_url = FALSE; $this->nuevo_modelo_url = FALSE; $this->nuevo_tipo_url = FALSE; $this->pais = new pais(); $this->serie = new serie(); $this->fabricante = new fabricante(); $this->marca = new marca(); $this->modelo = new modelo(); $this->tipo = new tipo(); //cargamos configuración de servicios $fsvar = new fs_var(); $this->servicios_setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_marca' => 0, 'servicios_marca' => 0, 'servicios_mostrar_modelo' => 0, 'servicios_modelo' => 0, 'servicios_mostrar_tipo' => 0, 'servicios_tipo' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0), FALSE); /*Cargamos traduccion*/ $this->st = $fsvar->array_get(array('st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_marca' => "Marca del aparato", 'st_modelo' => "Modelo del aparato", 'st_tipo' => "Tipo de aparato"), FALSE); /** * Comprobamos si el usuario tiene acceso a nueva_venta, * necesario para poder añadir líneas. */ if (isset($_GET['delete_detalle'])) { $det0 = new detalle_servicio(); $detalle = $det0->get($_GET['delete_detalle']); if ($detalle) { if ($detalle->delete()) { $this->new_message('Detalle eliminado correctamente.'); } else { $this->new_error_msg('Error al eliminar el detalle.'); } } else { $this->new_error_msg('Detalle no encontrado.'); } } if ($this->user->have_access_to('nueva_venta', FALSE)) { $nuevopedp = $this->page->get('nueva_venta'); if ($nuevopedp) { $this->nuevo_servicio_url = $nuevopedp->url(); } $this->nueva_marca_url = $this->marca->url(); $this->nuevo_modelo_url = $this->modelo->url(); $this->nuevo_tipo_url = $this->tipo->url(); } if (isset($_POST['idservicio'])) { $this->servicio = $servicio->get($_POST['idservicio']); $this->modificar(); } else { if (isset($_GET['id'])) { $this->servicio = $servicio->get($_GET['id']); } } if ($this->servicio) { $this->page->title = $this->servicio->codigo; if (isset($_POST['detalle'])) { $this->agrega_detalle(); } /// cargamos el agente if (!is_null($this->servicio->codagente)) { $agente = new agente(); $this->agente = $agente->get($this->servicio->codagente); } /// cargamos el cliente $this->cliente_s = $this->cliente->get($this->servicio->codcliente); $this->marca_s = $this->marca->get($this->servicio->codmarca); $this->modelo_s = $this->modelo->get($this->servicio->codmodelo); $this->tipo_s = $this->tipo->get($this->servicio->codtipo); } else { $this->new_error_msg("¡" . ucfirst(FS_SERVICIO) . " de cliente no encontrado!"); } }
private function modificar_detalles() { if (isset($_POST['detalle'])) { $this->agrega_detalle(); } else { if (isset($_GET['delete_detalle'])) { $det0 = new detalle_servicio(); $detalle = $det0->get($_GET['delete_detalle']); if ($detalle) { if ($detalle->delete()) { $this->new_message('Detalle eliminado correctamente.'); } else { $this->new_error_msg('Error al eliminar el detalle.'); } } else { $this->new_error_msg('Detalle no encontrado.'); } } } }