Reformatted source code
authorMartin Taal <martin.taal@openbravo.com>
Tue, 23 Dec 2008 20:16:42 +0000
changeset 2462 497dad67a0a9
parent 2461 7462cef093a6
child 2463 dd5ac4374aba
Reformatted source code
src/org/openbravo/authentication/AuthenticationException.java
src/org/openbravo/authentication/AuthenticationManager.java
src/org/openbravo/authentication/basic/AutologonAuthenticationManager.java
src/org/openbravo/authentication/basic/DefaultAuthenticationManager.java
src/org/openbravo/authentication/lam/LamAuthenticationManager.java
src/org/openbravo/base/OBSchedulerInitializerListener.java
src/org/openbravo/base/secureApp/DefaultValidationException.java
src/org/openbravo/base/secureApp/DefaultValuesData.java
src/org/openbravo/base/secureApp/ErrorConnection.java
src/org/openbravo/base/secureApp/LoginUtils.java
src/org/openbravo/base/secureApp/OrgTree.java
src/org/openbravo/base/secureApp/ServletGoBack.java
src/org/openbravo/base/secureApp/VariablesHistory.java
src/org/openbravo/base/secureApp/VariablesSecureApp.java
src/org/openbravo/dal/core/DalUUIDHexGenerator.java
src/org/openbravo/erpCommon/ad_actionButton/ActionButtonUtility.java
src/org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice.java
src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder.java
src/org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder.java
src/org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement.java
src/org/openbravo/erpCommon/ad_actionButton/CreateFile.java
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
src/org/openbravo/erpCommon/ad_actionButton/CreateFromMultiple.java
src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.java
src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters.java
src/org/openbravo/erpCommon/ad_actionButton/DropRegFactAcct.java
src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues.java
src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java
src/org/openbravo/erpCommon/ad_actionButton/ExportReferenceData.java
src/org/openbravo/erpCommon/ad_actionButton/InsertAcces.java
src/org/openbravo/erpCommon/ad_actionButton/Posted.java
src/org/openbravo/erpCommon/ad_actionButton/ProjectClose.java
src/org/openbravo/erpCommon/ad_actionButton/ProjectCopyFrom.java
src/org/openbravo/erpCommon/ad_actionButton/ProjectSetType.java
src/org/openbravo/erpCommon/ad_actionButton/RequestAction.java
src/org/openbravo/erpCommon/ad_actionButton/TestLine.java
src/org/openbravo/erpCommon/ad_actionButton/Test_In.java
src/org/openbravo/erpCommon/ad_actionButton/UpdateMaintenanceScheduled.java
src/org/openbravo/erpCommon/ad_callouts/Activation_Message.java
src/org/openbravo/erpCommon/ad_callouts/CalloutHelper.java
src/org/openbravo/erpCommon/ad_callouts/SE_Expense_Amount.java
src/org/openbravo/erpCommon/ad_callouts/SE_Expense_BP_Project.java
src/org/openbravo/erpCommon/ad_callouts/SE_Expense_Product.java
src/org/openbravo/erpCommon/ad_callouts/SE_ExternalPOS_BPartner.java
src/org/openbravo/erpCommon/ad_callouts/SE_InOut_DocType.java
src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_BPartner.java
src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_Project.java
src/org/openbravo/erpCommon/ad_callouts/SE_Order_BPartner.java
src/org/openbravo/erpCommon/ad_callouts/SE_Order_Project.java
src/org/openbravo/erpCommon/ad_callouts/SE_PeriodNo.java
src/org/openbravo/erpCommon/ad_callouts/SE_Period_Control.java
src/org/openbravo/erpCommon/ad_callouts/SE_Pricelist_Active.java
src/org/openbravo/erpCommon/ad_callouts/SE_ProjectLine_Value.java
src/org/openbravo/erpCommon/ad_callouts/SE_Project_BPartner.java
src/org/openbravo/erpCommon/ad_callouts/SE_Proposal_BPartner.java
src/org/openbravo/erpCommon/ad_callouts/SE_Request_CopyText.java
src/org/openbravo/erpCommon/ad_callouts/SE_Supplier_BPartner.java
src/org/openbravo/erpCommon/ad_callouts/SE_Taxes_Active.java
src/org/openbravo/erpCommon/ad_callouts/SE_Wh_SchedulePeriod.java
src/org/openbravo/erpCommon/ad_callouts/SL_AlertRule_SQL.java
src/org/openbravo/erpCommon/ad_callouts/SL_Assets.java
src/org/openbravo/erpCommon/ad_callouts/SL_BankDebt_Amount.java
src/org/openbravo/erpCommon/ad_callouts/SL_BankStmt_Amount.java
src/org/openbravo/erpCommon/ad_callouts/SL_Budget_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_CCPMeasure_Group.java
src/org/openbravo/erpCommon/ad_callouts/SL_CashJournal_Amounts.java
src/org/openbravo/erpCommon/ad_callouts/SL_Charge.java
src/org/openbravo/erpCommon/ad_callouts/SL_Command_ArgNumber.java
src/org/openbravo/erpCommon/ad_callouts/SL_Conversion_Rate.java
src/org/openbravo/erpCommon/ad_callouts/SL_CostcenterEmployee_SalaryCategory.java
src/org/openbravo/erpCommon/ad_callouts/SL_CreateFromMultiple_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_CreateFromMultiple_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_CreateFromMultiple_Warehouse.java
src/org/openbravo/erpCommon/ad_callouts/SL_CreateLines_Conversion_UOM.java
src/org/openbravo/erpCommon/ad_callouts/SL_GlobalUse_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_GlobalUse_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Locator.java
src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_InOut_BPartner.java
src/org/openbravo/erpCommon/ad_callouts/SL_InOut_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_Internal_Consumption_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_Internal_Consumption_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_InvoiceTax_Amt.java
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Amt.java
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Charge_Tax.java
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_DocType.java
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_PriceList.java
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Tax.java
src/org/openbravo/erpCommon/ad_callouts/SL_IsDefault.java
src/org/openbravo/erpCommon/ad_callouts/SL_JournalLineAmt.java
src/org/openbravo/erpCommon/ad_callouts/SL_Journal_Period.java
src/org/openbravo/erpCommon/ad_callouts/SL_MInOutTraceReports.java
src/org/openbravo/erpCommon/ad_callouts/SL_MachineCost.java
src/org/openbravo/erpCommon/ad_callouts/SL_MovementAll_Locator.java
src/org/openbravo/erpCommon/ad_callouts/SL_Movement_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_Movement_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Charge_Tax.java
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_Order_DocType.java
src/org/openbravo/erpCommon/ad_callouts/SL_Order_PriceList.java
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Tax.java
src/org/openbravo/erpCommon/ad_callouts/SL_Payment_Amounts.java
src/org/openbravo/erpCommon/ad_callouts/SL_Payment_DocType.java
src/org/openbravo/erpCommon/ad_callouts/SL_Payment_No_Verify.java
src/org/openbravo/erpCommon/ad_callouts/SL_ProductionPlan_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_ProductionPlan_WRPhase.java
src/org/openbravo/erpCommon/ad_callouts/SL_Production_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_Production_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_Project_Margin.java
src/org/openbravo/erpCommon/ad_callouts/SL_Project_Planned.java
src/org/openbravo/erpCommon/ad_callouts/SL_Project_PriceList.java
src/org/openbravo/erpCommon/ad_callouts/SL_Proposal_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_Request_Action.java
src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt.java
src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionOrder_Order.java
src/org/openbravo/erpCommon/ad_callouts/SL_Requisition_BPartner.java
src/org/openbravo/erpCommon/ad_callouts/SL_ScheduledMaintenance_Maintenance.java
src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_User_Name.java
src/org/openbravo/erpCommon/ad_callouts/SL_WRPhaseProduct_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_WRPhase_Sequence.java
src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_Conversion.java
src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_ProcessPlan.java
src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_Sequence.java
src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_StartDate.java
src/org/openbravo/erpCommon/ad_forms/About.java
src/org/openbravo/erpCommon/ad_forms/Account.java
src/org/openbravo/erpCommon/ad_forms/AccountingValueData.java
src/org/openbravo/erpCommon/ad_forms/AcctSchema.java
src/org/openbravo/erpCommon/ad_forms/AcctSchemaElement.java
src/org/openbravo/erpCommon/ad_forms/AcctServer.java
src/org/openbravo/erpCommon/ad_forms/AlertManagement.java
src/org/openbravo/erpCommon/ad_forms/CallAcctServer.java
src/org/openbravo/erpCommon/ad_forms/DebtPaymentUnapply.java
src/org/openbravo/erpCommon/ad_forms/DocAmortization.java
src/org/openbravo/erpCommon/ad_forms/DocBank.java
src/org/openbravo/erpCommon/ad_forms/DocCash.java
src/org/openbravo/erpCommon/ad_forms/DocDPManagement.java
src/org/openbravo/erpCommon/ad_forms/DocGLJournal.java
src/org/openbravo/erpCommon/ad_forms/DocInOut.java
src/org/openbravo/erpCommon/ad_forms/DocInventory.java
src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
src/org/openbravo/erpCommon/ad_forms/DocLine.java
src/org/openbravo/erpCommon/ad_forms/DocLine_Amortization.java
src/org/openbravo/erpCommon/ad_forms/DocLine_Bank.java
src/org/openbravo/erpCommon/ad_forms/DocLine_Cash.java
src/org/openbravo/erpCommon/ad_forms/DocLine_DPManagement.java
src/org/openbravo/erpCommon/ad_forms/DocLine_Invoice.java
src/org/openbravo/erpCommon/ad_forms/DocLine_Material.java
src/org/openbravo/erpCommon/ad_forms/DocLine_Payment.java
src/org/openbravo/erpCommon/ad_forms/DocMovement.java
src/org/openbravo/erpCommon/ad_forms/DocOrder.java
src/org/openbravo/erpCommon/ad_forms/DocPayment.java
src/org/openbravo/erpCommon/ad_forms/DocProduction.java
src/org/openbravo/erpCommon/ad_forms/DocTax.java
src/org/openbravo/erpCommon/ad_forms/EdiFileImport.java
src/org/openbravo/erpCommon/ad_forms/Fact.java
src/org/openbravo/erpCommon/ad_forms/FactLine.java
src/org/openbravo/erpCommon/ad_forms/FileImport.java
src/org/openbravo/erpCommon/ad_forms/FileLoadData.java
src/org/openbravo/erpCommon/ad_forms/GenerateInvoicesmanual.java
src/org/openbravo/erpCommon/ad_forms/GenerateShipmentsmanual.java
src/org/openbravo/erpCommon/ad_forms/Heartbeat.java
src/org/openbravo/erpCommon/ad_forms/HeartbeatConfirm.java
src/org/openbravo/erpCommon/ad_forms/InformeInOut.java
src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.java
src/org/openbravo/erpCommon/ad_forms/InvoiceVendorMultiline.java
src/org/openbravo/erpCommon/ad_forms/InvoiceVendorMultiline_Lines.java
src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
src/org/openbravo/erpCommon/ad_forms/ProductInfo.java
src/org/openbravo/erpCommon/ad_forms/Registration.java
src/org/openbravo/erpCommon/ad_forms/RegistrationConfirm.java
src/org/openbravo/erpCommon/ad_forms/RemittanceCancel.java
src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java
src/org/openbravo/erpCommon/ad_forms/RespuestaCS.java
src/org/openbravo/erpCommon/ad_forms/RespuestaCS_AcctServer.java
src/org/openbravo/erpCommon/ad_forms/Role.java
src/org/openbravo/erpCommon/ad_forms/SQLExecutor.java
src/org/openbravo/erpCommon/ad_forms/SQLExecutor_Query.java
src/org/openbravo/erpCommon/ad_forms/ShowSessionPreferences.java
src/org/openbravo/erpCommon/ad_forms/ShowSessionVariables.java
src/org/openbravo/erpCommon/ad_forms/ShowSessionVariablesStructureData.java
src/org/openbravo/erpCommon/ad_forms/Translation.java
src/org/openbravo/erpCommon/ad_forms/TranslationHandler.java
src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java
src/org/openbravo/erpCommon/ad_help/DisplayHelp.java
src/org/openbravo/erpCommon/ad_help/HelpWindow.java
src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java
src/org/openbravo/erpCommon/ad_process/AlertProcess.java
src/org/openbravo/erpCommon/ad_process/CashBankOperations.java
src/org/openbravo/erpCommon/ad_process/ChangeOrderOrg.java
src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal.java
src/org/openbravo/erpCommon/ad_process/CreateAccountingReport.java
src/org/openbravo/erpCommon/ad_process/CreateCashFlowStatement.java
src/org/openbravo/erpCommon/ad_process/CreateTaxReport.java
src/org/openbravo/erpCommon/ad_process/CreateTest.java
src/org/openbravo/erpCommon/ad_process/DeleteClient.java
src/org/openbravo/erpCommon/ad_process/DisplayJasper.java
src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice.java
src/org/openbravo/erpCommon/ad_process/GenerateHelp.java
src/org/openbravo/erpCommon/ad_process/HeartbeatProcess.java
src/org/openbravo/erpCommon/ad_process/ImportAccount.java
src/org/openbravo/erpCommon/ad_process/ImportAccountServlet.java
src/org/openbravo/erpCommon/ad_process/ImportBPartner.java
src/org/openbravo/erpCommon/ad_process/ImportBPartnerServlet.java
src/org/openbravo/erpCommon/ad_process/ImportBudget.java
src/org/openbravo/erpCommon/ad_process/ImportBudgetServlet.java
src/org/openbravo/erpCommon/ad_process/ImportOrder.java
src/org/openbravo/erpCommon/ad_process/ImportOrderServlet.java
src/org/openbravo/erpCommon/ad_process/ImportProcess.java
src/org/openbravo/erpCommon/ad_process/ImportProduct.java
src/org/openbravo/erpCommon/ad_process/ImportProductServlet.java
src/org/openbravo/erpCommon/ad_process/ImportTax.java
src/org/openbravo/erpCommon/ad_process/ImportTaxServlet.java
src/org/openbravo/erpCommon/ad_process/JasperProcess.java
src/org/openbravo/erpCommon/ad_process/PriceListCreateAll.java
src/org/openbravo/erpCommon/ad_process/PrintInvoices.java
src/org/openbravo/erpCommon/ad_process/ProcedureProcess.java
src/org/openbravo/erpCommon/ad_process/Register.java
src/org/openbravo/erpCommon/ad_process/RegisterModule.java
src/org/openbravo/erpCommon/ad_process/RequestReOpen.java
src/org/openbravo/erpCommon/ad_process/RescheduleProcess.java
src/org/openbravo/erpCommon/ad_process/RespuestaCS.java
src/org/openbravo/erpCommon/ad_process/RestartingContext.java
src/org/openbravo/erpCommon/ad_process/ScheduleProcess.java
src/org/openbravo/erpCommon/ad_process/SendMailText.java
src/org/openbravo/erpCommon/ad_process/TestHeartbeat.java
src/org/openbravo/erpCommon/ad_process/UnscheduleProcess.java
src/org/openbravo/erpCommon/ad_reports/ABCbPartner.java
src/org/openbravo/erpCommon/ad_reports/ABCproduct.java
src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java
src/org/openbravo/erpCommon/ad_reports/GenerateModel347.java
src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports.java
src/org/openbravo/erpCommon/ad_reports/ReportAccountingCountDimensionalAnalyses.java
src/org/openbravo/erpCommon/ad_reports/ReportAcctRedirectUtility.java
src/org/openbravo/erpCommon/ad_reports/ReportAgingBalance.java
src/org/openbravo/erpCommon/ad_reports/ReportAnnualCertification.java
src/org/openbravo/erpCommon/ad_reports/ReportBank.java
src/org/openbravo/erpCommon/ad_reports/ReportBankJR.java
src/org/openbravo/erpCommon/ad_reports/ReportBudgetExportExcel.java
src/org/openbravo/erpCommon/ad_reports/ReportBudgetGenerateExcel.java
src/org/openbravo/erpCommon/ad_reports/ReportCash.java
src/org/openbravo/erpCommon/ad_reports/ReportCashFlow.java
src/org/openbravo/erpCommon/ad_reports/ReportCashJR.java
src/org/openbravo/erpCommon/ad_reports/ReportCashflowForecast.java
src/org/openbravo/erpCommon/ad_reports/ReportDebtPayment.java
src/org/openbravo/erpCommon/ad_reports/ReportDebtPaymentTrack.java
src/org/openbravo/erpCommon/ad_reports/ReportDimensionalAnalysesPDF.java
src/org/openbravo/erpCommon/ad_reports/ReportExpense.java
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournalDetail.java
src/org/openbravo/erpCommon/ad_reports/ReportGuaranteeDateJR.java
src/org/openbravo/erpCommon/ad_reports/ReportInventory.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalyses.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalPDF.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerEdition.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerJR.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceDiscount.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceDiscountJR.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesJR.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorJR.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoices.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoicesJR.java
src/org/openbravo/erpCommon/ad_reports/ReportMaterialDimensionalAnalysesJR.java
src/org/openbravo/erpCommon/ad_reports/ReportMaterialTransactionEdition.java
src/org/openbravo/erpCommon/ad_reports/ReportMaterialTransactionEditionJR.java
src/org/openbravo/erpCommon/ad_reports/ReportNotPosted.java
src/org/openbravo/erpCommon/ad_reports/ReportOffer.java
src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoiceJR.java
src/org/openbravo/erpCommon/ad_reports/ReportParetoProduct.java
src/org/openbravo/erpCommon/ad_reports/ReportPendingProductionJr.java
src/org/openbravo/erpCommon/ad_reports/ReportPricelist.java
src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.java
src/org/openbravo/erpCommon/ad_reports/ReportProduction.java
src/org/openbravo/erpCommon/ad_reports/ReportProductionCost.java
src/org/openbravo/erpCommon/ad_reports/ReportProductionJR.java
src/org/openbravo/erpCommon/ad_reports/ReportProductionRunJR.java
src/org/openbravo/erpCommon/ad_reports/ReportProjectBuildingSite.java
src/org/openbravo/erpCommon/ad_reports/ReportProjectBuildingSiteJR.java
src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitabilityJR.java
src/org/openbravo/erpCommon/ad_reports/ReportProjectProgress.java
src/org/openbravo/erpCommon/ad_reports/ReportPurchaseDimensionalAnalysesJR.java
src/org/openbravo/erpCommon/ad_reports/ReportRefundInvoiceCustomerDimensionalAnalyses.java
src/org/openbravo/erpCommon/ad_reports/ReportRefundSalesDimensionalAnalyses.java
src/org/openbravo/erpCommon/ad_reports/ReportRefundSalesDimensionalAnalysesPDF.java
src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR.java
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderDimensionalPDF.java
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderInvoicedJasper.java
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderJR.java
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderOpenItem.java
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderOpenItemJR.java
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderProvidedJR.java
src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJR.java
src/org/openbravo/erpCommon/ad_reports/ReportShipmentEditionJR.java
src/org/openbravo/erpCommon/ad_reports/ReportShipper.java
src/org/openbravo/erpCommon/ad_reports/ReportStandardCostJR.java
src/org/openbravo/erpCommon/ad_reports/ReportTaxInvoice.java
src/org/openbravo/erpCommon/ad_reports/ReportTaxInvoiceJR.java
src/org/openbravo/erpCommon/ad_reports/ReportToInvoiceConsignment.java
src/org/openbravo/erpCommon/ad_reports/ReportToInvoiceConsignmentJR.java
src/org/openbravo/erpCommon/ad_reports/ReportTotalProductTemplate.java
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalanceDataComparator.java
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalanceDetail.java
src/org/openbravo/erpCommon/ad_reports/ReportValuationStock.java
src/org/openbravo/erpCommon/ad_reports/ReportWarehouseControl.java
src/org/openbravo/erpCommon/ad_reports/ReportWarehouseDetailInventoryJR.java
src/org/openbravo/erpCommon/ad_reports/ReportWarehousePartnerJR.java
src/org/openbravo/erpCommon/ad_reports/ReportWorkRequirementDaily.java
src/org/openbravo/erpCommon/ad_reports/ReportWorkRequirementDailyEnv.java
src/org/openbravo/erpCommon/ad_reports/ReportWorkRequirementJR.java
src/org/openbravo/erpCommon/ad_reports/RptM_Production.java
src/org/openbravo/erpCommon/ad_reports/Rpt_Etiquetas.java
src/org/openbravo/erpCommon/ad_workflow/WorkflowControl.java
src/org/openbravo/erpCommon/businessUtility/AccountTree.java
src/org/openbravo/erpCommon/businessUtility/Buscador.java
src/org/openbravo/erpCommon/businessUtility/ByteArrayDataSource.java
src/org/openbravo/erpCommon/businessUtility/EMail.java
src/org/openbravo/erpCommon/businessUtility/EMailAuthenticator.java
src/org/openbravo/erpCommon/businessUtility/MessageJS.java
src/org/openbravo/erpCommon/businessUtility/PAttributeSet.java
src/org/openbravo/erpCommon/businessUtility/PrinterReports.java
src/org/openbravo/erpCommon/businessUtility/TabFilter.java
src/org/openbravo/erpCommon/businessUtility/Tax.java
src/org/openbravo/erpCommon/businessUtility/Tree.java
src/org/openbravo/erpCommon/info/Account.java
src/org/openbravo/erpCommon/info/AttributeSetInstance.java
src/org/openbravo/erpCommon/info/BusinessPartner.java
src/org/openbravo/erpCommon/info/BusinessPartnerMultiple.java
src/org/openbravo/erpCommon/info/DebtPayment.java
src/org/openbravo/erpCommon/info/ImageInfo.java
src/org/openbravo/erpCommon/info/Invoice.java
src/org/openbravo/erpCommon/info/InvoiceLine.java
src/org/openbravo/erpCommon/info/Location.java
src/org/openbravo/erpCommon/info/Locator.java
src/org/openbravo/erpCommon/info/Product.java
src/org/openbravo/erpCommon/info/ProductComplete.java
src/org/openbravo/erpCommon/info/ProductMultiple.java
src/org/openbravo/erpCommon/info/Project.java
src/org/openbravo/erpCommon/info/SalesOrder.java
src/org/openbravo/erpCommon/info/SalesOrderLine.java
src/org/openbravo/erpCommon/info/ShipmentReceipt.java
src/org/openbravo/erpCommon/info/ShipmentReceiptLine.java
src/org/openbravo/erpCommon/modules/ApplyModule.java
src/org/openbravo/erpCommon/modules/ExtractModule.java
src/org/openbravo/erpCommon/modules/ExtractModuleTask.java
src/org/openbravo/erpCommon/modules/ImportModule.java
src/org/openbravo/erpCommon/modules/ModuleReferenceDataClientTree.java
src/org/openbravo/erpCommon/modules/ModuleReferenceDataOrgTree.java
src/org/openbravo/erpCommon/modules/ModuleTree.java
src/org/openbravo/erpCommon/modules/ModuleUtiltiy.java
src/org/openbravo/erpCommon/modules/UninstallModule.java
src/org/openbravo/erpCommon/modules/VersionUtility.java
src/org/openbravo/erpCommon/security/Login.java
src/org/openbravo/erpCommon/security/Logout.java
src/org/openbravo/erpCommon/security/Menu.java
src/org/openbravo/erpCommon/security/SessionLogin.java
src/org/openbravo/erpCommon/utility/Alert.java
src/org/openbravo/erpCommon/utility/BandStyleVO.java
src/org/openbravo/erpCommon/utility/CSResponse.java
src/org/openbravo/erpCommon/utility/ChangeAudit.java
src/org/openbravo/erpCommon/utility/ComboTableData.java
src/org/openbravo/erpCommon/utility/DataGrid.java
src/org/openbravo/erpCommon/utility/ErrorTextParser.java
src/org/openbravo/erpCommon/utility/ErrorTextParserORACLE.java
src/org/openbravo/erpCommon/utility/ErrorTextParserPOSTGRE.java
src/org/openbravo/erpCommon/utility/ExecuteQuery.java
src/org/openbravo/erpCommon/utility/ExecuteTask.java
src/org/openbravo/erpCommon/utility/ExportGrid.java
src/org/openbravo/erpCommon/utility/FieldProviderFactory.java
src/org/openbravo/erpCommon/utility/GenericTree.java
src/org/openbravo/erpCommon/utility/GenericTreeServlet.java
src/org/openbravo/erpCommon/utility/GridBO.java
src/org/openbravo/erpCommon/utility/GridColumnVO.java
src/org/openbravo/erpCommon/utility/GridReportVO.java
src/org/openbravo/erpCommon/utility/HTMLElement.java
src/org/openbravo/erpCommon/utility/Home.java
src/org/openbravo/erpCommon/utility/HttpsUtils.java
src/org/openbravo/erpCommon/utility/JRFieldProviderDataSource.java
src/org/openbravo/erpCommon/utility/JRFormatFactory.java
src/org/openbravo/erpCommon/utility/KeyMap.java
src/org/openbravo/erpCommon/utility/LeftTabsBar.java
src/org/openbravo/erpCommon/utility/Log.java
src/org/openbravo/erpCommon/utility/MessagesJS.java
src/org/openbravo/erpCommon/utility/ModelSQLGeneration.java
src/org/openbravo/erpCommon/utility/OBError.java
src/org/openbravo/erpCommon/utility/OBPrintStream.java
src/org/openbravo/erpCommon/utility/OpenPentaho.java
src/org/openbravo/erpCommon/utility/PoolStatus.java
src/org/openbravo/erpCommon/utility/PopupLoading.java
src/org/openbravo/erpCommon/utility/PrintJR.java
src/org/openbravo/erpCommon/utility/QueryFieldStructure.java
src/org/openbravo/erpCommon/utility/QueryParameterStructure.java
src/org/openbravo/erpCommon/utility/ReferencedLink.java
src/org/openbravo/erpCommon/utility/ReferencedTables.java
src/org/openbravo/erpCommon/utility/ReportDesignBO.java
src/org/openbravo/erpCommon/utility/SQLReturnObject.java
src/org/openbravo/erpCommon/utility/SequenceIdData.java
src/org/openbravo/erpCommon/utility/ServletSetPriority.java
src/org/openbravo/erpCommon/utility/SetPriorityCategoryData.java
src/org/openbravo/erpCommon/utility/SystemInfo.java
src/org/openbravo/erpCommon/utility/TableSQLData.java
src/org/openbravo/erpCommon/utility/Task.java
src/org/openbravo/erpCommon/utility/ToolBar.java
src/org/openbravo/erpCommon/utility/ToolBar_Button.java
src/org/openbravo/erpCommon/utility/ToolBar_HR.java
src/org/openbravo/erpCommon/utility/ToolBar_Image.java
src/org/openbravo/erpCommon/utility/ToolBar_Link.java
src/org/openbravo/erpCommon/utility/ToolBar_Space.java
src/org/openbravo/erpCommon/utility/UsedByLink.java
src/org/openbravo/erpCommon/utility/Utility.java
src/org/openbravo/erpCommon/utility/VerticalMenu.java
src/org/openbravo/erpCommon/utility/WindowTree.java
src/org/openbravo/erpCommon/utility/WindowTreeChecks.java
src/org/openbravo/erpCommon/utility/WindowTreeChecksClient.java
src/org/openbravo/erpCommon/utility/WindowTreeUtility.java
src/org/openbravo/erpCommon/utility/WindowTreeUtilityClient.java
src/org/openbravo/erpCommon/utility/Zip.java
src/org/openbravo/erpCommon/utility/poc/ClientAuthenticator.java
src/org/openbravo/erpCommon/utility/poc/EmailAddressType.java
src/org/openbravo/erpCommon/utility/poc/EmailManager.java
src/org/openbravo/erpCommon/utility/poc/EmailType.java
src/org/openbravo/erpCommon/utility/poc/PocException.java
src/org/openbravo/erpCommon/utility/reporting/DocumentType.java
src/org/openbravo/erpCommon/utility/reporting/ReportManager.java
src/org/openbravo/erpCommon/utility/reporting/ReportingException.java
src/org/openbravo/erpCommon/utility/reporting/printing/PrintInvoices.java
src/org/openbravo/erpCommon/utility/reporting/printing/PrintOrders.java
src/org/openbravo/erpCommon/utility/reporting/printing/PrintQuotations.java
src/org/openbravo/erpCommon/utility/reporting/printing/PrintShipments.java
src/org/openbravo/erpCommon/ws/externalSales/BPartner.java
src/org/openbravo/erpCommon/ws/externalSales/Category.java
src/org/openbravo/erpCommon/ws/externalSales/ExternalSales.java
src/org/openbravo/erpCommon/ws/externalSales/ExternalSalesImpl.java
src/org/openbravo/erpCommon/ws/externalSales/Order.java
src/org/openbravo/erpCommon/ws/externalSales/OrderIdentifier.java
src/org/openbravo/erpCommon/ws/externalSales/OrderLine.java
src/org/openbravo/erpCommon/ws/externalSales/Payment.java
src/org/openbravo/erpCommon/ws/externalSales/Product.java
src/org/openbravo/erpCommon/ws/externalSales/ProductPlus.java
src/org/openbravo/erpCommon/ws/externalSales/Tax.java
src/org/openbravo/erpCommon/ws/services/BusinessPartner.java
src/org/openbravo/erpCommon/ws/services/Contact.java
src/org/openbravo/erpCommon/ws/services/Customer.java
src/org/openbravo/erpCommon/ws/services/Location.java
src/org/openbravo/erpCommon/ws/services/WebService.java
src/org/openbravo/erpCommon/ws/services/WebServiceImpl.java
src/org/openbravo/erpReports/ReportTaxPaymentJR.java
src/org/openbravo/erpReports/ReportVatRegisterJR.java
src/org/openbravo/erpReports/RptC_Bpartner.java
src/org/openbravo/erpReports/RptC_Invoice.java
src/org/openbravo/erpReports/RptC_Order.java
src/org/openbravo/erpReports/RptC_OrderPO.java
src/org/openbravo/erpReports/RptC_Proposal.java
src/org/openbravo/erpReports/RptC_ProposalJr.java
src/org/openbravo/erpReports/RptC_Remittance.java
src/org/openbravo/erpReports/RptC_RemittanceJR.java
src/org/openbravo/erpReports/RptC_Settlement.java
src/org/openbravo/erpReports/RptMA_CCP_Group.java
src/org/openbravo/erpReports/RptMA_CCP_Measures.java
src/org/openbravo/erpReports/RptMA_ProcessPlan.java
src/org/openbravo/erpReports/RptM_Inout.java
src/org/openbravo/erpReports/RptM_Movement.java
src/org/openbravo/erpReports/RptM_Requisition.java
src/org/openbravo/erpReports/RptPromissoryNote.java
src/org/openbravo/scheduling/DefaultJob.java
src/org/openbravo/scheduling/OBScheduler.java
src/org/openbravo/scheduling/Process.java
src/org/openbravo/scheduling/ProcessBundle.java
src/org/openbravo/scheduling/ProcessContext.java
src/org/openbravo/scheduling/ProcessLogger.java
src/org/openbravo/scheduling/ProcessMonitor.java
src/org/openbravo/scheduling/ProcessRunner.java
src/org/openbravo/services/webservice/BusinessPartner.java
src/org/openbravo/services/webservice/Contact.java
src/org/openbravo/services/webservice/Customer.java
src/org/openbravo/services/webservice/Location.java
src/org/openbravo/services/webservice/Module.java
src/org/openbravo/services/webservice/ModuleDependency.java
src/org/openbravo/services/webservice/ModuleInstallDetail.java
src/org/openbravo/services/webservice/SimpleModule.java
src/org/openbravo/services/webservice/WebServiceImpl.java
src/org/openbravo/services/webservice/WebServiceImplService.java
src/org/openbravo/services/webservice/WebServiceImplServiceLocator.java
src/org/openbravo/services/webservice/WebServiceSoapBindingImpl.java
src/org/openbravo/services/webservice/WebServiceSoapBindingStub.java
--- a/src/org/openbravo/authentication/AuthenticationException.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/authentication/AuthenticationException.java	Tue Dec 23 20:16:42 2008 +0000
@@ -13,27 +13,31 @@
 package org.openbravo.authentication;
 
 /**
- *
+ * 
  * @author adrianromero
  */
 public class AuthenticationException extends java.lang.Exception {
-  private static final long serialVersionUID = 1L;
-  /**
-   * Creates a new instance of <code>AuthenticationException</code> without detail message.
-   */
-  public AuthenticationException() {
-  }
+    private static final long serialVersionUID = 1L;
 
+    /**
+     * Creates a new instance of <code>AuthenticationException</code> without
+     * detail message.
+     */
+    public AuthenticationException() {
+    }
 
-  /**
-   * Constructs an instance of <code>AuthenticationException</code> with the specified detail message.
-   * @param msg the detail message.
-   */
-  public AuthenticationException(String msg) {
-    super(msg);
-  }
+    /**
+     * Constructs an instance of <code>AuthenticationException</code> with the
+     * specified detail message.
+     * 
+     * @param msg
+     *            the detail message.
+     */
+    public AuthenticationException(String msg) {
+        super(msg);
+    }
 
-  public AuthenticationException(String msg, Throwable t) {
-    super(msg, t);
-  }
+    public AuthenticationException(String msg, Throwable t) {
+        super(msg, t);
+    }
 }
--- a/src/org/openbravo/authentication/AuthenticationManager.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/authentication/AuthenticationManager.java	Tue Dec 23 20:16:42 2008 +0000
@@ -19,12 +19,17 @@
 import javax.servlet.http.HttpServletResponse;
 
 /**
- *
+ * 
  * @author adrianromero
  */
 public interface AuthenticationManager {
 
-  public void init(HttpServlet s) throws AuthenticationException;
-  public String authenticate(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, ServletException, IOException;
-  public void logout(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;
+    public void init(HttpServlet s) throws AuthenticationException;
+
+    public String authenticate(HttpServletRequest request,
+            HttpServletResponse response) throws AuthenticationException,
+            ServletException, IOException;
+
+    public void logout(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException;
 }
--- a/src/org/openbravo/authentication/basic/AutologonAuthenticationManager.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/authentication/basic/AutologonAuthenticationManager.java	Tue Dec 23 20:16:42 2008 +0000
@@ -25,49 +25,59 @@
 import org.openbravo.database.ConnectionProvider;
 
 /**
- *
+ * 
  * @author adrianromero
  */
 public class AutologonAuthenticationManager implements AuthenticationManager {
-    
+
     private String m_sAutologonUsername;
     private String m_sUserId = null;
-  
+
     /** Creates a new instance of FixedAuthenticationManager */
     public AutologonAuthenticationManager() {
     }
-    
+
     public void init(HttpServlet s) throws AuthenticationException {
-                
+
         if (s instanceof ConnectionProvider) {
             ConnectionProvider conn = (ConnectionProvider) s;
-            m_sAutologonUsername = ConfigParameters.retrieveFrom(s.getServletContext()).getOBProperty("authentication.autologon.username");
+            m_sAutologonUsername = ConfigParameters.retrieveFrom(
+                    s.getServletContext()).getOBProperty(
+                    "authentication.autologon.username");
             try {
                 m_sUserId = SeguridadData.getUserId(conn, m_sAutologonUsername);
             } catch (ServletException e) {
-                throw new AuthenticationException("Cannot authenticate user: " + m_sAutologonUsername, e);
+                throw new AuthenticationException("Cannot authenticate user: "
+                        + m_sAutologonUsername, e);
             }
-            
+
         } else {
-            throw new AuthenticationException("Connection provider required for Autologon authentication");
-        }         
-    }   
+            throw new AuthenticationException(
+                    "Connection provider required for Autologon authentication");
+        }
+    }
 
-    public String authenticate(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, ServletException, IOException {
-        
-        if (m_sUserId == null || m_sUserId.equals("") || m_sUserId.equals("-1")) {   
+    public String authenticate(HttpServletRequest request,
+            HttpServletResponse response) throws AuthenticationException,
+            ServletException, IOException {
+
+        if (m_sUserId == null || m_sUserId.equals("") || m_sUserId.equals("-1")) {
             if (m_sAutologonUsername == null || m_sAutologonUsername.equals("")) {
-                throw new AuthenticationException("Autologon user emtpy.");                    
+                throw new AuthenticationException("Autologon user emtpy.");
             } else {
-                throw new AuthenticationException("Autologon user is not an Openbravo ERP user: " + m_sAutologonUsername);                    
+                throw new AuthenticationException(
+                        "Autologon user is not an Openbravo ERP user: "
+                                + m_sAutologonUsername);
             }
         } else {
             return m_sUserId;
         }
     }
 
-    public void logout(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+    public void logout(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
         // Never logs out this manager, just go to menu.
-        response.sendRedirect(HttpBaseUtils.getLocalAddress(request) + "/security/Menu.html");
-    }    
+        response.sendRedirect(HttpBaseUtils.getLocalAddress(request)
+                + "/security/Menu.html");
+    }
 }
\ No newline at end of file
--- a/src/org/openbravo/authentication/basic/DefaultAuthenticationManager.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/authentication/basic/DefaultAuthenticationManager.java	Tue Dec 23 20:16:42 2008 +0000
@@ -28,85 +28,101 @@
 import java.io.*;
 
 /**
- *
+ * 
  * @author adrianromero
  */
 public class DefaultAuthenticationManager implements AuthenticationManager {
 
-  private ConnectionProvider conn = null;
-  private String strServletSinIdentificar = null;
-  public Logger log4j = Logger.getLogger(DefaultAuthenticationManager.class);
+    private ConnectionProvider conn = null;
+    private String strServletSinIdentificar = null;
+    public Logger log4j = Logger.getLogger(DefaultAuthenticationManager.class);
 
-  /** Creates a new instance of DefaultAuthenticationManager */
-  public DefaultAuthenticationManager() {
-  }
+    /** Creates a new instance of DefaultAuthenticationManager */
+    public DefaultAuthenticationManager() {
+    }
 
-  public void init(HttpServlet s) throws AuthenticationException {
-    if (s instanceof ConnectionProvider) {
-      conn = (ConnectionProvider) s;
-      strServletSinIdentificar = s.getServletConfig().getServletContext().getInitParameter("ServletSinIdentificar");
-    } else {
-      throw new AuthenticationException("Connection provider required for default authentication");
+    public void init(HttpServlet s) throws AuthenticationException {
+        if (s instanceof ConnectionProvider) {
+            conn = (ConnectionProvider) s;
+            strServletSinIdentificar = s.getServletConfig().getServletContext()
+                    .getInitParameter("ServletSinIdentificar");
+        } else {
+            throw new AuthenticationException(
+                    "Connection provider required for default authentication");
+        }
     }
-  }
 
-  public String authenticate(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, ServletException, IOException {
-    String sUserId = (String) request.getSession(true).getAttribute("#Authenticated_user");
+    public String authenticate(HttpServletRequest request,
+            HttpServletResponse response) throws AuthenticationException,
+            ServletException, IOException {
+        String sUserId = (String) request.getSession(true).getAttribute(
+                "#Authenticated_user");
 
-    if (sUserId == null || sUserId.equals("")) {
-      String strAjax = "";
-      //strHidden and strPopUp not implemented
-      /*String strHidden = "";
-      String strPopUp = ""; */
-      try {
-        strAjax = request.getParameter("IsAjaxCall");
-      } catch (Exception ignored) {}
-      /*try {
-        strHidden = request.getParameter("IsHiddenCall");
-      } catch (Exception ignored) {}
-      try {
-        strPopUp = request.getParameter("IsPopUpCall");
-      } catch (Exception ignored) {}
-      */
-      VariablesHistory variables = new VariablesHistory(request);
+        if (sUserId == null || sUserId.equals("")) {
+            String strAjax = "";
+            // strHidden and strPopUp not implemented
+            /*
+             * String strHidden = ""; String strPopUp = "";
+             */
+            try {
+                strAjax = request.getParameter("IsAjaxCall");
+            } catch (Exception ignored) {
+            }
+            /*
+             * try { strHidden = request.getParameter("IsHiddenCall"); } catch
+             * (Exception ignored) {} try { strPopUp =
+             * request.getParameter("IsPopUpCall"); } catch (Exception ignored)
+             * {}
+             */
+            VariablesHistory variables = new VariablesHistory(request);
 
-      // redirects to the menu or the menu with the target
-      String strTarget = request.getRequestURL().toString();
-      if (!strTarget.endsWith("/security/Menu.html")) {
-        variables.setSessionValue("targetmenu", strTarget);
-      }
+            // redirects to the menu or the menu with the target
+            String strTarget = request.getRequestURL().toString();
+            if (!strTarget.endsWith("/security/Menu.html")) {
+                variables.setSessionValue("targetmenu", strTarget);
+            }
 
-      // redirects
-      String strDireccionLocal = HttpBaseUtils.getLocalAddress(request);
-      variables.setSessionValue("target", strDireccionLocal + "/security/Menu.html");
-      if (strAjax!=null && !strAjax.equals("")) bdErrorAjax(response, "Error", "", Utility.messageBD(this.conn, "NotLogged", variables.getLanguage()));
-      else response.sendRedirect(strDireccionLocal + strServletSinIdentificar);
-      return null;
-    } else {
-      return sUserId;
+            // redirects
+            String strDireccionLocal = HttpBaseUtils.getLocalAddress(request);
+            variables.setSessionValue("target", strDireccionLocal
+                    + "/security/Menu.html");
+            if (strAjax != null && !strAjax.equals(""))
+                bdErrorAjax(response, "Error", "", Utility.messageBD(this.conn,
+                        "NotLogged", variables.getLanguage()));
+            else
+                response.sendRedirect(strDireccionLocal
+                        + strServletSinIdentificar);
+            return null;
+        } else {
+            return sUserId;
+        }
     }
-  }
 
-  public void bdErrorAjax(HttpServletResponse response, String strType, String strTitle, String strText) throws IOException {
-    response.setContentType("text/xml; charset=UTF-8");
-    PrintWriter out = response.getWriter();
-    out.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
-    out.println("<xml-structure>\n");
-    out.println("  <status>\n");
-    out.println("    <type>" + strType + "</type>\n");
-    out.println("    <title>" + strTitle + "</title>\n");
-    out.println("    <description><![CDATA[" + strText + "]]></description>\n");
-    out.println("  </status>\n");
-    out.println("</xml-structure>\n");
-    out.close();
-  }
+    public void bdErrorAjax(HttpServletResponse response, String strType,
+            String strTitle, String strText) throws IOException {
+        response.setContentType("text/xml; charset=UTF-8");
+        PrintWriter out = response.getWriter();
+        out.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
+        out.println("<xml-structure>\n");
+        out.println("  <status>\n");
+        out.println("    <type>" + strType + "</type>\n");
+        out.println("    <title>" + strTitle + "</title>\n");
+        out.println("    <description><![CDATA[" + strText
+                + "]]></description>\n");
+        out.println("  </status>\n");
+        out.println("</xml-structure>\n");
+        out.close();
+    }
 
-  public void logout(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-    if (request.getSession().getAttribute("#Authenticated_user") != null && !request.getSession().getAttribute("#Authenticated_user").equals("")) {
-      request.getSession(true).removeAttribute("#Authenticated_user");
+    public void logout(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        if (request.getSession().getAttribute("#Authenticated_user") != null
+                && !request.getSession().getAttribute("#Authenticated_user")
+                        .equals("")) {
+            request.getSession(true).removeAttribute("#Authenticated_user");
+        }
+        if (!response.isCommitted())
+            response.sendRedirect(HttpBaseUtils.getLocalAddress(request));
     }
-    if(!response.isCommitted())
-      response.sendRedirect(HttpBaseUtils.getLocalAddress(request));
-  }
 
 }
--- a/src/org/openbravo/authentication/lam/LamAuthenticationManager.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/authentication/lam/LamAuthenticationManager.java	Tue Dec 23 20:16:42 2008 +0000
@@ -8,7 +8,7 @@
  * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
  * specific language governing permissions and limitations under the License.
  ************************************************************************************
-*/
+ */
 
 package org.openbravo.authentication.lam;
 
@@ -28,40 +28,44 @@
 import org.openbravo.database.ConnectionProvider;
 
 /**
- *
+ * 
  * @author adrian
  */
 public class LamAuthenticationManager implements AuthenticationManager {
-    
+
     private ConnectionProvider conn = null;
-    
+
     /** Creates a new instance of LamAuthenticationManager */
     public LamAuthenticationManager() {
     }
-    
+
     public void init(HttpServlet s) throws AuthenticationException {
-        
+
         // TODO: Read LAM configuration.
         if (s instanceof ConnectionProvider) {
             conn = (ConnectionProvider) s;
         } else {
-            throw new AuthenticationException("Connection provider required for LAM authentication");
-        }         
+            throw new AuthenticationException(
+                    "Connection provider required for LAM authentication");
+        }
     }
-    
-    public String authenticate(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, ServletException, IOException {     
-        
+
+    public String authenticate(HttpServletRequest request,
+            HttpServletResponse response) throws AuthenticationException,
+            ServletException, IOException {
+
         try {
             LamClient LC = new LamClient(); // TODO: configure LamClient
-            
-            
-            String sUserName =  LC.force_authenticate(request, response);
+
+            String sUserName = LC.force_authenticate(request, response);
             if (sUserName == null || sUserName.equals("")) {
                 return null;
             } else {
                 String sUserId = SeguridadData.getUserId(conn, sUserName);
-                if ("-1".equals(sUserId)) {   
-                    throw new AuthenticationException("Authenticated user is not an Openbravo ERP user: " + sUserName);                    
+                if ("-1".equals(sUserId)) {
+                    throw new AuthenticationException(
+                            "Authenticated user is not an Openbravo ERP user: "
+                                    + sUserName);
                 } else {
                     return sUserId;
                 }
@@ -72,16 +76,18 @@
             throw new ServletException("Cannot authenticate user.", e);
         } catch (KeyManagementException e) {
             throw new ServletException("Cannot authenticate user.", e);
-        }        
-    }  
-    
-    public void logout(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        
+        }
+    }
+
+    public void logout(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+
         try {
             LamClient LC = new LamClient(); // TODO: configure LamClient
-            LC.logout(request, response, HttpBaseUtils.getLocalAddress(request) + "/security/Menu.html");      
+            LC.logout(request, response, HttpBaseUtils.getLocalAddress(request)
+                    + "/security/Menu.html");
         } catch (XmlRpcException e) {
             throw new ServletException("Cannot close user session.", e);
-        }        
-    }     
+        }
+    }
 }
\ No newline at end of file
--- a/src/org/openbravo/base/OBSchedulerInitializerListener.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/base/OBSchedulerInitializerListener.java	Tue Dec 23 20:16:42 2008 +0000
@@ -3,7 +3,7 @@
  * This file is a copy of org.quartz.ee.servlet.QuartzInitializerListener
  * with some minor modifications to accommodate the Openbravo ERP environment.
  ************************************************************************
-*/
+ */
 package org.openbravo.base;
 
 import static org.openbravo.base.ConfigParameters.CONFIG_ATTRIBUTE;
@@ -19,124 +19,139 @@
 import org.quartz.impl.StdSchedulerFactory;
 
 /**
- * A copy of the QuartzInializerListener with some modifications to initialize the
- * Openbravo scheduling items.
+ * A copy of the QuartzInializerListener with some modifications to initialize
+ * the Openbravo scheduling items.
  * 
- * Places Openbravo ERP application resources such as ConnectionProvider and 
- * ConfigParameters in the scheduling context so that OBScheduler singleton instance
- * has access to them.
+ * Places Openbravo ERP application resources such as ConnectionProvider and
+ * ConfigParameters in the scheduling context so that OBScheduler singleton
+ * instance has access to them.
  * 
  * @author awolski
- *
+ * 
  */
 public class OBSchedulerInitializerListener implements ServletContextListener {
-  
-  private boolean performShutdown = true;
 
-  private Scheduler scheduler = null;
-  
-  public void contextInitialized(ServletContextEvent sce) {
-    
-    System.out.println("Quartz Initializer Servlet loaded, initializing Scheduler...");
+    private boolean performShutdown = true;
 
-    final ServletContext servletContext = sce.getServletContext();
-    StdSchedulerFactory factory;
-    try {
+    private Scheduler scheduler = null;
 
-        final String configFile = servletContext.getInitParameter("config-file");
-        final String shutdownPref = servletContext.getInitParameter("shutdown-on-unload");
+    public void contextInitialized(ServletContextEvent sce) {
 
-        if (shutdownPref != null) {
-            performShutdown = Boolean.valueOf(shutdownPref).booleanValue();
+        System.out
+                .println("Quartz Initializer Servlet loaded, initializing Scheduler...");
+
+        final ServletContext servletContext = sce.getServletContext();
+        StdSchedulerFactory factory;
+        try {
+
+            final String configFile = servletContext
+                    .getInitParameter("config-file");
+            final String shutdownPref = servletContext
+                    .getInitParameter("shutdown-on-unload");
+
+            if (shutdownPref != null) {
+                performShutdown = Boolean.valueOf(shutdownPref).booleanValue();
+            }
+
+            // get Properties
+            if (configFile != null) {
+                factory = new StdSchedulerFactory(configFile);
+            } else {
+                factory = new StdSchedulerFactory();
+            }
+
+            // Always want to get the scheduler, even if it isn't starting,
+            // to make sure it is both initialized and registered.
+            scheduler = factory.getScheduler();
+
+            // Should the Scheduler being started now or later
+            final String startOnLoad = servletContext
+                    .getInitParameter("start-scheduler-on-load");
+
+            int startDelay = 0;
+            final String startDelayS = servletContext
+                    .getInitParameter("start-delay-seconds");
+            try {
+                if (startDelayS != null && startDelayS.trim().length() > 0)
+                    startDelay = Integer.parseInt(startDelayS);
+            } catch (final Exception e) {
+                System.out
+                        .println("Cannot parse value of 'start-delay-seconds' to an integer: "
+                                + startDelayS + ", defaulting to 5 seconds.");
+                startDelay = 5;
+            }
+
+            /*
+             * If the "start-scheduler-on-load" init-parameter is not specified,
+             * the scheduler will be started. This is to maintain backwards
+             * compatability.
+             */
+            if (startOnLoad == null
+                    || (Boolean.valueOf(startOnLoad).booleanValue())) {
+                if (startDelay <= 0) {
+                    // Start now
+                    scheduler.start();
+                    System.out.println("Scheduler has been started...");
+                } else {
+                    // Start delayed
+                    scheduler.startDelayed(startDelay);
+                    System.out.println("Scheduler will start in " + startDelay
+                            + " seconds.");
+                }
+            } else {
+                System.out
+                        .println("Scheduler has not been started. Use scheduler.start()");
+            }
+
+            String factoryKey = servletContext
+                    .getInitParameter("servlet-context-factory-key");
+            if (factoryKey == null) {
+                factoryKey = QUARTZ_FACTORY_KEY;
+            }
+
+            /**
+             * Openbravo scheduling stuff.
+             */
+            System.out
+                    .println("Storing the Quartz Scheduler Factory in the servlet context at key: "
+                            + factoryKey);
+            servletContext.setAttribute(factoryKey, factory);
+
+            System.out
+                    .println("Storing ConfigParameters and ConnectionProvider in Scheduler Context.");
+            scheduler.getContext().put(POOL_ATTRIBUTE,
+                    servletContext.getAttribute(POOL_ATTRIBUTE));
+            scheduler.getContext().put(CONFIG_ATTRIBUTE,
+                    servletContext.getAttribute(CONFIG_ATTRIBUTE));
+
+            System.out.println("Initalizing singleton instance of "
+                    + OBScheduler.class.getName());
+            OBScheduler.getInstance().initialize(scheduler);
+
+        } catch (final Exception e) {
+            System.out.println("Quartz Scheduler failed to initialize: "
+                    + e.toString());
+            e.printStackTrace();
+        }
+    }
+
+    public void contextDestroyed(ServletContextEvent sce) {
+
+        if (!performShutdown) {
+            return;
         }
 
-        // get Properties
-        if (configFile != null) {
-            factory = new StdSchedulerFactory(configFile);
-        } else {
-            factory = new StdSchedulerFactory();
+        try {
+            if (scheduler != null) {
+                scheduler.shutdown();
+            }
+        } catch (final Exception e) {
+            System.out.println("Quartz Scheduler failed to shutdown cleanly: "
+                    + e.toString());
+            e.printStackTrace();
         }
 
-        // Always want to get the scheduler, even if it isn't starting, 
-        // to make sure it is both initialized and registered.
-        scheduler = factory.getScheduler();
-
-        // Should the Scheduler being started now or later
-        final String startOnLoad = servletContext
-                .getInitParameter("start-scheduler-on-load");
-
-        int startDelay = 0;
-        final String startDelayS = servletContext.getInitParameter("start-delay-seconds");
-        try {
-            if(startDelayS != null && startDelayS.trim().length() > 0)
-                startDelay = Integer.parseInt(startDelayS);
-        } catch(final Exception e) {
-            System.out.println("Cannot parse value of 'start-delay-seconds' to an integer: " + startDelayS + ", defaulting to 5 seconds.");
-            startDelay = 5;
-        }
-
-        /*
-         * If the "start-scheduler-on-load" init-parameter is not specified,
-         * the scheduler will be started. This is to maintain backwards
-         * compatability.
-         */
-        if (startOnLoad == null || (Boolean.valueOf(startOnLoad).booleanValue())) {
-            if(startDelay <= 0) {
-                // Start now
-                scheduler.start();
-                System.out.println("Scheduler has been started...");
-            }
-            else {
-                // Start delayed
-                scheduler.startDelayed(startDelay);
-                System.out.println("Scheduler will start in " + startDelay + " seconds.");
-            }
-        } else {
-            System.out.println("Scheduler has not been started. Use scheduler.start()");
-        }
-
-        String factoryKey = 
-            servletContext.getInitParameter("servlet-context-factory-key");
-        if (factoryKey == null) {
-            factoryKey = QUARTZ_FACTORY_KEY;
-        }
-
-        /**
-         * Openbravo scheduling stuff.
-         */
-        System.out.println("Storing the Quartz Scheduler Factory in the servlet context at key: "
-                + factoryKey);
-        servletContext.setAttribute(factoryKey, factory);
-        
-        System.out.println("Storing ConfigParameters and ConnectionProvider in Scheduler Context.");
-        scheduler.getContext().put(POOL_ATTRIBUTE, servletContext.getAttribute(POOL_ATTRIBUTE));
-        scheduler.getContext().put(CONFIG_ATTRIBUTE, servletContext.getAttribute(CONFIG_ATTRIBUTE));
-        
-        System.out.println("Initalizing singleton instance of " + OBScheduler.class.getName());
-        OBScheduler.getInstance().initialize(scheduler);
-
-    } catch (final Exception e) {
-        System.out.println("Quartz Scheduler failed to initialize: " + e.toString());
-        e.printStackTrace();
-    }
-  }
-
-  public void contextDestroyed(ServletContextEvent sce) {
-
-    if (!performShutdown) {
-        return;
+        System.out.println("Quartz Scheduler successful shutdown.");
     }
 
-    try {
-        if (scheduler != null) {
-            scheduler.shutdown();
-        }
-    } catch (final Exception e) {
-        System.out.println("Quartz Scheduler failed to shutdown cleanly: " + e.toString());
-        e.printStackTrace();
-    }
-
-    System.out.println("Quartz Scheduler successful shutdown.");
-}
-  
 }
\ No newline at end of file
--- a/src/org/openbravo/base/secureApp/DefaultValidationException.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/base/secureApp/DefaultValidationException.java	Tue Dec 23 20:16:42 2008 +0000
@@ -8,29 +8,36 @@
  * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
  * specific language governing permissions and limitations under the License.
  ************************************************************************************
-*/
+ */
 
 package org.openbravo.base.secureApp;
 
 /**
  * Class used to catch invalid settings during the login process
+ * 
  * @author Openbravo
- *
+ * 
  */
 public class DefaultValidationException extends Exception {
 
-  private static final long serialVersionUID = 1L;
-  private String defaultField;
-  
-  public DefaultValidationException (String message, String fieldName) {
-    super(message);
-    setDefaultField(fieldName);
-  }
-  
-  /**
-   * Method used to determine the field for which the default setting failed
-   * @return
-   */
-  public String getDefaultField() { return defaultField; }
-  private void setDefaultField(String fieldName) { defaultField = fieldName; }
+    private static final long serialVersionUID = 1L;
+    private String defaultField;
+
+    public DefaultValidationException(String message, String fieldName) {
+        super(message);
+        setDefaultField(fieldName);
+    }
+
+    /**
+     * Method used to determine the field for which the default setting failed
+     * 
+     * @return
+     */
+    public String getDefaultField() {
+        return defaultField;
+    }
+
+    private void setDefaultField(String fieldName) {
+        defaultField = fieldName;
+    }
 }
--- a/src/org/openbravo/base/secureApp/DefaultValuesData.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/base/secureApp/DefaultValuesData.java	Tue Dec 23 20:16:42 2008 +0000
@@ -8,7 +8,7 @@
  * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
  * specific language governing permissions and limitations under the License.
  ************************************************************************************
-*/
+ */
 package org.openbravo.base.secureApp;
 
 import java.sql.*;
@@ -19,64 +19,70 @@
 import org.openbravo.database.ConnectionProvider;
 import org.openbravo.exception.*;
 import org.openbravo.data.UtilSql;
-import org.apache.log4j.Logger ;
+import org.apache.log4j.Logger;
 
-/**Clase SqlStandardData
+/**
+ * Clase SqlStandardData
  */
 public class DefaultValuesData implements FieldProvider {
-  public String columnname;
-  static Logger log4j = Logger.getLogger(DefaultValuesData.class);
-  
-  public String getField(String fieldName) {
-    if (fieldName.equalsIgnoreCase("columnname"))
-      return columnname;
-    else {      
-      return null;
+    public String columnname;
+    static Logger log4j = Logger.getLogger(DefaultValuesData.class);
+
+    public String getField(String fieldName) {
+        if (fieldName.equalsIgnoreCase("columnname"))
+            return columnname;
+        else {
+            return null;
+        }
     }
-  }
 
-/**Select for relation
- */
-  public static String select(ConnectionProvider connectionProvider, String param1, String param2, String param3, String param4) throws ServletException {
-    String strSql = "SELECT " + param1 + " AS COLUMNNAME";
-    strSql = strSql + " FROM " + param2 + " ";
-    strSql = strSql + " WHERE isActive = 'Y' ";
-    strSql = strSql + " AND isDefault = 'Y' ";
-    strSql = strSql + " AND AD_Client_ID IN (" + param3 + ") ";
-    strSql = strSql + " AND AD_Org_ID IN (" + param4 + ") ";
-    strSql = strSql + " ORDER BY AD_Client_ID";
+    /**
+     * Select for relation
+     */
+    public static String select(ConnectionProvider connectionProvider,
+            String param1, String param2, String param3, String param4)
+            throws ServletException {
+        String strSql = "SELECT " + param1 + " AS COLUMNNAME";
+        strSql = strSql + " FROM " + param2 + " ";
+        strSql = strSql + " WHERE isActive = 'Y' ";
+        strSql = strSql + " AND isDefault = 'Y' ";
+        strSql = strSql + " AND AD_Client_ID IN (" + param3 + ") ";
+        strSql = strSql + " AND AD_Org_ID IN (" + param4 + ") ";
+        strSql = strSql + " ORDER BY AD_Client_ID";
 
-    Statement st = null;
-    ResultSet result;
-    String resultado="";
+        Statement st = null;
+        ResultSet result;
+        String resultado = "";
 
-    try {
-      st = connectionProvider.getStatement();
-      result = st.executeQuery(strSql);
+        try {
+            st = connectionProvider.getStatement();
+            result = st.executeQuery(strSql);
 
-      if (result.next()) {
-        resultado = UtilSql.getValue(result, "COLUMNNAME");
-      }
-      result.close();
-    } catch(SQLException e){
-      log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
-      throw new ServletException("@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
-    } catch(NoConnectionAvailableException ec){
-      log4j.error("Connection error in query: " + strSql + "Exception:"+ ec);
-      throw new ServletException("@CODE=NoConnectionAvailable");
-    } catch(PoolNotFoundException ep){
-      log4j.error("Pool error in query: " + strSql + "Exception:"+ ep);
-      throw new ServletException("@CODE=NoConnectionAvailable");
-    } catch(Exception ex){
-      log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
-      throw new ServletException("@CODE=@" + ex.getMessage());
-    } finally {
-      try {
-        connectionProvider.releaseStatement(st);
-      } catch(Exception ignore){
-        ignore.printStackTrace();
-      }
+            if (result.next()) {
+                resultado = UtilSql.getValue(result, "COLUMNNAME");
+            }
+            result.close();
+        } catch (SQLException e) {
+            log4j.error("SQL error in query: " + strSql + "Exception:" + e);
+            throw new ServletException("@CODE="
+                    + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
+        } catch (NoConnectionAvailableException ec) {
+            log4j.error("Connection error in query: " + strSql + "Exception:"
+                    + ec);
+            throw new ServletException("@CODE=NoConnectionAvailable");
+        } catch (PoolNotFoundException ep) {
+            log4j.error("Pool error in query: " + strSql + "Exception:" + ep);
+            throw new ServletException("@CODE=NoConnectionAvailable");
+        } catch (Exception ex) {
+            log4j.error("Exception in query: " + strSql + "Exception:" + ex);
+            throw new ServletException("@CODE=@" + ex.getMessage());
+        } finally {
+            try {
+                connectionProvider.releaseStatement(st);
+            } catch (Exception ignore) {
+                ignore.printStackTrace();
+            }
+        }
+        return (resultado);
     }
-    return(resultado);
-  }
 }
\ No newline at end of file
--- a/src/org/openbravo/base/secureApp/ErrorConnection.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/base/secureApp/ErrorConnection.java	Tue Dec 23 20:16:42 2008 +0000
@@ -15,7 +15,7 @@
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
-*/
+ */
 package org.openbravo.base.secureApp;
 
 import org.openbravo.base.ConnectionProviderContextListener;
@@ -28,41 +28,48 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 
+public class ErrorConnection extends HttpSecureAppServlet {
+    private static final long serialVersionUID = 1L;
 
-public class ErrorConnection extends HttpSecureAppServlet {
-  private static final long serialVersionUID = 1L;
+    public void init(ServletConfig config) {
+        super.init(config);
+        boolHist = false;
+    }
 
-  public void init (ServletConfig config) {
-    super.init(config);
-    boolHist = false;
-  }
+    public void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws IOException, ServletException {
+        VariablesSecureApp vars = new VariablesSecureApp(request);
 
-  public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
-    VariablesSecureApp vars = new VariablesSecureApp(request);
+        if (vars.commandIn("RECONNECT")) {
+            try {
+                ConnectionProviderContextListener.reloadPool(this
+                        .getServletContext());
+            } catch (Exception ex) {
+                log4j.error("Error captured: " + ex);
+                printPage(response, vars);
+                return;
+            }
+            response.sendRedirect(strDireccion
+                    + globalParameters.strServletSinIdentificar);
+        } else
+            printPage(response, vars);
+    }
 
-    if (vars.commandIn("RECONNECT")) {
-      try {
-        ConnectionProviderContextListener.reloadPool(this.getServletContext());
-      } catch (Exception ex) {
-        log4j.error("Error captured: " + ex);
-        printPage(response, vars);
-        return;
-      }
-      response.sendRedirect(strDireccion + globalParameters.strServletSinIdentificar);
-    } else printPage(response, vars);
-  }
+    void printPage(HttpServletResponse response, VariablesSecureApp vars)
+            throws IOException, ServletException {
+        if (log4j.isDebugEnabled())
+            log4j.debug("Output: Error connection");
+        XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+                "org/openbravo/base/secureApp/ErrorConnection")
+                .createXmlDocument();
 
-  void printPage(HttpServletResponse response, VariablesSecureApp vars) throws IOException, ServletException {
-    if (log4j.isDebugEnabled()) log4j.debug("Output: Error connection");
-    XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/base/secureApp/ErrorConnection").createXmlDocument();
+        response.setContentType("text/html; charset=UTF-8");
+        PrintWriter out = response.getWriter();
+        out.println(xmlDocument.print());
+        out.close();
+    }
 
-    response.setContentType("text/html; charset=UTF-8");
-    PrintWriter out = response.getWriter();
-    out.println(xmlDocument.print());
-    out.close();
-  }
-
-  public String getServletInfo() {
-    return "Servlet that presents the connection error window";
-  } // end of getServletInfo() method
+    public String getServletInfo() {
+        return "Servlet that presents the connection error window";
+    } // end of getServletInfo() method
 }
--- a/src/org/openbravo/base/secureApp/LoginUtils.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/base/secureApp/LoginUtils.java	Tue Dec 23 20:16:42 2008 +0000
@@ -8,7 +8,7 @@
  * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
  * specific language governing permissions and limitations under the License.
  ************************************************************************************
-*/
+ */
 package org.openbravo.base.secureApp;
 
 import javax.servlet.ServletException;
@@ -21,16 +21,19 @@
 import org.openbravo.database.ConnectionProvider;
 
 public class LoginUtils {
-    
+
     public static Logger log4j = Logger.getLogger(LoginUtils.class);
-    
+
     /** Creates a new instance of LoginUtils */
     private LoginUtils() {
     }
-    
-    public static boolean fillSessionArguments(ConnectionProvider conn, VariablesSecureApp vars, String strUserAuth, String strLanguage, String strIsRTL,  String strRol, String strCliente, String strOrg, String strAlmacen)  throws ServletException {
 
-         // Check session options 
+    public static boolean fillSessionArguments(ConnectionProvider conn,
+            VariablesSecureApp vars, String strUserAuth, String strLanguage,
+            String strIsRTL, String strRol, String strCliente, String strOrg,
+            String strAlmacen) throws ServletException {
+
+        // Check session options
         if (!RoleComboData.isUserRole(conn, strUserAuth, strRol)) {
             log4j.error("Login role is not in user roles list");
             log4j.error("User: " + strUserAuth);
@@ -42,104 +45,147 @@
             return false;
         }
         if (!OrganizationComboData.isLoginRoleOrg(conn, strRol, strOrg)) {
-          log4j.error("Login organization is not in role organizations list");
-          return false;
+            log4j.error("Login organization is not in role organizations list");
+            return false;
         }
 
-
-        // Set session vars     
+        // Set session vars
         vars.setSessionValue("#AD_User_ID", strUserAuth);
         vars.setSessionValue("#SalesRep_ID", strUserAuth);
         vars.setSessionValue("#AD_Language", strLanguage);
         vars.setSessionValue("#AD_Role_ID", strRol);
         vars.setSessionValue("#AD_Client_ID", strCliente);
-        vars.setSessionValue("#AD_Org_ID", strOrg);    
+        vars.setSessionValue("#AD_Org_ID", strOrg);
         vars.setSessionValue("#M_Warehouse_ID", strAlmacen);
 
-        vars.setSessionValue("#StdPrecision", "2");    
-        
-        //Organizations tree
+        vars.setSessionValue("#StdPrecision", "2");
+
+        // Organizations tree
         try {
-          OrgTree tree = new OrgTree(conn, strCliente);
-          vars.setSessionObject("#CompleteOrgTree", tree);
-          OrgTree accessibleTree = tree.getAccessibleTree(conn, strRol); 
-          vars.setSessionValue("#AccessibleOrgTree", accessibleTree.toString());
+            OrgTree tree = new OrgTree(conn, strCliente);
+            vars.setSessionObject("#CompleteOrgTree", tree);
+            OrgTree accessibleTree = tree.getAccessibleTree(conn, strRol);
+            vars.setSessionValue("#AccessibleOrgTree", accessibleTree
+                    .toString());
         } catch (Exception e) {
-          log4j.warn("Error while setting Organzation tree to session " + e);
-          return false;
+            log4j.warn("Error while setting Organzation tree to session " + e);
+            return false;
         }
-        
 
         try {
-          SeguridadData[] data = SeguridadData.select(conn, strRol, strUserAuth);
-          if (data==null || data.length==0) return false;
-          vars.setSessionValue("#User_Level", data[0].userlevel);
-          vars.setSessionValue("#User_Client", data[0].clientlist);
-          vars.setSessionValue("#User_Org", data[0].orglist);
-          vars.setSessionValue("#Approval_C_Currency_ID", data[0].cCurrencyId);
-          vars.setSessionValue("#Approval_Amt", data[0].amtapproval);
-          vars.setSessionValue("#Client_Value", data[0].value);
-          vars.setSessionValue("#Client_SMTP", data[0].smtphost);
-                   
-          data=null;
-          AttributeData[] attr = AttributeData.select(conn, Utility.getContext(conn, vars, "#User_Client", "LoginHandler"), Utility.getContext(conn, vars, "#User_Org", "LoginHandler"));
-          if (attr!=null && attr.length>0) {
-            vars.setSessionValue("$C_AcctSchema_ID", attr[0].value);
-            vars.setSessionValue("$C_Currency_ID", attr[0].attribute);
-            vars.setSessionValue("#StdPrecision", AttributeData.selectStdPrecision(conn, attr[0].attribute, Utility.getContext(conn, vars, "#User_Client", "LoginHandler"), Utility.getContext(conn, vars, "#User_Org", "LoginHandler")));
-            vars.setSessionValue("$HasAlias", attr[0].hasalias);
-            for (int i=0;i<attr.length;i++) vars.setSessionValue("$Element_" + attr[i].elementtype, "Y");
-          }
-          attr=null;
-          PreferencesData[] prefs = PreferencesData.select(conn, Utility.getContext(conn, vars, "#User_Client", "LoginHandler"), Utility.getContext(conn, vars, "#User_Org", "LoginHandler"), strUserAuth);
+            SeguridadData[] data = SeguridadData.select(conn, strRol,
+                    strUserAuth);
+            if (data == null || data.length == 0)
+                return false;
+            vars.setSessionValue("#User_Level", data[0].userlevel);
+            vars.setSessionValue("#User_Client", data[0].clientlist);
+            vars.setSessionValue("#User_Org", data[0].orglist);
+            vars
+                    .setSessionValue("#Approval_C_Currency_ID",
+                            data[0].cCurrencyId);
+            vars.setSessionValue("#Approval_Amt", data[0].amtapproval);
+            vars.setSessionValue("#Client_Value", data[0].value);
+            vars.setSessionValue("#Client_SMTP", data[0].smtphost);
 
-          if (prefs!=null && prefs.length>0) {
-            for (int i=0;i<prefs.length;i++) {
-              vars.setSessionValue("P|" + (prefs[i].adWindowId.equals("")?"":(prefs[i].adWindowId + "|")) + prefs[i].attribute, prefs[i].value);
+            data = null;
+            AttributeData[] attr = AttributeData
+                    .select(conn, Utility.getContext(conn, vars,
+                            "#User_Client", "LoginHandler"),
+                            Utility.getContext(conn, vars, "#User_Org",
+                                    "LoginHandler"));
+            if (attr != null && attr.length > 0) {
+                vars.setSessionValue("$C_AcctSchema_ID", attr[0].value);
+                vars.setSessionValue("$C_Currency_ID", attr[0].attribute);
+                vars.setSessionValue("#StdPrecision", AttributeData
+                        .selectStdPrecision(conn, attr[0].attribute, Utility
+                                .getContext(conn, vars, "#User_Client",
+                                        "LoginHandler"), Utility.getContext(
+                                conn, vars, "#User_Org", "LoginHandler")));
+                vars.setSessionValue("$HasAlias", attr[0].hasalias);
+                for (int i = 0; i < attr.length; i++)
+                    vars
+                            .setSessionValue("$Element_" + attr[i].elementtype,
+                                    "Y");
             }
-          }
-          prefs=null;
+            attr = null;
+            PreferencesData[] prefs = PreferencesData
+                    .select(conn, Utility.getContext(conn, vars,
+                            "#User_Client", "LoginHandler"),
+                            Utility.getContext(conn, vars, "#User_Org",
+                                    "LoginHandler"), strUserAuth);
 
-          attr = AttributeData.selectIsSOTrx(conn);
-          if (attr!=null && attr.length>0) {
-            for (int i=0;i<attr.length;i++) vars.setSessionValue(attr[i].adWindowId + "|isSOTrx", attr[i].value);
-          }
-          attr=null;
+            if (prefs != null && prefs.length > 0) {
+                for (int i = 0; i < prefs.length; i++) {
+                    vars.setSessionValue("P|"
+                            + (prefs[i].adWindowId.equals("") ? ""
+                                    : (prefs[i].adWindowId + "|"))
+                            + prefs[i].attribute, prefs[i].value);
+                }
+            }
+            prefs = null;
 
-          DefaultSessionValuesData[] ds = DefaultSessionValuesData.select(conn);
-          if (ds!=null && ds.length>0) {
-            for (int i=0;i<ds.length;i++) {
-              String value = DefaultValuesData.select(conn, ds[i].columnname, ds[i].tablename, Utility.getContext(conn, vars, "#User_Client", "LoginHandler"), Utility.getContext(conn, vars, "#User_Org", "LoginHandler"));
-              if (ds[i].tablename.equals("C_DocType")) vars.setSessionValue("#C_DocTypeTarget_ID", value);
-              vars.setSessionValue("#" + ds[i].columnname, value);
+            attr = AttributeData.selectIsSOTrx(conn);
+            if (attr != null && attr.length > 0) {
+                for (int i = 0; i < attr.length; i++)
+                    vars.setSessionValue(attr[i].adWindowId + "|isSOTrx",
+                            attr[i].value);
             }
-          }
-          vars.setSessionValue("#Date", Utility.getContext(conn, vars, "#Date", "LoginHandler"));
-          vars.setSessionValue("#ShowTrl", Utility.getPreference(vars, "ShowTrl", ""));
-          vars.setSessionValue("#ShowAcct", Utility.getPreference(vars, "ShowAcct", ""));
-          vars.setSessionValue("#ShowAudit", Utility.getPreference(vars, "ShowAuditDefault", ""));
-          vars.setSessionValue("#ShowConfirmation", Utility.getPreference(vars, "ShowConfirmationDefault", ""));
-          vars.setSessionValue("#Autosave", Utility.getPreference(vars, "Autosave", ""));
-          SystemPreferencesData[] dataSystem = SystemPreferencesData.select(conn);
-          if (dataSystem!=null && dataSystem.length>0) {
-            vars.setSessionValue("#RecordRange", dataSystem[0].tadRecordrange);
-            vars.setSessionValue("#RecordRangeInfo", dataSystem[0].tadRecordrangeInfo);
-            vars.setSessionValue("#Transactional$Range", dataSystem[0].tadTransactionalrange);
-            if (strIsRTL.equals("Y")) {
-              vars.setSessionValue("#Theme", "rtl/"+dataSystem[0].tadTheme);
-              vars.setSessionValue("#TextDirection", "RTL");
-            } else if (strIsRTL.equals("N")) {
-              vars.setSessionValue("#Theme", "ltr/"+dataSystem[0].tadTheme);
-              vars.setSessionValue("#TextDirection", "LTR");
-            } else {
-              log4j.error("Can't detect direction of language: ltr? rtl? parameter isRTL missing in call to LoginUtils.getStringParameter");
-              return false;
+            attr = null;
+
+            DefaultSessionValuesData[] ds = DefaultSessionValuesData
+                    .select(conn);
+            if (ds != null && ds.length > 0) {
+                for (int i = 0; i < ds.length; i++) {
+                    String value = DefaultValuesData.select(conn,
+                            ds[i].columnname, ds[i].tablename, Utility
+                                    .getContext(conn, vars, "#User_Client",
+                                            "LoginHandler"), Utility
+                                    .getContext(conn, vars, "#User_Org",
+                                            "LoginHandler"));
+                    if (ds[i].tablename.equals("C_DocType"))
+                        vars.setSessionValue("#C_DocTypeTarget_ID", value);
+                    vars.setSessionValue("#" + ds[i].columnname, value);
+                }
             }
-          }
+            vars.setSessionValue("#Date", Utility.getContext(conn, vars,
+                    "#Date", "LoginHandler"));
+            vars.setSessionValue("#ShowTrl", Utility.getPreference(vars,
+                    "ShowTrl", ""));
+            vars.setSessionValue("#ShowAcct", Utility.getPreference(vars,
+                    "ShowAcct", ""));
+            vars.setSessionValue("#ShowAudit", Utility.getPreference(vars,
+                    "ShowAuditDefault", ""));
+            vars.setSessionValue("#ShowConfirmation", Utility.getPreference(
+                    vars, "ShowConfirmationDefault", ""));
+            vars.setSessionValue("#Autosave", Utility.getPreference(vars,
+                    "Autosave", ""));
+            SystemPreferencesData[] dataSystem = SystemPreferencesData
+                    .select(conn);
+            if (dataSystem != null && dataSystem.length > 0) {
+                vars.setSessionValue("#RecordRange",
+                        dataSystem[0].tadRecordrange);
+                vars.setSessionValue("#RecordRangeInfo",
+                        dataSystem[0].tadRecordrangeInfo);
+                vars.setSessionValue("#Transactional$Range",
+                        dataSystem[0].tadTransactionalrange);
+                if (strIsRTL.equals("Y")) {
+                    vars.setSessionValue("#Theme", "rtl/"
+                            + dataSystem[0].tadTheme);
+                    vars.setSessionValue("#TextDirection", "RTL");
+                } else if (strIsRTL.equals("N")) {
+                    vars.setSessionValue("#Theme", "ltr/"
+                            + dataSystem[0].tadTheme);
+                    vars.setSessionValue("#TextDirection", "LTR");
+                } else {
+                    log4j
+                            .error("Can't detect direction of language: ltr? rtl? parameter isRTL missing in call to LoginUtils.getStringParameter");
+                    return false;
+                }
+            }
 
         } catch (ServletException e) {
-          log4j.warn("Error while loading session arguments: " + e);
-          return false;
+            log4j.warn("Error while loading session arguments: " + e);
+            return false;
         }
         return true;
     }
--- a/src/org/openbravo/base/secureApp/OrgTree.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/base/secureApp/OrgTree.java	Tue Dec 23 20:16:42 2008 +0000
@@ -8,7 +8,7 @@
  * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
  * specific language governing permissions and limitations under the License.
  ************************************************************************************
-*/
+ */
 
 package org.openbravo.base.secureApp;
 
@@ -20,342 +20,404 @@
 import org.openbravo.erpCommon.utility.WindowTreeData;
 import org.openbravo.database.ConnectionProvider;
 
-public class OrgTree implements Serializable{
-  private static final long serialVersionUID=1L;
-  private List<OrgTreeNode> nodes;
-	
-	/**
-	 * Creates a new Organization tree with all the nodes
-	 * 
-	 * @param conn DB connection
-	 * @param strClient client to get the org tree from
-	 */
-	public OrgTree(ConnectionProvider conn, String strClient) {
-	  try {
-	    String treeID = WindowTreeData.selectTreeID(conn, "'"+strClient+"'", "OO")[0].id;
-	    WindowTreeData[] data = WindowTreeData.selectOrg(conn, "", "", "", "", treeID);
-	    this.nodes = OrgTreeNode.createTree(data);
-	  } catch (Exception e) {
-	    e.printStackTrace();
-	  }
-	}
-	/**
-	 * Creates an empty Tree
-	 */
-	public OrgTree() {
-	  nodes =new ArrayList<OrgTreeNode>();
-	  
-	}
-	
-	/**
-	 * Creates a tree with the nodes in nodeList
-	 * @param nodeList
-	 */
-	public OrgTree(List<OrgTreeNode> nodeList) {
-	  nodes = nodeList;
-	}
-	
-	/**
-	 * Creates a tree with a colon-separated AD_Org_ID in strOrgs
-	 * @param strOrgs colon-separated AD_Org_ID. Example "'0','1000000'"
-	 */
-	public OrgTree(String strOrgs) {
-		OrgTreeNode orgTreeNode;
-		List<OrgTreeNode> nodeList = new ArrayList<OrgTreeNode>();
-		
-		int i=0;
-		int charAt_Old=0;
-		while (i < strOrgs.length()) {
-			char c = strOrgs.charAt(i++);
-			if (c==',') {
-				String AD_Org_ID = strOrgs.substring(charAt_Old+1, i-2);
-				charAt_Old=i;
-				orgTreeNode = new OrgTreeNode(AD_Org_ID);
-				nodeList.add(orgTreeNode);
-			}
-			// Get the last org of the string
-			if (i==strOrgs.length()-1) {
-				String AD_Org_ID = strOrgs.substring(charAt_Old+1, i);
-				orgTreeNode = new OrgTreeNode(AD_Org_ID);
-				nodeList.add(orgTreeNode);
-			}
-		}
-		
-		nodes = nodeList;
-	}
-	
-	/**
-	 * Returns a String with the Ready Organizations which are able 
-	 * to manage transactions (like for example Invoices)
-	 * @param strOrgs colon-separated AD_Org_ID. Example "'0','1000000'"
-	 * @return colon-separated AD_Org_ID of Ready Organizations 
-	 * which are able to manage transactions. Example: "'0','1000000'"
-	 */
-	public static String getTransactionAllowedOrgs(String strOrgs){
-		StringBuffer sb = new StringBuffer();		
-		OrgTree orgTree = new OrgTree(strOrgs);		
-		Iterator<OrgTreeNode> iterator = orgTree.iterator();
-	    while (iterator.hasNext()) {
-	        OrgTreeNode n = iterator.next();
-	        if (n.getIsReady()=="true" && n.getOrgType().isTransactionsAllowed()) {
-	        	sb.append("'"+n.getId()+"',");
-	        }     
-	    }
-	    // Remove the last ','
-	    if (sb.length()>0 && sb.charAt(sb.length()-1)==',') {
-	    	sb.deleteCharAt(sb.length()-1);	
-	    }
-		return sb.toString();
-	}
-	
-	/**
-	 * Returns a sub-tree of the original tree with those organizations accessible by the role
-	 * @param conn
-	 * @param strRole
-	 * @return
-	 */
-	public OrgTree getAccessibleTree(ConnectionProvider conn, String strRole, boolean withZero){
-	  //TODO: this method with boolean should be removed.
-    return getAccessibleTree(conn, strRole);
-	}
-	
-	public OrgTree getAccessibleTree(ConnectionProvider conn, String strRole){
-	   try {
-	      OrgTreeData[] data = OrgTreeData.select(conn, strRole);
-	      OrgTree accessibleOrgTree = new OrgTree();
-	      for (int i=0; i<data.length;i++) {
-	        accessibleOrgTree.addTree(this.getLogicPath(data[i].adOrgId));
-	      }
-	      return accessibleOrgTree;
-	    } catch (Exception e) {
-	      return new OrgTree();
-	    }
-	}
-	
-	/**
-	 * Obtains a tree with all the nodes that can be referenced from the original one.
-	 * @param original tree contains all the nodes to reference from 
-	 * @return new tree with referenceable nodes.
-	 */
-	public OrgTree getReferenceableTree(OrgTree tree){
-	  Iterator<OrgTreeNode> iterator = tree.iterator();
-	  OrgTree refeTree=new OrgTree();
-	  while (iterator.hasNext()) {
-	    OrgTreeNode o = iterator.next();
-	    refeTree.addTree(this.getLogicPath(o.getId()));
-	  }
-	  return refeTree;
-	}
-	
-	
-	/**
-	 * Obtains all nodes descendant of the given parentNodeId
-	 * @param parentNodeId
-	 * @return the new tree with the desdentant elements
-	 */
-	public OrgTree getDescendantTree(String parentNodeId) {
-	  try {
-  	  List<OrgTreeNode> treeNodes = new ArrayList<OrgTreeNode>();
-  	  getDescendantTreeList(parentNodeId, treeNodes);
-  	  return new OrgTree(treeNodes);
-	  }catch(Exception e){
-	    return new OrgTree();
-	  }
-	}
-	
-	/**
-	 * Obtains all nodes ascendant of the given nodId
-	 * @param nodeId
-	 * @return the new tree with the ascendant elements
-	 */
-	public OrgTree getAscendantTree(String nodeId){
-	  try {
-  	  List<OrgTreeNode> treeNodes = new ArrayList<OrgTreeNode>();
-  	  OrgTreeNode parentNode = getNodeById(nodeId);
-  	  while (parentNode!=null) {
-  	    treeNodes.add(parentNode);
-  	    parentNode = getNodeById(parentNode.getParentId());
-  	  }
-  	  return new OrgTree(treeNodes);
-	  } catch(Exception e){
-      return new OrgTree();
+public class OrgTree implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private List<OrgTreeNode> nodes;
+
+    /**
+     * Creates a new Organization tree with all the nodes
+     * 
+     * @param conn
+     *            DB connection
+     * @param strClient
+     *            client to get the org tree from
+     */
+    public OrgTree(ConnectionProvider conn, String strClient) {
+        try {
+            String treeID = WindowTreeData.selectTreeID(conn, "'" + strClient
+                    + "'", "OO")[0].id;
+            WindowTreeData[] data = WindowTreeData.selectOrg(conn, "", "", "",
+                    "", treeID);
+            this.nodes = OrgTreeNode.createTree(data);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
-	}
-	
-	/**
-	 * Obtains the logic path for a node, this is the sum of all desdendat nodes and all ascendant ones.
-	 * @param nodeId
-	 * @return the new tree with the Logic Path
-	 */
-	public OrgTree getLogicPath(String nodeId){
-	  try {
-	    return addTree(this.getDescendantTree(nodeId), this.getAscendantTree(nodeId));
-	  } catch(Exception e){
-      return new OrgTree();
+
+    /**
+     * Creates an empty Tree
+     */
+    public OrgTree() {
+        nodes = new ArrayList<OrgTreeNode>();
+
     }
-	}
-	
-	public Iterator<OrgTreeNode> iterator(){
-	  return nodes.iterator();
-	}
-	
-	public static String getAllOrgsString(ConnectionProvider conn, String name) {
-	  try {
-  	  OrgTreeData[] dataClients = OrgTreeData.selectAllClients(conn);
-  	  String retVal="";
-  	  if (dataClients== null) return "";
-  	  retVal += "var "+name+"=new Array(";
-  	  for (int i=0; i<dataClients.length; i++) {
-  	     OrgTree t = new OrgTree(conn, dataClients[i].adClientId);
-  	     OrgTreeData[] dataRole = OrgTreeData.selectRoles(conn, dataClients[i].adClientId);
-  	     if (dataRole != null) {
-  	       for (int j=0; j<dataRole.length; j++) {
-  	         OrgTree tRole= t.getAccessibleTree(conn, dataRole[j].adRoleId, dataRole[j].userlevel.contains("S"));
-  	         Iterator<OrgTreeNode> iterator = tRole.iterator();
-  	         while (iterator.hasNext()) {
-  	           OrgTreeNode n = iterator.next();
-  	           retVal += "new Array(\""+dataRole[j].adRoleId+"\", \""+n.getId()+"\", \""+n.getValue()+"\")"+((!iterator.hasNext()&&(j==dataRole.length-1)&&(i==dataClients.length-1))?"\n":",\n");
-  	         }
-  	       }
-  	     }
-  	  }
-  	  retVal +=");";
-  	    
-  	  return retVal;
-	  } catch (Exception e) {
-	    return "";
-	  }
-	}
 
-	/**
-	 * Converts the tree into String. Nodes comma separated. 
-	 */
-	public String toString() {
-    String s="";
-    if (nodes == null) return "";
-    for (int i=0;i<nodes.toArray().length;i++) {
-      if (nodes.get(i)!=null)
-        s+= "'"+nodes.get(i).getId()+"'"+((i<nodes.toArray().length-1)?",":"");
+    /**
+     * Creates a tree with the nodes in nodeList
+     * 
+     * @param nodeList
+     */
+    public OrgTree(List<OrgTreeNode> nodeList) {
+        nodes = nodeList;
     }
-    return s;
-  }
-	
-	/**
-   * Converts the tree into String. Displaying the name in order to make it more understandable 
-   */
-  public String toDebugString() {
-    String s="";
-    if (nodes == null) return "";
-    for (int i=0;i<nodes.toArray().length;i++) {
-      if (nodes.get(i)!=null)
-        s+= nodes.get(i).getId()+" - "+nodes.get(i).getValue()+((i<nodes.toArray().length-1)?"\n":"");
+
+    /**
+     * Creates a tree with a colon-separated AD_Org_ID in strOrgs
+     * 
+     * @param strOrgs
+     *            colon-separated AD_Org_ID. Example "'0','1000000'"
+     */
+    public OrgTree(String strOrgs) {
+        OrgTreeNode orgTreeNode;
+        List<OrgTreeNode> nodeList = new ArrayList<OrgTreeNode>();
+
+        int i = 0;
+        int charAt_Old = 0;
+        while (i < strOrgs.length()) {
+            char c = strOrgs.charAt(i++);
+            if (c == ',') {
+                String AD_Org_ID = strOrgs.substring(charAt_Old + 1, i - 2);
+                charAt_Old = i;
+                orgTreeNode = new OrgTreeNode(AD_Org_ID);
+                nodeList.add(orgTreeNode);
+            }
+            // Get the last org of the string
+            if (i == strOrgs.length() - 1) {
+                String AD_Org_ID = strOrgs.substring(charAt_Old + 1, i);
+                orgTreeNode = new OrgTreeNode(AD_Org_ID);
+                nodeList.add(orgTreeNode);
+            }
+        }
+
+        nodes = nodeList;
     }
-    return s;
-  }
 
-	/**
-	 * Sums the nodes in t1 which do not exist in the current tree.
-	 * @param t1
-	 */
-	public void addTree(OrgTree t1){
-    if ((t1 != null) && (t1.nodes!= null)) {
-      for (int i=0; i<t1.nodes.toArray().length; i++) {
-        if (!this.isNodeInTree(t1.nodes.get(i).getId()))
-          this.nodes.add(t1.nodes.get(i));
-      }
+    /**
+     * Returns a String with the Ready Organizations which are able to manage
+     * transactions (like for example Invoices)
+     * 
+     * @param strOrgs
+     *            colon-separated AD_Org_ID. Example "'0','1000000'"
+     * @return colon-separated AD_Org_ID of Ready Organizations which are able
+     *         to manage transactions. Example: "'0','1000000'"
+     */
+    public static String getTransactionAllowedOrgs(String strOrgs) {
+        StringBuffer sb = new StringBuffer();
+        OrgTree orgTree = new OrgTree(strOrgs);
+        Iterator<OrgTreeNode> iterator = orgTree.iterator();
+        while (iterator.hasNext()) {
+            OrgTreeNode n = iterator.next();
+            if (n.getIsReady() == "true"
+                    && n.getOrgType().isTransactionsAllowed()) {
+                sb.append("'" + n.getId() + "',");
+            }
+        }
+        // Remove the last ','
+        if (sb.length() > 0 && sb.charAt(sb.length() - 1) == ',') {
+            sb.deleteCharAt(sb.length() - 1);
+        }
+        return sb.toString();
     }
-	}
-	
-	/**
-	 * Sums different nodes of two trees. And returns a new one.
-	 * @param t1 tree1
-	 * @param t2 tree2
-	 * @return new tree (t1+t2)
-	 */
-	public static OrgTree addTree(OrgTree t1, OrgTree t2) {
-    List<OrgTreeNode> treeNodes = new ArrayList<OrgTreeNode>();
-    
-    treeNodes.addAll(t1.nodes);
-    
-    OrgTree returnTree=new OrgTree(treeNodes);
-    returnTree.addTree(t2);
-    return returnTree;
-  }
-	
-	
- /**
-   * List param is modified with all the child nodes, repeatNodes decides what to do in case of 
-   * repeated nodes.
-   * @param parentNodeId
-   * @param list
-   * @param repeatNodes
-   */
-  private void getDescendantTreeList(String parentNodeId, List<OrgTreeNode> list, boolean repeatNodes, boolean withZero) {
-    List<OrgTreeNode> childNodes = getNodesWithParent(parentNodeId);
-    if (repeatNodes) {
-      if (withZero || !getNodeById(parentNodeId).getId().equals("0")) list.add(getNodeById(parentNodeId));
-    } else {
-      if ((list == null) && (withZero || !getNodeById(parentNodeId).getId().equals("0")))
-        list.add(getNodeById(parentNodeId));
-      else {
-        boolean exists = false;
-        for (int i=0; i<list.toArray().length; i++)
-          if (list.get(i).equals(parentNodeId)) exists = true;
-        if ((!exists) && (withZero || !getNodeById(parentNodeId).getId().equals("0"))) list.add(getNodeById(parentNodeId));
-      }
-    }      
-    if (childNodes.toArray().length !=0)
-      for (int i=0; i<childNodes.toArray().length; i++)
-        getDescendantTreeList(childNodes.get(i).getId(), list, repeatNodes, withZero);
 
-  }
-	
-	/**
-	 * List param is modified with all the child nodes
-	 * @param parentNodeId
-	 * @param list
-	 */
-	private void getDescendantTreeList(String parentNodeId, List<OrgTreeNode> list) {
-	  getDescendantTreeList(parentNodeId, list, true, true);
-	}
-	
-	/**
-	 * Returns the node matching the id, in case it does not exists it returns null
-	 * @param id
-	 * @return
-	 */
-	private OrgTreeNode getNodeById(String id) {
-	  if (nodes == null) return null;
-	  for (int i=0; i<nodes.toArray().length; i++)
-	    if (nodes.get(i).equals(id)) return nodes.get(i);
-	  return null;
-	}
-	
-	/**
-	 * In case the node id is in the tree it returns true, if not false.
-	 * @param id
-	 * @return
-	 */
-	private boolean isNodeInTree(String id){
-	  if (nodes == null) return false;
-	   for (int i=0; i<nodes.toArray().length; i++)
-	      if (nodes.get(i).equals(id)) return true;
-	  return false;
-	}
-	
-	/**
-	 * Returns the list of the nodes that have a determinate node.
-	 * @param parentId
-	 * @return
-	 */
-	private List<OrgTreeNode> getNodesWithParent(String parentId) {
-	  List<OrgTreeNode> vecNodes = new ArrayList<OrgTreeNode>();
-	  int idx = 0;
-	  for (int i=0;i<nodes.toArray().length;i++)
-	    if (nodes.get(i).getParentId().equals(parentId)) { 
-	      vecNodes.add(idx++, nodes.get(i));
-	    }
-	  return vecNodes;
-	}
+    /**
+     * Returns a sub-tree of the original tree with those organizations
+     * accessible by the role
+     * 
+     * @param conn
+     * @param strRole
+     * @return
+     */
+    public OrgTree getAccessibleTree(ConnectionProvider conn, String strRole,
+            boolean withZero) {
+        // TODO: this method with boolean should be removed.
+        return getAccessibleTree(conn, strRole);
+    }
+
+    public OrgTree getAccessibleTree(ConnectionProvider conn, String strRole) {
+        try {
+            OrgTreeData[] data = OrgTreeData.select(conn, strRole);
+            OrgTree accessibleOrgTree = new OrgTree();
+            for (int i = 0; i < data.length; i++) {
+                accessibleOrgTree.addTree(this.getLogicPath(data[i].adOrgId));
+            }
+            return accessibleOrgTree;
+        } catch (Exception e) {
+            return new OrgTree();
+        }
+    }
+
+    /**
+     * Obtains a tree with all the nodes that can be referenced from the
+     * original one.
+     * 
+     * @param original
+     *            tree contains all the nodes to reference from
+     * @return new tree with referenceable nodes.
+     */
+    public OrgTree getReferenceableTree(OrgTree tree) {
+        Iterator<OrgTreeNode> iterator = tree.iterator();
+        OrgTree refeTree = new OrgTree();
+        while (iterator.hasNext()) {
+            OrgTreeNode o = iterator.next();
+            refeTree.addTree(this.getLogicPath(o.getId()));
+        }
+        return refeTree;
+    }
+
+    /**
+     * Obtains all nodes descendant of the given parentNodeId
+     * 
+     * @param parentNodeId
+     * @return the new tree with the desdentant elements
+     */
+    public OrgTree getDescendantTree(String parentNodeId) {
+        try {
+            List<OrgTreeNode> treeNodes = new ArrayList<OrgTreeNode>();
+            getDescendantTreeList(parentNodeId, treeNodes);
+            return new OrgTree(treeNodes);
+        } catch (Exception e) {
+            return new OrgTree();
+        }
+    }
+
+    /**
+     * Obtains all nodes ascendant of the given nodId
+     * 
+     * @param nodeId
+     * @return the new tree with the ascendant elements
+     */
+    public OrgTree getAscendantTree(String nodeId) {
+        try {
+            List<OrgTreeNode> treeNodes = new ArrayList<OrgTreeNode>();
+            OrgTreeNode parentNode = getNodeById(nodeId);
+            while (parentNode != null) {
+                treeNodes.add(parentNode);
+                parentNode = getNodeById(parentNode.getParentId());
+            }
+            return new OrgTree(treeNodes);
+        } catch (Exception e) {
+            return new OrgTree();
+        }
+    }
+
+    /**
+     * Obtains the logic path for a node, this is the sum of all desdendat nodes
+     * and all ascendant ones.
+     * 
+     * @param nodeId
+     * @return the new tree with the Logic Path
+     */
+    public OrgTree getLogicPath(String nodeId) {
+        try {
+            return addTree(this.getDescendantTree(nodeId), this
+                    .getAscendantTree(nodeId));
+        } catch (Exception e) {
+            return new OrgTree();
+        }
+    }
+
+    public Iterator<OrgTreeNode> iterator() {
+        return nodes.iterator();
+    }
+
+    public static String getAllOrgsString(ConnectionProvider conn, String name) {
+        try {
+            OrgTreeData[] dataClients = OrgTreeData.selectAllClients(conn);
+            String retVal = "";
+            if (dataClients == null)
+                return "";
+            retVal += "var " + name + "=new Array(";
+            for (int i = 0; i < dataClients.length; i++) {
+                OrgTree t = new OrgTree(conn, dataClients[i].adClientId);
+                OrgTreeData[] dataRole = OrgTreeData.selectRoles(conn,
+                        dataClients[i].adClientId);
+                if (dataRole != null) {
+                    for (int j = 0; j < dataRole.length; j++) {
+                        OrgTree tRole = t.getAccessibleTree(conn,
+                                dataRole[j].adRoleId, dataRole[j].userlevel
+                                        .contains("S"));
+                        Iterator<OrgTreeNode> iterator = tRole.iterator();
+                        while (iterator.hasNext()) {
+                            OrgTreeNode n = iterator.next();
+                            retVal += "new Array(\""
+                                    + dataRole[j].adRoleId
+                                    + "\", \""
+                                    + n.getId()
+                                    + "\", \""
+                                    + n.getValue()
+                                    + "\")"
+                                    + ((!iterator.hasNext()
+                                            && (j == dataRole.length - 1) && (i == dataClients.length - 1)) ? "\n"
+                                            : ",\n");
+                        }
+                    }
+                }
+            }
+            retVal += ");";
+
+            return retVal;
+        } catch (Exception e) {
+            return "";
+        }
+    }
+
+    /**
+     * Converts the tree into String. Nodes comma separated.
+     */
+    public String toString() {
+        String s = "";
+        if (nodes == null)
+            return "";
+        for (int i = 0; i < nodes.toArray().length; i++) {
+            if (nodes.get(i) != null)
+                s += "'" + nodes.get(i).getId() + "'"
+                        + ((i < nodes.toArray().length - 1) ? "," : "");
+        }
+        return s;
+    }
+
+    /**
+     * Converts the tree into String. Displaying the name in order to make it
+     * more understandable
+     */
+    public String toDebugString() {
+        String s = "";
+        if (nodes == null)
+            return "";
+        for (int i = 0; i < nodes.toArray().length; i++) {
+            if (nodes.get(i) != null)
+                s += nodes.get(i).getId() + " - " + nodes.get(i).getValue()
+                        + ((i < nodes.toArray().length - 1) ? "\n" : "");
+        }
+        return s;
+    }
+
+    /**
+     * Sums the nodes in t1 which do not exist in the current tree.
+     * 
+     * @param t1
+     */
+    public void addTree(OrgTree t1) {
+        if ((t1 != null) && (t1.nodes != null)) {
+            for (int i = 0; i < t1.nodes.toArray().length; i++) {
+                if (!this.isNodeInTree(t1.nodes.get(i).getId()))
+                    this.nodes.add(t1.nodes.get(i));
+            }
+        }
+    }
+
+    /**
+     * Sums different nodes of two trees. And returns a new one.
+     * 
+     * @param t1
+     *            tree1
+     * @param t2
+     *            tree2
+     * @return new tree (t1+t2)
+     */
+    public static OrgTree addTree(OrgTree t1, OrgTree t2) {
+        List<OrgTreeNode> treeNodes = new ArrayList<OrgTreeNode>();
+
+        treeNodes.addAll(t1.nodes);
+
+        OrgTree returnTree = new OrgTree(treeNodes);
+        returnTree.addTree(t2);
+        return returnTree;
+    }
+
+    /**
+     * List param is modified with all the child nodes, repeatNodes decides what
+     * to do in case of repeated nodes.
+     * 
+     * @param parentNodeId
+     * @param list
+     * @param repeatNodes
+     */
+    private void getDescendantTreeList(String parentNodeId,
+            List<OrgTreeNode> list, boolean repeatNodes, boolean withZero) {
+        List<OrgTreeNode> childNodes = getNodesWithParent(parentNodeId);
+        if (repeatNodes) {
+            if (withZero || !getNodeById(parentNodeId).getId().equals("0"))
+                list.add(getNodeById(parentNodeId));
+        } else {
+            if ((list == null)
+                    && (withZero || !getNodeById(parentNodeId).getId().equals(
+                            "0")))
+                list.add(getNodeById(parentNodeId));
+            else {
+                boolean exists = false;
+                for (int i = 0; i < list.toArray().length; i++)
+                    if (list.get(i).equals(parentNodeId))
+                        exists = true;
+                if ((!exists)
+                        && (withZero || !getNodeById(parentNodeId).getId()
+                                .equals("0")))
+                    list.add(getNodeById(parentNodeId));
+            }
+        }
+        if (childNodes.toArray().length != 0)
+            for (int i = 0; i < childNodes.toArray().length; i++)
+                getDescendantTreeList(childNodes.get(i).getId(), list,
+                        repeatNodes, withZero);
+
+    }
+
+    /**
+     * List param is modified with all the child nodes
+     * 
+     * @param parentNodeId
+     * @param list
+     */
+    private void getDescendantTreeList(String parentNodeId,
+            List<OrgTreeNode> list) {
+        getDescendantTreeList(parentNodeId, list, true, true);
+    }
+
+    /**
+     * Returns the node matching the id, in case it does not exists it returns
+     * null
+     * 
+     * @param id
+     * @return
+     */
+    private OrgTreeNode getNodeById(String id) {
+        if (nodes == null)
+            return null;
+        for (int i = 0; i < nodes.toArray().length; i++)
+            if (nodes.get(i).equals(id))
+                return nodes.get(i);
+        return null;
+    }
+
+    /**
+     * In case the node id is in the tree it returns true, if not false.
+     * 
+     * @param id
+     * @return
+     */
+    private boolean isNodeInTree(String id) {
+        if (nodes == null)
+            return false;
+        for (int i = 0; i < nodes.toArray().length; i++)
+            if (nodes.get(i).equals(id))
+                return true;
+        return false;
+    }
+
+    /**
+     * Returns the list of the nodes that have a determinate node.
+     * 
+     * @param parentId
+     * @return
+     */
+    private List<OrgTreeNode> getNodesWithParent(String parentId) {
+        List<OrgTreeNode> vecNodes = new ArrayList<OrgTreeNode>();
+        int idx = 0;
+        for (int i = 0; i < nodes.toArray().length; i++)
+            if (nodes.get(i).getParentId().equals(parentId)) {
+                vecNodes.add(idx++, nodes.get(i));
+            }
+        return vecNodes;
+    }
 
 }
--- a/src/org/openbravo/base/secureApp/ServletGoBack.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/base/secureApp/ServletGoBack.java	Tue Dec 23 20:16:42 2008 +0000
@@ -8,7 +8,7 @@
  * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
  * specific language governing permissions and limitations under the License.
  ************************************************************************************
-*/
+ */
 package org.openbravo.base.secureApp;
 
 //import org.openbravo.xmlEngine.Report;
@@ -18,37 +18,39 @@
 import javax.servlet.*;
 import javax.servlet.http.*;
 
+public class ServletGoBack extends HttpBaseServlet {
+    private static final long serialVersionUID = 1L;
+    String strServletPorDefecto;
 
+    public class Variables extends VariablesHistory {
 
-public class ServletGoBack extends HttpBaseServlet {
-  private static final long serialVersionUID = 1L;
-  String strServletPorDefecto;
+        public Variables(HttpServletRequest request) {
+            super(request);
+            String sufix = getCurrentHistoryIndex();
+            removeSessionValue("reqHistory.servlet" + sufix);
+            removeSessionValue("reqHistory.path" + sufix);
+            removeSessionValue("reqHistory.command" + sufix);
+            downCurrentHistoryIndex();
+        }
+    }
 
-  public class Variables extends VariablesHistory {
+    public void init(ServletConfig config) {
+        super.init(config);
+        strServletPorDefecto = config.getServletContext().getInitParameter(
+                "DefaultServlet");
+    }
 
-    public Variables(HttpServletRequest request) {
-      super(request);
-      String sufix = getCurrentHistoryIndex();
-      removeSessionValue("reqHistory.servlet" + sufix);
-      removeSessionValue("reqHistory.path" + sufix);
-      removeSessionValue("reqHistory.command" + sufix);
-      downCurrentHistoryIndex();
+    public void doPost(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        log4j.info("start doPost");
+        Variables vars = new Variables(req);
+        String strUrl = strDireccion
+                + vars.getCurrentServletPath(strServletPorDefecto)
+                + "?Command=" + vars.getCurrentServletCommand();
+        res.sendRedirect(res.encodeRedirectURL(strUrl));
     }
-  }
 
-  public void init (ServletConfig config) {
-    super.init(config);
-    strServletPorDefecto = config.getServletContext().getInitParameter("DefaultServlet");
-  }
-
-  public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException {
-    log4j.info("start doPost");
-    Variables vars = new Variables(req);
-    String strUrl = strDireccion + vars.getCurrentServletPath(strServletPorDefecto) + "?Command=" + vars.getCurrentServletCommand();
-    res.sendRedirect(res.encodeRedirectURL(strUrl));
-  }
-
-  public String getServletInfo() {
-    return "Servlet that receives and redirects go back requests, using history information registered in the httpSession";
-  } // end of getServletInfo() method
+    public String getServletInfo() {
+        return "Servlet that receives and redirects go back requests, using history information registered in the httpSession";
+    } // end of getServletInfo() method
 }
--- a/src/org/openbravo/base/secureApp/VariablesHistory.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/base/secureApp/VariablesHistory.java	Tue Dec 23 20:16:42 2008 +0000
@@ -8,96 +8,107 @@
  * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
  * specific language governing permissions and limitations under the License.
  ************************************************************************************
-*/
+ */
 package org.openbravo.base.secureApp;
 
 import javax.servlet.http.*;
-import org.apache.log4j.Logger ;
+import org.apache.log4j.Logger;
 
 public class VariablesHistory {
-  private String currentHistoryIndex;
-  private static final int reqHistoryLength = 10;
-  HttpSession session;
-  private String role;
-  private String language;
-  private String dbSessionID;
-  static Logger log4j = Logger.getLogger(VariablesHistory.class);
+    private String currentHistoryIndex;
+    private static final int reqHistoryLength = 10;
+    HttpSession session;
+    private String role;
+    private String language;
+    private String dbSessionID;
+    static Logger log4j = Logger.getLogger(VariablesHistory.class);
 
-  public VariablesHistory(HttpServletRequest request) {
-    this.session = request.getSession(true);
-    this.currentHistoryIndex = getSessionValue("reqHistory.current", "0");
-    this.role = getSessionValue("#AD_Role_ID");
-    this.language = getSessionValue("#AD_Language");
-    this.dbSessionID = getSessionValue("#AD_Session_ID");
-  }
+    public VariablesHistory(HttpServletRequest request) {
+        this.session = request.getSession(true);
+        this.currentHistoryIndex = getSessionValue("reqHistory.current", "0");
+        this.role = getSessionValue("#AD_Role_ID");
+        this.language = getSessionValue("#AD_Language");
+        this.dbSessionID = getSessionValue("#AD_Session_ID");
+    }
 
-  public String getCurrentHistoryIndex() {
-    return Integer.toString(Integer.valueOf(this.currentHistoryIndex).intValue()%reqHistoryLength);
-  }
+    public String getCurrentHistoryIndex() {
+        return Integer.toString(Integer.valueOf(this.currentHistoryIndex)
+                .intValue()
+                % reqHistoryLength);
+    }
 
-  public void upCurrentHistoryIndex() {
-    this.currentHistoryIndex = Integer.toString(Integer.valueOf(this.currentHistoryIndex).intValue() + 1);
-    setSessionValue("reqHistory.current", this.currentHistoryIndex);
-  }
+    public void upCurrentHistoryIndex() {
+        this.currentHistoryIndex = Integer.toString(Integer.valueOf(
+                this.currentHistoryIndex).intValue() + 1);
+        setSessionValue("reqHistory.current", this.currentHistoryIndex);
+    }
 
-  public void downCurrentHistoryIndex() {
-    this.currentHistoryIndex = Integer.toString(Integer.valueOf(this.currentHistoryIndex).intValue() - 1);
-    setSessionValue("reqHistory.current", this.currentHistoryIndex);
-  }
+    public void downCurrentHistoryIndex() {
+        this.currentHistoryIndex = Integer.toString(Integer.valueOf(
+                this.currentHistoryIndex).intValue() - 1);
+        setSessionValue("reqHistory.current", this.currentHistoryIndex);
+    }
 
-  public String getCurrentServletPath(String defaultServletPath) {
-    return getSessionValue("reqHistory.path" + getCurrentHistoryIndex(), defaultServletPath);
-  }
-  public String getCurrentServletCommand() {
-    return getSessionValue("reqHistory.command" + getCurrentHistoryIndex(), "DEFAULT");
-  }
+    public String getCurrentServletPath(String defaultServletPath) {
+        return getSessionValue("reqHistory.path" + getCurrentHistoryIndex(),
+                defaultServletPath);
+    }
 
-  public String getSessionValue(String sessionAttribute) {
-    return getSessionValue(sessionAttribute, "");
-  }
+    public String getCurrentServletCommand() {
+        return getSessionValue("reqHistory.command" + getCurrentHistoryIndex(),
+                "DEFAULT");
+    }
 
-  public String getSessionValue(String sessionAttribute, String defaultValue) {
-    String auxStr = null;
-    try {
-      auxStr = (String) session.getAttribute(sessionAttribute.toUpperCase());
-      if (auxStr==null || auxStr.trim().equals(""))
-        auxStr = defaultValue;
+    public String getSessionValue(String sessionAttribute) {
+        return getSessionValue(sessionAttribute, "");
     }
-    catch (Exception e) {
-      auxStr = defaultValue;
+
+    public String getSessionValue(String sessionAttribute, String defaultValue) {
+        String auxStr = null;
+        try {
+            auxStr = (String) session.getAttribute(sessionAttribute
+                    .toUpperCase());
+            if (auxStr == null || auxStr.trim().equals(""))
+                auxStr = defaultValue;
+        } catch (Exception e) {
+            auxStr = defaultValue;
+        }
+        if (!sessionAttribute.equalsIgnoreCase("menuVertical"))
+            if (log4j.isDebugEnabled())
+                log4j.debug("Session attribute: " + sessionAttribute + ":..."
+                        + auxStr);
+        return auxStr;
     }
-    if (!sessionAttribute.equalsIgnoreCase("menuVertical")) if (log4j.isDebugEnabled()) log4j.debug("Session attribute: " + sessionAttribute + ":..." + auxStr);
-  return auxStr;
-  }
 
-  public void setSessionValue(String attribute, String value) {
-    try {
-      session.setAttribute(attribute.toUpperCase(), value);
-      if (!attribute.equalsIgnoreCase("menuVertical")) if (log4j.isDebugEnabled()) log4j.debug("session value: " + attribute + ":..." + value.toString());
+    public void setSessionValue(String attribute, String value) {
+        try {
+            session.setAttribute(attribute.toUpperCase(), value);
+            if (!attribute.equalsIgnoreCase("menuVertical"))
+                if (log4j.isDebugEnabled())
+                    log4j.debug("session value: " + attribute + ":..."
+                            + value.toString());
+        } catch (Exception e) {
+            log4j.error("setSessionValue error: " + attribute + ":..." + value);
+        }
     }
-    catch (Exception e) {
-      log4j.error("setSessionValue error: " + attribute + ":..." + value);
+
+    public void removeSessionValue(String attribute) {
+        try {
+            session.removeAttribute(attribute.toUpperCase());
+        } catch (Exception e) {
+            log4j.error("removeSessionValue error: " + attribute);
+        }
     }
-  }
 
-  public void removeSessionValue(String attribute) {
-    try {
-      session.removeAttribute(attribute.toUpperCase());
+    public String getRole() {
+        return role;
     }
-    catch (Exception e) {
-      log4j.error("removeSessionValue error: " + attribute);
+
+    public String getLanguage() {
+        return language;
     }
-  }
 
-  public String getRole() {
-    return role;
-  }
-
-  public String getLanguage() {
-    return language;
-  }
-
-  public String getDBSession() {
-    return dbSessionID;
-  }
+    public String getDBSession() {
+        return dbSessionID;
+    }
 }
--- a/src/org/openbravo/base/secureApp/VariablesSecureApp.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/base/secureApp/VariablesSecureApp.java	Tue Dec 23 20:16:42 2008 +0000
@@ -8,7 +8,7 @@
  * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
  * specific language governing permissions and limitations under the License.
  ************************************************************************************
-*/
+ */
 package org.openbravo.base.secureApp;
 
 import org.openbravo.base.VariablesBase;
@@ -18,400 +18,429 @@
 
 /**
  * This class is used to provide the coder with friendly methods to retrieve
- * certain environment, session and servlet call variables. 
+ * certain environment, session and servlet call variables.
  * 
  * @author Openbravo
- *
+ * 
  */
 public class VariablesSecureApp extends VariablesBase {
-  private String user;
-  private String role;
-  private String language;
-  private String theme;
-  private String client;
-  private String organization;
-  private String warehouse;
-  private String command;
-  private String userClient;
-  private String userOrganization;
-  private String dbSessionID;
-  private String javaDateFormat;
-  private String javaDataTimeFormat;
-  private String jsDateFormat;
-  private String sqlDateFormat;
-  private String accessLevel;
+    private String user;
+    private String role;
+    private String language;
+    private String theme;
+    private String client;
+    private String organization;
+    private String warehouse;
+    private String command;
+    private String userClient;
+    private String userOrganization;
+    private String dbSessionID;
+    private String javaDateFormat;
+    private String javaDataTimeFormat;
+    private String jsDateFormat;
+    private String sqlDateFormat;
+    private String accessLevel;
 
-  /**
-   * Constructor used to make an empty/manual instance of this class.
-   *  
-   * @param strUser         ID of the user as specified by the AD_USER_ID 
-   *                        column within the AD_USER database table.
-   * @param strClient       ID of the client as specified by the AD_CLIENT_ID
-   *                        column within the AD_CLIENT database table.
-   * @param strOrganization ID of the organization as specified by the 
-   *                        AD_ORG_ID column within the AD_ORG database table.
-   */
-  public VariablesSecureApp(String strUser, String strClient, String strOrganization) {
-    this.user = strUser;
-    this.role = "";
-    this.language = System.getProperty("user.language") + "_" + System.getProperty("user.country");
-    this.theme = "";
-    this.client = strClient;
-    this.organization = strOrganization;
-    this.userClient = "";
-    this.userOrganization = "";
-    this.warehouse = "";
-    this.dbSessionID = "";
-    this.command = "DEFAULT";
-    this.javaDateFormat = "";
-    this.jsDateFormat = "";
-    this.sqlDateFormat = "";
-    this.accessLevel = "";
-  }
+    /**
+     * Constructor used to make an empty/manual instance of this class.
+     * 
+     * @param strUser
+     *            ID of the user as specified by the AD_USER_ID column within
+     *            the AD_USER database table.
+     * @param strClient
+     *            ID of the client as specified by the AD_CLIENT_ID column
+     *            within the AD_CLIENT database table.
+     * @param strOrganization
+     *            ID of the organization as specified by the AD_ORG_ID column
+     *            within the AD_ORG database table.
+     */
+    public VariablesSecureApp(String strUser, String strClient,
+            String strOrganization) {
+        this.user = strUser;
+        this.role = "";
+        this.language = System.getProperty("user.language") + "_"
+                + System.getProperty("user.country");
+        this.theme = "";
+        this.client = strClient;
+        this.organization = strOrganization;
+        this.userClient = "";
+        this.userOrganization = "";
+        this.warehouse = "";
+        this.dbSessionID = "";
+        this.command = "DEFAULT";
+        this.javaDateFormat = "";
+        this.jsDateFormat = "";
+        this.sqlDateFormat = "";
+        this.accessLevel = "";
+    }
 
-  /**
-   * Constructor that parses the session variables to initialize the class' 
-   * internal variables.
-   * 
-   * @param request HttpServletRequest object originating from the user request.
-   */
-  public VariablesSecureApp(HttpServletRequest request) {
-    super(request);
-    setValues();
-  }
-  
-  /**
-   * Constructor that parses the session variables to initialize the class' 
-   * internal variables for multipart requests.
-   * 
-   * @param request HttpServletRequest object originating from the user request.
-   */
-  public VariablesSecureApp(HttpServletRequest request, boolean f) {
-    super(request,f);
-    setValues(); 
-  }
-  
-  /**
-   * Internal method used to parse the session variables and store them into
-   * private variables of this class. These variables can them be retrieved 
-   * through various get methods (e.g. getUser(), getRole(), etc.).
-   */
-  private void setValues(){
-    this.user = getSessionValue("#AD_User_ID");
-    this.role = getSessionValue("#AD_Role_ID");
-    this.language = getSessionValue("#AD_Language");
-    this.theme = getSessionValue("#Theme");
-    this.client = getSessionValue("#AD_Client_ID");
-    this.organization = getSessionValue("#AD_Org_ID");
-    this.userClient = getSessionValue("#User_Client");
-    this.userOrganization = getSessionValue("#User_Org");
-    this.warehouse = getSessionValue("#M_Warehouse_ID");
-    this.dbSessionID = getSessionValue("#AD_Session_ID");
-    this.command = getStringParameter("Command", "DEFAULT");
-    this.javaDateFormat = getSessionValue("#AD_JavaDateFormat");
-    this.javaDataTimeFormat = getSessionValue("#AD_JavaDateTimeFormat");
-    this.jsDateFormat = getSessionValue("#AD_JsDateFormat");
-    this.sqlDateFormat = getSessionValue("#AD_SqlDateFormat");
-    this.accessLevel = getSessionValue("#CurrentAccessLevel");
-  }
+    /**
+     * Constructor that parses the session variables to initialize the class'
+     * internal variables.
+     * 
+     * @param request
+     *            HttpServletRequest object originating from the user request.
+     */
+    public VariablesSecureApp(HttpServletRequest request) {
+        super(request);
+        setValues();
+    }
 
-  /**
-   * Returns the primary key (AD_USER_ID) of the authenticated user deriving from the
-   * AD_USER table.
-   * 
-   * @return AD_USER_ID primary key number formatted as string
-   */
-  public String getUser() {
-    return user;
-  }
+    /**
+     * Constructor that parses the session variables to initialize the class'
+     * internal variables for multipart requests.
+     * 
+     * @param request
+     *            HttpServletRequest object originating from the user request.
+     */
+    public VariablesSecureApp(HttpServletRequest request, boolean f) {
+        super(request, f);
+        setValues();
+    }
 
-  /**
-   * Returns the primary key (AD_ROLE_ID) of the role of the authenticated user deriving 
-   * as entered in the AD_ROLE table.
-   * 
-   * @return AD_ROLE_ID primary key number formatted as string
-   */
-  public String getRole() {
-    return role;
-  }
+    /**
+     * Internal method used to parse the session variables and store them into
+     * private variables of this class. These variables can them be retrieved
+     * through various get methods (e.g. getUser(), getRole(), etc.).
+     */
+    private void setValues() {
+        this.user = getSessionValue("#AD_User_ID");
+        this.role = getSessionValue("#AD_Role_ID");
+        this.language = getSessionValue("#AD_Language");
+        this.theme = getSessionValue("#Theme");
+        this.client = getSessionValue("#AD_Client_ID");
+        this.organization = getSessionValue("#AD_Org_ID");
+        this.userClient = getSessionValue("#User_Client");
+        this.userOrganization = getSessionValue("#User_Org");
+        this.warehouse = getSessionValue("#M_Warehouse_ID");
+        this.dbSessionID = getSessionValue("#AD_Session_ID");
+        this.command = getStringParameter("Command", "DEFAULT");
+        this.javaDateFormat = getSessionValue("#AD_JavaDateFormat");
+        this.javaDataTimeFormat = getSessionValue("#AD_JavaDateTimeFormat");
+        this.jsDateFormat = getSessionValue("#AD_JsDateFormat");
+        this.sqlDateFormat = getSessionValue("#AD_SqlDateFormat");
+        this.accessLevel = getSessionValue("#CurrentAccessLevel");
+    }
 
-  /**
-   * Returns the code of the language currently selected by the authenticated 
-   * user according to the RFC 4646 format LANG_REGION, e.g. es_ES for 
-   * Spanish language from Spain or en_GB for English language from Great 
-   * Britain.
-   * 
-   * @return The language code formatted as a string according to RFC 4646.
-   */
-  public String getLanguage() {
-    return language;
-  }
+    /**
+     * Returns the primary key (AD_USER_ID) of the authenticated user deriving
+     * from the AD_USER table.
+     * 
+     * @return AD_USER_ID primary key number formatted as string
+     */
+    public String getUser() {
+        return user;
+    }
 
-  /**
-   * Returns the unique name of the theme currently selected for the session. 
-   * This usually corresponds to the theme's folder name in the web/skins. 
-   * Default theme's value is 'Default'.
-   * 
-   * @return String with the unique name of the theme.
-   */
-  public String getTheme() {
-    if (!theme.equals("")) {
-      return theme;
-    } else {
-      return "ltr/Default";
+    /**
+     * Returns the primary key (AD_ROLE_ID) of the role of the authenticated
+     * user deriving as entered in the AD_ROLE table.
+     * 
+     * @return AD_ROLE_ID primary key number formatted as string
+     */
+    public String getRole() {
+        return role;
     }
-  }
 
-  /**
-   * Returns the ID of the client (AD_CLIENT_ID) as defined by the 
-   * role of the user's current session.
-   *  
-   * @return String with the AD_CLIENT_ID primary key value.
-   */
-  public String getClient() {
-    return client;
-  }
+    /**
+     * Returns the code of the language currently selected by the authenticated
+     * user according to the RFC 4646 format LANG_REGION, e.g. es_ES for Spanish
+     * language from Spain or en_GB for English language from Great Britain.
+     * 
+     * @return The language code formatted as a string according to RFC 4646.
+     */
+    public String getLanguage() {
+        return language;
+    }
 
-  /**
-   * Returns the ID of the organization (AD_ORG_ID) selected by the 
-   * user among the ones available within the role of the 
-   * current session.
-   *  
-   * @return String with the AD_ORG_ID primary key value.
-   */
-  public String getOrg() {
-    return organization;
-  }
+    /**
+     * Returns the unique name of the theme currently selected for the session.
+     * This usually corresponds to the theme's folder name in the web/skins.
+     * Default theme's value is 'Default'.
+     * 
+     * @return String with the unique name of the theme.
+     */
+    public String getTheme() {
+        if (!theme.equals("")) {
+            return theme;
+        } else {
+            return "ltr/Default";
+        }
+    }
 
-  public String getUserClient() {
-    return userClient;
-  }
+    /**
+     * Returns the ID of the client (AD_CLIENT_ID) as defined by the role of the
+     * user's current session.
+     * 
+     * @return String with the AD_CLIENT_ID primary key value.
+     */
+    public String getClient() {
+        return client;
+    }
 
-  public String getUserOrg() {
-    return getSessionValue("#AccessibleOrgTree");
-  }
-  
+    /**
+     * Returns the ID of the organization (AD_ORG_ID) selected by the user among
+     * the ones available within the role of the current session.
+     * 
+     * @return String with the AD_ORG_ID primary key value.
+     */
+    public String getOrg() {
+        return organization;
+    }
 
-  /**
-   * Returns the ID of the current default warehouse that will be used with
-   * transactions that require a warehouse selected. This is selected using
-   * the Role change window and the user can only select warehouses he or she
-   * has access to.
-   *  
-   * @return String with the M_WAREHOUSE primary key value.
-   */
-  public String getWarehouse() {
-    return warehouse;
-  }
+    public String getUserClient() {
+        return userClient;
+    }
 
-  /**
-   * Returns the ID of the session stored within the AD_SESSION database 
-   * table.
-   * 
-   * @return String with the AD_SESSION primary key value.
-   */
-  public String getDBSession() {
-    return dbSessionID;
-  }
+    public String getUserOrg() {
+        return getSessionValue("#AccessibleOrgTree");
+    }
 
-  /**
-   * Returns the command that was passed to the servlet through the Command 
-   * parameter of the HTTP POST/GET. Normally used by the java controllers
-   * so that one controller can support various actions/functions.
-   * 
-   * @return String containing the value of the Command parameter.
-   */
-  public String getCommand() {
-    return command;
-  }
-  
-  public String getAccessLevel() {
-    return accessLevel;
-  }
+    /**
+     * Returns the ID of the current default warehouse that will be used with
+     * transactions that require a warehouse selected. This is selected using
+     * the Role change window and the user can only select warehouses he or she
+     * has access to.
+     * 
+     * @return String with the M_WAREHOUSE primary key value.
+     */
+    public String getWarehouse() {
+        return warehouse;
+    }
 
-  /**
-   * Returns true if the Command parameter of the HTTP POST/GET request to the
-   * servlet equals the value specified, false if not.
-   * 
-   * @param  inKey1 The string to compare Command parameter to. 
-   * @return        Boolean indicating the equality of the Command and the
-   *                inKey1 parameter. 
-   * @see           getCommand
-   */
-  public boolean commandIn(String inKey1) {
-    if (command.equals(inKey1))
-      return true;
-    else
-      return false;
-  }
+    /**
+     * Returns the ID of the session stored within the AD_SESSION database
+     * table.
+     * 
+     * @return String with the AD_SESSION primary key value.
+     */
+    public String getDBSession() {
+        return dbSessionID;
+    }
 
-  /**
-   * Returns true if the Command parameter of the HTTP POST/GET request to the
-   * servlet equals either of the values specified, false if not.
-   * 
-   * @param  inKey1 The string to compare the Command parameter to. 
-   * @param  inKey2 The second string to compare the Command parameter to. 
-   * @return        Boolean indicating the equality of the Command and 
-   *                either of the inKeyX parameters. 
-   * @see           getCommand
-   */
-  public boolean commandIn(String inKey1, String inKey2) {
-    if (command.equals(inKey1) || command.equals(inKey2))
-      return true;
-    else
-      return false;
-  }
+    /**
+     * Returns the command that was passed to the servlet through the Command
+     * parameter of the HTTP POST/GET. Normally used by the java controllers so
+     * that one controller can support various actions/functions.
+     * 
+     * @return String containing the value of the Command parameter.
+     */
+    public String getCommand() {
+        return command;
+    }
 
-  /**
-   * Returns true if the Command parameter of the HTTP POST/GET request to the
-   * servlet equals either of the values specified, false if not.
-   * 
-   * @param  inKey1 The string to compare the Command parameter to. 
-   * @param  inKey2 The second string to compare the Command parameter to. 
-   * @param  inKey3 The third string to compare the Command parameter to .
-   * @return        Boolean indicating the equality of the Command and 
-   *                either of the inKeyX parameters.
-   * @see           getCommand
-   */
-  public boolean commandIn(String inKey1, String inKey2, String inKey3) {
-    if (command.equals(inKey1) || command.equals(inKey2) || command.equals(inKey3))
-      return true;
-    else
-      return false;
-  }
+    public String getAccessLevel() {
+        return accessLevel;
+    }
 
-  /**
-   * Returns true if the Command parameter of the HTTP POST/GET request to the
-   * servlet equals either of the values specified, false if not.
-   * 
-   * @param  inKey1 The string to compare the Command parameter to. 
-   * @param  inKey2 The second string to compare the Command parameter to. 
-   * @param  inKey3 The third string to compare the Command parameter to.
-   * @param  inKey4 The fourth string to compare the Command parameter to.
-   * @return        Boolean indicating the equality of the Command and 
-   *                either of the inKeyX parameters. 
-   * @see           getCommand
-   */
-  public boolean commandIn(String inKey1, String inKey2, String inKey3, String inKey4) {
-    if (command.equals(inKey1) || command.equals(inKey2) || command.equals(inKey3) || command.equals(inKey4))
-      return true;
-    else
-      return false;
-  }
-  
-  /**
-   * Returns true if the Command parameter of the HTTP POST/GET request to the
-   * servlet equals either of the values specified, false if not.
-   * 
-   * @param  inKey1 The string to compare the Command parameter to.
-   * @param  inKey2 The second string to compare the Command parameter to.
-   * @param  inKey3 The third string to compare the Command parameter to.
-   * @param  inKey4 The fourth string to compare the Command parameter to. 
-   * @param  inKey5 The fifth string to compare the Command parameter to. 
-   * @return        Boolean indicating the equality of the Command and 
-   *                either of the inKeyX parameters. 
-   * @see           getCommand
-   */
-  public boolean commandIn(String inKey1, String inKey2, String inKey3, String inKey4, String inKey5) {
-    if (command.equals(inKey1) || command.equals(inKey2) || command.equals(inKey3) || command.equals(inKey4) || command.equals(inKey5))
-      return true;
-    else
-      return false;
-  }
+    /**
+     * Returns true if the Command parameter of the HTTP POST/GET request to the
+     * servlet equals the value specified, false if not.
+     * 
+     * @param inKey1
+     *            The string to compare Command parameter to.
+     * @return Boolean indicating the equality of the Command and the inKey1
+     *         parameter.
+     * @see getCommand
+     */
+    public boolean commandIn(String inKey1) {
+        if (command.equals(inKey1))
+            return true;
+        else
+            return false;
+    }
 
-  /**
-   * Returns the date format used in Java formatting as defined by the 
-   * dateFormat.java variable within the config/Openbravo.properties
-   * configuration file.
-   * 
-   * @return Formatting string, for example 'dd-MM-yyyy'.
-   */
-  public String getJavaDateFormat() {
-    return javaDateFormat;
-  }
-  
-  /**
-   * @return the javaDataTimeFormat
-   */
-  public String getJavaDataTimeFormat() {
-    return javaDataTimeFormat;
-  }
-  
-  /**
-   * Returns the date format used in Javascript formatting as defined by the 
-   * dateFormat.java variable within the config/Openbravo.properties
-   * configuration file.
-   * 
-   * @return Formatting string, for example '%d-%m-%Y'.
-   */
-  public String getJsDateFormat() {
-    return jsDateFormat;
-  }
-  
-  /**
-   * Returns the date format used in SQL formatting as defined by the 
-   * dateFormat.sql variable within the config/Openbravo.properties
-   * configuration file.
-   * 
-   * @return Formatting string, for example 'DD-MM-YYYY'.
-   */
-  public String getSqlDateFormat() {
-    return sqlDateFormat;
-  }
+    /**
+     * Returns true if the Command parameter of the HTTP POST/GET request to the
+     * servlet equals either of the values specified, false if not.
+     * 
+     * @param inKey1
+     *            The string to compare the Command parameter to.
+     * @param inKey2
+     *            The second string to compare the Command parameter to.
+     * @return Boolean indicating the equality of the Command and either of the
+     *         inKeyX parameters.
+     * @see getCommand
+     */
+    public boolean commandIn(String inKey1, String inKey2) {
+        if (command.equals(inKey1) || command.equals(inKey2))
+            return true;
+        else
+            return false;
+    }
 
-  /**
-   * Returns a deserialized OBError object retrieved from the session data that
-   * might contain the error information for the specified tab. This error 
-   * would normally be generated by the controller servlet of that tab.
-   * 
-   * @param  AD_Tab_ID String with the primary key (ID) of the tab as entered 
-   *                   within the AD_TAB database table.
-   * @return           Deserialized OBError object retrieved from the session. 
-   *                   Null if no error message exists for this tab.
-   * @see              setMessage
-   * @see              removeMessage
-   */
-  public OBError getMessage(String AD_Tab_ID) {
-    return ((OBError)getSessionObject(AD_Tab_ID + "|message"));
-  }
+    /**
+     * Returns true if the Command parameter of the HTTP POST/GET request to the
+     * servlet equals either of the values specified, false if not.
+     * 
+     * @param inKey1
+     *            The string to compare the Command parameter to.
+     * @param inKey2
+     *            The second string to compare the Command parameter to.
+     * @param inKey3
+     *            The third string to compare the Command parameter to .
+     * @return Boolean indicating the equality of the Command and either of the
+     *         inKeyX parameters.
+     * @see getCommand
+     */
+    public boolean commandIn(String inKey1, String inKey2, String inKey3) {
+        if (command.equals(inKey1) || command.equals(inKey2)
+                || command.equals(inKey3))
+            return true;
+        else
+            return false;
+    }
 
-  /**
-   * Serializes and saves the error object to a session variable, specific 
-   * to the tab which ID is being passed.
-   *  
-   * @param AD_Tab_ID String with the primary key (ID) of the tab as entered 
-   *                  within the AD_TAB database table.
-   * @param error     The OBError object that needs to be set.
-   * @see             getMessage
-   * @see             removeMessage
-   */
-  public void setMessage(String AD_Tab_ID, OBError error) {
-    setSessionObject(AD_Tab_ID + "|message", error);
-  }
+    /**
+     * Returns true if the Command parameter of the HTTP POST/GET request to the
+     * servlet equals either of the values specified, false if not.
+     * 
+     * @param inKey1
+     *            The string to compare the Command parameter to.
+     * @param inKey2
+     *            The second string to compare the Command parameter to.
+     * @param inKey3
+     *            The third string to compare the Command parameter to.
+     * @param inKey4
+     *            The fourth string to compare the Command parameter to.
+     * @return Boolean indicating the equality of the Command and either of the
+     *         inKeyX parameters.
+     * @see getCommand
+     */
+    public boolean commandIn(String inKey1, String inKey2, String inKey3,
+            String inKey4) {
+        if (command.equals(inKey1) || command.equals(inKey2)
+                || command.equals(inKey3) || command.equals(inKey4))
+            return true;
+        else
+            return false;
+    }
 
-  /**
-   * Removes the error object for the specified tab from the session data.
-   * This needs to be done in order for the message not to appear every time
-   * the tab is reloaded.
-   * 
-   * @param AD_Tab_ID String with the primary key (ID) of the tab as entered 
-   *                  within the AD_TAB database table.
-   * @see             setMessage
-   * @see             getMessage
-   */
-  public void removeMessage(String AD_Tab_ID) {
-    removeSessionValue(AD_Tab_ID + "|message");
-  }
-  
-  public FieldProvider getEditionData(String AD_Tab_ID) {
-    return ((FieldProvider)getSessionObject(AD_Tab_ID + "|editionData"));
-  }
+    /**
+     * Returns true if the Command parameter of the HTTP POST/GET request to the
+     * servlet equals either of the values specified, false if not.
+     * 
+     * @param inKey1
+     *            The string to compare the Command parameter to.
+     * @param inKey2
+     *            The second string to compare the Command parameter to.
+     * @param inKey3
+     *            The third string to compare the Command parameter to.
+     * @param inKey4
+     *            The fourth string to compare the Command parameter to.
+     * @param inKey5
+     *            The fifth string to compare the Command parameter to.
+     * @return Boolean indicating the equality of the Command and either of the
+     *         inKeyX parameters.
+     * @see getCommand
+     */
+    public boolean commandIn(String inKey1, String inKey2, String inKey3,
+            String inKey4, String inKey5) {
+        if (command.equals(inKey1) || command.equals(inKey2)
+                || command.equals(inKey3) || command.equals(inKey4)
+                || command.equals(inKey5))
+            return true;
+        else
+            return false;
+    }
 
-  public void setEditionData(String AD_Tab_ID, FieldProvider data) {
-    setSessionObject(AD_Tab_ID + "|editionData", data);
-  }
+    /**
+     * Returns the date format used in Java formatting as defined by the
+     * dateFormat.java variable within the config/Openbravo.properties
+     * configuration file.
+     * 
+     * @return Formatting string, for example 'dd-MM-yyyy'.
+     */
+    public String getJavaDateFormat() {
+        return javaDateFormat;
+    }
 
-  public void removeEditionData(String AD_Tab_ID) {
-    removeSessionValue(AD_Tab_ID + "|editionData");
-  }
+    /**
+     * @return the javaDataTimeFormat
+     */
+    public String getJavaDataTimeFormat() {
+        return javaDataTimeFormat;
+    }
+
+    /**
+     * Returns the date format used in Javascript formatting as defined by the
+     * dateFormat.java variable within the config/Openbravo.properties
+     * configuration file.
+     * 
+     * @return Formatting string, for example '%d-%m-%Y'.
+     */
+    public String getJsDateFormat() {
+        return jsDateFormat;
+    }
+
+    /**
+     * Returns the date format used in SQL formatting as defined by the
+     * dateFormat.sql variable within the config/Openbravo.properties
+     * configuration file.
+     * 
+     * @return Formatting string, for example 'DD-MM-YYYY'.
+     */
+    public String getSqlDateFormat() {
+        return sqlDateFormat;
+    }
+
+    /**
+     * Returns a deserialized OBError object retrieved from the session data
+     * that might contain the error information for the specified tab. This
+     * error would normally be generated by the controller servlet of that tab.
+     * 
+     * @param AD_Tab_ID
+     *            String with the primary key (ID) of the tab as entered within
+     *            the AD_TAB database table.
+     * @return Deserialized OBError object retrieved from the session. Null if
+     *         no error message exists for this tab.
+     * @see setMessage
+     * @see removeMessage
+     */
+    public OBError getMessage(String AD_Tab_ID) {
+        return ((OBError) getSessionObject(AD_Tab_ID + "|message"));
+    }
+
+    /**
+     * Serializes and saves the error object to a session variable, specific to
+     * the tab which ID is being passed.
+     * 
+     * @param AD_Tab_ID
+     *            String with the primary key (ID) of the tab as entered within
+     *            the AD_TAB database table.
+     * @param error
+     *            The OBError object that needs to be set.
+     * @see getMessage
+     * @see removeMessage
+     */
+    public void setMessage(String AD_Tab_ID, OBError error) {
+        setSessionObject(AD_Tab_ID + "|message", error);
+    }
+
+    /**
+     * Removes the error object for the specified tab from the session data.
+     * This needs to be done in order for the message not to appear every time
+     * the tab is reloaded.
+     * 
+     * @param AD_Tab_ID
+     *            String with the primary key (ID) of the tab as entered within
+     *            the AD_TAB database table.
+     * @see setMessage
+     * @see getMessage
+     */
+    public void removeMessage(String AD_Tab_ID) {
+        removeSessionValue(AD_Tab_ID + "|message");
+    }
+
+    public FieldProvider getEditionData(String AD_Tab_ID) {
+        return ((FieldProvider) getSessionObject(AD_Tab_ID + "|editionData"));
+    }
+
+    public void setEditionData(String AD_Tab_ID, FieldProvider data) {
+        setSessionObject(AD_Tab_ID + "|editionData", data);
+    }
+
+    public void removeEditionData(String AD_Tab_ID) {
+        removeSessionValue(AD_Tab_ID + "|editionData");
+    }
 }
--- a/src/org/openbravo/dal/core/DalUUIDHexGenerator.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/dal/core/DalUUIDHexGenerator.java	Tue Dec 23 20:16:42 2008 +0000
@@ -39,8 +39,8 @@
     public Serializable generate(SessionImplementor session, Object obj) {
         final BaseOBObjectDef bob = (BaseOBObjectDef) obj;
         if (bob.getId() != null) {
-            return ((String)bob.getId()).toUpperCase();
+            return ((String) bob.getId()).toUpperCase();
         }
-        return ((String)super.generate(session, obj)).toUpperCase();
+        return ((String) super.generate(session, obj)).toUpperCase();
     }
 }
\ No newline at end of file
--- a/src/org/openbravo/erpCommon/ad_actionButton/ActionButtonUtility.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ActionButtonUtility.java	Tue Dec 23 20:16:42 2008 +0000
@@ -15,7 +15,7 @@
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
-*/
+ */
 package org.openbravo.erpCommon.ad_actionButton;
 
 import java.util.Vector;
@@ -28,140 +28,163 @@
 import org.apache.log4j.Logger;
 
 public class ActionButtonUtility {
-  static Logger log4j = Logger.getLogger(ActionButtonUtility.class);
+    static Logger log4j = Logger.getLogger(ActionButtonUtility.class);
 
-  public static FieldProvider[] docAction(ConnectionProvider conn, VariablesSecureApp vars, String strDocAction, String strReference, String strDocStatus, String strProcessing, String strTable) {
-    FieldProvider[] ld = null;
-    if (log4j.isDebugEnabled()) log4j.debug("DocAction - generating combo elements for table: " + strTable + " - actual status: " + strDocStatus);
-    try {
-      ComboTableData comboTableData = new ComboTableData(vars, conn, "LIST", "DocAction", strReference, "", Utility.getContext(conn, vars, "#User_Org", "ActionButtonUtility"), Utility.getContext(conn, vars, "#User_Client", "ActionButtonUtility"), 0);
-      Utility.fillSQLParameters(conn, vars, null, comboTableData, "ActionButtonUtility", "");
-      ld = comboTableData.select(false);
-      comboTableData = null;
-    } catch (Exception e) {
-      return null;
+    public static FieldProvider[] docAction(ConnectionProvider conn,
+            VariablesSecureApp vars, String strDocAction, String strReference,
+            String strDocStatus, String strProcessing, String strTable) {
+        FieldProvider[] ld = null;
+        if (log4j.isDebugEnabled())
+            log4j.debug("DocAction - generating combo elements for table: "
+                    + strTable + " - actual status: " + strDocStatus);
+        try {
+            ComboTableData comboTableData = new ComboTableData(vars, conn,
+                    "LIST", "DocAction", strReference, "", Utility.getContext(
+                            conn, vars, "#User_Org", "ActionButtonUtility"),
+                    Utility.getContext(conn, vars, "#User_Client",
+                            "ActionButtonUtility"), 0);
+            Utility.fillSQLParameters(conn, vars, null, comboTableData,
+                    "ActionButtonUtility", "");
+            ld = comboTableData.select(false);
+            comboTableData = null;
+        } catch (Exception e) {
+            return null;
+        }
+        SQLReturnObject[] data = null;
+        if (ld != null) {
+            Vector<Object> v = new Vector<Object>();
+            SQLReturnObject data1 = new SQLReturnObject();
+            if (!strProcessing.equals("") && strProcessing.equals("Y")) {
+                data1.setData("ID", "XL");
+                v.addElement(data1);
+            } else if (strDocStatus.equals("NA")) {
+                data1.setData("ID", "AP");
+                v.addElement(data1);
+                data1 = new SQLReturnObject();
+                data1.setData("ID", "RJ");
+                v.addElement(data1);
+                data1 = new SQLReturnObject();
+                data1.setData("ID", "VO");
+                v.addElement(data1);
+            } else if (strDocStatus.equals("DR") || strDocStatus.equals("IP")) {
+                data1.setData("ID", "CO");
+                v.addElement(data1);
+                if (!strTable.equals("319") && !strTable.equals("800212")) {
+                    data1 = new SQLReturnObject();
+                    data1.setData("ID", "VO");
+                    v.addElement(data1);
+                }
+            } else if ((strDocStatus.equals("CO")) && !(strTable.equals("318"))
+                    && // C_Invoice
+                    !(strTable.equals("319"))) { // M_InOut
+                // Exclude Close for tables C_Invoice and M_InOut because it has
+                // no sense for them
+                data1.setData("ID", "CL");
+                v.addElement(data1);
+            }
+            data1 = new SQLReturnObject();
+            if (strTable.equals("259")) { // C_Order
+                if (strDocStatus.equals("DR")) {
+                    data1.setData("ID", "PR");
+                    v.addElement(data1);
+                } else if (strDocStatus.equals("CO")) {
+                    data1.setData("ID", "RE");
+                    v.addElement(data1);
+                }
+            } else if (strTable.equals("318")) { // C_Invoice
+                if (strDocStatus.equals("CO")) {
+                    data1.setData("ID", "RC");
+                    v.addElement(data1);
+                    data1 = new SQLReturnObject();
+                    data1.setData("ID", "RE");
+                    v.addElement(data1);
+                }
+            } else if (strTable.equals("319")) { // M_InOut
+                if (strDocStatus.equals("CO")) {
+                    data1.setData("ID", "RC");
+                    v.addElement(data1);
+                }
+            } else if (strTable.equals("224")) { // GL_Journal
+                if (strDocStatus.equals("CO")) {
+                    data1.setData("ID", "RE");
+                    v.addElement(data1);
+                }
+            } else if (strTable.equals("800212")) { // M_Requisition
+                if (strDocStatus.equals("CO")) {
+                    data1.setData("ID", "RE");
+                    v.addElement(data1);
+                }
+            }
+
+            data = new SQLReturnObject[v.size()];
+            v.copyInto(data);
+            if (log4j.isDebugEnabled())
+                log4j.debug("DocAction - total combo elements: " + data.length);
+            for (int i = 0; i < data.length; i++) {
+                if (log4j.isDebugEnabled())
+                    log4j.debug("DocAction - Element: " + i + " - ID: "
+                            + data[i].getField("ID"));
+                for (int j = 0; j < ld.length; j++) {
+                    if (data[i].getField("ID").equals(ld[j].getField("ID"))) {
+                        data[i].setData("NAME", ld[j].getField("NAME"));
+                        data[i].setData("DESCRIPTION", ld[j]
+                                .getField("DESCRIPTION"));
+                        break;
+                    }
+                }
+            }
+        }
+        return data;
     }
-    SQLReturnObject[] data=null;
-    if (ld!=null) {
-      Vector<Object> v = new Vector<Object>();
-      SQLReturnObject data1 = new SQLReturnObject();
-      if (!strProcessing.equals("") && strProcessing.equals("Y")) {
-        data1.setData("ID", "XL");
-        v.addElement(data1);
-      } else if (strDocStatus.equals("NA")) {
-        data1.setData("ID", "AP");
-        v.addElement(data1);
-        data1 = new SQLReturnObject();
-        data1.setData("ID", "RJ");
-        v.addElement(data1);
-        data1 = new SQLReturnObject();
-        data1.setData("ID", "VO");
-        v.addElement(data1);
-      } else if (strDocStatus.equals("DR") || strDocStatus.equals("IP")) {
-        data1.setData("ID", "CO");
-        v.addElement(data1);
-        if (!strTable.equals("319") && !strTable.equals("800212")) {
-          data1 = new SQLReturnObject();
-          data1.setData("ID", "VO");
-          v.addElement(data1);
-        }        
-      } else if ((strDocStatus.equals("CO")) && 
-                !(strTable.equals("318")) &&  //C_Invoice
-                !(strTable.equals("319"))) {  //M_InOut
-        //Exclude Close for tables C_Invoice and M_InOut because it has no sense for them
-        data1.setData("ID", "CL");
-        v.addElement(data1);
-      }
-      data1 = new SQLReturnObject();
-      if (strTable.equals("259")) { //C_Order
-        if (strDocStatus.equals("DR")) {
-          data1.setData("ID", "PR");
-          v.addElement(data1);
-        } else if (strDocStatus.equals("CO")) {
-          data1.setData("ID", "RE");
-          v.addElement(data1);
+
+    public static FieldProvider[] projectAction(ConnectionProvider conn,
+            VariablesSecureApp vars, String strProjectAction,
+            String strReference, String strProjectStatus) {
+        FieldProvider[] ld = null;
+        try {
+            ComboTableData comboTableData = new ComboTableData(vars, conn,
+                    "LIST", "ProjectAction", strReference, "", Utility
+                            .getContext(conn, vars, "#User_Org",
+                                    "ActionButtonUtility"), Utility.getContext(
+                            conn, vars, "#User_Client", "ActionButtonUtility"),
+                    0);
+            Utility.fillSQLParameters(conn, vars, null, comboTableData,
+                    "ActionButtonUtility", "");
+            ld = comboTableData.select(false);
+            comboTableData = null;
+        } catch (Exception e) {
+            return null;
         }
-      } else if (strTable.equals("318")) { //C_Invoice
-        if (strDocStatus.equals("CO")) {
-          data1.setData("ID", "RC");
-          v.addElement(data1);
-          data1 = new SQLReturnObject();
-          data1.setData("ID", "RE");
-          v.addElement(data1);
+        SQLReturnObject[] data = null;
+        if (ld != null) {
+            Vector<Object> v = new Vector<Object>();
+            SQLReturnObject data1 = new SQLReturnObject();
+            if (strProjectStatus.equals("NF") || strProjectStatus.equals("OP")) {
+                data1.setData("ID", "OR");
+                v.addElement(data1);
+                data1 = new SQLReturnObject();
+                data1.setData("ID", "OC");
+                v.addElement(data1);
+            } else if (strProjectStatus.equals("OR")) {
+                data1.setData("ID", "OC");
+                v.addElement(data1);
+            }
+
+            if (v.size() > 0) {
+                data = new SQLReturnObject[v.size()];
+                v.copyInto(data);
+                for (int i = 0; i < data.length; i++) {
+                    for (int j = 0; j < ld.length; j++) {
+                        if (data[i].getField("ID").equals(ld[j].getField("ID"))) {
+                            data[i].setData("NAME", ld[j].getField("NAME"));
+                            data[i].setData("DESCRIPTION", ld[j]
+                                    .getField("DESCRIPTION"));
+                            break;
+                        }
+                    }
+                }
+            }
         }
-      } else if (strTable.equals("319")) { //M_InOut
-        if (strDocStatus.equals("CO")) {
-          data1.setData("ID", "RC");
-          v.addElement(data1);
-        }
-      } else if (strTable.equals("224")) { //GL_Journal
-        if (strDocStatus.equals("CO")) {
-          data1.setData("ID", "RE");
-          v.addElement(data1);
-        }
-      } else if (strTable.equals("800212")) { //M_Requisition
-        if (strDocStatus.equals("CO")) {
-          data1.setData("ID", "RE");
-          v.addElement(data1);
-        }
-      }
-
-      data = new SQLReturnObject[v.size()];
-      v.copyInto(data);
-      if (log4j.isDebugEnabled()) log4j.debug("DocAction - total combo elements: " + data.length);
-      for (int i=0;i<data.length;i++) {
-        if (log4j.isDebugEnabled()) log4j.debug("DocAction - Element: " + i + " - ID: " + data[i].getField("ID"));
-        for (int j=0;j<ld.length;j++) {
-          if (data[i].getField("ID").equals(ld[j].getField("ID"))) {
-            data[i].setData("NAME", ld[j].getField("NAME"));
-            data[i].setData("DESCRIPTION", ld[j].getField("DESCRIPTION"));
-            break;
-          }
-        }
-      }
+        return data;
     }
-    return data;
-  }
-
-  public static FieldProvider[] projectAction(ConnectionProvider conn, VariablesSecureApp vars, String strProjectAction, String strReference, String strProjectStatus) {
-    FieldProvider[] ld = null;
-    try {
-      ComboTableData comboTableData = new ComboTableData(vars, conn, "LIST", "ProjectAction", strReference, "", Utility.getContext(conn, vars, "#User_Org", "ActionButtonUtility"), Utility.getContext(conn, vars, "#User_Client", "ActionButtonUtility"), 0);
-      Utility.fillSQLParameters(conn, vars, null, comboTableData, "ActionButtonUtility", "");
-      ld = comboTableData.select(false);
-      comboTableData = null;
-    } catch (Exception e) {
-      return null;
-    }
-    SQLReturnObject[] data=null;
-    if (ld!=null) {
-      Vector<Object> v = new Vector<Object>();
-      SQLReturnObject data1 = new SQLReturnObject();
-      if (strProjectStatus.equals("NF") || strProjectStatus.equals("OP")) {
-        data1.setData("ID", "OR");
-        v.addElement(data1);
-        data1 = new SQLReturnObject();
-        data1.setData("ID", "OC");
-        v.addElement(data1);
-      } else if (strProjectStatus.equals("OR")) {
-        data1.setData("ID", "OC");
-        v.addElement(data1);
-      }
-
-      if (v.size()>0) {
-        data = new SQLReturnObject[v.size()];
-        v.copyInto(data);
-        for (int i=0;i<data.length;i++) {
-          for (int j=0;j<ld.length;j++) {
-            if (data[i].getField("ID").equals(ld[j].getField("ID"))) {
-              data[i].setData("NAME", ld[j].getField("NAME"));
-              data[i].setData("DESCRIPTION", ld[j].getField("DESCRIPTION"));
-              break;
-            }
-          }
-        }
-      }
-    }
-    return data;
-  }
 }
--- a/src/org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice.java	Tue Dec 23 20:16:42 2008 +0000
@@ -15,7 +15,7 @@
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
-*/
+ */
 package org.openbravo.erpCommon.ad_actionButton;
 
 import org.openbravo.erpCommon.utility.*;
@@ -27,120 +27,146 @@
 import javax.servlet.*;
 import javax.servlet.http.*;
 
-
-
 // imports for transactions
 import java.sql.Connection;
 
+public class CopyFromInvoice extends HttpSecureAppServlet {
+    private static final long serialVersionUID = 1L;
 
-public class CopyFromInvoice extends HttpSecureAppServlet {
-  private static final long serialVersionUID = 1L;
-
-  public void init (ServletConfig config) {
-    super.init(config);
-    boolHist = false;
-  }
-
-  public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
-    VariablesSecureApp vars = new VariablesSecureApp(request);
-
-    if (vars.commandIn("DEFAULT")) {
-      String strProcessId = vars.getStringParameter("inpProcessId");
-      String strWindow = vars.getStringParameter("inpwindowId");
-      String strTab = vars.getStringParameter("inpTabId");
-      String strKey = vars.getGlobalVariable("inpcInvoiceId", strWindow + "|C_Invoice_ID");
-      printPage(response, vars, strKey, strWindow, strTab, strProcessId);
-    } else if (vars.commandIn("SAVE")) {
-      String strKey = vars.getStringParameter("inpcInvoiceId");
-      String strInvoice = vars.getStringParameter("inpNewcInvoiceId");
-      String strWindow = vars.getStringParameter("inpwindowId");
-      String strTab = vars.getStringParameter("inpTabId");
-      ActionButtonDefaultData[] tab = ActionButtonDefaultData.windowName(this, strTab);
-      String strWindowPath="", strTabName="";
-      if (tab!=null && tab.length!=0) {
-        strTabName = FormatUtilities.replace(tab[0].name);
-        strWindowPath = "../" + FormatUtilities.replace(tab[0].description) + "/" + strTabName + "_Relation.html";
-      } else strWindowPath = strDefaultServlet;
-
-        OBError myError = processButton(vars, strKey, strInvoice, strWindow);
-        vars.setMessage(strTab, myError);        
-        printPageClosePopUp(response, vars, strWindowPath);
-    } else pageErrorPopUp(response);
-  }
-
-  OBError processButton(VariablesSecureApp vars, String strKey, String strInvoice, String windowId) {
-    int i = 0;
-    OBError myError = null;
-    Connection conn = null;
-    try {
-      conn = getTransactionConnection();    
-      CopyFromInvoiceData[] data = CopyFromInvoiceData.select(conn, this, strInvoice, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#User_Org", windowId));
-      if (data!=null && data.length!=0) {
-        for (i=0;i<data.length;i++) {
-          String strSequence = SequenceIdData.getUUID();
-          try {
-            CopyFromInvoiceData.insert(conn, this, strSequence, strKey, vars.getClient(), vars.getOrg(), vars.getUser(), data[i].cInvoicelineId);
-          } catch(ServletException ex) {
-            myError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
-            releaseRollbackConnection(conn);
-          }          
-        }
-      }
-      releaseCommitConnection(conn);
-    } catch (Exception e) {
-      try {
-        releaseRollbackConnection(conn);
-      } catch (Exception ignored) {}
-      log4j.warn("Rollback in transaction",e);
-      myError = new OBError();
-      myError.setType("Error");
-      myError.setTitle(Utility.messageBD(this, "Error", vars.getLanguage()));
-      myError.setMessage(Utility.messageBD(this, "ProcessRunError", vars.getLanguage()));
-      return myError;
-    }
-    myError = new OBError();
-    myError.setType("Success");
-    myError.setTitle(Utility.messageBD(this, "Success", vars.getLanguage()));
-    myError.setMessage(Utility.messageBD(this, "RecordsCopied", vars.getLanguage()) + " " + i);
-    return myError;
-  }
-
-
-  void printPage(HttpServletResponse response, VariablesSecureApp vars, String strKey, String windowId, String strTab, String strProcessId)
-    throws IOException, ServletException {
-      if (log4j.isDebugEnabled()) log4j.debug("Output: Button process Copy from Invoice");
-
-      ActionButtonDefaultData[] data = null;
-      String strHelp="", strDescription="";
-      if (vars.getLanguage().equals("en_US")) data = ActionButtonDefaultData.select(this, strProcessId);
-      else data = ActionButtonDefaultData.selectLanguage(this, vars.getLanguage(), strProcessId);
-
-      if (data!=null && data.length!=0) {
-        strDescription = data[0].description;
-        strHelp = data[0].help;
-      }
-      String[] discard = {""};
-      if (strHelp.equals("")) discard[0] = new String("helpDiscard");
-      XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice", discard).createXmlDocument();
-      xmlDocument.setParameter("key", strKey);
-      xmlDocument.setParameter("window", windowId);
-      xmlDocument.setParameter("tab", strTab);
-      xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
-      xmlDocument.setParameter("question", Utility.messageBD(this, "StartProcess?", vars.getLanguage()));
-      xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
-      xmlDocument.setParameter("theme", vars.getTheme());
-      xmlDocument.setParameter("description", strDescription);
-      xmlDocument.setParameter("help", strHelp);
-
-      
-      response.setContentType("text/html; charset=UTF-8");
-      PrintWriter out = response.getWriter();
-      out.println(xmlDocument.print());
-      out.close();
+    public void init(ServletConfig config) {
+        super.init(config);
+        boolHist = false;
     }
 
-  public String getServletInfo() {
-    return "Servlet Copy from invoice";
-  } // end of getServletInfo() method
+    public void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws IOException, ServletException {
+        VariablesSecureApp vars = new VariablesSecureApp(request);
+
+        if (vars.commandIn("DEFAULT")) {
+            String strProcessId = vars.getStringParameter("inpProcessId");
+            String strWindow = vars.getStringParameter("inpwindowId");
+            String strTab = vars.getStringParameter("inpTabId");
+            String strKey = vars.getGlobalVariable("inpcInvoiceId", strWindow
+                    + "|C_Invoice_ID");
+            printPage(response, vars, strKey, strWindow, strTab, strProcessId);
+        } else if (vars.commandIn("SAVE")) {
+            String strKey = vars.getStringParameter("inpcInvoiceId");
+            String strInvoice = vars.getStringParameter("inpNewcInvoiceId");
+            String strWindow = vars.getStringParameter("inpwindowId");
+            String strTab = vars.getStringParameter("inpTabId");
+            ActionButtonDefaultData[] tab = ActionButtonDefaultData.windowName(
+                    this, strTab);
+            String strWindowPath = "", strTabName = "";
+            if (tab != null && tab.length != 0) {
+                strTabName = FormatUtilities.replace(tab[0].name);
+                strWindowPath = "../"
+                        + FormatUtilities.replace(tab[0].description) + "/"
+                        + strTabName + "_Relation.html";
+            } else
+                strWindowPath = strDefaultServlet;
+
+            OBError myError = processButton(vars, strKey, strInvoice, strWindow);
+            vars.setMessage(strTab, myError);
+            printPageClosePopUp(response, vars, strWindowPath);
+        } else
+            pageErrorPopUp(response);
+    }
+
+    OBError processButton(VariablesSecureApp vars, String strKey,
+            String strInvoice, String windowId) {
+        int i = 0;
+        OBError myError = null;
+        Connection conn = null;
+        try {
+            conn = getTransactionConnection();
+            CopyFromInvoiceData[] data = CopyFromInvoiceData.select(conn, this,
+                    strInvoice, Utility.getContext(this, vars, "#User_Client",
+                            windowId), Utility.getContext(this, vars,
+                            "#User_Org", windowId));
+            if (data != null && data.length != 0) {
+                for (i = 0; i < data.length; i++) {
+                    String strSequence = SequenceIdData.getUUID();
+                    try {
+                        CopyFromInvoiceData.insert(conn, this, strSequence,
+                                strKey, vars.getClient(), vars.getOrg(), vars
+                                        .getUser(), data[i].cInvoicelineId);
+                    } catch (ServletException ex) {
+                        myError = Utility.translateError(this, vars, vars
+                                .getLanguage(), ex.getMessage());
+                        releaseRollbackConnection(conn);
+                    }
+                }
+            }
+            releaseCommitConnection(conn);
+        } catch (Exception e) {
+            try {
+                releaseRollbackConnection(conn);
+            } catch (Exception ignored) {
+            }
+            log4j.warn("Rollback in transaction", e);
+            myError = new OBError();
+            myError.setType("Error");
+            myError.setTitle(Utility.messageBD(this, "Error", vars
+                    .getLanguage()));
+            myError.setMessage(Utility.messageBD(this, "ProcessRunError", vars
+                    .getLanguage()));
+            return myError;
+        }
+        myError = new OBError();
+        myError.setType("Success");
+        myError
+                .setTitle(Utility
+                        .messageBD(this, "Success", vars.getLanguage()));
+        myError.setMessage(Utility.messageBD(this, "RecordsCopied", vars
+                .getLanguage())
+                + " " + i);
+        return myError;
+    }
+
+    void printPage(HttpServletResponse response, VariablesSecureApp vars,
+            String strKey, String windowId, String strTab, String strProcessId)
+            throws IOException, ServletException {
+        if (log4j.isDebugEnabled())
+            log4j.debug("Output: Button process Copy from Invoice");
+
+        ActionButtonDefaultData[] data = null;
+        String strHelp = "", strDescription = "";
+        if (vars.getLanguage().equals("en_US"))
+            data = ActionButtonDefaultData.select(this, strProcessId);
+        else
+            data = ActionButtonDefaultData.selectLanguage(this, vars
+                    .getLanguage(), strProcessId);
+
+        if (data != null && data.length != 0) {
+            strDescription = data[0].description;
+            strHelp = data[0].help;
+        }
+        String[] discard = { "" };
+        if (strHelp.equals(""))
+            discard[0] = new String("helpDiscard");
+        XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+                "org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice",
+                discard).createXmlDocument();
+        xmlDocument.setParameter("key", strKey);
+        xmlDocument.setParameter("window", windowId);
+        xmlDocument.setParameter("tab", strTab);
+        xmlDocument.setParameter("language", "defaultLang=\""
+                + vars.getLanguage() + "\";");
+        xmlDocument.setParameter("question", Utility.messageBD(this,
+                "StartProcess?", vars.getLanguage()));
+        xmlDocument.setParameter("directory", "var baseDirectory = \""
+                + strReplaceWith + "/\";\n");
+        xmlDocument.setParameter("theme", vars.getTheme());
+        xmlDocument.setParameter("description", strDescription);
+        xmlDocument.setParameter("help", strHelp);
+
+        response.setContentType("text/html; charset=UTF-8");
+        PrintWriter out = response.getWriter();
+        out.println(xmlDocument.print());
+        out.close();
+    }
+
+    public String getServletInfo() {
+        return "Servlet Copy from invoice";
+    } // end of getServletInfo() method
 }
-
--- a/src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder.java	Tue Dec 23 20:16:42 2008 +0000
@@ -15,7 +15,7 @@
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
-*/
+ */
 package org.openbravo.erpCommon.ad_actionButton;
 
 import org.openbravo.erpCommon.utility.*;
@@ -36,175 +36,266 @@
 import org.openbravo.erpCommon.utility.DateTimeData;
 
 public class CopyFromOrder extends HttpSecureAppServlet {
-  private static final long serialVersionUID = 1L;
-  static final BigDecimal ZERO = new BigDecimal(0.0);
+    private static final long serialVersionUID = 1L;
+    static final BigDecimal ZERO = new BigDecimal(0.0);
 
-  public void init (ServletConfig config) {
-    super.init(config);
-    boolHist = false;
-  }
+    public void init(ServletConfig config) {
+        super.init(config);
+        boolHist = false;
+    }
 
-  public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
-    VariablesSecureApp vars = new VariablesSecureApp(request);
-    
-    if (vars.commandIn("DEFAULT")) {
-      String strWindowId = vars.getStringParameter("inpwindowId");
-      String strSOTrx = Utility.getContext(this, vars, "isSOTrx", strWindowId);
-      String strKey = vars.getGlobalVariable("inpcOrderId", strWindowId + "|C_Order_ID");
-      String strTabId = vars.getStringParameter("inpTabId");
-      String strBpartner = vars.getStringParameter("inpcBpartnerId");
-      String strmPricelistId = vars.getStringParameter("inpmPricelistId" );
-      printPageDataSheet(response, vars, strKey, strWindowId, strTabId, strSOTrx, strBpartner, strmPricelistId);
-    } else if (vars.commandIn("SAVE")) {
-      String strRownum = vars.getRequiredInStringParameter("inpRownumId");
-      String strKey = vars.getRequiredStringParameter("inpcOrderId");
-      String strWindowId = vars.getStringParameter("inpWindowId");
-      String strSOTrx = vars.getStringParameter("inpissotrx");
-      String strTabId = vars.getStringParameter("inpTabId");
-      OBError myError = copyLines(vars, strRownum, strKey, strWindowId, strSOTrx);
-      ActionButtonDefaultData[] tab = ActionButtonDefaultData.windowName(this, strTabId);
-      String strWindowPath="", strTabName="";
-      if (tab!=null && tab.length!=0) {
-        strTabName = FormatUtilities.replace(tab[0].name);
-        strWindowPath = "../" + FormatUtilities.replace(tab[0].description) + "/" + strTabName + "_Relation.html";
-      } else strWindowPath = strDefaultServlet;
-      
-      vars.setMessage(strTabId, myError);      
-      printPageClosePopUp(response, vars, strWindowPath);
-    } else pageErrorPopUp(response);
-  }
+    public void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws IOException, ServletException {
+        VariablesSecureApp vars = new VariablesSecureApp(request);
 
-  OBError copyLines(VariablesSecureApp vars, String strRownum, String strKey, String strWindowId, String strSOTrx) 
-      throws IOException, ServletException {
+        if (vars.commandIn("DEFAULT")) {
+            String strWindowId = vars.getStringParameter("inpwindowId");
+            String strSOTrx = Utility.getContext(this, vars, "isSOTrx",
+                    strWindowId);
+            String strKey = vars.getGlobalVariable("inpcOrderId", strWindowId
+                    + "|C_Order_ID");
+            String strTabId = vars.getStringParameter("inpTabId");
+            String strBpartner = vars.getStringParameter("inpcBpartnerId");
+            String strmPricelistId = vars.getStringParameter("inpmPricelistId");
+            printPageDataSheet(response, vars, strKey, strWindowId, strTabId,
+                    strSOTrx, strBpartner, strmPricelistId);
+        } else if (vars.commandIn("SAVE")) {
+            String strRownum = vars.getRequiredInStringParameter("inpRownumId");
+            String strKey = vars.getRequiredStringParameter("inpcOrderId");
+            String strWindowId = vars.getStringParameter("inpWindowId");
+            String strSOTrx = vars.getStringParameter("inpissotrx");
+            String strTabId = vars.getStringParameter("inpTabId");
+            OBError myError = copyLines(vars, strRownum, strKey, strWindowId,
+                    strSOTrx);
+            ActionButtonDefaultData[] tab = ActionButtonDefaultData.windowName(
+                    this, strTabId);
+            String strWindowPath = "", strTabName = "";
+            if (tab != null && tab.length != 0) {
+                strTabName = FormatUtilities.replace(tab[0].name);
+                strWindowPath = "../"
+                        + FormatUtilities.replace(tab[0].description) + "/"
+                        + strTabName + "_Relation.html";
+            } else
+                strWindowPath = strDefaultServlet;
 
-    OBError myError = null;
-    int count = 0;
-    
-    if (strRownum.equals("")){      
-      //return "";
-      myError = Utility.translateError(this, vars, vars.getLanguage(), "ProcessRunError");
-      return myError;
+            vars.setMessage(strTabId, myError);
+            printPageClosePopUp(response, vars, strWindowPath);
+        } else
+            pageErrorPopUp(response);
     }
-    Connection conn = null;
-    try {
-      conn = getTransactionConnection();
-        if (strRownum.startsWith("(")) strRownum = strRownum.substring(1, strRownum.length()-1);
-      if (!strRownum.equals("")) {
-        strRownum = Replace.replace(strRownum, "'", "");
-        StringTokenizer st = new StringTokenizer(strRownum, ",", false);
-        while (st.hasMoreTokens()) {
-          strRownum = st.nextToken().trim();
-          String strmProductId = vars.getStringParameter("inpmProductId" + strRownum);
-          String strmAttributesetinstanceId = vars.getStringParameter("inpmAttributesetinstanceId" + strRownum);
-          String strLastpriceso = vars.getStringParameter("inpLastpriceso" + strRownum);
-          String strQty = vars.getStringParameter("inpquantity" + strRownum);
-          String strcTaxId = vars.getStringParameter("inpcTaxId" + strRownum);
-          String strcUOMId = vars.getStringParameter("inpcUOMId" + strRownum);
-          String strCOrderlineID = SequenceIdData.getUUID();
-          CopyFromOrderRecordData[] order = CopyFromOrderRecordData.select(this, strKey);
-          CopyFromOrderData[] orderlineprice = CopyFromOrderData.selectPrices(this, order[0].dateordered, strmProductId, order[0].mPricelistId);
-          if (orderlineprice==null || orderlineprice.length==0) {
-            orderlineprice = CopyFromOrderData.set();
-            orderlineprice[0].pricelist ="0";
-            orderlineprice[0].pricelimit = "0";
-            orderlineprice[0].stdprecision = "0";
-          }
 
-          String strPrecision = orderlineprice[0].stdprecision.equals("")?"0":orderlineprice[0].stdprecision;
-          
-          BigDecimal discount, priceActual, priceList;          
-          int StdPrecision = Integer.valueOf(strPrecision).intValue();
-          priceList = (orderlineprice[0].pricelist.equals("")?ZERO:new BigDecimal(orderlineprice[0].pricelist));
-          priceActual = (strLastpriceso.equals("")?ZERO:new BigDecimal(strLastpriceso));
-          
-          if (priceList.doubleValue() == 0.0) discount = ZERO;
-          else {
-            if (log4j.isDebugEnabled()) log4j.debug("pricelist:" + Double.toString(priceList.doubleValue()));
-            if (log4j.isDebugEnabled()) log4j.debug("priceActual:" + Double.toString(priceActual.doubleValue()));
-            discount = new BigDecimal ((priceList.doubleValue() - priceActual.doubleValue()) / priceList.doubleValue() * 100.0);
-          }
-          if (log4j.isDebugEnabled()) log4j.debug("Discount: " + discount.toString());
-          if (discount.scale() > StdPrecision) discount = discount.setScale(StdPrecision, BigDecimal.ROUND_HALF_UP);
-          try {
-            CopyFromOrderData.insertCOrderline(conn, this, strCOrderlineID, order[0].adClientId, order[0].adOrgId, vars.getUser(),
-            strKey, order[0].cBpartnerId, order[0].cBpartnerLocationId, order[0].dateordered, order[0].dateordered, 
-            strmProductId, order[0].mWarehouseId.equals("")?vars.getWarehouse():order[0].mWarehouseId, strcUOMId, strQty, order[0].cCurrencyId, orderlineprice[0].pricelist, strLastpriceso, orderlineprice[0].pricelimit, discount.toString(), strcTaxId, strmAttributesetinstanceId);
-          } catch(ServletException ex) {
-            myError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
-            releaseRollbackConnection(conn);
+    OBError copyLines(VariablesSecureApp vars, String strRownum, String strKey,
+            String strWindowId, String strSOTrx) throws IOException,
+            ServletException {
+
+        OBError myError = null;
+        int count = 0;
+
+        if (strRownum.equals("")) {
+            // return "";
+            myError = Utility.translateError(this, vars, vars.getLanguage(),
+                    "ProcessRunError");
             return myError;
-          }
-          count++;
         }
-      }
-      releaseCommitConnection(conn);
-      myError = new OBError();
-      myError.setType("Success");
-      myError.setTitle(Utility.messageBD(this, "Success", vars.getLanguage()));
-      myError.setMessage(Utility.messageBD(this, "RecordsCopied", vars.getLanguage()) + " " + count);
-    } catch (Exception e){
-      try {
-        releaseRollbackConnection(conn);
-      } catch (Exception ignored) {}
-      e.printStackTrace();
-      log4j.warn("Rollback in transaction");
-      myError = Utility.translateError(this, vars, vars.getLanguage(), "ProcessRunError");
+        Connection conn = null;
+        try {
+            conn = getTransactionConnection();
+            if (strRownum.startsWith("("))
+                strRownum = strRownum.substring(1, strRownum.length() - 1);
+            if (!strRownum.equals("")) {
+                strRownum = Replace.replace(strRownum, "'", "");
+                StringTokenizer st = new StringTokenizer(strRownum, ",", false);
+                while (st.hasMoreTokens()) {
+                    strRownum = st.nextToken().trim();
+                    String strmProductId = vars
+                            .getStringParameter("inpmProductId" + strRownum);
+                    String strmAttributesetinstanceId = vars
+                            .getStringParameter("inpmAttributesetinstanceId"
+                                    + strRownum);
+                    String strLastpriceso = vars
+                            .getStringParameter("inpLastpriceso" + strRownum);
+                    String strQty = vars.getStringParameter("inpquantity"
+                            + strRownum);
+                    String strcTaxId = vars.getStringParameter("inpcTaxId"
+                            + strRownum);
+                    String strcUOMId = vars.getStringParameter("inpcUOMId"
+                            + strRownum);
+                    String strCOrderlineID = SequenceIdData.getUUID();
+                    CopyFromOrderRecordData[] order = CopyFromOrderRecordData
+                            .select(this, strKey);
+                    CopyFromOrderData[] orderlineprice = CopyFromOrderData
+                            .selectPrices(this, order[0].dateordered,
+                                    strmProductId, order[0].mPricelistId);
+                    if (orderlineprice == null || orderlineprice.length == 0) {
+                        orderlineprice = CopyFromOrderData.set();
+                        orderlineprice[0].pricelist = "0";
+                        orderlineprice[0].pricelimit = "0";
+                        orderlineprice[0].stdprecision = "0";
+                    }
+
+                    String strPrecision = orderlineprice[0].stdprecision
+                            .equals("") ? "0" : orderlineprice[0].stdprecision;
+
+                    BigDecimal discount, priceActual, priceList;
+                    int StdPrecision = Integer.valueOf(strPrecision).intValue();
+                    priceList = (orderlineprice[0].pricelist.equals("") ? ZERO
+                            : new BigDecimal(orderlineprice[0].pricelist));
+                    priceActual = (strLastpriceso.equals("") ? ZERO
+                            : new BigDecimal(strLastpriceso));
+
+                    if (priceList.doubleValue() == 0.0)
+                        discount = ZERO;
+                    else {
+                        if (log4j.isDebugEnabled())
+                            log4j.debug("pricelist:"
+                                    + Double.toString(priceList.doubleValue()));
+                        if (log4j.isDebugEnabled())
+                            log4j
+                                    .debug("priceActual:"
+                                            + Double.toString(priceActual
+                                                    .doubleValue()));
+                        discount = new BigDecimal(
+                                (priceList.doubleValue() - priceActual
+                                        .doubleValue())
+                                        / priceList.doubleValue() * 100.0);
+                    }
+                    if (log4j.isDebugEnabled())
+                        log4j.debug("Discount: " + discount.toString());
+                    if (discount.scale() > StdPrecision)
+                        discount = discount.setScale(StdPrecision,
+                                BigDecimal.ROUND_HALF_UP);
+                    try {
+                        CopyFromOrderData
+                                .insertCOrderline(conn, this, strCOrderlineID,
+                                        order[0].adClientId, order[0].adOrgId,
+                                        vars.getUser(), strKey,
+                                        order[0].cBpartnerId,
+                                        order[0].cBpartnerLocationId,
+                                        order[0].dateordered,
+                                        order[0].dateordered, strmProductId,
+                                        order[0].mWarehouseId.equals("") ? vars
+                                                .getWarehouse()
+                                                : order[0].mWarehouseId,
+                                        strcUOMId, strQty,
+                                        order[0].cCurrencyId,
+                                        orderlineprice[0].pricelist,
+                                        strLastpriceso,
+                                        orderlineprice[0].pricelimit, discount
+                                                .toString(), strcTaxId,
+                                        strmAttributesetinstanceId);
+                    } catch (ServletException ex) {
+                        myError = Utility.translateError(this, vars, vars
+                                .getLanguage(), ex.getMessage());
+                        releaseRollbackConnection(conn);
+                        return myError;
+                    }
+                    count++;
+                }
+            }
+            releaseCommitConnection(conn);
+            myError = new OBError();
+            myError.setType("Success");
+            myError.setTitle(Utility.messageBD(this, "Success", vars
+                    .getLanguage()));
+            myError.setMessage(Utility.messageBD(this, "RecordsCopied", vars
+                    .getLanguage())
+                    + " " + count);
+        } catch (Exception e) {
+            try {
+                releaseRollbackConnection(conn);
+            } catch (Exception ignored) {
+            }
+            e.printStackTrace();
+            log4j.warn("Rollback in transaction");
+            myError = Utility.translateError(this, vars, vars.getLanguage(),
+                    "ProcessRunError");
+        }
+        return myError;
     }
-    return myError;
-  }
 
+    void printPageDataSheet(HttpServletResponse response,
+            VariablesSecureApp vars, String strKey, String strWindowId,
+            String strTabId, String strSOTrx, String strBpartner,
+            String strmPricelistId) throws IOException, ServletException {
+        log4j.debug("Output: Shipment");
 
-  void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars, String strKey, String strWindowId, String strTabId, String strSOTrx, String strBpartner, String strmPricelistId) throws IOException, ServletException {
-    log4j.debug("Output: Shipment");
+        XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+                "org/openbravo/erpCommon/ad_actionButton/CopyFromOrder")
+                .createXmlDocument();
+        CopyFromOrderRecordData[] dataOrder = CopyFromOrderRecordData.select(
+                this, strKey);
+        CopyFromOrderData[] data = CopyFromOrderData.select(this, strBpartner,
+                strmPricelistId, dataOrder[0].dateordered, strSOTrx,
+                dataOrder[0].lastDays.equals("") ? "0" : dataOrder[0].lastDays);
+        xmlDocument.setParameter("language", "defaultLang=\""
+                + vars.getLanguage() + "\";");
+        xmlDocument.setParameter("directory", "var baseDirectory = \""
+                + strReplaceWith + "/\";\n");
+        xmlDocument.setParameter("theme", vars.getTheme());
+        xmlDocument.setParameter("key", strKey);
+        xmlDocument.setParameter("windowId", strWindowId);
+        xmlDocument.setParameter("tabId", strTabId);
+        xmlDocument.setParameter("sotrx", strSOTrx);
+        xmlDocument.setParameter("yearactual", DateTimeData.sysdateYear(this));
+        xmlDocument.setParameter("lastmonth",
+                dataOrder[0].lastDays.equals("") ? "0" : dataOrder[0].lastDays);
+        xmlDocument.setParameter("pendingdelivery",
+                strSOTrx.equals("Y") ? CopyFromOrderRecordData
+                        .pendingDeliverySales(this, strBpartner,
+                                dataOrder[0].adOrgId, dataOrder[0].adClientId)
+                        : CopyFromOrderRecordData.materialReceiptPending(this,
+                                strBpartner, dataOrder[0].adOrgId,
+                                dataOrder[0].adClientId));
+        xmlDocument.setParameter("pendingInvoice",
+                strSOTrx.equals("Y") ? CopyFromOrderRecordData
+                        .pendingInvoiceSales(this, strBpartner,
+                                dataOrder[0].adOrgId, dataOrder[0].adClientId)
+                        : CopyFromOrderRecordData.purchasePendingInvoice(this,
+                                strBpartner, dataOrder[0].adOrgId,
+                                dataOrder[0].adClientId));
+        xmlDocument.setParameter("debtpending", CopyFromOrderRecordData
+                .debtPending(this, strBpartner, dataOrder[0].adOrgId,
+                        dataOrder[0].adClientId, strSOTrx));
+        xmlDocument.setParameter("contact", CopyFromOrderRecordData.contact(
+                this, dataOrder[0].adUserId));
+        xmlDocument.setParameter("lastOrder",
+                CopyFromOrderRecordData.maxDateordered(this, vars
+                        .getSqlDateFormat(), strBpartner, strSOTrx,
+                        dataOrder[0].adOrgId, dataOrder[0].adClientId));
+        xmlDocument.setParameter("orgname", dataOrder[0].orgname);
+        String strInvoicing = CopyFromOrderRecordData.invoicing(this, strSOTrx,
+                strBpartner, dataOrder[0].adOrgId, dataOrder[0].adClientId);
+        String strTotal = CopyFromOrderRecordData.invoicingTotal(this,
+                strSOTrx, dataOrder[0].adOrgId, dataOrder[0].adClientId);
+        xmlDocument.setParameter("invoicing", strInvoicing);
+        xmlDocument.setParameter("bpartnername", dataOrder[0].bpartnername);
 
-    XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_actionButton/CopyFromOrder").createXmlDocument();
-    CopyFromOrderRecordData[] dataOrder = CopyFromOrderRecordData.select(this, strKey);
-    CopyFromOrderData[] data = CopyFromOrderData.select(this, strBpartner, strmPricelistId, dataOrder[0].dateordered, strSOTrx, dataOrder[0].lastDays.equals("")?"0":dataOrder[0].lastDays);
-    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
-    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
-    xmlDocument.setParameter("theme", vars.getTheme());
-    xmlDocument.setParameter("key", strKey);
-    xmlDocument.setParameter("windowId", strWindowId);
-    xmlDocument.setParameter("tabId", strTabId);
-    xmlDocument.setParameter("sotrx", strSOTrx);
-    xmlDocument.setParameter("yearactual", DateTimeData.sysdateYear(this));
-    xmlDocument.setParameter("lastmonth", dataOrder[0].lastDays.equals("")?"0":dataOrder[0].lastDays);
-    xmlDocument.setParameter("pendingdelivery", strSOTrx.equals("Y")?CopyFromOrderRecordData.pendingDeliverySales(this, strBpartner, dataOrder[0].adOrgId, dataOrder[0].adClientId):CopyFromOrderRecordData.materialReceiptPending(this, strBpartner, dataOrder[0].adOrgId, dataOrder[0].adClientId));
-    xmlDocument.setParameter("pendingInvoice", strSOTrx.equals("Y")?CopyFromOrderRecordData.pendingInvoiceSales(this, strBpartner, dataOrder[0].adOrgId, dataOrder[0].adClientId):CopyFromOrderRecordData.purchasePendingInvoice(this, strBpartner, dataOrder[0].adOrgId, dataOrder[0].adClientId));
-    xmlDocument.setParameter("debtpending", CopyFromOrderRecordData.debtPending(this, strBpartner, dataOrder[0].adOrgId, dataOrder[0].adClientId, strSOTrx));
-    xmlDocument.setParameter("contact", CopyFromOrderRecordData.contact(this, dataOrder[0].adUserId));
-    xmlDocument.setParameter("lastOrder", CopyFromOrderRecordData.maxDateordered(this, vars.getSqlDateFormat(), strBpartner, strSOTrx, dataOrder[0].adOrgId, dataOrder[0].adClientId));
-    xmlDocument.setParameter("orgname", dataOrder[0].orgname);
-    String strInvoicing = CopyFromOrderRecordData.invoicing(this, strSOTrx, strBpartner, dataOrder[0].adOrgId, dataOrder[0].adClientId);
-    String strTotal = CopyFromOrderRecordData.invoicingTotal(this, strSOTrx, dataOrder[0].adOrgId, dataOrder[0].adClientId);
-    xmlDocument.setParameter("invoicing", strInvoicing);
-    xmlDocument.setParameter("bpartnername",dataOrder[0].bpartnername);
+        BigDecimal invoicing, total, totalAverage;
 
-    BigDecimal invoicing, total, totalAverage;
+        invoicing = (strInvoicing.equals("") ? ZERO : (new BigDecimal(
+                strInvoicing)));
+        total = (strTotal.equals("") ? ZERO : new BigDecimal(strTotal));
+        String strTotalAverage = "";
+        if (total == ZERO) {
+            totalAverage = new BigDecimal(invoicing.doubleValue()
+                    / total.doubleValue() * 100.0);
+            totalAverage = totalAverage.setScale(2, BigDecimal.ROUND_HALF_UP);
+            strTotalAverage = totalAverage.toString();
+            // int intscale = totalAverage.scale();
+        }
 
-    invoicing = (strInvoicing.equals("")?ZERO:(new BigDecimal(strInvoicing)));
-    total = (strTotal.equals("")?ZERO:new BigDecimal(strTotal));
-    String strTotalAverage = "";
-    if (total==ZERO) {
-      totalAverage = new BigDecimal (invoicing.doubleValue() / total.doubleValue() * 100.0);
-      totalAverage = totalAverage.setScale(2, BigDecimal.ROUND_HALF_UP);
-      strTotalAverage = totalAverage.toString();
-      //int intscale = totalAverage.scale();
-    } 
+        xmlDocument.setParameter("totalAverage", strTotalAverage);
 
-    xmlDocument.setParameter("totalAverage", strTotalAverage);
+        xmlDocument.setData("structure1", data);
+        xmlDocument.setData("structure2", dataOrder);
+        response.setContentType("text/html; charset=UTF-8");
+        PrintWriter out = response.getWriter();
+        out.println(xmlDocument.print());
+        out.close();
 
-    xmlDocument.setData("structure1", data);
-    xmlDocument.setData("structure2", dataOrder);
-    response.setContentType("text/html; charset=UTF-8");
-    PrintWriter out = response.getWriter();
-    out.println(xmlDocument.print());
-    out.close();
-    
-  }
+    }
 
-  public String getServletInfo() {
-    return "Servlet Copy from order";
-  } // end of getServletInfo() method
+    public String getServletInfo() {
+        return "Servlet Copy from order";
+    } // end of getServletInfo() method
 }
-
--- a/src/org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder.java	Tue Dec 23 20:16:42 2008 +0000
@@ -15,7 +15,7 @@
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
-*/
+ */
 package org.openbravo.erpCommon.ad_actionButton;
 
 import org.openbravo.erpCommon.utility.*;
@@ -37,157 +37,244 @@
 import org.openbravo.erpCommon.utility.DateTimeData;
 
 public class CopyFromPOOrder extends HttpSecureAppServlet {
-  private static final long serialVersionUID = 1L;
-  static final BigDecimal ZERO = new BigDecimal(0.0);
+    private static final long serialVersionUID = 1L;
+    static final BigDecimal ZERO = new BigDecimal(0.0);
 
-  public void init (ServletConfig config) {
-    super.init(config);
-    boolHist = false;
-  }
-
-  public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
-    VariablesSecureApp vars = new VariablesSecureApp(request);
-    
-    if (vars.commandIn("DEFAULT")) {
-      String strProcessId = vars.getStringParameter("inpProcessId");
-      String strWindow = vars.getStringParameter("inpwindowId");
-      String strTab = vars.getStringParameter("inpTabId");
-      String strKey = vars.getGlobalVariable("inpcOrderId", strWindow + "|C_Order_ID");
-      printPage(response, vars, strKey, strWindow, strTab, strProcessId);
-    } else if (vars.commandIn("SAVE")) {
-      String strWindow = vars.getStringParameter("inpwindowId");
-      String strOrder = vars.getStringParameter("inpcOrderId");
-      String strKey = vars.getRequestGlobalVariable("inpKey", strWindow + "|C_Order_ID");
-      String strTab = vars.getStringParameter("inpTabId");
-      ActionButtonDefaultData[] tab = ActionButtonDefaultData.windowName(this, strTab);
-      String strWindowPath="", strTabName="";
-      if (tab!=null && tab.length!=0) {
-        strTabName = FormatUtilities.replace(tab[0].name);
-        if (tab[0].help.equals("Y")) strWindowPath="../utility/WindowTree_FS.html?inpTabId=" + strTab;
-        else strWindowPath = "../" + FormatUtilities.replace(tab[0].description) + "/" + strTabName + "_Relation.html";
-      } else strWindowPath = strDefaultServlet;
-      OBError myError = processButton(vars, strKey, strOrder, strWindow);
-      if (log4j.isDebugEnabled()) log4j.debug(myError.getMessage());
-      vars.setMessage(strTab,myError);
-      printPageClosePopUp(response, vars, strWindowPath);
-    } else pageErrorPopUp(response);
-  }
-
-
- OBError processButton(VariablesSecureApp vars, String strKey, String strOrder, String windowId) {
-    OBError myError = null;    
-    int i = 0;
-    String priceactual = "";
-    String pricelist = "";
-    String pricelimit = "";
-    String strPrecision = "0";
-    String strPricePrecision="0";
-    String strDiscount = "";
-    Connection conn = null;
-    try {
-      conn = getTransactionConnection();
-      CopyFromPOOrderData[] data = CopyFromPOOrderData.selectLines(this, strOrder);
-      CopyFromPOOrderData[] order = CopyFromPOOrderData.select(this, strKey);
-      for (i=0;data!=null && i<data.length;i++){
-          SEExpenseProductData[] data3 = SEExpenseProductData.select(this, data[i].mProductId, order[0].mPricelistId.equals("")?CopyFromPOOrderData.defaultPriceList(this):order[0].mPricelistId);
-          for (int j=0;data3!=null && j<data3.length;j++) {
-            if (data3[j].validfrom == null  || data3[j].validfrom.equals("") || !DateTimeData.compare(this, DateTimeData.today(this), data3[j].validfrom).equals("-1")){
-            priceactual = data3[j].pricestd;
-            pricelist = data3[j].pricelist;
-            pricelimit = data3[j].pricelimit;
-            SLOrderAmtData[] data4 = SLOrderAmtData.select(this, strKey);
-              if (data4!=null && data4.length>0) {
-              strPrecision = data4[0].stdprecision.equals("")?"0":data4[0].stdprecision;
-              strPricePrecision = data4[0].priceprecision.equals("")?"0":data4[0].priceprecision;
-              }
-            int StdPrecision = Integer.valueOf(strPrecision).intValue();
-            int PricePrecision = Integer.valueOf(strPricePrecision).intValue();
-
-            BigDecimal priceActual, priceList, discount;
-
-            priceActual = (priceactual.equals("")?ZERO:(new BigDecimal(priceactual))).setScale(PricePrecision, BigDecimal.ROUND_HALF_UP);
-            priceList = (pricelist.equals("")?ZERO:new BigDecimal(pricelist));
-            if (priceList.doubleValue() == 0.0) discount = ZERO;
-            else discount = new BigDecimal ((priceList.doubleValue() - priceActual.doubleValue()) / priceList.doubleValue() * 100.0);
-            if (discount.scale() > StdPrecision) discount = discount.setScale(StdPrecision, BigDecimal.ROUND_HALF_UP);
-            strDiscount = discount.toString();
-            priceactual = priceActual.toString();
-            pricelist = priceList.toString();
-            }
-          }
-          if (priceactual.equals("")) priceactual="0";
-          if (pricelist.equals("")) pricelist="0";
-          if (pricelimit.equals("")) pricelimit="0";
-          int line = 0;
-          String strCTaxID = Tax.get(this, data[i].mProductId, DateTimeData.today(this), order[0].adOrgId, order[0].mWarehouseId.equals("")?vars.getWarehouse():order[0].mWarehouseId, CopyFromPOOrderData.cBPartnerLocationId(this, order[0].cBpartnerId), CopyFromPOOrderData.cBPartnerLocationId(this, order[0].cBpartnerId), order[0].cProjectId, true);
-          if (strCTaxID.equals("")){
-            myError = Utility.translateError(this, vars, vars.getLanguage(), Utility.messageBD(this, "TaxNotFound", vars.getLanguage()));
-            return myError;
-          }
-          line = Integer.valueOf(order[0].line.equals("")?"0":order[0].line).intValue() + ((i+1) * 10);
-          String strCOrderlineID = SequenceIdData.getUUID();
-          try {
-            CopyFromPOOrderData.insertCOrderline(conn, this, strCOrderlineID, order[0].adClientId, order[0].adOrgId, vars.getUser(),
-            strKey, Integer.toString(line), order[0].cBpartnerId, 
-            order[0].cBpartnerLocationId.equals("")?ExpenseSOrderData.cBPartnerLocationId(this, 
-            order[0].cBpartnerId):order[0].cBpartnerLocationId, DateTimeData.today(this), DateTimeData.today(this), data[i].description, 
-            data[i].mProductId, order[0].mWarehouseId.equals("")?vars.getWarehouse():order[0].mWarehouseId, data[i].cUomId, data[i].qtyordered, data[i].quantityorder,
-            data[i].cCurrencyId, pricelist, priceactual, pricelimit, strCTaxID, strDiscount, data[i].mProductUomId, data[i].orderline);
-          } catch(ServletException ex) {
-            myError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
-            releaseRollbackConnection(conn);
-            return myError;
-          }
-
-      }
-      
-      releaseCommitConnection(conn);
-      myError = new OBError();
-      myError.setType("Success");  
-      myError.setTitle(Utility.messageBD(this, "Success", vars.getLanguage()));
-      myError.setMessage(Utility.messageBD(this, "RecordsCopied", vars.getLanguage()) + i);
-    } catch (Exception e) {
-      try {
-        releaseRollbackConnection(conn);
-      } catch (Exception ignored) {}
-      e.printStackTrace();
-      log4j.warn("Rollback in transaction");
-      myError = Utility.translateError(this, vars, vars.getLanguage(), "ProcessRunError");
-    }
-    return myError;
-  }
-
-
-  void printPage(HttpServletResponse response, VariablesSecureApp vars, String strKey, String windowId, String strTab, String strProcessId)
-    throws IOException, ServletException {
-      if (log4j.isDebugEnabled()) log4j.debug("Output: Button process Copy lines");
-      ActionButtonDefaultData[] data = null;
-      String strHelp="", strDescription="";
-      if (vars.getLanguage().equals("en_US")) data = ActionButtonDefaultData.select(this, strProcessId);
-      else data = ActionButtonDefaultData.selectLanguage(this, vars.getLanguage(),strProcessId);
-      if (data!=null && data.length!=0) {
-        strDescription = data[0].description;
-        strHelp = data[0].help;
-      }
-      String[] discard = {""};
-      if (strHelp.equals("")) discard[0] = new String("helpDiscard");
-      XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder", discard).createXmlDocument();
-      xmlDocument.setParameter("key", strKey);
-      xmlDocument.setParameter("window", windowId);
-      xmlDocument.setParameter("tab", strTab);
-      xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
-      xmlDocument.setParameter("question", Utility.messageBD(this, "StartProcess?", vars.getLanguage()));
-      xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
-      xmlDocument.setParameter("theme", vars.getTheme());
-      xmlDocument.setParameter("description", strDescription);
-      xmlDocument.setParameter("help", strHelp);
-      response.setContentType("text/html");
-      PrintWriter out = response.getWriter();
-      out.println(xmlDocument.print());
-      out.close();
+    public void init(ServletConfig config) {
+        super.init(config);
+        boolHist = false;
     }
 
-  public String getServletInfo() {
-    return "Servlet Copy from order";
-  } // end of the getServletInfo() method
+    public void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws IOException, ServletException {
+        VariablesSecureApp vars = new VariablesSecureApp(request);
+
+        if (vars.commandIn("DEFAULT")) {
+            String strProcessId = vars.getStringParameter("inpProcessId");
+            String strWindow = vars.getStringParameter("inpwindowId");
+            String strTab = vars.getStringParameter("inpTabId");
+            String strKey = vars.getGlobalVariable("inpcOrderId", strWindow
+                    + "|C_Order_ID");
+            printPage(response, vars, strKey, strWindow, strTab, strProcessId);
+        } else if (vars.commandIn("SAVE")) {
+            String strWindow = vars.getStringParameter("inpwindowId");
+            String strOrder = vars.getStringParameter("inpcOrderId");
+            String strKey = vars.getRequestGlobalVariable("inpKey", strWindow
+                    + "|C_Order_ID");
+            String strTab = vars.getStringParameter("inpTabId");
+            ActionButtonDefaultData[] tab = ActionButtonDefaultData.windowName(
+                    this, strTab);
+            String strWindowPath = "", strTabName = "";
+            if (tab != null && tab.length != 0) {
+                strTabName = FormatUtilities.replace(tab[0].name);
+                if (tab[0].help.equals("Y"))
+                    strWindowPath = "../utility/WindowTree_FS.html?inpTabId="
+                            + strTab;
+                else
+                    strWindowPath = "../"
+                            + FormatUtilities.replace(tab[0].description) + "/"
+                            + strTabName + "_Relation.html";
+            } else
+                strWindowPath = strDefaultServlet;
+            OBError myError = processButton(vars, strKey, strOrder, strWindow);
+            if (log4j.isDebugEnabled())
+                log4j.debug(myError.getMessage());
+            vars.setMessage(strTab, myError);
+            printPageClosePopUp(response, vars, strWindowPath);
+        } else
+            pageErrorPopUp(response);
+    }
+
+    OBError processButton(VariablesSecureApp vars, String strKey,
+            String strOrder, String windowId) {
+        OBError myError = null;
+        int i = 0;
+        String priceactual = "";
+        String pricelist = "";
+        String pricelimit = "";
+        String strPrecision = "0";
+        String strPricePrecision = "0";
+        String strDiscount = "";
+        Connection conn = null;
+        try {
+            conn = getTransactionConnection();
+            CopyFromPOOrderData[] data = CopyFromPOOrderData.selectLines(this,
+                    strOrder);
+            CopyFromPOOrderData[] order = CopyFromPOOrderData.select(this,
+                    strKey);
+            for (i = 0; data != null && i < data.length; i++) {
+                SEExpenseProductData[] data3 = SEExpenseProductData
+                        .select(this, data[i].mProductId, order[0].mPricelistId
+                                .equals("") ? CopyFromPOOrderData
+                                .defaultPriceList(this) : order[0].mPricelistId);
+                for (int j = 0; data3 != null && j < data3.length; j++) {
+                    if (data3[j].validfrom == null
+                            || data3[j].validfrom.equals("")
+                            || !DateTimeData.compare(this,
+                                    DateTimeData.today(this),
+                                    data3[j].validfrom).equals("-1")) {
+                        priceactual = data3[j].pricestd;
+                        pricelist = data3[j].pricelist;
+                        pricelimit = data3[j].pricelimit;
+                        SLOrderAmtData[] data4 = SLOrderAmtData.select(this,
+                                strKey);
+                        if (data4 != null && data4.length > 0) {
+                            strPrecision = data4[0].stdprecision.equals("") ? "0"
+                                    : data4[0].stdprecision;
+                            strPricePrecision = data4[0].priceprecision
+                                    .equals("") ? "0" : data4[0].priceprecision;
+                        }
+                        int StdPrecision = Integer.valueOf(strPrecision)
+                                .intValue();
+                        int PricePrecision = Integer.valueOf(strPricePrecision)
+                                .intValue();
+
+                        BigDecimal priceActual, priceList, discount;
+
+                        priceActual = (priceactual.equals("") ? ZERO
+                                : (new BigDecimal(priceactual))).setScale(
+                                PricePrecision, BigDecimal.ROUND_HALF_UP);
+                        priceList = (pricelist.equals("") ? ZERO
+                                : new BigDecimal(pricelist));
+                        if (priceList.doubleValue() == 0.0)
+                            discount = ZERO;
+                        else
+                            discount = new BigDecimal(
+                                    (priceList.doubleValue() - priceActual
+                                            .doubleValue())
+                                            / priceList.doubleValue() * 100.0);
+                        if (discount.scale() > StdPrecision)
+                            discount = discount.setScale(StdPrecision,
+                                    BigDecimal.ROUND_HALF_UP);
+                        strDiscount = discount.toString();
+                        priceactual = priceActual.toString();
+                        pricelist = priceList.toString();
+                    }
+                }
+                if (priceactual.equals(""))
+                    priceactual = "0";
+                if (pricelist.equals(""))
+                    pricelist = "0";
+                if (pricelimit.equals(""))
+                    pricelimit = "0";
+                int line = 0;
+                String strCTaxID = Tax.get(this, data[i].mProductId,
+                        DateTimeData.today(this), order[0].adOrgId,
+                        order[0].mWarehouseId.equals("") ? vars.getWarehouse()
+                                : order[0].mWarehouseId,
+                        CopyFromPOOrderData.cBPartnerLocationId(this,
+                                order[0].cBpartnerId),
+                        CopyFromPOOrderData.cBPartnerLocationId(this,
+                                order[0].cBpartnerId), order[0].cProjectId,
+                        true);
+                if (strCTaxID.equals("")) {
+                    myError = Utility.translateError(this, vars, vars
+                            .getLanguage(), Utility.messageBD(this,
+                            "TaxNotFound", vars.getLanguage()));
+                    return myError;
+                }
+                line = Integer.valueOf(
+                        order[0].line.equals("") ? "0" : order[0].line)
+                        .intValue()
+                        + ((i + 1) * 10);
+                String strCOrderlineID = SequenceIdData.getUUID();
+                try {
+                    CopyFromPOOrderData
+                            .insertCOrderline(
+                                    conn,
+                                    this,
+                                    strCOrderlineID,
+                                    order[0].adClientId,
+                                    order[0].adOrgId,
+                                    vars.getUser(),
+                                    strKey,
+                                    Integer.toString(line),
+                                    order[0].cBpartnerId,
+                                    order[0].cBpartnerLocationId.equals("") ? ExpenseSOrderData
+                                            .cBPartnerLocationId(this,
+                                                    order[0].cBpartnerId)
+                                            : order[0].cBpartnerLocationId,
+                                    DateTimeData.today(this), DateTimeData
+                                            .today(this), data[i].description,
+                                    data[i].mProductId, order[0].mWarehouseId
+                                            .equals("") ? vars.getWarehouse()
+                                            : order[0].mWarehouseId,
+                                    data[i].cUomId, data[i].qtyordered,
+                                    data[i].quantityorder, data[i].cCurrencyId,
+                                    pricelist, priceactual, pricelimit,
+                                    strCTaxID, strDiscount,
+                                    data[i].mProductUomId, data[i].orderline);
+                } catch (ServletException ex) {
+                    myError = Utility.translateError(this, vars, vars
+                            .getLanguage(), ex.getMessage());
+                    releaseRollbackConnection(conn);
+                    return myError;
+                }
+
+            }
+
+            releaseCommitConnection(conn);
+            myError = new OBError();
+            myError.setType("Success");
+            myError.setTitle(Utility.messageBD(this, "Success", vars
+                    .getLanguage()));
+            myError.setMessage(Utility.messageBD(this, "RecordsCopied", vars
+                    .getLanguage())
+                    + i);
+        } catch (Exception e) {
+            try {
+                releaseRollbackConnection(conn);
+            } catch (Exception ignored) {
+            }
+            e.printStackTrace();
+            log4j.warn("Rollback in transaction");
+            myError = Utility.translateError(this, vars, vars.getLanguage(),
+                    "ProcessRunError");
+        }
+        return myError;
+    }
+
+    void printPage(HttpServletResponse response, VariablesSecureApp vars,
+            String strKey, String windowId, String strTab, String strProcessId)
+            throws IOException, ServletException {
+        if (log4j.isDebugEnabled())
+            log4j.debug("Output: Button process Copy lines");
+        ActionButtonDefaultData[] data = null;
+        String strHelp = "", strDescription = "";
+        if (vars.getLanguage().equals("en_US"))
+            data = ActionButtonDefaultData.select(this, strProcessId);
+        else
+            data = ActionButtonDefaultData.selectLanguage(this, vars
+                    .getLanguage(), strProcessId);
+        if (data != null && data.length != 0) {
+            strDescription = data[0].description;
+            strHelp = data[0].help;
+        }
+        String[] discard = { "" };
+        if (strHelp.equals(""))
+            discard[0] = new String("helpDiscard");
+        XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+                "org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder",
+                discard).createXmlDocument();
+        xmlDocument.setParameter("key", strKey);
+        xmlDocument.setParameter("window", windowId);
+        xmlDocument.setParameter("tab", strTab);
+        xmlDocument.setParameter("language", "defaultLang=\""
+                + vars.getLanguage() + "\";");
+        xmlDocument.setParameter("question", Utility.messageBD(this,
+                "StartProcess?", vars.getLanguage()));
+        xmlDocument.setParameter("directory", "var baseDirectory = \""
+                + strReplaceWith + "/\";\n");
+        xmlDocument.setParameter("theme", vars.getTheme());
+        xmlDocument.setParameter("description", strDescription);
+        xmlDocument.setParameter("help", strHelp);
+        response.setContentType("text/html");
+        PrintWriter out = response.getWriter();
+        out.println(xmlDocument.print());
+        out.close();
+    }
+
+    public String getServletInfo() {
+        return "Servlet Copy from order";
+    } // end of the getServletInfo() method
 }
--- a/src/org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement.java	Tue Dec 23 20:16:42 2008 +0000
@@ -15,7 +15,7 @@
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
-*/
+ */
 package org.openbravo.erpCommon.ad_actionButton;
 
 import org.openbravo.erpCommon.utility.*;
@@ -27,220 +27,302 @@
 import javax.servlet.*;
 import javax.servlet.http.*;
 
-
 // imports for transactions
 import java.sql.Connection;
 
 public class CopyFromSettlement extends HttpSecureAppServlet {
-  private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-  public void init (ServletConfig config) {
-    super.init(config);
-    boolHist = false;
-  }
+    public void init(ServletConfig config) {
+        super.init(config);
+        boolHist = false;
+    }
 
-  public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
-    VariablesSecureApp vars = new VariablesSecureApp(request);
+    public void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws IOException, ServletException {
+        VariablesSecureApp vars = new VariablesSecureApp(request);
 
-    if (vars.commandIn("DEFAULT")) {
-      vars.getGlobalVariable("inpProcessId", "CopyFromSettlement|AD_Process_ID");
-      vars.getGlobalVariable("inpwindowId", "CopyFromSettlement|Window_ID");
-      vars.getGlobalVariable("inpTabId", "CopyFromSettlement|Tab_ID");
-      String strSettlement = vars.getRequiredGlobalVariable("inpcSettlementId", "CopyFromSettlement|C_Settlement_ID");
-      log4j.warn("***************  strSettlement - " + strSettlement);
-      printPage(response, vars);
-    } else if (vars.commandIn("FIND")) {
-      String strDateFrom = vars.getStringParameter("inpDateFrom");
-      String strDateTo = vars.getStringParameter("inpDateTo");
-      String strDocumentNo = vars.getStringParameter("inpDocumentNo");
-      String strDescription = vars.getStringParameter("inpDescription");
-      String strSettlement = vars.getGlobalVariable("inpcSettlementId", "CopyFromSettlement|C_Settlement_ID");
-      String strWindow = vars.getStringParameter("inpwindowId");
-      printPage(response, vars, strDescription, strDocumentNo, strDateFrom, strDateTo, strSettlement, strWindow);
-    } else if (vars.commandIn("FIND2")) {
-      String strSettlement = vars.getGlobalVariable("inpcSettlementId", "CopyFromSettlement|C_Settlement_ID");
-      String strSettlementFrom = vars.getStringParameter("inpcSettlementFromFrame4");
-      String strWindow = vars.getStringParameter("inpwindowId");
-      printPage(response, vars, strSettlement, strSettlementFrom, strWindow);
-    } else if (vars.commandIn("SAVE")) {
-      vars.getGlobalVariable("inpProcessId", "CopyFromSettlement|AD_Process_ID");
-      vars.getGlobalVariable("inpwindowId", "CopyFromSettlement|Window_ID");
-      String strTab = vars.getGlobalVariable("inpTabId", "CopyFromSettlement|Tab_ID");
-      String strSettlement = vars.getRequestGlobalVariable("inpcSettlementId", "CopyFromSettlement|C_Settlement_ID");
-      String strKey= vars.getRequestGlobalVariable("inpcSettlementFromId", "CopyFromSettlement|C_SettlementFrom_ID");
-      ActionButtonDefaultData[] tab = ActionButtonDefaultData.windowName(this, strTab);
-      String strWindowPath="", strTabName="";
-      if (tab!=null && tab.length!=0) {
-        strTabName = FormatUtilities.replace(tab[0].name);
-        strWindowPath = "../" + FormatUtilities.replace(tab[0].description) + "/" + strTabName + "_Relation.html";
-      } else strWindowPath = strDefaultServlet;
+        if (vars.commandIn("DEFAULT")) {
+            vars.getGlobalVariable("inpProcessId",
+                    "CopyFromSettlement|AD_Process_ID");
+            vars.getGlobalVariable("inpwindowId",
+                    "CopyFromSettlement|Window_ID");
+            vars.getGlobalVariable("inpTabId", "CopyFromSettlement|Tab_ID");
+            String strSettlement = vars.getRequiredGlobalVariable(
+                    "inpcSettlementId", "CopyFromSettlement|C_Settlement_ID");
+            log4j.warn("***************  strSettlement - " + strSettlement);
+            printPage(response, vars);
+        } else if (vars.commandIn("FIND")) {
+            String strDateFrom = vars.getStringParameter("inpDateFrom");
+            String strDateTo = vars.getStringParameter("inpDateTo");
+            String strDocumentNo = vars.getStringParameter("inpDocumentNo");
+            String strDescription = vars.getStringParameter("inpDescription");
+            String strSettlement = vars.getGlobalVariable("inpcSettlementId",
+                    "CopyFromSettlement|C_Settlement_ID");
+            String strWindow = vars.getStringParameter("inpwindowId");
+            printPage(response, vars, strDescription, strDocumentNo,
+                    strDateFrom, strDateTo, strSettlement, strWindow);
+        } else if (vars.commandIn("FIND2")) {
+            String strSettlement = vars.getGlobalVariable("inpcSettlementId",
+                    "CopyFromSettlement|C_Settlement_ID");
+            String strSettlementFrom = vars
+                    .getStringParameter("inpcSettlementFromFrame4");
+            String strWindow = vars.getStringParameter("inpwindowId");
+            printPage(response, vars, strSettlement, strSettlementFrom,
+                    strWindow);
+        } else if (vars.commandIn("SAVE")) {
+            vars.getGlobalVariable("inpProcessId",
+                    "CopyFromSettlement|AD_Process_ID");
+            vars.getGlobalVariable("inpwindowId",
+                    "CopyFromSettlement|Window_ID");
+            String strTab = vars.getGlobalVariable("inpTabId",
+                    "CopyFromSettlement|Tab_ID");
+            String strSettlement = vars.getRequestGlobalVariable(
+                    "inpcSettlementId", "CopyFromSettlement|C_Settlement_ID");
+            String strKey = vars.getRequestGlobalVariable(
+                    "inpcSettlementFromId",
+                    "CopyFromSettlement|C_SettlementFrom_ID");
+            ActionButtonDefaultData[] tab = ActionButtonDefaultData.windowName(
+                    this, strTab);
+            String strWindowPath = "", strTabName = "";
+            if (tab != null && tab.length != 0) {
+                strTabName = FormatUtilities.replace(tab[0].name);
+                strWindowPath = "../"
+                        + FormatUtilities.replace(tab[0].description) + "/"
+                        + strTabName + "_Relation.html";
+            } else
+                strWindowPath = strDefaultServlet;
 
-      OBError myError = processButton(vars, strSettlement, strKey);
-      if (log4j.isDebugEnabled()) log4j.debug(myError.getMessage());
-      vars.setMessage(strTab,myError);
-      log4j.warn("********** strWindowPath - " + strWindowPath);
-      printPageClosePopUp(response, vars, strWindowPath);
-    } else pageErrorPopUp(response);
-  }
+            OBError myError = processButton(vars, strSettlement, strKey);
+            if (log4j.isDebugEnabled())
+                log4j.debug(myError.getMessage());
+            vars.setMessage(strTab, myError);
+            log4j.warn("********** strWindowPath - " + strWindowPath);
+            printPageClosePopUp(response, vars, strWindowPath);
+        } else
+            pageErrorPopUp(response);
+    }
 
+    OBError processButton(VariablesSecureApp vars, String strSettlement,
+            String strKey) {
+        OBError myError = null;
+        int i = 0;
+        Connection conn = null;
 
-  OBError processButton(VariablesSecureApp vars, String strSettlement, String strKey) {
-    OBError myError = null;
-    int i=0;
-    Connection conn = null;
-    
-    String strDebtPayment = "";
-    String strDebtPaymentBalancing = "";
-    String strCBPartnerId = "";
-    String strDate = "";
-    String strDebe = "";
-    String strHaber = "";
-    String strImporte = "";
-    try {
-      conn = getTransactionConnection();
-      CopyFromSettlementData [] data = CopyFromSettlementData.select(this, strKey);
-      CopyFromSettlementData [] to = CopyFromSettlementData.selectSettlement(this, strSettlement);
-      for (i = 0;data!=null && i<data.length;i++){
-        CopyFromSettlementData [] data1 =CopyFromSettlementData.selectDebtPaymentBalancing(this, data[i].cDebtPaymentId);
-        strDebtPayment = SequenceIdData.getUUID();
-        strCBPartnerId = vars.getStringParameter("inpcBpartnerId"+data[i].cDebtPaymentId);
-        strDate = vars.getStringParameter("inpDate"+data[i].cDebtPaymentId);
-        strImporte = vars.getStringParameter("inpAmount"+data[i].cDebtPaymentId);
+        String strDebtPayment = "";
+        String strDebtPaymentBalancing = "";
+        String strCBPartnerId = "";
+        String strDate = "";
+        String strDebe = "";
+        String strHaber = "";
+        String strImporte = "";
         try {
-          CopyFromSettlementData.insertDebtPayment(conn,this, strDebtPayment, to[0].client, to[0].org, vars.getUser(), data[i].isreceipt, strSettlement, data[i].description, strCBPartnerId, data[i].cCurrencyId, data[i].cBankaccountId, data[i].cCashbookId, data[i].paymentrule, strImporte, data[i].writeoffamt, strDate, data[i].ismanual, data[i].cGlitemId, data[i].isdirectposting, data[i].status);
-        } catch(ServletException ex) {
-          myError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
-          releaseRollbackConnection(conn);
-          return myError;
+            conn = getTransactionConnection();
+            CopyFromSettlementData[] data = CopyFromSettlementData.select(this,
+                    strKey);
+            CopyFromSettlementData[] to = CopyFromSettlementData
+                    .selectSettlement(this, strSettlement);
+            for (i = 0; data != null && i < data.length; i++) {
+                CopyFromSettlementData[] data1 = CopyFromSettlementData
+                        .selectDebtPaymentBalancing(this,
+                                data[i].cDebtPaymentId);
+                strDebtPayment = SequenceIdData.getUUID();
+                strCBPartnerId = vars.getStringParameter("inpcBpartnerId"
+                        + data[i].cDebtPaymentId);
+                strDate = vars.getStringParameter("inpDate"
+                        + data[i].cDebtPaymentId);
+                strImporte = vars.getStringParameter("inpAmount"
+                        + data[i].cDebtPaymentId);
+                try {
+                    CopyFromSettlementData.insertDebtPayment(conn, this,
+                            strDebtPayment, to[0].client, to[0].org, vars
+                                    .getUser(), data[i].isreceipt,
+                            strSettlement, data[i].description, strCBPartnerId,
+                            data[i].cCurrencyId, data[i].cBankaccountId,
+                            data[i].cCashbookId, data[i].paymentrule,
+                            strImporte, data[i].writeoffamt, strDate,
+                            data[i].ismanual, data[i].cGlitemId,
+                            data[i].isdirectposting, data[i].status);
+                } catch (ServletException ex) {
+                    myError = Utility.translateError(this, vars, vars
+                            .getLanguage(), ex.getMessage());
+                    releaseRollbackConnection(conn);
+                    return myError;
+                }
+                for (int j = 0; j < data1.length; j++) {
+                    strDebe = vars.getStringParameter("inpDebe"
+                            + data1[j].cDebtPaymentBalancingId);
+                    strHaber = vars.getStringParameter("inpHaber"
+                            + data1[j].cDebtPaymentBalancingId);
+                    strDebtPaymentBalancing = SequenceIdData.getUUID();
+                    try {
+                        CopyFromSettlementData.insert(conn, this,
+                                strDebtPaymentBalancing, to[0].client,
+                                to[0].org, vars.getUser(), strDebtPayment,
+                                strDebe, strHaber, data1[j].cGlitemId);
+                    } catch (ServletException ex) {
+                        myError = Utility.translateError(this, vars, vars
+                                .getLanguage(), ex.getMessage());
+                        releaseRollbackConnection(conn);
+                        return myError;
+                    }
+                }
+            }
+            releaseCommitConnection(conn);
+            myError = new OBError();
+            myError.setType("Success");
+            myError.setTitle(Utility.messageBD(this, "Success", vars
+                    .getLanguage()));
+            myError.setMessage(Utility.messageBD(this, "RecordsCopied", vars
+                    .getLanguage())
+                    + i);
+        } catch (Exception e) {
+            try {
+                releaseRollbackConnection(conn);
+            } catch (Exception ignored) {
+            }
+            e.printStackTrace();
+            log4j.warn("Rollback in transaction");
+            myError = Utility.translateError(this, vars, vars.getLanguage(),
+                    "ProcessRunError");
         }
-        for (int j=0;j<data1.length;j++){
-          strDebe = vars.getStringParameter("inpDebe"+data1[j].cDebtPaymentBalancingId);
-          strHaber = vars.getStringParameter("inpHaber"+data1[j].cDebtPaymentBalancingId);
-          strDebtPaymentBalancing = SequenceIdData.getUUID();
-          try {
-            CopyFromSettlementData.insert(conn,this, strDebtPaymentBalancing, to[0].client, to[0].org, vars.getUser(),strDebtPayment, strDebe, strHaber, data1[j].cGlitemId);
-          } catch(ServletException ex) {
-            myError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
-            releaseRollbackConnection(conn);
-            return myError;
-          }
-        }
-      }
-      releaseCommitConnection(conn);
-      myError = new OBError();
-      myError.setType("Success");
-      myError.setTitle(Utility.messageBD(this, "Success", vars.getLanguage()));
-      myError.setMessage(Utility.messageBD(this, "RecordsCopied", vars.getLanguage()) + i);
-    } catch (Exception e) {
-      try {
-        releaseRollbackConnection(conn);
-      } catch (Exception ignored) {}
-      e.printStackTrace();
-      log4j.warn("Rollback in transaction");
-      myError = Utility.translateError(this, vars, vars.getLanguage(), "ProcessRunError");
+        return myError;
     }
-    return myError;
-  }
 
-  void printPage(HttpServletResponse response, VariablesSecureApp vars) throws IOException, ServletException {
-    if (log4j.isDebugEnabled()) log4j.debug("Output: Button process Copy from Settlement");
-    
-    String[] discard = {"sectionDetail","sectionDetail2"};
-    
-    XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement",discard).createXmlDocument();
-    
-    String strDateFormat = vars.getSessionValue("#AD_SqlDateFormat");
-    
-    xmlDocument.setParameter("dateFromdisplayFormat", strDateFormat);
-    xmlDocument.setParameter("dateFromsaveFormat", strDateFormat);
-    xmlDocument.setParameter("dateTodisplayFormat", strDateFormat);
-    xmlDocument.setParameter("dateTosaveFormat", strDateFormat);
-    xmlDocument.setParameter("dateFrom","");
-    xmlDocument.setParameter("dateTo","");
-    xmlDocument.setParameter("calendar", vars.getLanguage().substring(0,2));
-    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
-    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
-    xmlDocument.setParameter("theme", vars.getTheme());
-    response.setContentType("text/html; charset=UTF-8");
-    PrintWriter out = response.getWriter();
-    out.println(xmlDocument.print());
-    out.close();
-  }
+    void printPage(HttpServletResponse response, VariablesSecureApp vars)
+            throws IOException, ServletException {
+        if (log4j.isDebugEnabled())
+            log4j.debug("Output: Button process Copy from Settlement");
 
-  void printPage(HttpServletResponse response, VariablesSecureApp vars, String strSetDescription, String strDocumentNo, String strDateFrom, String strDateTo, String strSettlement, String strWindow) throws IOException, ServletException {
-    if (log4j.isDebugEnabled()) log4j.debug("Output: Button process Copy from Settlement");
-    
-    String[] discard = {"",""};
-    CopyFromSettlementData [] data = CopyFromSettlementData.selectRelation(this, "%"+strSetDescription+"%","%"+strDocumentNo+"%", Utility.getContext(this, vars, "#User_Org", strWindow), Utility.getContext(this, vars, "#User_Client", strWindow), strDateFrom, strDateTo);
-    
-    if(data == null || data.length == 0) discard[0] = new String("sectionDetail");
-    discard[1] = new String("sectionDetail2");
-    
-    XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement", discard).createXmlDocument();
-    String strDateFormat = vars.getSessionValue("#AD_SqlDateFormat");
-    xmlDocument.setParameter("dateFrom", strDateFrom);     
-    xmlDocument.setParameter("dateFromdisplayFormat", strDateFormat);
-    xmlDocument.setParameter("dateFromsaveFormat", strDateFormat);
-    xmlDocument.setParameter("dateTo", strDateTo);    
-    xmlDocument.setParameter("dateTodisplayFormat", strDateFormat);
-    xmlDocument.setParameter("dateTosaveFormat", strDateFormat);
-    xmlDocument.setParameter("calendar", vars.getLanguage().substring(0,2));
-    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
-    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
-    xmlDocument.setParameter("theme", vars.getTheme());
-    xmlDocument.setParameter("paramSettlement", strSettlement);
-    xmlDocument.setParameter("documentNo", strDocumentNo);  
-    xmlDocument.setData("structure", data);
-    response.setContentType("text/html; charset=UTF-8");
-    PrintWriter out = response.getWriter();
-    out.println(xmlDocument.print());
-    out.close();
-  }
-  
-  void printPage(HttpServletResponse response, VariablesSecureApp vars, String strSettlement, String strSettlementFrom, String strWindow) throws IOException, ServletException {
-    
-    String strDateFrom = vars.getStringParameter("inpDateFrom");
-    String strDateTo = vars.getStringParameter("inpDateTo");
-    String strDocumentNo = vars.getStringParameter("inpDocumentNo");
-    String strDescription = vars.getStringParameter("inpDescription");
-    String strDateFormat = vars.getSessionValue("#AD_SqlDateFormat");
-    
-    String[] discard = {"",""};
-    
-    CopyFromSettlementData [] data = CopyFromSettlementData.selectRelation(this, "%"+strDescription+"%","%"+strDocumentNo+"%", Utility.getContext(this, vars, "#User_Org", strWindow), Utility.getContext(this, vars, "#User_Client", strWindow), strDateFrom, strDateTo);
-    
-    if(data == null || data.length == 0) discard[0] = new String("sectionDetail");    
-    
-    CopyFromSettlementData [] data2 = CopyFromSettlementData.selectDebtPaymentBalancingF4(this, strDateFormat, vars.getLanguage(), strSettlementFrom);
-    
-    if(data2 == null || data2.length == 0) discard[1] = new String("sectionDetail2");
-    
-    XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement",discard).createXmlDocument();
-    
-    xmlDocument.setParameter("dateFrom", strDateFrom);     
-    xmlDocument.setParameter("dateFromdisplayFormat", strDateFormat);
-    xmlDocument.setParameter("dateFromsaveFormat", strDateFormat);
-    xmlDocument.setParameter("dateTo", strDateTo);    
-    xmlDocument.setParameter("dateTodisplayFormat", strDateFormat);
-    xmlDocument.setParameter("dateTosaveFormat", strDateFormat);
-    xmlDocument.setParameter("calendar", vars.getLanguage().substring(0,2));
-    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
-    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
-    xmlDocument.setParameter("theme", vars.getTheme());
-    xmlDocument.setParameter("paramSettlement", strSettlement);
-    xmlDocument.setParameter("paramSettlementId", strSettlement);
-    xmlDocument.setParameter("paramSettlementFromId", strSettlementFrom);
-    xmlDocument.setParameter("documentNo", strDocumentNo); 
-    xmlDocument.setData("structure", data);
-    xmlDocument.setData("structure2", data2);
-    response.setContentType("text/html");
-    PrintWriter out = response.getWriter();
-    out.println(xmlDocument.print());
-    out.close();
-  }
+        String[] discard = { "sectionDetail", "sectionDetail2" };
 
-  public String getServletInfo() {
-    return "Servlet Copy from settlement";
-  } // end of getServletInfo() method
+        XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+                "org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement",
+                discard).createXmlDocument();
+
+        String strDateFormat = vars.getSessionValue("#AD_SqlDateFormat");
+
+        xmlDocument.setParameter("dateFromdisplayFormat", strDateFormat);
+        xmlDocument.setParameter("dateFromsaveFormat", strDateFormat);
+        xmlDocument.setParameter("dateTodisplayFormat", strDateFormat);
+        xmlDocument.setParameter("dateTosaveFormat", strDateFormat);
+        xmlDocument.setParameter("dateFrom", "");
+        xmlDocument.setParameter("dateTo", "");
+        xmlDocument
+                .setParameter("calendar", vars.getLanguage().substring(0, 2));
+        xmlDocument.setParameter("language", "defaultLang=\""
+                + vars.getLanguage() + "\";");
+        xmlDocument.setParameter("directory", "var baseDirectory = \""
+                + strReplaceWith + "/\";\n");
+        xmlDocument.setParameter("theme", vars.getTheme());
+        response.setContentType("text/html; charset=UTF-8");
+        PrintWriter out = response.getWriter();
+        out.println(xmlDocument.print());
+        out.close();
+    }
+
+    void printPage(HttpServletResponse response, VariablesSecureApp vars,
+            String strSetDescription, String strDocumentNo, String strDateFrom,
+            String strDateTo, String strSettlement, String strWindow)
+            throws IOException, ServletException {
+        if (log4j.isDebugEnabled())
+            log4j.debug("Output: Button process Copy from Settlement");
+
+        String[] discard = { "", "" };
+        CopyFromSettlementData[] data = CopyFromSettlementData.selectRelation(
+                this, "%" + strSetDescription + "%", "%" + strDocumentNo + "%",
+                Utility.getContext(this, vars, "#User_Org", strWindow), Utility
+                        .getContext(this, vars, "#User_Client", strWindow),
+                strDateFrom, strDateTo);
+
+        if (data == null || data.length == 0)
+            discard[0] = new String("sectionDetail");
+        discard[1] = new String("sectionDetail2");
+
+        XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+                "org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement",
+                discard).createXmlDocument();
+        String strDateFormat = vars.getSessionValue("#AD_SqlDateFormat");
+        xmlDocument.setParameter("dateFrom", strDateFrom);
+        xmlDocument.setParameter("dateFromdisplayFormat", strDateFormat);
+        xmlDocument.setParameter("dateFromsaveFormat", strDateFormat);
+        xmlDocument.setParameter("dateTo", strDateTo);
+        xmlDocument.setParameter("dateTodisplayFormat", strDateFormat);
+        xmlDocument.setParameter("dateTosaveFormat", strDateFormat);
+        xmlDocument
+                .setParameter("calendar", vars.getLanguage().substring(0, 2));
+        xmlDocument.setParameter("language", "defaultLang=\""
+                + vars.getLanguage() + "\";");
+        xmlDocument.setParameter("directory", "var baseDirectory = \""
+                + strReplaceWith + "/\";\n");
+        xmlDocument.setParameter("theme", vars.getTheme());
+        xmlDocument.setParameter("paramSettlement", strSettlement);
+        xmlDocument.setParameter("documentNo", strDocumentNo);
+        xmlDocument.setData("structure", data);
+        response.setContentType("text/html; charset=UTF-8");
+        PrintWriter out = response.getWriter();
+        out.println(xmlDocument.print());
+        out.close();
+    }
+
+    void printPage(HttpServletResponse response, VariablesSecureApp vars,
+            String strSettlement, String strSettlementFrom, String strWindow)
+            throws IOException, ServletException {
+
+        String strDateFrom = vars.getStringParameter("inpDateFrom");
+        String strDateTo = vars.getStringParameter("inpDateTo");
+        String strDocumentNo = vars.getStringParameter("inpDocumentNo");
+        String strDescription = vars.getStringParameter("inpDescription");
+        String strDateFormat = vars.getSessionValue("#AD_SqlDateFormat");
+
+        String[] discard = { "", "" };
+
+        CopyFromSettlementData[] data = CopyFromSettlementData.selectRelation(
+                this, "%" + strDescription + "%", "%" + strDocumentNo + "%",
+                Utility.getContext(this, vars, "#User_Org", strWindow), Utility
+                        .getContext(this, vars, "#User_Client", strWindow),
+                strDateFrom, strDateTo);
+
+        if (data == null || data.length == 0)
+            discard[0] = new String("sectionDetail");
+
+        CopyFromSettlementData[] data2 = CopyFromSettlementData
+                .selectDebtPaymentBalancingF4(this, strDateFormat, vars
+                        .getLanguage(), strSettlementFrom);
+
+        if (data2 == null || data2.length == 0)
+            discard[1] = new String("sectionDetail2");
+
+        XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+                "org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement",
+                discard).createXmlDocument();
+
+        xmlDocument.setParameter("dateFrom", strDateFrom);
+        xmlDocument.setParameter("dateFromdisplayFormat", strDateFormat);
+        xmlDocument.setParameter("dateFromsaveFormat", strDateFormat);
+        xmlDocument.setParameter("dateTo", strDateTo);
+        xmlDocument.setParameter("dateTodisplayFormat", strDateFormat);
+        xmlDocument.setParameter("dateTosaveFormat", strDateFormat);
+        xmlDocument
+                .setParameter("calendar", vars.getLanguage().substring(0, 2));
+        xmlDocument.setParameter("language", "defaultLang=\""
+                + vars.getLanguage() + "\";");
+        xmlDocument.setParameter("directory", "var baseDirectory = \""
+                + strReplaceWith + "/\";\n");
+        xmlDocument.setParameter("theme", vars.getTheme());
+        xmlDocument.setParameter("paramSettlement", strSettlement);
+        xmlDocument.setParameter("paramSettlementId", strSettlement);
+        xmlDocument.setParameter("paramSettlementFromId", strSettlementFrom);
+        xmlDocument.setParameter("documentNo", strDocumentNo);
+        xmlDocument.setData("structure", data);
+        xmlDocument.setData("structure2", data2);
+        response.setContentType("text/html");
+        PrintWriter out = response.getWriter();
+        out.println(xmlDocument.print());
+        out.close();
+    }
+
+    public String getServletInfo() {
+        return "Servlet Copy from settlement";
+    } // end of getServletInfo() method
 }
-
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFile.java	Tue Dec 23 20:07:34 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFile.java	Tue Dec 23 20:16:42 2008 +0000
@@ -15,7 +15,7 @@
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
-*/
+ */
 package org.openbravo.erpCommon.ad_actionButton;
 
 import org.openbravo.erpCommon.ad_combos.*;
@@ -29,552 +29,820 @@
 import javax.servlet.*;
 import javax.servlet.http.*;
 
+public class CreateFile extends HttpSecureAppServlet {
+    private static final long serialVersionUID = 1L;
 
-public class CreateFile extends HttpSecureAppServlet {
-  private static final long serialVersionUID = 1L;
-
-  public void init (ServletConfig config) {
-    super.init(config);
-    boolHist = false;
-  }
-
-  public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
-    VariablesSecureApp vars = new VariablesSecureApp(request);
-
-    if (vars.commandIn("DEFAULT")) {
-      String strProcessId = vars.getStringParameter("inpProcessId");
-      String strWindow = vars.getStringParameter("inpwindowId");
-      String strKey = vars.getStringParameter("inpcRemittanceId");
-      String strMessage = "";
-      printPage(response, vars, strKey, strWindow, strProcessId, strMessage, true);
-    } else if(vars.commandIn("GENERATE")){
-      String strKey = vars.getStringParameter("inpcRemittanceId");
-      getPrintPage(response, vars, strKey);
-    }
-  }
-
-
-  void printPage(HttpServletResponse response, VariablesSecureApp vars, String strKey, String windowId, String strProcessId, String strMessage, boolean isDefault)
-    throws IOException, ServletException {
-      if (log4j.isDebugEnabled()) log4j.debug("Output: Button create file msg:"+strMessage);
-
-      ActionButtonDefaultData[] data = null;
-      String strHelp="", strDescription="";
-      if (vars.getLanguage().equals("en_US")) data = ActionButtonDefaultData.select(this, strProcessId);
-      else data = ActionButtonDefaultData.selectLanguage(this, vars.getLanguage(), strProcessId);
-
-      if (data!=null && data.length!=0) {
-        strDescription = data[0].description;
-        strHelp = data[0].help;
-      }
-      String[] discard = {""};
-      if (strHelp.equals("")) discard[0] = new String("helpDiscard");
-      XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_actionButton/CreateFile", discard).createXmlDocument();
-      xmlDocument.setParameter("key", strKey);
-      xmlDocument.setParameter("window", windowId);
-      xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
-      xmlDocument.setData("reportTyperemittance","liststructure", TyperemittanceComboData.select(this, Utility.getContext(this, vars, "#User_Client", "CreateFile"), Utility.getContext(this, vars, "#User_Org", "CreateFile")));
-      xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\r\n");
-      xmlDocument.setParameter("theme", vars.getTheme());
-      xmlDocument.setParameter("description", strDescription);
-      xmlDocument.setParameter("help", strHelp);
-      
-      if(isDefault){
-        xmlDocument.setParameter("messageType", "");
-        xmlDocument.setParameter("messageTitle", "");
-        xmlDocument.setParameter("messageMessage", "");
-      }else{
-        OBError myMessage = new OBError();
-        myMessage.setTitle("");
-        if(log4j.isDebugEnabled()) log4j.debug("CreateFile - before setMessage");
-        if(strMessage==null || strMessage.equals("")) myMessage.setType("Success");
-        else myMessage.setType("Error");
-        if(strMessage!=null && !strMessage.equals("")) {
-          myMessage.setMessage(strMessage);
-        } else Utility.translateError(this, vars, vars.getLanguage(), "Success");
-        if(log4j.isDebugEnabled()) log4j.debug("CreateFile - Message Type: " + myMessage.getType());
-        vars.setMessage("CreateFile", myMessage);
-        if(log4j.isDebugEnabled()) log4j.debug("CreateFile - after setMessage");
-        if (myMessage!=null) {
-          xmlDocument.setParameter("messageType", myMessage.getType());
-          xmlDocument.setParameter("messageTitle", myMessage.getTitle());
-          xmlDocument.setParameter("messageMessage", myMessage.getMessage());
-        }
-      }
-      
-      
-      response.setContentType("text/html; charset=UTF-8");
-      PrintWriter out = response.getWriter();
-      out.println(xmlDocument.print());
-      out.close();
+    public void init(ServletConfig config) {
+        super.init(config);
+        boolHist = false;
     }
 
-  void getPrintPage(HttpServletResponse response, VariablesSecureApp vars, String strKey) throws IOException, ServletException {
-    if (log4j.isDebugEnabled()) log4j.debug("generate "+strKey);
-    String strCuaderno = CreateFileData.selectParam(this,strKey,"CUADERNO");
-    String strContract = CreateFileData.selectParam(this,strKey,"CONTRACT");
-    if (strCuaderno==null) strCuaderno = "";
+    public void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws IOException, ServletException {
+        VariablesSecureApp vars = new VariablesSecureApp(request);
 
-    if (strCuaderno.equals("58")) printPageFind58(response, vars, strKey, strContract);
-    else if (strCuaderno.equals("19")) printPageFind19(response, vars, strKey, strContract);
-    else if (strCuaderno.equals("34")) printPageFind34(response, vars, strKey);
-    else advisePopUp(response, "Error", 
-    		                   Utility.messageBD(this, "Error", vars.getLanguage()), 
-    		                   Utility.messageBD(this, "RemittanceTypeError", vars.getLanguage()));
-  }
-
-  void printPageFind58(HttpServletResponse response, VariablesSecureApp vars, String strKey, String strContract) throws IOException, ServletException {
-    if (log4j.isDebugEnabled()) log4j.debug("Output: pageFind");
-    StringBuffer strBuf = new StringBuffer();
-    String strMessage = "";
-    CreateFileData[] Principio = CreateFileData.select(this, strKey);
-    CreateFileData[] Lineas = CreateFileData.selectLineas(this,strKey);
-    CreateFileData[] Total = CreateFileData.selectTotal(this,strKey);
-    int comprobacion1 = new Integer(CreateFileData.selectComprobacion1(this, strKey)).intValue();
-    int comprobacion2 = new Integer(CreateFileData.selectComprobacion2(this, strKey)).intValue();
-    int comprobacion3 = new Integer(CreateFileData.selectComprobacion3(this, strKey)).intValue();
-    int comprobacion4 = new Integer(CreateFileData.selectComprobacion4(this, strKey)).intValue();
-    CreateFileData[]comprobacion5=CreateFileData.selectComprobacion5(this, strKey);
-    if (log4j.isDebugEnabled()) log4j.debug(" c1:"+comprobacion1+" c2:"+comprobacion2+" c3:"+comprobacion3+" c4:"+comprobacion4+" c5:"+comprobacion5.length);
-
-    for (int i=0;i<comprobacion5.length;i++){ 
-    	strMessage=strMessage+comprobacion5[i].bpname+ " "+Utility.messageBD(this,"CodeBankBPErrorMultiple",vars.getLanguage())+"<br />";
-    }   
-    if (!strMessage.equals("")){
-          printPage(response, vars, strKey, "", "", strMessage, false);
-    }
-    
-    if(comprobacion1 != 0 || comprobacion2 == 0 || comprobacion3 !=1 || comprobacion4 == 0){
-    strMessage = Utility.messageBD(this, "CreateFileError", vars.getLanguage());
-    printPage(response, vars, strKey, "", "", strMessage, false);
-    }
-    int contador = 2;
-    // dubugging headers
-    if (Principio == null || Principio.length == 0){
-        strMessage = Utility.messageBD(this, "DefaultAccountError", vars.getLanguage());
-        printPage(response, vars, strKey, "", "", strMessage, false);
-		return;
-    }
-    if (Lineas == null || Total == null)return;
-    if (Principio[0].nif == null || Principio[0].nif.equals("")){
-        strMessage = Utility.messageBD(this, "NIFError", vars.getLanguage());
-    }
-    if (Principio[0].codebank == null || Principio[0].codebank.equals("")){
-        strMessage = Utility.messageBD(this, "CodeBankError", vars.getLanguage());
-    }
-    if (Principio[0].codebranch == null || Principio[0].codebranch.equals("")){
-        strMessage = Utility.messageBD(this, "CodeBranchError", vars.getLanguage());
-    }
-    if (Principio[0].digitcontrol1 == null || Principio[0].digitcontrol1.equals("")){
-        strMessage = Utility.messageBD(this, "DC1Error", vars.getLanguage());
-    }
-    if (Principio[0].digitcontrol2 == null || Principio[0].digitcontrol2.equals("")){
-        strMessage = Utility.messageBD(this, "DC2Error", vars.getLanguage());
-    }
-    if (Principio[0].ine == null || Principio[0].ine.equals("")){
-        strMessage = Utility.messageBD(this, "INEError", vars.getLanguage());
-    }
-    // presentation header
-    strBuf = strBuf.append("5170").append(Principio[0].nif).append(strContract).append(Principio[0].dateplanned);
-    strBuf = strBuf.append(Principio[0].entidad);
-    strBuf = strBuf.append(Principio[0].entofi).append("\r\n");
-    // ordering header
-    strBuf = strBuf.append("5370").append(Principio[0].nif).append(strContract).append(Principio[0].dateplanned);
-    strBuf = strBuf.append(Principio[0].entidad).append(Principio[0].nCuenta).append("        06");
-    strBuf = strBuf.append(Principio[0].ine).append("   \r\n");
-    // lines
-    for (int i=0;i<Lineas.length;i++){
-        // debugging lines
-        if (Lineas[i].creditcardnumber == null || Lineas[i].creditcardnumber.equals("")){
-            strMessage = Utility.messageBD(this, "CodeBankBPError", vars.getLanguage()) + Lineas[i].tercero;
+        if (vars.commandIn("DEFAULT")) {
+            String strProcessId = vars.getStringParameter("inpProcessId");
+            String strWindow = vars.getStringParameter("inpwindowId");
+            String strKey = vars.getStringParameter("inpcRemittanceId");
+            String strMessage = "";
+            printPage(response, vars, strKey, strWindow, strProcessId,
+                    strMessage, true);
+        } else if (vars.commandIn("GENERATE")) {
+            String strKey = vars.getStringParameter("inpcRemittanceId");
+            getPrintPage(response, vars, strKey);
         }
-        if (Lineas[i].fechaVencimiento == null || Lineas[i].fechaVencimiento.equals("")){
-            strMessage = Utility.messageBD(this, "DatePlannedError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].direccion == null || Lineas[i].direccion.equals("")){
-            strMessage = Utility.messageBD(this, "AddressError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].plaza == null || Lineas[i].plaza.equals("")){
-            strMessage = Utility.messageBD(this, "SquareError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].postal == null || Lineas[i].postal.equals("")){
-            strMessage = Utility.messageBD(this, "PostCodeError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].localidad == null || Lineas[i].localidad.equals("")){
-            strMessage = Utility.messageBD(this, "TownError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].fechaFactura == null || Lineas[i].fechaFactura.equals("")){
-            strMessage = Utility.messageBD(this, "InvoiceDateError", vars.getLanguage()) + Lineas[i].tercero;;
-        }
-        strBuf = strBuf.append("5670").append(Principio[0].nif).append(strContract).append(Lineas[i].nFactura).append(Lineas[i].tercero);
-        strBuf = strBuf.append(Lineas[i].creditcardnumber).append(Lineas[i].payamt).append("                ");
-        strBuf = strBuf.append(Replace.replace(Lineas[i].concepto,"\n", "")).append(Lineas[i].fechaVencimiento).append("  \r\n");
-        contador++;
-        strBuf = strBuf.append("5676").append(Principio[0].nif).append(strContract).append(Lineas[i].nFactura).append(Lineas[i].direccion);
-        strBuf = strBuf.append(Lineas[i].plaza).append(Lineas[i].postal).append(Lineas[i].localidad);
-        strBuf = strBuf.append(Lineas[i].codigoProvincia).append(Lineas[i].fechaFactura).append("\r\n");
-        contador++;
-    }
-    CreateFileData[] NLineas = CreateFileData.selectNLineas(this, String.valueOf(contador));
-    //total orderer
-    strBuf = strBuf.append("5870").append(Principio[0].nif).append(strContract).append(NLineas[0].hueco);
-    strBuf = strBuf.append(Total[0].payamt).append(Total[0].nFactura).append(NLineas[0].lineas).append("\r\n");
-    NLineas = CreateFileData.selectNLineas(this, String.valueOf(contador + 2));
-    //total
-    strBuf = strBuf.append("5970").append(Principio[0].nif).append(strContract);
-    strBuf = strBuf.append(NLineas[0].ordenantes).append(Total[0].payamt).append(Total[0].nFactura).append(NLineas[0].lineas);
-    if (!strMessage.equals("")){
-      printPage(response, vars, strKey, "", "", strMessage, false);
-    }else{
-      response.setContentType("application/rtf");
-      response.setHeader("Content-Disposition","attachment; filename=BANK.DAT");
-      PrintWriter out = response.getWriter();
-      out.println(strBuf.toString());
-      out.close();
-    }
-  }
-
-  void printPageFind19(HttpServletResponse response, VariablesSecureApp vars, String strKey, String strContract) throws IOException, ServletException {
-    if (log4j.isDebugEnabled()) log4j.debug("Output: pageFind");
-    StringBuffer strBuf = new StringBuffer();
-    String strMessage = "";
-    CreateFileData[] Principio = CreateFileData.select(this, strKey);
-    CreateFileData[] Lineas = CreateFileData.selectLineas(this,strKey);
-    CreateFileData[] Total = CreateFileData.selectTotal(this,strKey);
-
-    int comprobacion1 = new Integer(CreateFileData.selectComprobacion1(this, strKey)).intValue();
-	int comprobacion2 = new Integer(CreateFileData.selectComprobacion2(this, strKey)).intValue();
-	int comprobacion3 = new Integer(CreateFileData.selectComprobacion3(this, strKey)).intValue();
-	int comprobacion4 = new Integer(CreateFileData.selectComprobacion4(this, strKey)).intValue();
-	CreateFileData[]comprobacion5=CreateFileData.selectComprobacion5(this, strKey);
-    if (log4j.isDebugEnabled()) log4j.debug(" c1:"+comprobacion1+" c2:"+comprobacion2+" c3:"+comprobacion3+" c4:"+comprobacion4+" c5:"+comprobacion5.length);
-
-    for (int i=0;i<comprobacion5.length;i++){ 
-    	strMessage=strMessage+comprobacion5[i].bpname+ " "+Utility.messageBD(this,"CodeBankBPErrorMultiple",vars.getLanguage())+"<br />";
-    }   
-    if (!strMessage.equals("")){
-          printPage(response, vars, strKey, "", "", strMessage, false);
-    }
-    
-    if(comprobacion1 != 0 || comprobacion2 == 0 || comprobacion3 !=1 || comprobacion4 == 0){
-      if (log4j.isDebugEnabled()) log4j.debug("Error: c1:"+comprobacion1+" c2:"+comprobacion2+" c3:"+comprobacion3+" c4:"+comprobacion4);
-      strMessage = Utility.messageBD(this, "CreateFileError", vars.getLanguage());
-      printPage(response, vars, strKey, "", "", strMessage, false);
-    }
-    if (log4j.isDebugEnabled()) log4j.debug("check1 ok");
-    int contador = 2;
-    //debugging headers
-    if (Principio == null || Principio.length == 0){
-        strMessage = Utility.messageBD(this, "DefaultAccountError", vars.getLanguage());
-        printPage(response, vars, strKey, "", "", strMessage, false);
-		return;
-    }
-    if (Lineas == null || Total == null)return;
-    if (Principio[0].nif == null || Principio[0].nif.equals("")){
-        strMessage = Utility.messageBD(this, "NIFError", vars.getLanguage());
-        if (log4j.isDebugEnabled()) log4j.debug("NIF");
-    }
-    if (Principio[0].codebank == null || Principio[0].codebank.equals("")){
-        strMessage = Utility.messageBD(this, "CodeBankError", vars.getLanguage());
-        if (log4j.isDebugEnabled()) log4j.debug("codebank");
-    }
-    if (Principio[0].codebranch == null || Principio[0].codebranch.equals("")){
-        strMessage = Utility.messageBD(this, "CodeBranchError", vars.getLanguage());
-        if (log4j.isDebugEnabled()) log4j.debug("CodeBranchError");
-    }
-    if (Principio[0].digitcontrol1 == null || Principio[0].digitcontrol1.equals("")){
-        strMessage = Utility.messageBD(this, "DC1Error", vars.getLanguage());
-        if (log4j.isDebugEnabled()) log4j.debug("DC1Error");
-    }
-    if (Principio[0].digitcontrol2 == null || Principio[0].digitcontrol2.equals("")){
-        strMessage = Utility.messageBD(this, "DC2Error", vars.getLanguage());
-        if (log4j.isDebugEnabled()) log4j.debug("DC2Error");
-    }
-    if (log4j.isDebugEnabled()) log4j.debug("check2 ok");
-    //presentation header
-    strBuf = strBuf.append("5180").append(Principio[0].nif).append(strContract).append(Principio[0].hoy).append(Principio[0].dateplanned);
-    strBuf = strBuf.append(Principio[0].entidad19);
-    strBuf = strBuf.append(Principio[0].entofi).append("\r\n");
-    //ordering header
-    strBuf = strBuf.append("5380").append(Principio[0].nif).append(strContract).append(Principio[0].hoy).append(Principio[0].dateplanned);
-    strBuf = strBuf.append(Principio[0].entidad19).append(Principio[0].nCuenta).append("        01                                                             ");
-    strBuf = strBuf.append("   \r\n");
-    // Lines
-    for (int i=0;i<Lineas.length;i++){
-        //lines debugging
-        if (Lineas[i].creditcardnumber == null || Lineas[i].creditcardnumber.equals("")){
-            if (log4j.isDebugEnabled()) log4j.debug("CodeBankBPError");
-            strMessage = Utility.messageBD(this, "CodeBankBPError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].fechaVencimiento == null || Lineas[i].fechaVencimiento.equals("")){
-          if (log4j.isDebugEnabled()) log4j.debug("DatePlannedError");
-            strMessage = Utility.messageBD(this, "DatePlannedError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].direccion == null || Lineas[i].direccion.equals("")){
-          if (log4j.isDebugEnabled()) log4j.debug("AddressError");
-            strMessage = Utility.messageBD(this, "AddressError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].plaza == null || Lineas[i].plaza.equals("")){
-          if (log4j.isDebugEnabled()) log4j.debug("SquareError");
-            strMessage = Utility.messageBD(this, "SquareError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].postal == null || Lineas[i].postal.equals("")){
-          if (log4j.isDebugEnabled()) log4j.debug("PostCodeError");
-            strMessage = Utility.messageBD(this, "PostCodeError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].localidad == null || Lineas[i].localidad.equals("")){
-          if (log4j.isDebugEnabled()) log4j.debug("TownError");
-            strMessage = Utility.messageBD(this, "TownError", vars.getLanguage()) + Lineas[i].tercero;
-        }
-        if (Lineas[i].fechaFactura == null || Lineas[i].fechaFactura.equals("")){
-          if (log4j.isDebugEnabled()) log4j.debug("InvoiceDateError");
-            strMessage = Utility.messageBD(this, "InvoiceDateError", vars.getLanguage()) + Lineas[i].tercero;;
-        }
-        strBuf = strBuf.append("5680").append(Principio[0].nif).append(strContract).append(Lineas[i].nFactura19).append(Lineas[i].tercero);
-        strBuf = strBuf.append(Lineas[i].creditcardnumber).append(Lineas[i].payamt).append("0000000000000000");
-        strBuf = strBuf.append(Replace.replace(Lineas[i].concepto,"\n", "")).append(Lineas[i].fechaVencimiento).append("  \r\n");
-        contador++;
-/*        strBuf = strBuf.append("5676").append(Principio[0].nif).append("000").append(Lineas[i].nFactura).append(Lineas[i].direccion);
-        strBuf = strBuf.append(Lineas[i].plaza).append(Lineas[i].postal).append(Lineas[i].localidad);
-        strBuf = strBuf.append(Lineas[i].codigoProvincia).append(Lineas[i].fechaFactura).append("\r\n");
-        contador++;*/
-    }
-    if (log4j.isDebugEnabled()) log4j.debug("check3 ok");
-    CreateFileData[] NLineas = CreateFileData.selectNLineas(this, String.valueOf(contador));
-    //total orderer
-    strBuf = strBuf.append("5880").append(Principio[0].nif).append(strContract).append(NLineas[0].hueco);
-    strBuf = strBuf.append(Total[0].payamt).append(Total[0].nFactura).append(NLineas[0].lineas).append("\r\n");
-    NLineas = CreateFileData.selectNLineas(this, String.valueOf(contador + 2));
-    //total
-    strBuf = strBuf.append("5980").append(Principio[0].nif).append(strContract);
-    strBuf = strBuf.append(NLineas[0].ordenantes).append(Total[0].payamt).append(Total[0].nFactura).append(NLineas[0].lineas);
-    if (!strMessage.equals("")){
-      printPage(response, vars, strKey, "", "", strMessage, false);
-    }else{
-      response.setContentType("application/rtf");
-      response.setHeader("Content-Disposition","attachment; filename=BANK.DAT");
-      PrintWriter out = response.getWriter();
-      out.println(strBuf.toString());
-      out.close();
-    }
-  }
-
-
-
-  void printPageFind34(HttpServletResponse response, VariablesSecureApp vars, String strKey) throws IOException, ServletException {
-    if (log4j.isDebugEnabled()) log4j.debug("Output: pageFind34");
-    StringBuffer strBuf = new StringBuffer();
-    String strMessage = "";
-
-
-    String strConcepto = CreateFileData.selectParam(this,strKey,"CONCEPTO");
-    if (log4j.isDebugEnabled()) log4j.debug("Item"+strConcepto);
-    if (strConcepto == null||strConcepto.equals("")) strConcepto="N";
-    if (log4j.isDebugEnabled()) log4j.debug("Item"+strConcepto);
-    char cConcepto=strConcepto.charAt(0);
-
-    String strCodigo;
-
-    switch (cConcepto)
-    {
-      case 'C': //check
-        strCodigo = "57";
-        break;
-      case 'R': //promissory note
-        strCodigo = "58";
-        break;
-      case 'P': //certified payments
-        strCodigo = "59";
-        break;
-      default:  //Salaries y bank transfers
-        strCodigo = "56";
-    }
-    if (log4j.isDebugEnabled()) log4j.debug("code"+strCodigo);
-    /*
-      1->Orderer (by default)
-      2->Beneficiary
-    */
-    String strGastos = CreateFileData.selectParam(this,strKey,"GASTOS");
-    if (strGastos==null||!strGastos.equals("2")) strGastos="1";
-    if (log4j.isDebugEnabled()) log4j.debug("strGastos"+strGastos);
-
-    /*
-      0->Only one journal entry
-      1->One entry per beneficiary
-    */
-    String strDetalle = CreateFileData.selectParam(this,strKey,"DETALLE");
-    if (strDetalle==null||!strDetalle.equals("1")) strDetalle="0";
-    if (log4j.isDebugEnabled()) log4j.debug("code"+strDetalle);
-
-
-    CreateFile34Data[] Principio = CreateFile34Data.select(this, strKey);
-    CreateFile34Data[] Lineas = CreateFile34Data.selectLineas(this,strKey);
-    CreateFile34Data[] Total = CreateFile34Data.selectTotal(this,strKey);
-    int comprobacion1 = new Integer(CreateFileData.selectComprobacion1(this, strKey)).intValue();
-	int comprobacion2 = new Integer(CreateFileData.selectComprobacion2(this, strKey)).intValue();