Пример #1
0
 protected function GenerateResponse()
 {
     try {
         $this->response = PersonalYAgentesController::DetallesRol(isset($_POST['id_rol']) ? $_POST['id_rol'] : null);
     } catch (Exception $e) {
         //Logger::error($e);
         throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage()));
     }
 }
Пример #2
0
<?php

define("BYPASS_INSTANCE_CHECK", false);
require_once "../../../server/bootstrap.php";
$page = new GerenciaComponentPage();
$page->requireParam("rid", "GET", "Este rol no existe.");
//$este_rol = RolDAO::getByPK($_GET["rid"]);
$este_rol = PersonalYAgentesController::DetallesRol($_GET["rid"]);
$este_rol = $este_rol["detalles"];
$menu = new MenuComponent();
$menu->addItem("Editar este rol", "personal.editar.rol.php?rid=" . $_GET["rid"]);
$usuarios_rol = UsuarioDAO::search(new Usuario(array("id_rol" => $_GET["rid"], "activo" => 1)));
if (empty($usuarios_rol)) {
    $btn_eliminar = new MenuItem("Eliminar este rol", null);
    $btn_eliminar->addApiCall("api/personal/rol/eliminar");
    $btn_eliminar->onApiCallSuccessRedirect("personal.rol.lista.php");
    $btn_eliminar->addName("eliminar");
    $funcion_eliminar = "function eliminar_rol (btn) {" . "\tif(btn == 'yes')" . "\t{" . "\t\tvar p = {};" . "\t\tp.id_rol = " . $_GET["rid"] . ";" . "\t\tsendToApi_eliminar(p);" . "\t}" . "}" . "" . "function confirmar () {" . "\tExt.MessageBox.confirm('Eliminar', 'Desea eliminar este rol?', eliminar_rol );" . "}";
    $btn_eliminar->addOnClick("confirmar", $funcion_eliminar);
    $menu->addMenuItem($btn_eliminar);
}
$page->addComponent($menu);
$page->addComponent(new TitleComponent("Detalles de " . $este_rol["nombre"], 2));
// Forma de producto
$form = new DAOFormComponent(RolDAO::getByPK($este_rol["id_rol"]));
$form->setEditable(false);
$form->hideField(array("id_rol"));
$form->createComboBoxJoinDistintName("id_tarifa_venta", "id_tarifa", "nombre", TarifaDAO::search(new Tarifa(array("tipo_tarifa" => "venta"))), $este_rol["id_tarifa_venta"]);
$form->createComboBoxJoinDistintName("id_tarifa_compra", "id_tarifa", "nombre", TarifaDAO::search(new Tarifa(array("tipo_tarifa" => "venta"))), $este_rol["id_tarifa_compra"]);
$form->createComboBoxJoinDistintName("id_rol_padre", "id_rol", "nombre", RolDAO::getAll(), $este_rol["id_rol_padre"]);
$form->createComboBoxJoin("id_perfil", "descripcion", POSController::ListaPerfilConfiguracion(), $este_rol["id_perfil"]);