$resultado[$i]['descripcion'] = $fila['descripcion']; $resultado[$i]['nativa'] = true; $suboperation = PUCSubcuenta::listar($resultado[$i]['id'], $gbd); if ($suboperation['result']) { $resultado[$i]['subentity'] = "subcuenta"; } $i++; } $operation['result'] = $resultado; } } echo json_encode($operation); } if ($get->entity == "subcuenta") { $gbd = new Conexion(); $operation = PUCSubcuenta::listar($get->id, $gbd); if ($operation['ejecution']) { if ($operation['result']) { $i = 0; foreach ($operation['result'] as $fila) { $resultado[$i]['id'] = $fila['scnt_id']; $resultado[$i]['nombre'] = $fila['nombre']; $resultado[$i]['descripcion'] = $fila['descripcion']; $resultado[$i]['nativa'] = $fila['scnt_nativa']; if (!$resultado[$i]['nativa']) { $resultado[$i]['tipo'] = "subcuenta"; } $suboperation = PUCCuentaAuxiliar::listar($resultado[$i]['id'], $gbd); if ($suboperation['result']) { $resultado[$i]['subentity'] = "cuenta_auxiliar"; }
} if ($get->actualizar) { if (isset($_SESSION['subcuenta'])) { $subcuenta = unserialize($_SESSION['subcuenta']); if ($get->cuenta != "" && $get->id != "" && $get->nombre != "" && $get->descripcion != "" && $get->ajuste != "") { $get->cuenta = strtoupper(base64_decode($get->cuenta)); $get->id = strtoupper(base64_decode($get->id)); $get->nombre = strtoupper(base64_decode($get->nombre)); $get->descripcion = base64_decode($get->descripcion); $get->ajuste = base64_decode($get->ajuste); $gbd = new Conexion(); $operation = $subcuenta->actualizar($get->nombre, $get->descripcion, $get->ajuste, $get->cuenta, $get->id, $gbd); if ($operation['ejecution'] && $operation['result']) { $operation['message'] = "Se modifico correctamente la información."; $log = Log::registro($usuario->getID(), "info", "Modificación de información. - Subcuenta. {" . $get->nombre . ", " . $get->descripcion . ", " . $get->ajuste . ", " . $get->cuenta . ", " . $get->id . "}", $gbd); $subcuenta = new PUCSubcuenta($get->id, $gbd); $subcuenta->cargarCuenta($gbd); $cuenta = $subcuenta->getCuenta(); $cuenta->cargarGrupo($gbd); $grupo = $cuenta->getGrupo(); $grupo->cargarClase($gbd); $_SESSION['subcuenta'] = serialize($subcuenta); } elseif (!$operation['ejecution']) { $log = Log::registro($usuario->getID(), "error", "Modificación de información. - Subcuenta. {" . $get->nombre . ", " . $get->descripcion . ", " . $get->ajuste . ", " . $get->subcuenta . ", " . $get->id . "} - {" . $operation['error'] . "}", $gbd); } } else { $operation['ejecution'] = true; $operation['result'] = false; $operation['message'] = "Por favor diligencie los todos los campos del formulario."; } echo json_encode($operation);