Fixed bug [ 1889741 ] Openbravo PostgreSQL 8.3 compatible
authorCarlos Romero <carlos.romero@openbravo.com>
Tue, 12 Feb 2008 18:53:44 +0000
changeset 423 ecf368072c48
parent 422 e00336c36741
child 424 6496bf90729e
Fixed bug [ 1889741 ] Openbravo PostgreSQL 8.3 compatible
database/model/prescript-PostgreSql.sql
src/org/openbravo/base/secureApp/Attribute_data.xsql
src/org/openbravo/base/secureApp/DefaultOptions_data.xsql
src/org/openbravo/base/secureApp/Seguridad_data.xsql
src/org/openbravo/base/secureApp/SystemPreferences_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/ActionButtonDefault_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrderRecord_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateCloseFactAcct_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFile34_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFile_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFromMultiple_Receipt_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFromMultiple_Shipment_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Bank_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_CRemittance_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_DPManagement_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Invoice_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Settlement_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Shipment_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/DropCloseFactAcct_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/DropRegFactAcct_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues_Hours_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues_Values_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/ImportProduct_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/InsertAcces_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/InvoicingSchedule_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/Locator_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/Posted_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/ProjectClose_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/ProjectCopyFrom_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/ProjectSetType_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/RequestAction_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/TestLine_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/Test_In_data.xsql
src/org/openbravo/erpCommon/ad_actionButton/UpdateMaintenanceScheduled_data.xsql
src/org/openbravo/erpCommon/ad_background/PeriodicAcctServer_data.xsql
src/org/openbravo/erpCommon/ad_background/PeriodicAlert_data.xsql
src/org/openbravo/erpCommon/ad_background/PeriodicBackground_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SE_Expense_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SE_InOut_DocType_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_BPartner_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_Project_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SE_Order_BPartner_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SE_Order_Project_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SE_ProjectLine_Value_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SE_Proposal_BPartner_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SE_Request_CopyText_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_BankStmt_Amount_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_CCPMeasure_Group_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_CashJournal_Amounts_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Charge_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Command_ArgNumber_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_CostcenterEmployee_SalaryCategory_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_GlobalUse_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Locator_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Internal_Consumption_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_InvoiceTax_Amt_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Amt_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Conversion_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Tax_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_JournalLineAmt_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Journal_Period_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Locator_Renting_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_MInOutTraceReports_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Order_DocType_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Order_PriceList_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Stock_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Tax_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Payment_Amounts_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Payment_DocType_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_ProductionPlan_WRPhase_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Production_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_ProjectPlanned_Amt_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Proposal_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_Request_Action_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_ScheduledMaintenance_Maintenance_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_WRPhaseProduct_Product_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_WRPhase_Sequence_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_ProcessPlan_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_Sequence.xsql
src/org/openbravo/erpCommon/ad_combos/AdOrgTreeCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/AttributeSetInstanceCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/ClientCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/LocatorCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/PaymentRuleCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/PriceListVersionCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/RegionCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/ReportTypeCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/RoleCombo_data.xsql
src/org/openbravo/erpCommon/ad_combos/WarehouseCombo_data.xsql
src/org/openbravo/erpCommon/ad_forms/Account_data.xsql
src/org/openbravo/erpCommon/ad_forms/AcctSchemaElement_data.xsql
src/org/openbravo/erpCommon/ad_forms/AcctSchema_data.xsql
src/org/openbravo/erpCommon/ad_forms/AcctServer_data.xsql
src/org/openbravo/erpCommon/ad_forms/AlertManagement_data.xsql
src/org/openbravo/erpCommon/ad_forms/DebtPaymentUnapply_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocAmortization_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocBank_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocCash_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocDPManagement_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocGLJournal_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocInOut_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocInventory_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineAmortization_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineBank_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineCash_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineDPManagement_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineGLJournal_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineInOut_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineInventory_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineInvoice_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineMovement_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLineOrder_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLinePayment_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocLine_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocMovement_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocOrder_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocPayment_data.xsql
src/org/openbravo/erpCommon/ad_forms/DocTax_data.xsql
src/org/openbravo/erpCommon/ad_forms/EdiFileImport_data.xsql
src/org/openbravo/erpCommon/ad_forms/FactLine_data.xsql
src/org/openbravo/erpCommon/ad_forms/FileImport_data.xsql
src/org/openbravo/erpCommon/ad_forms/GenerateInvoicesmanual_data.xsql
src/org/openbravo/erpCommon/ad_forms/GenerateShipmentsmanual_data.xsql
src/org/openbravo/erpCommon/ad_forms/InformeInOut.java
src/org/openbravo/erpCommon/ad_forms/InformeInOut_data.xsql
src/org/openbravo/erpCommon/ad_forms/InitialClientSetup_data.xsql
src/org/openbravo/erpCommon/ad_forms/InvoiceVendorMultiline_Lines_data.xsql
src/org/openbravo/erpCommon/ad_forms/InvoiceVendorMultiline_data.xsql
src/org/openbravo/erpCommon/ad_forms/MatchingPOReceiptInvoice_data.xsql
src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPendingLines_data.xsql
src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending_data.xsql
src/org/openbravo/erpCommon/ad_forms/MaterialTransactions_data.xsql
src/org/openbravo/erpCommon/ad_forms/ProductInfo_data.xsql
src/org/openbravo/erpCommon/ad_forms/RemittanceCancel_data.xsql
src/org/openbravo/erpCommon/ad_forms/Role_data.xsql
src/org/openbravo/erpCommon/ad_forms/ShowSession_data.xsql
src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Element_data.xsql
src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Field_data.xsql
src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_data.xsql
src/org/openbravo/erpCommon/ad_help/DisplayHelp_data.xsql
src/org/openbravo/erpCommon/ad_process/AssetDelivery_data.xsql
src/org/openbravo/erpCommon/ad_process/BPartnerLocation_data.xsql
src/org/openbravo/erpCommon/ad_process/BPartner_data.xsql
src/org/openbravo/erpCommon/ad_process/CDebtpayment_data.xsql
src/org/openbravo/erpCommon/ad_process/COrderLine_data.xsql
src/org/openbravo/erpCommon/ad_process/COrder_data.xsql
src/org/openbravo/erpCommon/ad_process/CashBankOperations_data.xsql
src/org/openbravo/erpCommon/ad_process/ChangeOrderOrg_data.xsql
src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal_data.xsql
src/org/openbravo/erpCommon/ad_process/CreateAccountingReport_data.xsql
src/org/openbravo/erpCommon/ad_process/CreateCashFlowStatement_data.xsql
src/org/openbravo/erpCommon/ad_process/CreateTaxReport_data.xsql
src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice_data.xsql
src/org/openbravo/erpCommon/ad_process/GenerateHelp_data.xsql
src/org/openbravo/erpCommon/ad_process/ImportAccount_data.xsql
src/org/openbravo/erpCommon/ad_process/ImportBPartner_data.xsql
src/org/openbravo/erpCommon/ad_process/ImportBudget_data.xsql
src/org/openbravo/erpCommon/ad_process/ImportOrder_data.xsql
src/org/openbravo/erpCommon/ad_process/ImportProcess_data.xsql
src/org/openbravo/erpCommon/ad_process/ImportProduct_data.xsql
src/org/openbravo/erpCommon/ad_process/ImportTax_data.xsql
src/org/openbravo/erpCommon/ad_process/Location_data.xsql
src/org/openbravo/erpCommon/ad_process/Order_data.xsql
src/org/openbravo/erpCommon/ad_process/PriceListCreateAll_data.xsql
src/org/openbravo/erpCommon/ad_process/PrintInvoices_data.xsql
src/org/openbravo/erpCommon/ad_process/ProductPrice_data.xsql
src/org/openbravo/erpCommon/ad_process/SendMailText_data.xsql
src/org/openbravo/erpCommon/ad_process/User_data.xsql
src/org/openbravo/erpCommon/ad_reports/ABCbPartner_data.xsql
src/org/openbravo/erpCommon/ad_reports/ABCproduct_data.xsql
src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports_EV_data.xsql
src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports_data.xsql
src/org/openbravo/erpCommon/ad_reports/GenerateModel347_data.xsql
src/org/openbravo/erpCommon/ad_reports/InoutEdition_data.xsql
src/org/openbravo/erpCommon/ad_reports/InvoiceCustomerEdition_data.xsql
src/org/openbravo/erpCommon/ad_reports/InvoiceEdition_data.xsql
src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports_data.xsql
src/org/openbravo/erpCommon/ad_reports/OrderEdition_data.xsql
src/org/openbravo/erpCommon/ad_reports/PurchaseEdition_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportAccountingCountDimensionalAnalyses_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportAcctRedirectUtility_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportBankJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportBank_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportBudgetGenerateExcel_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportCashFlow_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportCashJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportCash_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportCashflowForecast_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportDebtPayment_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportExpense_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournalDetail_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportGuaranteeDate_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportInventory_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalyses_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportInvoices_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportMaterialDimensionalAnalysesJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportNotPosted_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoice_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportPricelist_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportProductMovement_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportProductionCost_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportProductionRun_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportProjectBuildingSite_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitability_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportPurchaseDimensionalAnalysesJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportRawMaterial_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportRefundInvoiceCustomerDimensionalAnalyses_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportRefundSalesDimensionalAnalyses_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyze_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderInvoiced_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderOpenItem_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderProvided_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportShipper_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportTaxInvoice_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportToInvoiceConsignment_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalanceDetail_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportValuationStock_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportWarehouseDetailInventory_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportWarehousePartner_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportWorkRequirementDailyEnv_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportWorkRequirementDaily_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportWorkRequirementJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/RptM_Production_data.xsql
src/org/openbravo/erpCommon/ad_reports/Rpt_Etiquetas_data.xsql
src/org/openbravo/erpCommon/ad_reports/SubCategoryProduct_data.xsql
src/org/openbravo/erpCommon/ad_reports/SubreportOfferProduct_data.xsql
src/org/openbravo/erpCommon/ad_workflow/WorkflowControl_data.xsql
src/org/openbravo/erpCommon/businessUtility/AccountTree_data.xsql
src/org/openbravo/erpCommon/businessUtility/Buscador_data.xsql
src/org/openbravo/erpCommon/businessUtility/PAttributeSet_data.xsql
src/org/openbravo/erpCommon/businessUtility/TabAttachments_data.xsql
src/org/openbravo/erpCommon/businessUtility/TabFilter_data.xsql
src/org/openbravo/erpCommon/businessUtility/Tax_data.xsql
src/org/openbravo/erpCommon/businessUtility/Tree_data.xsql
src/org/openbravo/erpCommon/businessUtility/WindowTabs_data.xsql
src/org/openbravo/erpCommon/info/Account_data.xsql
src/org/openbravo/erpCommon/info/AttributeSetInstance_data.xsql
src/org/openbravo/erpCommon/info/BusinessPartner_data.xsql
src/org/openbravo/erpCommon/info/CashJournal_data.xsql
src/org/openbravo/erpCommon/info/DebtPayment_data.xsql
src/org/openbravo/erpCommon/info/ImageInfo_data.xsql
src/org/openbravo/erpCommon/info/InvoiceLine_data.xsql
src/org/openbravo/erpCommon/info/Invoice_data.xsql
src/org/openbravo/erpCommon/info/Location_Search_data.xsql
src/org/openbravo/erpCommon/info/Locator_data.xsql
src/org/openbravo/erpCommon/info/ProductComplete_data.xsql
src/org/openbravo/erpCommon/info/ProductMultiple_data.xsql
src/org/openbravo/erpCommon/info/Product_data.xsql
src/org/openbravo/erpCommon/info/Project_data.xsql
src/org/openbravo/erpCommon/info/SalesOrderLine_data.xsql
src/org/openbravo/erpCommon/info/SalesOrder_data.xsql
src/org/openbravo/erpCommon/info/ShipmentReceiptLine_data.xsql
src/org/openbravo/erpCommon/info/ShipmentReceipt_data.xsql
src/org/openbravo/erpCommon/reference/List_data.xsql
src/org/openbravo/erpCommon/reference/PInstanceProcess_data.xsql
src/org/openbravo/erpCommon/reference/Preferences_data.xsql
src/org/openbravo/erpCommon/security/Access_data.xsql
src/org/openbravo/erpCommon/security/Organization_data.xsql
src/org/openbravo/erpCommon/security/SessionLogin_data.xsql
src/org/openbravo/erpCommon/utility/ComboTableQuery_data.xsql
src/org/openbravo/erpCommon/utility/DocumentNo_data.xsql
src/org/openbravo/erpCommon/utility/ExecuteTask_data.xsql
src/org/openbravo/erpCommon/utility/Menu_data.xsql
src/org/openbravo/erpCommon/utility/PrintJR_data.xsql
src/org/openbravo/erpCommon/utility/ReferencedLink_data.xsql
src/org/openbravo/erpCommon/utility/ReferencedTables_data.xsql
src/org/openbravo/erpCommon/utility/TableSQLQuery_data.xsql
src/org/openbravo/erpCommon/utility/UsedByLink_data.xsql
src/org/openbravo/erpCommon/utility/Utility_data.xsql
src/org/openbravo/erpCommon/utility/VerticalMenu_data.xsql
src/org/openbravo/erpCommon/utility/WindowAccess_data.xsql
src/org/openbravo/erpCommon/utility/WindowTreeChecks_data.xsql
src/org/openbravo/erpCommon/utility/WindowTreeUtilityClient_data.xsql
src/org/openbravo/erpCommon/utility/WindowTree_data.xsql
src/org/openbravo/erpCommon/ws/externalSales/ExternalSalesIOrder_data.xsql
src/org/openbravo/erpCommon/ws/externalSales/ExternalSalesOrder_data.xsql
src/org/openbravo/erpCommon/ws/externalSales/ExternalSalesProduct_data.xsql
src/org/openbravo/erpCommon/ws/externalSales/ExternalSales_data.xsql
src/org/openbravo/erpReports/RptC_BpartnerSales_data.xsql
src/org/openbravo/erpReports/RptC_Bpartner_data.xsql
src/org/openbravo/erpReports/RptC_Invoice_Lines_data.xsql
src/org/openbravo/erpReports/RptC_Invoice_Tax_data.xsql
src/org/openbravo/erpReports/RptC_Invoice_data.xsql
src/org/openbravo/erpReports/RptC_Order_Lines_data.xsql
src/org/openbravo/erpReports/RptC_ProposalJr_data.xsql
src/org/openbravo/erpReports/RptC_Proposal_data.xsql
src/org/openbravo/erpReports/RptC_Remittance_Header_data.xsql
src/org/openbravo/erpReports/RptC_Remittance_Lines_data.xsql
src/org/openbravo/erpReports/RptC_Settlement_Header_data.xsql
src/org/openbravo/erpReports/RptC_Settlement_Lines_data.xsql
src/org/openbravo/erpReports/RptMA_CCP_Measures_Hours_data.xsql
src/org/openbravo/erpReports/RptMA_CCP_Measures_Values_data.xsql
src/org/openbravo/erpReports/RptM_Inout_Header_data.xsql
src/org/openbravo/erpReports/RptM_Inout_Lines_data.xsql
src/org/openbravo/erpReports/RptM_Inout_data.xsql
src/org/openbravo/erpReports/RptM_Movement_data.xsql
src/org/openbravo/erpReports/RptPromissoryNoteAfter_data.xsql
src/org/openbravo/erpReports/RptPromissoryNoteHeader_data.xsql
src/org/openbravo/erpReports/RptPromissoryNoteTree_data.xsql
--- a/database/model/prescript-PostgreSql.sql	Tue Feb 12 17:01:08 2008 +0000
+++ b/database/model/prescript-PostgreSql.sql	Tue Feb 12 18:53:44 2008 +0000
@@ -173,6 +173,32 @@
 ' LANGUAGE 'plpgsql'
 /-- END
 
+CREATE OR REPLACE FUNCTION to_number(integer)
+  RETURNS "numeric" AS
+$BODY$
+BEGIN
+RETURN to_number($1, 'S99999999999999D999999');
+EXCEPTION 
+  WHEN OTHERS THEN 
+    RETURN NULL;
+END;
+$BODY$
+  LANGUAGE 'plpgsql' VOLATILE;
+/-- END
+
+CREATE OR REPLACE FUNCTION to_number(numeric)
+  RETURNS "numeric" AS
+$BODY$
+BEGIN
+RETURN $1;
+EXCEPTION 
+  WHEN OTHERS THEN 
+    RETURN NULL;
+END;
+$BODY$
+  LANGUAGE 'plpgsql' VOLATILE;
+/-- END
+
 CREATE OR REPLACE FUNCTION to_date
 (
 text
@@ -195,6 +221,17 @@
 ' LANGUAGE 'plpgsql'
 /-- END
 
+CREATE OR REPLACE FUNCTION to_date
+(
+timestamp, varchar
+)
+RETURNS timestamp AS '
+BEGIN
+RETURN to_timestamp($1, $2);
+END;
+' LANGUAGE 'plpgsql'
+/-- END
+
 CREATE OR REPLACE FUNCTION to_timestamp
 (
  timestamptz
@@ -539,6 +576,69 @@
 --  RIGHTARG = boolean)
 --/-- END
 
+CREATE OR REPLACE FUNCTION equal(numeric, varchar)
+  RETURNS boolean AS '
+BEGIN
+RETURN $1 = TO_NUMBER($2);
+END;
+' LANGUAGE 'plpgsql'
+/-- END
+
+--DROP OPERATOR = (numeric, varchar);
+--SELECT * FROM drop_operator('=','numeric','varchar');
+CREATE OPERATOR =(
+  PROCEDURE = "equal",
+  LEFTARG = numeric,
+  RIGHTARG = varchar)
+--/-- END
+
+CREATE OR REPLACE FUNCTION lowerequal(numeric, varchar)
+  RETURNS boolean AS '
+BEGIN
+RETURN $1 <= TO_NUMBER($2);
+END;
+' LANGUAGE 'plpgsql'
+/-- END
+
+--DROP OPERATOR <= (numeric, varchar);
+--SELECT * FROM drop_operator('<=','numeric','varchar');
+CREATE OPERATOR <=(
+  PROCEDURE = "lowerequal",
+  LEFTARG = numeric,
+  RIGHTARG = varchar)
+--/-- END
+
+CREATE OR REPLACE FUNCTION lowerequal(timestamp, varchar)
+  RETURNS boolean AS '
+BEGIN
+RETURN $1 <= TO_DATE($2);
+END;
+' LANGUAGE 'plpgsql'
+/-- END
+
+--DROP OPERATOR <= (timestamp, varchar);
+--SELECT * FROM drop_operator('<=','timestamp','varchar');
+CREATE OPERATOR <=(
+  PROCEDURE = "lowerequal",
+  LEFTARG = timestamp,
+  RIGHTARG = varchar)
+--/-- END
+
+CREATE OR REPLACE FUNCTION greaterequal(timestamp, varchar)
+  RETURNS boolean AS '
+BEGIN
+RETURN $1 >= TO_DATE($2);
+END;
+' LANGUAGE 'plpgsql'
+/-- END
+
+--DROP OPERATOR >= (timestamp, varchar);
+--SELECT * FROM drop_operator('>=','timestamp','varchar');
+CREATE OPERATOR >=(
+  PROCEDURE = "greaterequal",
+  LEFTARG = timestamp,
+  RIGHTARG = varchar)
+--/-- END
 
 CREATE OR REPLACE FUNCTION trunc
 (
--- a/src/org/openbravo/base/secureApp/Attribute_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/base/secureApp/Attribute_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,7 +36,7 @@
         FROM AD_Preference 
         WHERE AD_Client_ID IN (0, TO_NUMBER(?))
         AND AD_Org_ID IN (0, TO_NUMBER(?))
-        AND (AD_User_ID IS NULL OR AD_User_ID=0 OR AD_User_ID=?)
+        AND (AD_User_ID IS NULL OR AD_User_ID=0 OR AD_User_ID = TO_NUMBER(?))
         AND IsActive='Y' 
         ORDER BY Attribute, AD_Client_ID, AD_Org_ID, AD_User_ID
       </Sql>
@@ -58,7 +58,7 @@
         <![CDATA[
           SELECT STDPRECISION 
           FROM C_CURRENCY 
-          WHERE C_CURRENCY_ID = ? 
+          WHERE C_CURRENCY_ID = to_number(?) 
           AND AD_CLIENT_ID IN ('1')
           AND AD_ORG_ID IN ('1') 
         ]]>
--- a/src/org/openbravo/base/secureApp/DefaultOptions_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/base/secureApp/DefaultOptions_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -183,7 +183,7 @@
           AS DEFAULT_M_WAREHOUSE_ID, 
         (SELECT MIN(ad_language) FROM ad_language WHERE isbaselanguage='Y' AND isactive='Y') AS DEFAULT_AD_LANGUAGE 
         FROM ad_role_orgaccess ro
-        WHERE ro.ad_role_id = (SELECT MAX(ad_role_id) FROM ad_user_roles WHERE ad_user_id = ? AND isActive = 'Y')
+        WHERE ro.ad_role_id = (SELECT MAX(ad_role_id) FROM ad_user_roles WHERE ad_user_id = to_number(?) AND isActive = 'Y')
         AND ro.isactive = 'Y'
         ORDER BY ro.ad_org_id, ro.ad_client_id
       ]]></Sql>
@@ -199,7 +199,7 @@
             DEFAULT_AD_CLIENT_ID = TO_NUMBER(?),
             DEFAULT_AD_ORG_ID = TO_NUMBER(?),
             DEFAULT_M_WAREHOUSE_ID = TO_NUMBER(?)
-        WHERE AD_USER_ID = ?
+        WHERE AD_USER_ID = to_number(?)
       ]]></Sql>
       <Parameter name="adlanguage"/>
       <Parameter name="adroleid"/>
--- a/src/org/openbravo/base/secureApp/Seguridad_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/base/secureApp/Seguridad_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -22,8 +22,8 @@
         r.AD_Client_ID, c.NAME, u.C_BPARTNER_ID, c.VALUE, c.SMTPHOST 
         FROM AD_ROLE r, AD_CLIENT c, AD_USER u, 
         AD_USER_ROLES ur 
-        WHERE r.AD_Role_ID = ? 
-        AND ur.AD_USER_ID = ? 
+        WHERE r.AD_Role_ID = to_number(?) 
+        AND ur.AD_USER_ID = to_number(?) 
         AND r.AD_CLIENT_ID = c.AD_CLIENT_ID
         AND r.IsActive='Y' AND c.IsActive='Y' 
         AND r.AD_ROLE_ID = ur.AD_ROLE_ID 
@@ -61,7 +61,7 @@
    <SqlMethod name="loggedOK" type="preparedStatement" return="boolean">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT COUNT(*) AS TOTAL FROM AD_SESSION WHERE AD_SESSION_ID = ? AND PROCESSED = 'N' AND ISACTIVE = 'Y'
+        SELECT COUNT(*) AS TOTAL FROM AD_SESSION WHERE AD_SESSION_ID = to_number(?) AND PROCESSED = 'N' AND ISACTIVE = 'Y'
       </Sql>
       <Parameter name="adSessionId"/>
    </SqlMethod>
--- a/src/org/openbravo/base/secureApp/SystemPreferences_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/base/secureApp/SystemPreferences_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -33,7 +33,7 @@
    <SqlMethod name="isActive" type="preparedStatement" return="Boolean">
       <SqlMethodComment></SqlMethodComment>
       <Sql><![CDATA[
-        SELECT (CASE ISACTIVE WHEN 'Y' THEN 1 ELSE 0 END)AS ISACTIVE FROM AD_PROCESS WHERE AD_PROCESS_ID = ?
+        SELECT (CASE ISACTIVE WHEN 'Y' THEN 1 ELSE 0 END)AS ISACTIVE FROM AD_PROCESS WHERE AD_PROCESS_ID = to_number(?)
       ]]></Sql>
       <Parameter name="adProcessId"/>
    </SqlMethod>   
--- a/src/org/openbravo/erpCommon/ad_actionButton/ActionButtonDefault_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ActionButtonDefault_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -27,7 +27,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT NAME, DESCRIPTION, HELP FROM AD_PROCESS WHERE AD_PROCESS_ID = ?
+        SELECT NAME, DESCRIPTION, HELP FROM AD_PROCESS WHERE AD_PROCESS_ID = to_number(?)
       ]]>
     </Sql>
     <Parameter name="adProcessId"/>
@@ -41,7 +41,7 @@
         COALESCE(PT.HELP, P.HELP) AS HELP 
         FROM AD_PROCESS P left join AD_PROCESS_TRL PT on P.AD_PROCESS_ID = PT.AD_PROCESS_ID
                                       AND PT.AD_LANGUAGE = ?
-        WHERE P.AD_PROCESS_ID = ? 
+        WHERE P.AD_PROCESS_ID = to_number(?) 
       ]]>
     </Sql>
     <Parameter name="adLanguage"/>
@@ -53,7 +53,7 @@
       <![CDATA[
         SELECT T.HASTREE AS HELP, W.NAME AS DESCRIPTION, T.NAME AS NAME 
         FROM AD_WINDOW W, AD_TAB T 
-        WHERE T.AD_TAB_ID = ? 
+        WHERE T.AD_TAB_ID = to_number(?) 
         AND W.AD_WINDOW_ID = T.AD_WINDOW_ID 
       ]]>
     </Sql>
@@ -66,7 +66,7 @@
         select coalesce(tt.name, t.name) as name 
         from ad_ref_list t left join ad_ref_list_trl tt on t.ad_ref_list_id = tt.ad_ref_list_id 
                                                         and tt.ad_language = ?
-        where ad_reference_id = ?
+        where ad_reference_id = to_number(?)
         and value = (CASE TO_CHAR(?) WHEN '--' THEN 'CL' ELSE TO_CHAR(?) END)
       ]]>
     </Sql>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -28,7 +28,7 @@
     <Sql>
       <![CDATA[
         SELECT C_InvoiceLine_ID FROM C_InvoiceLine 
-        WHERE C_Invoice_ID = ? 
+        WHERE C_Invoice_ID = to_number(?) 
         AND AD_CLIENT_ID IN ('1') 
         AND AD_ORG_ID IN ('1') 
         AND ISACTIVE = 'Y'
@@ -48,12 +48,12 @@
         S_RESOURCEASSIGNMENT_ID, A_ASSET_ID, TAXAMT, M_ATTRIBUTESETINSTANCE_ID, ISDESCRIPTION, QUANTITYORDER, M_PRODUCT_UOM_ID, 
         PRICESTD)
         SELECT TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 'Y', now(), TO_NUMBER(?), now(), TO_NUMBER(?),'', '', 
-        (SELECT COALESCE(MAX(LINE),0)+10 FROM C_InvoiceLine WHERE C_InvoiceLine_ID = ?), DESCRIPTION, M_PRODUCT_ID, 
+        (SELECT COALESCE(MAX(LINE),0)+10 FROM C_InvoiceLine WHERE C_InvoiceLine_ID = to_number(?)), DESCRIPTION, M_PRODUCT_ID, 
         QTYINVOICED, PRICELIST, PRICEACTUAL, PRICELIMIT, LINENETAMT, C_CHARGE_ID, CHARGEAMT, C_UOM_ID, C_TAX_ID, 
         S_RESOURCEASSIGNMENT_ID, A_ASSET_ID, TAXAMT, M_ATTRIBUTESETINSTANCE_ID, ISDESCRIPTION, QUANTITYORDER, M_PRODUCT_UOM_ID, 
         PRICESTD
         FROM C_INVOICELINE 
-        WHERE C_INVOICELINE_ID = ? 
+        WHERE C_INVOICELINE_ID = to_number(?) 
       ]]>
     </Sql>
     <Parameter name="cNewInvoiceId"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrderRecord_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrderRecord_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -33,7 +33,7 @@
         AND C_ORDER.C_BPARTNER_LOCATION_ID = C_BPARTNER_LOCATION.C_BPARTNER_LOCATION_ID
         AND C_ORDER.M_PRICELIST_ID = M_PRICELIST.M_PRICELIST_ID
         AND C_ORDER.AD_ORG_ID = AD_ORG.AD_ORG_ID
-        AND C_ORDER.C_ORDER_ID = ?
+        AND C_ORDER.C_ORDER_id = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cOrderId"/>
@@ -44,9 +44,9 @@
       <![CDATA[
         SELECT coalesce(ROUND(SUM(TOTALLINES),2),0) AS SHIPMENTAMOUNTPENDING
         FROM M_INOUT_CANDIDATE_V
-        WHERE C_BPARTNER_ID = ?
-        AND AD_ORG_ID = ?
-        AND AD_CLIENT_ID = ?
+        WHERE C_BPARTNER_id = TO_NUMBER(?)
+        AND AD_ORG_id = TO_NUMBER(?)
+        AND AD_CLIENT_id = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cBpartnerId"/>
@@ -59,9 +59,9 @@
       <![CDATA[
         SELECT coalesce(ROUND(SUM(TOTALLINES),2),0) AS INVOICEAMOUNTPENDING
         FROM C_INVOICE_CANDIDATE_V
-        WHERE C_BPARTNER_ID = ?
-        AND AD_ORG_ID = ?
-        AND AD_CLIENT_ID = ?
+        WHERE C_BPARTNER_ID = TO_NUMBER(?)
+        AND AD_ORG_ID = TO_NUMBER(?)
+        AND AD_CLIENT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cBpartnerId"/>
@@ -74,10 +74,10 @@
       <![CDATA[
         SELECT coalesce(ROUND(SUM(DP.AMOUNT),2),0) AS AMOUNTDEBT
         FROM C_DEBT_PAYMENT DP, C_CURRENCY
-        WHERE DP.C_BPARTNER_ID = ?
+        WHERE DP.C_BPARTNER_ID = TO_NUMBER(?)
         AND DP.C_CURRENCY_ID = C_CURRENCY.C_CURRENCY_ID
-        AND DP.AD_ORG_ID = ?
-        AND DP.AD_CLIENT_ID = ?
+        AND DP.AD_ORG_ID = TO_NUMBER(?)
+        AND DP.AD_CLIENT_ID = TO_NUMBER(?)
         AND C_DEBT_PAYMENT_STATUS(DP.C_Settlement_Cancel_ID, DP.CANCEL_PROCESSED, DP.GENERATE_PROCESSED, DP.ISPAID, DP.ISVALID, 
         DP.C_CASHLINE_ID, DP.C_BANKSTATEMENTLINE_ID) = 'P'
         AND DP.ISRECEIPT=?
@@ -94,7 +94,7 @@
       <![CDATA[
         SELECT max(coalesce(to_char(FIRSTNAME),'')||' '||coalesce(to_char(LASTNAME),'')||(case coalesce(to_char(PHONE),'') when '' then '' else ' ('||to_char(PHONE)||')' end)) AS CONTACT
         FROM AD_USER
-        WHERE AD_USER_ID = ?
+        WHERE AD_USER_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="adUserId"/>
@@ -110,9 +110,9 @@
         AND I.DATEINVOICED >= TRUNC(TO_DATE(NOW()), 'YEAR') 
         AND I.PROCESSED = 'Y'
         AND I.ISSOTRX=?
-        AND I.C_BPARTNER_ID = ?
-        AND I.AD_ORG_ID = ?
-        AND I.AD_CLIENT_ID = ?
+        AND I.C_BPARTNER_ID = TO_NUMBER(?)
+        AND I.AD_ORG_ID = TO_NUMBER(?)
+        AND I.AD_CLIENT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="issotrx"/>
@@ -131,8 +131,8 @@
         AND I.DATEINVOICED >= TRUNC(TO_DATE(NOW()), 'YEAR') 
         AND I.PROCESSED = 'Y'
         AND I.ISSOTRX=?
-        AND I.AD_ORG_ID = ?
-        AND I.AD_CLIENT_ID = ?
+        AND I.AD_ORG_ID = TO_NUMBER(?)
+        AND I.AD_CLIENT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="issotrx"/>
@@ -145,11 +145,11 @@
       <![CDATA[
         SELECT TO_CHAR(MAX(DATEORDERED),to_char(?)) AS DATEORDERED
         FROM C_ORDER
-        WHERE C_BPARTNER_ID = ?
+        WHERE C_BPARTNER_ID = TO_NUMBER(?)
         AND DOCSTATUS = 'CO' 
         AND ISSOTRX = ?
-        AND AD_ORG_ID = ?
-        AND AD_CLIENT_ID = ?
+        AND AD_ORG_ID = TO_NUMBER(?)
+        AND AD_CLIENT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="dateFormat"/>
@@ -170,9 +170,9 @@
         AND C_ORDER.C_CURRENCY_ID = C_CURRENCY.C_CURRENCY_ID
         AND C_ORDER.ISSOTRX='N'
         AND C_ORDER.DOCSTATUS = 'CO'
-        AND C_ORDER.C_BPARTNER_ID = ?
-        AND C_ORDER.AD_ORG_ID = ?
-        AND C_ORDER.AD_CLIENT_ID = ?
+        AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+        AND C_ORDER.AD_ORG_ID = TO_NUMBER(?)
+        AND C_ORDER.AD_CLIENT_ID = TO_NUMBER(?)
         GROUP BY C_ORDERLINE.QTYORDERED, PRICEACTUAL) A
       ]]>
     </Sql>
@@ -192,9 +192,9 @@
         AND C_ORDER.C_CURRENCY_ID = C_CURRENCY.C_CURRENCY_ID
         AND C_ORDER.ISSOTRX='N'
         AND C_ORDER.DOCSTATUS = 'CO'
-        AND C_ORDER.C_BPARTNER_ID = ?
-        AND C_ORDER.AD_ORG_ID = ? 
-        AND C_ORDER.AD_CLIENT_ID = ?
+        AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+        AND C_ORDER.AD_ORG_ID = TO_NUMBER(?) 
+        AND C_ORDER.AD_CLIENT_ID = TO_NUMBER(?)
         GROUP BY C_ORDERLINE.QTYORDERED, PRICEACTUAL) A
       ]]>
     </Sql>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -43,10 +43,10 @@
                                                                     WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
                                                                     AND C_ORDER.DATEORDERED = (SELECT MAX(C_ORDER.DATEORDERED) FROM C_ORDER, C_ORDERLINE
                                                                     WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
-                                                                    AND C_ORDER.C_BPARTNER_ID = ?
+                                                                    AND C_ORDER.C_BPARTNER_ID = to_number(?)
                                                                     AND C_ORDERLINE.M_PRODUCT_ID = M.M_PRODUCT_ID
                                                                     AND C_ORDER.DOCSTATUS = 'CO')
-                                                                    AND C_ORDER.C_BPARTNER_ID = ?
+                                                                    AND C_ORDER.C_BPARTNER_ID = to_number(?)
                                                                     AND C_ORDERLINE.M_PRODUCT_ID = M.M_PRODUCT_ID
                                                                     AND C_ORDER.DOCSTATUS = 'CO') 
                                                                ELSE M_GET_OFFERS_PRICE(TO_DATE(NOW()), TO_NUMBER(?), CL.M_PRODUCT_ID,BOM_PRICESTD(CL.M_PRODUCT_ID, GET_PRICELIST_VERSION(TO_NUMBER(?), TO_DATE(?))), 1 /*CL.QTYORDERED what should be here*/, C.M_PRICELIST_ID) 
@@ -57,7 +57,7 @@
         AND CL.M_PRODUCT_ID = M.M_PRODUCT_ID
         AND CL.C_TAX_ID = C_TAX.C_TAX_ID
         AND M.C_UOM_ID = C_UOM.C_UOM_ID
-        AND C.C_BPARTNER_ID = ?
+        AND C.C_BPARTNER_ID = to_number(?)
         AND C.DOCSTATUS = 'CO'
         AND M.ISACTIVE = 'Y'
         AND C.ISSOTRX = ?
--- a/src/org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
         '' AS QTYORDERED, '' AS QUANTITYORDER, '' AS M_PRODUCT_UOM_ID,
         '' AS DESCRIPTION, '' AS PRICESTD, '' AS M_OFFER_ID, '' as orderline
         FROM C_ORDER O LEFT JOIN C_ORDERLINE OL ON O.C_ORDER_ID = OL.C_ORDER_ID
-        WHERE O.C_ORDER_ID = ?
+        WHERE O.C_ORDER_ID = TO_NUMBER(?)
         GROUP BY O.C_BPARTNER_ID, O.C_BPARTNER_LOCATION_ID, O.M_WAREHOUSE_ID, O.C_CURRENCY_ID, O.C_PROJECT_ID,
         O.M_PRICELIST_ID, O.AD_ORG_ID, O.AD_CLIENT_ID
       ]]>
@@ -43,7 +43,7 @@
         SELECT C_ORDERLINE_ID as orderline, C_UOM_ID, M_PRODUCT_ID, QTYORDERED, QUANTITYORDER,
         M_PRODUCT_UOM_ID, DESCRIPTION, C_CURRENCY_ID
         FROM C_ORDERLINE
-        WHERE C_ORDER_ID = ?
+        WHERE C_ORDER_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cOrderLineId"/>
@@ -95,7 +95,7 @@
     <Sql>
       <![CDATA[
         SELECT MAX(C_BPARTNER_LOCATION_ID) FROM C_BPARTNER_LOCATION
-        WHERE C_BPARTNER_ID = ?
+        WHERE C_BPARTNER_ID = TO_NUMBER(?)
         AND C_BPartner_Location.IsActive='Y'
       ]]>
     </Sql>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CopyFromSettlement_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -33,7 +33,7 @@
         '' as c_settlement_id, '' as documentno,  '' AS C_DEBT_PAYMENT_BALANCING_ID, '' AS TERCERO, '' AS EFECTO,
         '' AS CONCEPTO, '' AS DATEPLANNED, '' AS DATEFORMAT
         FROM C_DEBT_PAYMENT
-        WHERE c_settlement_generate_id = ?
+        WHERE c_settlement_generate_ID = TO_NUMBER(?)
         AND isactive='Y' 
       ]]>
     </Sql>
@@ -46,7 +46,7 @@
       <![CDATA[
         SELECT ad_org_id as org, ad_client_id as client, datetrx
         FROM C_Settlement
-        WHERE c_settlement_id = ?
+        WHERE c_settlement_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cSettlementId"/>
@@ -107,7 +107,7 @@
       <![CDATA[
         SELECT AMOUNTDEBIT, AMOUNTCREDIT, C_GLITEM_ID, C_DEBT_PAYMENT_BALANCING_ID
         FROM C_DEBT_PAYMENT_BALANCING
-        WHERE c_debt_payment_id = ?
+        WHERE c_debt_payment_ID = TO_NUMBER(?)
         AND isactive = 'Y'
       ]]>
     </Sql>
@@ -148,7 +148,7 @@
         LEFT JOIN C_BPARTNER ON C_DEBT_PAYMENT.C_BPARTNER_ID = C_BPARTNER.C_BPARTNER_ID
         LEFT JOIN AD_REF_LIST_V ON C_DEBT_PAYMENT.PAYMENTRULE = AD_REF_LIST_V.VALUE AND AD_REF_LIST_V.AD_LANGUAGE = 'es_ES' AND AD_REF_LIST_V.AD_REFERENCE_ID = 195
         WHERE C_DEBT_PAYMENT.C_BPARTNER_ID = C_BPARTNER.C_BPARTNER_ID	
-        AND C_SETTLEMENT.C_SETTLEMENT_ID = ?
+        AND C_SETTLEMENT.C_SETTLEMENT_ID = TO_NUMBER(?)
         ORDER BY C_DEBT_PAYMENT.DATEPLANNED, TERCERO, EFECTO
       ]]>
     </Sql>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateCloseFactAcct_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateCloseFactAcct_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,11 +29,11 @@
       <![CDATA[
         SELECT C_PERIOD_ID AS ID, NAME, '' AS TOTALAMTDR, '' AS TOTALAMTCR, '' AS ACCOUNT_ID
         FROM C_PERIOD
-        WHERE C_YEAR_ID = ?
+        WHERE C_YEAR_ID = TO_NUMBER(?)
         AND PERIODNO>=(
                 SELECT MIN(PERIODNO)
                 FROM C_PERIOD
-                WHERE C_YEAR_ID = ?
+                WHERE C_YEAR_ID = TO_NUMBER(?)
                 AND CLOSE_FACT_ACCT_GROUP_ID IS NULL)
         ORDER BY PERIODNO
       ]]>
@@ -48,9 +48,9 @@
         SELECT (CASE sign(SUM(AMTACCTDR)-sum(amtacctcr)) WHEN -1 THEN 0 ELSE (SUM(AMTACCTDR)-sum(amtacctcr)) END) AS TOTALAMTCR, 
         (CASE sign(SUM(AMTACCTCR)-sum(amtacctdr)) WHEN -1 THEN 0 ELSE (SUM(AMTACCTCR)-sum(amtacctdr)) END) AS TOTALAMTDR, ACCOUNT_ID
         FROM FACT_ACCT
-        WHERE C_PERIOD_ID BETWEEN (SELECT C_PERIOD_ID FROM  C_PERIOD WHERE C_YEAR_ID = ? AND PERIODNO = (SELECT MIN(PERIODNO)
+        WHERE C_PERIOD_ID BETWEEN (SELECT C_PERIOD_ID FROM  C_PERIOD WHERE C_YEAR_ID = TO_NUMBER(?) AND PERIODNO = (SELECT MIN(PERIODNO)
                 FROM C_PERIOD
-                WHERE C_YEAR_ID = ?
+                WHERE C_YEAR_ID = TO_NUMBER(?)
                 AND CLOSE_FACT_ACCT_GROUP_ID IS NULL)) AND ?
         AND ACCOUNT_ID IN (SELECT ACCOUNT_ID 
                 FROM C_ELEMENTVALUE, C_VALIDCOMBINATION
@@ -101,7 +101,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT ENDDATE FROM C_PERIOD WHERE C_PERIOD_ID = ?
+        SELECT ENDDATE FROM C_PERIOD WHERE C_PERIOD_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cPeriodId"/>
@@ -110,7 +110,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT STARTDATE FROM C_PERIOD WHERE C_PERIOD_ID = ?
+        SELECT STARTDATE FROM C_PERIOD WHERE C_PERIOD_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cPeriodId"/>
@@ -121,8 +121,8 @@
       <![CDATA[
         SELECT C_PERIOD_ID
         FROM C_PERIOD 
-        WHERE STARTDATE > (SELECT STARTDATE FROM C_PERIOD WHERE C_PERIOD_ID = ?)
-        AND C_YEAR_ID = ?
+        WHERE STARTDATE > (SELECT STARTDATE FROM C_PERIOD WHERE C_PERIOD_ID = TO_NUMBER(?))
+        AND C_YEAR_ID = TO_NUMBER(?)
         ORDER BY STARTDATE ASC
       ]]>
     </Sql>
@@ -134,8 +134,8 @@
     <Sql>
       <![CDATA[
       SELECT C_YEAR_ID FROM C_YEAR
-      WHERE C_CALENDAR_ID = (SELECT  C_CALENDAR_ID FROM C_YEAR WHERE C_YEAR_ID = ?)
-      AND C_YEAR_ID > ?
+      WHERE C_CALENDAR_ID = (SELECT  C_CALENDAR_ID FROM C_YEAR WHERE C_YEAR_ID = TO_NUMBER(?))
+      AND C_YEAR_ID > TO_NUMBER(?)
       ORDER BY YEAR
       ]]>
     </Sql>
@@ -147,7 +147,7 @@
     <Sql>
       <![CDATA[
 	    SELECT C_PERIOD_ID FROM C_PERIOD
-      WHERE C_YEAR_ID = ?
+      WHERE C_YEAR_ID = TO_NUMBER(?)
       ORDER BY PERIODNO
       ]]>
     </Sql>
@@ -165,7 +165,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT C_CURRENCY_ID FROM C_ACCTSCHEMA WHERE C_ACCTSCHEMA_ID = ?
+        SELECT C_CURRENCY_ID FROM C_ACCTSCHEMA WHERE C_ACCTSCHEMA_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cAcctschemaId"/>
@@ -177,7 +177,7 @@
         SELECT C_VALIDCOMBINATION.ACCOUNT_ID 
         FROM C_ACCTSCHEMA_GL, C_VALIDCOMBINATION
         WHERE C_ACCTSCHEMA_GL.INCOMESUMMARY_ACCT = C_VALIDCOMBINATION.C_VALIDCOMBINATION_ID
-        AND C_ACCTSCHEMA_GL.C_ACCTSCHEMA_ID = ?
+        AND C_ACCTSCHEMA_GL.C_ACCTSCHEMA_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cAcctschemaId"/>
@@ -189,8 +189,8 @@
         UPDATE C_PERIOD SET CLOSE_FACT_ACCT_GROUP_ID = TO_NUMBER(?)
         WHERE C_PERIOD_ID IN (SELECT C_PERIOD_ID 
                          FROM C_PERIOD 
-                         WHERE C_YEAR_ID = ?    
-                         AND PERIODNO <= (SELECT PERIODNO FROM C_PERIOD WHERE C_PERIOD_ID = ?)
+                         WHERE C_YEAR_ID = TO_NUMBER(?)    
+                         AND PERIODNO <= (SELECT PERIODNO FROM C_PERIOD WHERE C_PERIOD_ID = TO_NUMBER(?))
                          AND CLOSE_FACT_ACCT_GROUP_ID IS NULL)
       ]]>
     </Sql>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFile34_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFile34_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -28,11 +28,11 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
     <![CDATA[      
-    select lpad(oi.taxID,10)                                                             AS NIF,
+    select lpad(TO_CHAR(oi.taxID),10)                                                             AS NIF,
     TO_CHAR(now(), 'DD')||TO_CHAR(now(), 'MM')||TO_CHAR(now(), 'YY')                     AS HOY,
     TO_CHAR(r.duedate, 'DD')||TO_CHAR(r.duedate, 'MM')||TO_CHAR(r.duedate, 'YY')         AS DUEDATE,
-    LPAD(B.CODEBANK,4,0)||LPAD(B.CODEBRANCH,4,0)||LPAD(ba.CODEACCOUNT,10,0)              AS N_CUENTA,
-    LPAD(B.DIGITCONTROL||ba.DIGITCONTROL,2,0)                                            AS DC,
+    LPAD(TO_CHAR(B.CODEBANK),4,TO_CHAR('0'))||LPAD(TO_CHAR(B.CODEBRANCH),4,TO_CHAR('0'))||LPAD(TO_CHAR(ba.CODEACCOUNT),10,TO_CHAR('0')) AS N_CUENTA,
+    LPAD(TO_CHAR(B.DIGITCONTROL||ba.DIGITCONTROL),2,TO_CHAR('0'))                                 AS DC,
     RPAD(C.NAME,36)                                                                     AS NOMBRE,
     RPAD(l.Address1||' '||l.Address2,36)                                                  AS DOMICILIO,
     RPAD(l.City,36)                                                                     AS PLAZA,
@@ -59,7 +59,7 @@
        and r.C_BANKACCOUNT_ID = ba.c_bankAccount_id
        and b.c_bank_id = ba.c_bank_Id
        and oi.C_Location_ID = l.C_location_ID
-      and r.C_Remittance_ID = ?
+      and r.C_Remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -69,12 +69,12 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
     <![CDATA[
-      SELECT LPAD(BP.TAXID,12,' ')                      AS NIF, BP.TAXID,
-             LPAD(DP.AMOUNT*100,12,0)                   AS PAYAMT,
-             SUBSTR(TRIM(LPAD(BP_A.ACCOUNTNO,20,0)),1,4)|| /*BANCO*/ 
-             SUBSTR(TRIM(LPAD(BP_A.ACCOUNTNO,20,0)),5,4)|| /*OFICINA*/ 
-             SUBSTR(TRIM(LPAD(BP_A.ACCOUNTNO,20,0)),11) AS N_CUENTA,
-             SUBSTR(TRIM(LPAD(BP_A.ACCOUNTNO,20,0)),9,2)AS DC, BP_A.ACCOUNTNO AS ACCT,
+      SELECT LPAD(TO_CHAR(BP.TAXID),12,TO_CHAR(' '))                      AS NIF, BP.TAXID,
+             LPAD(TO_CHAR(DP.AMOUNT*100),12,TO_CHAR('0'))                   AS PAYAMT,
+             SUBSTR(TRIM(LPAD(TO_CHAR(BP_A.ACCOUNTNO),20,TO_CHAR('0'))),1,4)|| /*BANCO*/ 
+             SUBSTR(TRIM(LPAD(TO_CHAR(BP_A.ACCOUNTNO),20,TO_CHAR('0'))),5,4)|| /*OFICINA*/ 
+             SUBSTR(TRIM(LPAD(TO_CHAR(BP_A.ACCOUNTNO),20,TO_CHAR('0'))),11) AS N_CUENTA,
+             SUBSTR(TRIM(LPAD(TO_CHAR(BP_A.ACCOUNTNO),20,TO_CHAR('0'))),9,2)AS DC, BP_A.ACCOUNTNO AS ACCT,
              RPAD(COALESCE(BP.NAME2,BP.NAME),36,' ')    AS nombre, COALESCE(BP.NAME2,BP.NAME) AS NOM,
              RPAD(L.ADDRESS1||' '||L.ADDRESS2,36,' ')   AS DOMICILIO,L.ADDRESS2||L.ADDRESS1 AS DOM,
              RPAD(L.POSTAL,5)||RPAD(L.CITY,31,' ')      AS PLAZA, L.POSTAL||L.CITY AS PLA,
@@ -88,7 +88,7 @@
       WHERE S.C_debt_payment_id = DP.C_debt_payment_id
       AND DP.C_BPARTNER_ID = BP.C_BPARTNER_ID
       AND BP_L.C_BPARTNER_LOCATION_ID = COALESCE(C_GETBPLOCATIONID(BP.C_BPARTNER_ID, 'B'),BP_L.C_BPARTNER_LOCATION_ID)
-      and s.C_Remittance_ID = ?
+      and s.C_Remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -99,11 +99,11 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
     <![CDATA[
-          SELECT lpad(Lpad(sum(DP.AMOUNT)*100,12,0),27,' ') AS PAYAMT
+          SELECT lpad(Lpad(TO_CHAR(to_number(sum(DP.AMOUNT)*100)),12,TO_CHAR('0')),27,TO_CHAR(' ')) AS PAYAMT
       FROM C_DEBT_PAYMENT DP,
            c_remittanceLine rl
      where dp.c_debt_payment_id = rl.c_debt_payment_id
-       and rl.C_Remittance_ID = ?
+       and rl.C_Remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -114,9 +114,9 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
     <![CDATA[
-       SELECT LPAD(?,10,0) AS LINEAS, 
-              LPAD(1,8,0)  AS ORDENANTES, 
-              LPAD(' ',13,' ') AS HUECO 
+       SELECT LPAD(TO_CHAR(?),10,'0') AS LINEAS, 
+              LPAD(TO_CHAR(1),8,'0')  AS ORDENANTES, 
+              LPAD(TO_CHAR(' '),13,' ') AS HUECO 
          FROM DUAL
     ]]>
     </Sql>
@@ -147,7 +147,7 @@
              c_Remittance_Parameter rp
        where r.C_Remittance_Type_id = rt.C_Remittance_Type_id
          and rp.C_Remittance_Type_Id =  rt.C_Remittance_Type_id
-         and r.C_Remittance_id = ?
+         and r.C_Remittance_ID = TO_NUMBER(?)
          and upper(rp.name)=upper(to_char(?))
     ]]>
     </Sql>
@@ -174,7 +174,7 @@
     <![CDATA[
       SELECT COUNT(*) 
       FROM c_remittanceLine rl 
-    WHERE rl.c_remittance_id = ?
+    WHERE rl.c_remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -186,7 +186,7 @@
       select count(*)
       from c_remittance
     where processed='Y'
-     and c_remittance_id = ?
+     and c_remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -201,7 +201,7 @@
     WHERE DP.C_DEBT_PAYMENT_ID = rl.C_DEBT_PAYMENT_id
     AND DP.ISPAID = 'N'
     AND DP.C_BPARTNER_ID IS NOT NULL
-    and rl.c_remittance_id = ?
+    and rl.c_remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFile_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFile_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,9 +30,9 @@
     <![CDATA[
 				select B.NAME AS BANK,b.codebank, b.codebranch, b.DIGITCONTROL as digitcontrol1, ba.DIGITCONTROL as digitcontrol2, 
       ba.CODEACCOUNT, 
-			LPAD(B.CODEBANK,4,0)||LPAD(B.CODEBRANCH,4,0)||B.DIGITCONTROL||ba.DIGITCONTROL||LPAD(ba.CODEACCOUNT,10,0) AS N_CUENTA,
-      lpad(rpad(c.NAME,40,' '),46,' ') AS ENTIDAD, rpad(c.NAME,40,' ') AS ENTIDAD19, oi.TAXID AS NIF, TO_CHAR(r.Duedate  ,'DD')||TO_CHAR(r.Duedate,'MM')||TO_CHAR(r.Duedate,'YY')AS DATEPLANNED, TO_CHAR(now(), 'DD')||TO_CHAR(now(), 'MM')||TO_CHAR(now(), 'YY') AS HOY, 
-			LPAD(RPAD(LPAD(B.CODEBANK,4,0)||LPAD(B.CODEBRANCH,4,0),74,' '),94,' ') AS ENTOFI, LPAD(B.INE_NUMBER,61,' ') AS INE, 
+			LPAD(B.CODEBANK,4,TO_CHAR('0'))||LPAD(B.CODEBRANCH,4,TO_CHAR('0'))||B.DIGITCONTROL||ba.DIGITCONTROL||LPAD(ba.CODEACCOUNT,10,TO_CHAR('0')) AS N_CUENTA,
+      lpad(rpad(c.NAME,40,' '),46,TO_CHAR(' ')) AS ENTIDAD, rpad(c.NAME,40,' ') AS ENTIDAD19, oi.TAXID AS NIF, TO_CHAR(r.Duedate  ,'DD')||TO_CHAR(r.Duedate,'MM')||TO_CHAR(r.Duedate,'YY')AS DATEPLANNED, TO_CHAR(now(), 'DD')||TO_CHAR(now(), 'MM')||TO_CHAR(now(), 'YY') AS HOY, 
+			LPAD(RPAD(LPAD(B.CODEBANK,4,TO_CHAR('0'))||LPAD(B.CODEBRANCH,4,TO_CHAR('0')),74,' '),94,TO_CHAR(' ')) AS ENTOFI, LPAD(B.INE_NUMBER,61,TO_CHAR(' ')) AS INE, 
 			'' AS TERCERO,
       '' AS FECHA_FACTURA, '' AS FECHA_VENCIMIENTO, '' AS PAYAMT, '' AS CREDITCARDNUMBER, '' AS N_FACTURA, '' AS N_FACTURA19, '' AS CIUDAD, '' AS DIRECCION,
       '' AS CONCEPTO, '' AS PLAZA, '' AS LOCALIDAD, '' AS POSTAL, '' AS CODIGO_PROVINCIA, '' AS LINEAS, '' AS ORDENANTES, '' AS HUECO, '' AS CONTENT
@@ -44,7 +44,7 @@
 		 	 and   r.AD_ORG_ID = oi.ad_org_id
 			 and r.C_BANKACCOUNT_ID = ba.c_bankAccount_id
 			 and b.c_bank_id = ba.c_bank_Id
-       and r.C_Remittance_ID = ?
+       and r.C_Remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -54,9 +54,9 @@
     <Sql>
     <![CDATA[
       SELECT RPAD(COALESCE(BP.NAME2,BP.NAME),40,' ') AS TERCERO,RPAD(TO_CHAR(COALESCE(C_INVOICE.DATEINVOICED,DP.DATEPLANNED), 'DDMMYY'),14) AS FECHA_FACTURA, 
-      TO_CHAR(TO_CHAR(DP.DATEPLANNED, 'DDMMYY')) AS FECHA_VENCIMIENTO,LPAD(ROUND(DP.AMOUNT*100,0),10,0) AS PAYAMT, 
+      TO_CHAR(TO_CHAR(DP.DATEPLANNED, 'DDMMYY')) AS FECHA_VENCIMIENTO,LPAD(TO_CHAR(ROUND(DP.AMOUNT*100,0)),10,TO_CHAR('0')) AS PAYAMT, 
       (SELECT MAX(BP_A.ACCOUNTNO) FROM C_BP_BANKACCOUNT BP_A WHERE BP.C_BPARTNER_ID = BP_A.C_BPARTNER_ID AND BP_A.ISACTIVE='Y')  AS CREDITCARDNUMBER,
-      LPAD(BP.VALUE,12,'0') AS N_FACTURA, RPAD(LPAD(BP.VALUE,8,'0'),12,' ') AS N_FACTURA19,L.CITY AS CIUDAD, RPAD(L.ADDRESS1,40,' ') AS DIRECCION, 
+      LPAD(TO_CHAR(BP.VALUE),12,TO_CHAR('0')) AS N_FACTURA, RPAD(LPAD(TO_CHAR(BP.VALUE),8,TO_CHAR('0')),12,' ') AS N_FACTURA19,L.CITY AS CIUDAD, RPAD(L.ADDRESS1,40,' ') AS DIRECCION, 
       TO_CHAR(now(),'DD')||TO_CHAR(now(),'MM')||TO_CHAR(now(),'YY') AS HOY, RPAD(COALESCE(TO_CHAR(DP.DESCRIPTION),' '),40,' ') AS CONCEPTO,
       RPAD(L.CITY,35,' ') AS PLAZA, RPAD(L.CITY,38,' ') AS LOCALIDAD, L.POSTAL AS POSTAL, SUBSTR(L.POSTAL,0,2) AS CODIGO_PROVINCIA, BP.TAXID AS NIF
       FROM c_remittanceline S, C_BPARTNER_LOCATION BP_L,
@@ -66,7 +66,7 @@
       AND DP.C_BPARTNER_ID = BP.C_BPARTNER_ID
       AND BP_L.C_BPARTNER_LOCATION_ID = C_GETBPLOCATIONID(BP.C_BPARTNER_ID, 'B')
       AND BP_L.C_LOCATION_ID = L.C_LOCATION_ID
-      and s.C_Remittance_ID = ?
+      and s.C_Remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -75,12 +75,12 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
     <![CDATA[
-      SELECT RPAD(LPAD(ROUND(sum(DP.AMOUNT)*100,0),10,0),16,' ') AS PAYAMT, 
-      LPAD(COUNT(*),10,0) AS N_FACTURA 
+      SELECT RPAD(LPAD(TO_CHAR(ROUND(sum(DP.AMOUNT)*100,0)),10,TO_CHAR('0')),16,TO_CHAR(' ')) AS PAYAMT, 
+      LPAD(TO_CHAR(COUNT(*)),10,TO_CHAR('0')) AS N_FACTURA 
       FROM C_DEBT_PAYMENT DP,
 			     c_remittanceLine rl
 		 where dp.c_debt_payment_id = rl.c_debt_payment_id
-       and rl.C_Remittance_ID = ?
+       and rl.C_Remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -89,7 +89,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
     <![CDATA[
-    SELECT RPAD(LPAD(?,10,0),48,' ') AS LINEAS, LPAD(RPAD(LPAD(1,4,0),20,' '),72,' ') AS ORDENANTES, LPAD(' ',72,' ') AS HUECO FROM DUAL
+    SELECT RPAD(LPAD(TO_CHAR(?),10,TO_CHAR('0')),48,' ') AS LINEAS, LPAD(RPAD(LPAD(TO_CHAR(1),4,TO_CHAR('0')),20,' '),72,TO_CHAR(' ')) AS ORDENANTES, LPAD(' ',72,TO_CHAR(' ')) AS HUECO FROM DUAL
     ]]>
     </Sql>
     <Parameter name="nLineas"/>
@@ -104,7 +104,7 @@
              c_Remittance_Parameter rp
 			 where r.C_Remittance_Type_id = rt.C_Remittance_Type_id
 			   and rp.C_Remittance_Type_Id =  rt.C_Remittance_Type_id
-				 and r.C_Remittance_id = ?
+				 and r.C_Remittance_ID = TO_NUMBER(?)
 				 and upper(rp.name)=upper(to_char(?))
     ]]>
     </Sql>
@@ -121,7 +121,7 @@
     WHERE rl.c_debt_payment_id = dp.c_debt_payment_id
     AND DP.ISPAID = 'N' 
     AND DP.C_BPARTNER_ID = NULL
-		and rl.c_remittance_id = ?
+		and rl.c_remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -132,7 +132,7 @@
     <![CDATA[
     	SELECT COUNT(*) 
 		  FROM c_remittanceLine rl 
-    WHERE rl.c_remittance_id = ?
+    WHERE rl.c_remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -144,7 +144,7 @@
     	select count(*)
 		  from c_remittance
 		where processed='Y'
-		 and c_remittance_id = ?
+		 and c_remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
@@ -159,7 +159,7 @@
     WHERE DP.C_DEBT_PAYMENT_ID = rl.C_DEBT_PAYMENT_id
     AND DP.ISPAID = 'N'
     AND DP.C_BPARTNER_ID IS NOT NULL
-		and rl.c_remittance_id = ?
+		and rl.c_remittance_ID = TO_NUMBER(?)
     ]]>
     </Sql>
     <Parameter name="cRemittanceId"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFromMultiple_Receipt_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFromMultiple_Receipt_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -27,7 +27,7 @@
         FROM M_LOCATOR L 
         WHERE L.AD_CLIENT_ID IN ('1')
         AND L.AD_ORG_ID IN ('1')
-        AND L.M_WAREHOUSE_ID = ? 
+        AND L.M_WAREHOUSE_ID = TO_NUMBER(?) 
         AND L.ISACTIVE = 'Y' 
         AND NOT EXISTS(SELECT 1 FROM M_STORAGE_DETAIL S
         WHERE S.M_LOCATOR_ID = L.M_LOCATOR_ID 
@@ -48,7 +48,7 @@
     <Parameter name="adOrgClient" type="replace" optional="true" after="L.AD_ORG_ID IN (" text="'1'"/>
     <Parameter name="mWarehouseId"/>
     <Parameter name="mLocatorId" optional="true" after="AND L.ISACTIVE = 'Y' " text=" AND L.X = ? "/>
-    <Parameter name="mLocatortypeId" optional="true" after="AND 1=1" text=" AND L.M_LOCATOR_TYPE_ID = ? "/>
+    <Parameter name="mLocatortypeId" optional="true" after="AND 1=1" text=" AND L.M_LOCATOR_TYPE_ID = TO_NUMBER(?) "/>
   </SqlMethod>
   <SqlMethod name="selectM_Locator_X" type="preparedStatement" return="multiple">
     <SqlMethodComment>Ids and Names of table dir M_Locator</SqlMethodComment>
@@ -57,7 +57,7 @@
       FROM M_Locator, M_Warehouse
       WHERE M_Warehouse.M_Warehouse_Id = M_Locator.M_Warehouse_Id
       AND M_Locator.isActive = 'Y'
-      AND  M_Warehouse.M_WAREHOUSE_ID = ? 
+      AND  M_Warehouse.M_WAREHOUSE_ID = TO_NUMBER(?) 
       ORDER BY M_Locator.X
     ]]></Sql>
     <Parameter name="warehouse"/>
@@ -65,7 +65,7 @@
   <SqlMethod name="tabName" type="preparedStatement" return="String" default="">
     <SqlMethodComment>Ids and Names of table dir M_Locator</SqlMethodComment>
     <Sql><![CDATA[
-      SELECT NAME FROM AD_TAB WHERE AD_TAB_ID = ?
+      SELECT NAME FROM AD_TAB WHERE AD_TAB_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="adTabId"/>
   </SqlMethod>
@@ -76,7 +76,7 @@
         INSERT INTO M_INOUTLINE (M_INOUTLINE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, LINE, 
         DESCRIPTION, M_INOUT_ID, C_ORDERLINE_ID, M_LOCATOR_ID, M_PRODUCT_ID, C_UOM_ID, MOVEMENTQTY, ISINVOICED, LOT, SERNO, 
         M_ATTRIBUTESETINSTANCE_ID, ISDESCRIPTION, QUANTITYORDER, M_PRODUCT_UOM_ID, M_INOUTLINE_TYPE_ID) 
-        VALUES (?,?,?,'Y',NOW(),?,NOW(),?, (SELECT COALESCE(MAX(LINE),0) + 10 FROM M_INOUTLINE WHERE M_INOUT_ID=?),
+        VALUES (?,?,?,'Y',NOW(),?,NOW(),?, (SELECT COALESCE(MAX(LINE),0) + 10 FROM M_INOUTLINE WHERE M_INOUT_ID = TO_NUMBER(?)),
         NULL,?,NULL,?,?,?,?,'N',NULL,NULL,
         ?,'N',?,?,?)
       ]]>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFromMultiple_Shipment_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFromMultiple_Shipment_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -42,9 +42,9 @@
         ORDER BY P.NAME, L.PRIORITYNO, L.X, L.Y, L.Z 
       ]]>
     </Sql>
-    <Parameter name="bpartner" optional="true" after="WHERE " text=" P.C_BPARTNER_ID = ? AND "/>
-    <Parameter name="product" optional="true" after="WHERE " text=" S.M_PRODUCT_ID = ? AND "/>
-    <Parameter name="warehouse" optional="true" after="WHERE " text=" L.M_WAREHOUSE_ID = ? AND "/>
+    <Parameter name="bpartner" optional="true" after="WHERE " text=" P.C_BPARTNER_ID = TO_NUMBER(?) AND "/>
+    <Parameter name="product" optional="true" after="WHERE " text=" S.M_PRODUCT_ID = TO_NUMBER(?) AND "/>
+    <Parameter name="warehouse" optional="true" after="WHERE " text=" L.M_WAREHOUSE_ID = TO_NUMBER(?) AND "/>
     <Parameter name="x" optional="true" after="WHERE " text=" L.X = ? AND "/>
     <Parameter name="y" optional="true" after="WHERE " text=" L.Y = ? AND "/>
     <Parameter name="z" optional="true" after="WHERE " text=" L.Z = ? AND "/>
@@ -53,14 +53,14 @@
   <SqlMethod name="bpartnerDescription" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
-      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID = ?
+      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
   <SqlMethod name="productDescription" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
-      SELECT NAME FROM M_PRODUCT WHERE M_PRODUCT_ID = ?
+      SELECT NAME FROM M_PRODUCT WHERE M_PRODUCT_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="mProductId"/>
   </SqlMethod>
@@ -71,11 +71,11 @@
         INSERT INTO M_INOUTLINE (M_INOUTLINE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, LINE, 
         DESCRIPTION, M_INOUT_ID, C_ORDERLINE_ID, M_LOCATOR_ID, M_PRODUCT_ID, C_UOM_ID, MOVEMENTQTY, ISINVOICED, LOT, SERNO, 
         M_ATTRIBUTESETINSTANCE_ID, ISDESCRIPTION, QUANTITYORDER, M_PRODUCT_UOM_ID, M_INOUTLINE_TYPE_ID) 
-        SELECT TO_NUMBER(?),TO_NUMBER(?),TO_NUMBER(?),'Y',now(),TO_NUMBER(?),now(),TO_NUMBER(?), (SELECT COALESCE(MAX(LINE),0) + 10 FROM M_INOUTLINE WHERE M_INOUT_ID=?),
+        SELECT TO_NUMBER(?),TO_NUMBER(?),TO_NUMBER(?),'Y',now(),TO_NUMBER(?),now(),TO_NUMBER(?), (SELECT COALESCE(MAX(LINE),0) + 10 FROM M_INOUTLINE WHERE M_INOUT_ID = TO_NUMBER(?)),
         NULL,TO_NUMBER(?),NULL,M_LOCATOR_ID,M_PRODUCT_ID,C_UOM_ID,TO_NUMBER(?),'N',NULL,NULL,
         M_ATTRIBUTESETINSTANCE_ID,'N',TO_NUMBER(?),M_PRODUCT_UOM_ID,TO_NUMBER(?)
         FROM M_STORAGE_DETAIL 
-        WHERE M_STORAGE_DETAIL_ID = ? 
+        WHERE M_STORAGE_DETAIL_ID = TO_NUMBER(?) 
       ]]>
     </Sql>
     <Parameter name="mInoutlineId"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Bank_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Bank_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -59,15 +59,15 @@
     <Parameter name="userClient" optional="true" type="replace" after="AND p.AD_CLIENT_ID IN (" text="'1'"/>
     <Parameter name="userOrg" optional="true" type="replace" after="AND p.AD_ORG_ID IN (" text="'1'"/>
     <Parameter name="adLanguage"/>
-    <Parameter name="cBPartnerId" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND p.C_BPARTNER_ID = ? "/>
+    <Parameter name="cBPartnerId" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND p.C_BPARTNER_ID = TO_NUMBER(?) "/>
     <Parameter name="paymentrule" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND p.PAYMENTRULE = ? "/>
     <Parameter name="planneddateFrom" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)"><![CDATA[ AND p.DATEPLANNED >= TO_DATE(?) ]]></Parameter>
     <Parameter name="planneddateTo" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)"><![CDATA[ AND p.DATEPLANNED <= TO_DATE(?) ]]></Parameter>
     <Parameter name="amountFrom" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)"><![CDATA[ AND p.AMOUNT >= ? ]]></Parameter>
     <Parameter name="amountTo" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)"><![CDATA[ AND p.AMOUNT <= ? ]]></Parameter>
     <Parameter name="isreceipt" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND p.ISRECEIPT = ? "/>
-    <Parameter name="cBankaccountId" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND p.C_BankAccount_ID = ? "/>
-    <Parameter name="adOrgId" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND p.AD_ORG_ID = ? "/>
+    <Parameter name="cBankaccountId" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND p.C_BankAccount_ID = TO_NUMBER(?) "/>
+    <Parameter name="adOrgId" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND p.AD_ORG_ID = TO_NUMBER(?) "/>
     <Parameter name="ischarge" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND p.ISPAID = ? "/>
     <Parameter name="invoice" optional="true" after="AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)" text=" AND EXISTS (SELECT 1 FROM C_INVOICE WHERE p.C_INVOICE_ID = C_INVOICE.C_INVOICE_ID AND DOCUMENTNO LIKE TO_CHAR(?))"/>
   </SqlMethod>
@@ -78,7 +78,7 @@
       <![CDATA[
         SELECT COUNT(*) 
         FROM C_DEBT_Payment_v p 
-        WHERE p.C_Debt_Payment_ID = ? 
+        WHERE p.C_Debt_Payment_ID = TO_NUMBER(?) 
         AND C_DEBT_PAYMENT_STATUS(p.C_Settlement_Cancel_ID, p.Cancel_Processed, p.Generate_Processed, 
         p.IsPaid, p.IsValid, p.C_CashLine_ID, p.C_BankStatementLine_ID) IN ('P', 'A') 
         AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID)
@@ -89,7 +89,7 @@
   <SqlMethod name="bpartner" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID=?
+      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -110,23 +110,23 @@
         SELECT TO_NUMBER(?),TO_NUMBER(?),p.AD_ORG_ID, 
                'Y', now(), TO_NUMBER(?), 
                now(), TO_NUMBER(?), TO_NUMBER(?), 
-               TO_DATE(?), TO_DATE(?), (SELECT (COALESCE(Max(Line),0))+10 FROM C_BankStatementLine WHERE C_BankStatement_ID=?), 'N', 
+               TO_DATE(?), TO_DATE(?), (SELECT (COALESCE(Max(Line),0))+10 FROM C_BankStatementLine WHERE C_BankStatement_ID = TO_NUMBER(?)), 'N', 
                p.C_Debt_Payment_ID, Description, 
                C_Currency_Convert(p.Amount,p.C_Currency_ID, (SELECT A.C_CURRENCY_ID
                                                               FROM C_BANKSTATEMENT S, C_BANKACCOUNT A 
                                                               WHERE S.C_BANKACCOUNT_ID = A.C_BANKACCOUNT_ID 
-                                                              AND S.C_BankStatement_ID = ?),TO_DATE(?),null,p.AD_Client_ID,p.AD_Org_ID),
+                                                              AND S.C_BankStatement_ID = TO_NUMBER(?)),TO_DATE(?),null,p.AD_Client_ID,p.AD_Org_ID),
                TO_NUMBER(?),
                (SELECT A.C_CURRENCY_ID
                   FROM C_BANKSTATEMENT S, C_BANKACCOUNT A 
                   WHERE S.C_BANKACCOUNT_ID = A.C_BANKACCOUNT_ID 
-                  AND S.C_BankStatement_ID = ?), 
+                  AND S.C_BankStatement_ID = TO_NUMBER(?)), 
                C_Currency_Convert(p.Amount,p.C_Currency_ID, (SELECT A.C_CURRENCY_ID
                                                                               FROM C_BANKSTATEMENT S, C_BANKACCOUNT A 
                                                                               WHERE S.C_BANKACCOUNT_ID = A.C_BANKACCOUNT_ID 
-                                                                              AND S.C_BankStatement_ID = ?),TO_DATE(?),null,p.AD_Client_ID,p.AD_Org_ID)- TO_NUMBER(?)
+                                                                              AND S.C_BankStatement_ID = TO_NUMBER(?)),TO_DATE(?),null,p.AD_Client_ID,p.AD_Org_ID)- TO_NUMBER(?)
         FROM C_Debt_Payment_v p 
-        WHERE p.C_Debt_Payment_ID=?
+        WHERE p.C_Debt_Payment_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cBankstatementlineId"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_CRemittance_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_CRemittance_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -72,7 +72,7 @@
     <Parameter name="userClient" optional="true" type="replace" after="AND DP.AD_CLIENT_ID IN (" text="'1'"/>
     <Parameter name="userOrg" optional="true" type="replace" after="AND DP.AD_ORG_ID IN (" text="'1'"/>    
     <Parameter name="adOrgId" optional="true" type="replace" after="AND  DP.AD_ORG_ID IN (" text="'2'"/>    
-    <Parameter name="cBPartnerId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.C_BPARTNER_ID = ? "/>
+    <Parameter name="cBPartnerId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.C_BPARTNER_ID = TO_NUMBER(?) "/>
     <Parameter name="paymentrule" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.PAYMENTRULE = ? "/>
     <Parameter name="planneddateFrom" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.DATEPLANNED >= TO_DATE(?) ]]></Parameter>
     <Parameter name="planneddateTo" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.DATEPLANNED <= TO_DATE(?) ]]></Parameter>
@@ -89,7 +89,7 @@
   <SqlMethod name="bpartner" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID=?
+      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -98,7 +98,7 @@
     <Sql><![CDATA[
       SELECT COUNT(*) 
       FROM C_DEBT_PAYMENT DP 
-      WHERE DP.C_DEBT_PAYMENT_ID = ? 
+      WHERE DP.C_DEBT_PAYMENT_ID = TO_NUMBER(?) 
       AND C_DEBT_PAYMENT_STATUS(DP.C_Settlement_Cancel_ID, DP.Cancel_Processed, DP.Generate_Processed, 
       DP.IsPaid, DP.IsValid, DP.C_CashLine_ID, DP.C_BankStatementLine_ID)='P' 
       AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE DP.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID) 
@@ -115,7 +115,7 @@
          SELECT TO_NUMBER(?),TO_NUMBER(?), AD_ORG_ID ,'Y', 
                 now(), TO_NUMBER(?), now(), TO_NUMBER(?), TO_NUMBER(?),TO_NUMBER(?), C_DEBT_PAYMENT_ID
                 FROM C_DEBT_PAYMENT
-                WHERE C_DEBT_PAYMENT_ID = ?
+                WHERE C_DEBT_PAYMENT_ID = TO_NUMBER(?)
         ]]>
     </Sql>
     <Parameter name="LineID"/>
@@ -134,7 +134,7 @@
       <![CDATA[
           SELECT COALESCE(MAX(LINE),0) AS LINE
             FROM C_REMITTANCELINE 
-           WHERE C_REMITTANCE_ID = ?
+           WHERE C_REMITTANCE_ID = TO_NUMBER(?)
         ]]>
     </Sql>
     <Parameter name="remittaceID"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_DPManagement_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_DPManagement_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -68,7 +68,7 @@
     <Parameter name="userClient" optional="true" type="replace" after="AND DP.AD_CLIENT_ID IN (" text="'1'"/>
     <Parameter name="userOrg" optional="true" type="replace" after="AND DP.AD_ORG_ID IN (" text="'1'"/>
     
-    <Parameter name="cBPartnerId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.C_BPARTNER_ID = ? "/>
+    <Parameter name="cBPartnerId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.C_BPARTNER_ID = TO_NUMBER(?) "/>
     <Parameter name="paymentrule" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.PAYMENTRULE = ? "/>
     <Parameter name="planneddateFrom" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.DATEPLANNED >= TO_DATE(?) ]]></Parameter>
     <Parameter name="planneddateTo" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.DATEPLANNED <= TO_DATE(?) ]]></Parameter>
@@ -77,13 +77,13 @@
     <Parameter name="amountTo" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.AMOUNT <= ? ]]></Parameter>
     <Parameter name="amount" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND ABS(DP.AMOUNT) < ? ]]></Parameter>
     <Parameter name="statusFrom" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.STATUS = ? ]]></Parameter>
-    <Parameter name="adOrgId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.AD_Org_ID = ? "/>
+    <Parameter name="adOrgId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.AD_Org_ID = TO_NUMBER(?) "/>
   </SqlMethod>
   
   <SqlMethod name="bpartner" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID=?
+      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -92,7 +92,7 @@
     <Sql><![CDATA[
       SELECT COUNT(*) 
       FROM C_DEBT_PAYMENT DP 
-      WHERE DP.C_DEBT_PAYMENT_ID = ? 
+      WHERE DP.C_DEBT_PAYMENT_ID = TO_NUMBER(?) 
       AND C_DEBT_PAYMENT_STATUS(DP.C_Settlement_Cancel_ID, DP.Cancel_Processed, DP.Generate_Processed, 
       DP.IsPaid, DP.IsValid, DP.C_CashLine_ID, DP.C_BankStatementLine_ID)='P' 
       AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE DP.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID) 
@@ -108,7 +108,7 @@
                                          CREATED, CREATEDBY, UPDATED, UPDATEDBY, C_DP_MANAGEMENT_ID, STATUS_TO,C_DEBT_PAYMENT_ID, LINE)
         SELECT TO_NUMBER(?),TO_NUMBER(?), ad_org_id,'Y', now(), TO_NUMBER(?), now(), TO_NUMBER(?), TO_NUMBER(?),?,C_DEBT_PAYMENT_ID, TO_NUMBER(?)
         FROM C_DEBT_PAYMENT
-        WHERE C_DEBT_PAYMENT_ID = ?
+        WHERE C_DEBT_PAYMENT_ID = TO_NUMBER(?)
 
       ]]>
     </Sql>
@@ -127,7 +127,7 @@
       <![CDATA[
 	    SELECT COALESCE(MAX(LINE),0) AS LINE
 		  FROM C_DP_ManagementLine
-		 WHERE C_DP_MANAGEMENT_ID = ?
+		 WHERE C_DP_MANAGEMENT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="dpmId"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Invoice_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Invoice_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -43,7 +43,7 @@
         AND o.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID=uom.C_UOM_ID
         AND l.M_Product_ID=p.M_Product_ID
-        AND l.C_Order_ID = ? 
+        AND l.C_Order_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal, l.QtyOrdered,l.C_UOM_ID,
         uom.UOMSymbol,l.M_Product_ID,p.NAME,l.Line,l.C_OrderLine_ID, l.ad_org_id
         HAVING (l.QtyOrdered-SUM(COALESCE(m.Qty,0))) <> 0
@@ -66,7 +66,7 @@
         AND o.DocStatus IN ('CL','CO') 
         AND o.AD_Client_ID IN ('1') 
         AND o.AD_Org_ID IN ('1')
-        AND o.C_BPartner_ID = ?
+        AND o.C_BPartner_ID = TO_NUMBER(?)
         AND EXISTS (SELECT 1 
                      FROM C_ORDERLINE l left join M_MATCHPO m on  l.C_OrderLine_ID=m.C_OrderLine_ID
                                                               and m.C_InvoiceLine_ID IS NOT NULL  
@@ -95,7 +95,7 @@
         AND ic.AD_Client_ID IN ('1') 
         AND ic.AD_Org_ID IN ('1') 
         AND l.M_Product_ID=p.M_Product_ID 
-        AND ic.C_Order_ID = ? 
+        AND ic.C_Order_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal, l.QtyOrdered,
         l.C_UOM_ID,uom.UOMSymbol,l.M_Product_ID,p.NAME,l.Line,l.C_OrderLine_ID, l.QTYINVOICED, l.ad_org_id
         ORDER BY NAME, l.Line
@@ -116,7 +116,7 @@
         WHERE o.C_ORDER_ID = ic.C_ORDER_ID 
         AND ic.AD_Client_ID IN ('1') 
         AND ic.AD_Org_ID IN ('1') 
-        AND ic.C_BPartner_ID = ? 
+        AND ic.C_BPartner_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal 
         ORDER BY NAME
       ]]>
@@ -145,7 +145,7 @@
         AND o.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID=uom.C_UOM_ID 
         AND l.M_Product_ID=p.M_Product_ID  
-        AND l.C_Order_ID = ? 
+        AND l.C_Order_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal, l.QtyOrdered,l.C_UOM_ID,
         uom.UOMSymbol, uomt.UOMSYMBOL,l.M_Product_ID,p.NAME,l.Line,l.C_OrderLine_ID 
         HAVING (l.QtyOrdered-SUM(COALESCE(m.Qty,0))) <> 0
@@ -175,7 +175,7 @@
         AND ic.AD_Client_ID IN ('1') 
         AND ic.AD_Org_ID IN ('1') 
         AND l.M_Product_ID=p.M_Product_ID
-        AND ic.C_Order_ID = ? 
+        AND ic.C_Order_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal, l.QtyOrdered,
         l.C_UOM_ID,uom.UOMSymbol, uomt.UOMSymbol,l.M_Product_ID,p.NAME,l.Line,l.C_OrderLine_ID, l.QTYINVOICED 
         ORDER BY NAME, l.Line
@@ -264,7 +264,7 @@
         AND s.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID=uom.C_UOM_ID 
         AND l.M_Product_ID=p.M_Product_ID 
-        AND l.M_InOut_ID=? 
+        AND l.M_InOut_ID = TO_NUMBER(?) 
         GROUP BY s.M_InOut_ID, s.DocumentNo, s.MovementDate, l.MovementQty,l.C_UOM_ID,uom.UOMSymbol,
         l.M_Product_ID,ma.serno,p.NAME, l.M_InOutLine_ID,l.Line,l.C_OrderLine_ID 
         HAVING  (l.MovementQty-SUM(COALESCE(mi.Qty,0))) <> 0
@@ -287,7 +287,7 @@
         AND s.DocStatus IN ('CL','CO') 
         AND s.AD_Client_ID IN ('1') 
         AND s.AD_Org_ID IN ('1') 
-        AND s.C_BPartner_ID = ? 
+        AND s.C_BPartner_ID = TO_NUMBER(?) 
         AND EXISTS (SELECT 1 
                      FROM M_INOUTLINE l left join M_MATCHINV mi on l.M_InOutLine_ID=mi.M_InOutLine_ID
                       WHERE l.M_INOUT_ID = s.M_INOUT_ID 
@@ -320,7 +320,7 @@
         AND l.C_UOM_ID=uom.C_UOM_ID 
         AND l.M_Product_ID=p.M_Product_ID 
         AND l.isinvoiced = 'N' 
-        AND l.M_InOut_ID=?
+        AND l.M_InOut_ID = TO_NUMBER(?)
         GROUP BY s.M_InOut_ID, s.DocumentNo, s.MovementDate, l.MovementQty,l.C_UOM_ID,uom.UOMSymbol,
         l.M_Product_ID,p.NAME, ma.serno, l.M_InOutLine_ID,l.Line,l.C_OrderLine_ID
         ORDER BY NAME, l.Line
@@ -342,7 +342,7 @@
         AND s.DocStatus IN ('CL','CO') 
         AND s.AD_Client_ID IN ('1') 
         AND s.AD_Org_ID IN ('1')
-        AND s.C_BPartner_ID = ?  
+        AND s.C_BPartner_ID = TO_NUMBER(?)  
         AND EXISTS (SELECT 1 FROM M_INOUTLINE l 
         WHERE l.M_INOUT_ID = s.M_INOUT_ID 
         AND l.isinvoiced = 'N') 
@@ -374,7 +374,7 @@
         AND s.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID=uom.C_UOM_ID 
         AND l.M_Product_ID=p.M_Product_ID 
-        AND l.M_InOut_ID=? 
+        AND l.M_InOut_ID = TO_NUMBER(?) 
         GROUP BY s.M_InOut_ID, s.DocumentNo, s.MovementDate, l.MovementQty,l.C_UOM_ID,uom.UOMSymbol, uomt.UOMSymbol,
         l.M_Product_ID,p.NAME, ma.serno, l.M_InOutLine_ID,l.Line,l.C_OrderLine_ID 
         HAVING  (l.MovementQty-SUM(COALESCE(mi.Qty,0))) <> 0
@@ -408,7 +408,7 @@
         AND l.C_UOM_ID=uom.C_UOM_ID 
         AND l.M_Product_ID=p.M_Product_ID 
         AND l.isinvoiced = 'N' 
-        AND l.M_InOut_ID=? 
+        AND l.M_InOut_ID = TO_NUMBER(?) 
         GROUP BY s.M_InOut_ID, s.DocumentNo, s.MovementDate, l.MovementQty,l.C_UOM_ID,uom.UOMSymbol, uomt.UOMSymbol,
         l.M_Product_ID,p.NAME,ma.serno, l.M_InOutLine_ID,l.Line,l.C_OrderLine_ID
         ORDER BY NAME, l.Line
@@ -467,7 +467,7 @@
       SELECT plv.M_PriceList_Version_ID AS ID
       FROM M_PRICELIST pl,M_PRICELIST_VERSION plv 
       WHERE pl.M_PriceList_ID=plv.M_PriceList_ID AND plv.IsActive='Y'
-      AND plv.ValidFrom <= TO_DATE(?) AND pl.M_PriceList_ID=? 
+      AND plv.ValidFrom <= TO_DATE(?) AND pl.M_PriceList_ID = TO_NUMBER(?) 
       ORDER BY plv.ValidFrom DESC
       ]]>
     </Sql>
@@ -481,7 +481,7 @@
       <![CDATA[
       SELECT PriceActual,PriceList,PriceLimit,Description, '' AS C_ORDERLINE_ID, PriceStd
       FROM C_OrderLine 
-      WHERE C_OrderLine_ID=?
+      WHERE C_OrderLine_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cOrderlineId"/>
@@ -496,8 +496,8 @@
       M_GET_OFFER_PRICE(M_GET_OFFER(to_date(?), to_number(?), pp.M_Product_ID), BOM_PriceStd(pp.M_Product_ID,pp.M_PriceList_Version_ID)) AS PriceActual, 
       M_GET_OFFER(to_date(?), to_number(?), pp.M_Product_ID) AS M_Offer_ID
       FROM M_PRODUCTPRICE pp 
-      WHERE pp.M_Product_ID=? 
-      AND pp.M_PriceList_Version_ID=? 
+      WHERE pp.M_Product_ID = TO_NUMBER(?) 
+      AND pp.M_PriceList_Version_ID = TO_NUMBER(?) 
       ]]>
     </Sql>
     <Parameter name="dateinvoiced"/>
@@ -514,7 +514,7 @@
       Created,CreatedBy,Updated,UpdatedBy, C_OrderLine_ID,M_InOutLine_ID, Line,Description, M_Product_ID,
       C_UOM_ID,QtyInvoiced, PriceList,PriceActual,PriceLimit, LineNetAmt,ChargeAmt,C_Tax_ID, QuantityOrder, M_Product_UOM_ID,
       M_Attributesetinstance_ID, PriceStd)
-      VALUES (TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 'Y', now(), TO_NUMBER(?), now(), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), (SELECT (COALESCE(Max(Line),0))+10 FROM C_InvoiceLine WHERE C_Invoice_ID=?), ?, 
+      VALUES (TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 'Y', now(), TO_NUMBER(?), now(), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), (SELECT (COALESCE(Max(Line),0))+10 FROM C_InvoiceLine WHERE C_Invoice_ID = TO_NUMBER(?)), ?, 
       TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 0, TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?))
     </Sql>
     <Parameter name="cInvoicelineId"/>
@@ -544,7 +544,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
       UPDATE C_Invoice SET C_Order_ID=TO_NUMBER(?)
-      WHERE C_Invoice_ID = ?
+      WHERE C_Invoice_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="cOrderId"/>
     <Parameter name="cInvoiceId"/>
@@ -553,8 +553,8 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql> <![CDATA[
       UPDATE C_INVOICE SET C_Order_ID=NULL
-      WHERE C_Invoice_ID=?
-      AND C_Order_ID IS NOT NULL AND C_Order_ID <> ?
+      WHERE C_Invoice_ID = TO_NUMBER(?)
+      AND C_Order_ID IS NOT NULL AND C_Order_ID <> TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="cInvoiceId"/>
     <Parameter name="cOrderId"/>
@@ -564,7 +564,7 @@
     <Sql><![CDATA[
       SELECT C_Project_ID
       FROM C_INVOICE
-      WHERE C_INVOICE_ID = ? 
+      WHERE C_INVOICE_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cInvoiceId"/>
   </SqlMethod>
@@ -573,7 +573,7 @@
     <Sql><![CDATA[
       SELECT C_Tax_ID
       FROM C_ORDERLINE
-      WHERE C_ORDERLINE_ID = ? 
+      WHERE C_ORDERLINE_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cOrderLineId"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Settlement_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Settlement_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -58,7 +58,7 @@
     <Parameter name="userClient" optional="true" type="replace" after="AND DP.AD_CLIENT_ID IN (" text="'1'"/>
     <Parameter name="userOrg" optional="true" type="replace" after="AND DP.AD_ORG_ID IN (" text="'1'"/>
     <Parameter name="language"/>
-    <Parameter name="cBPartnerId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.C_BPARTNER_ID = ? "/>
+    <Parameter name="cBPartnerId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.C_BPARTNER_ID = TO_NUMBER(?) "/>
     <Parameter name="paymentrule" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.PAYMENTRULE = ? "/>
     <Parameter name="planneddateFrom" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.DATEPLANNED >= TO_DATE(?) ]]></Parameter>
     <Parameter name="planneddateTo" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.DATEPLANNED <= TO_DATE(?) ]]></Parameter>
@@ -66,12 +66,12 @@
     <Parameter name="amountFrom" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.AMOUNT >= ? ]]></Parameter>
     <Parameter name="amountTo" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND DP.AMOUNT <= ? ]]></Parameter>
     <Parameter name="amount" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID "><![CDATA[ AND ABS(DP.AMOUNT) < ? ]]></Parameter>
-    <Parameter name="adOrgId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.AD_Org_ID = ? "/>
+    <Parameter name="adOrgId" optional="true" after="AND DP.C_CURRENCY_ID = C.C_CURRENCY_ID " text=" AND DP.AD_Org_ID = TO_NUMBER(?) "/>
   </SqlMethod>
   <SqlMethod name="bpartner" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID=?
+      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -80,7 +80,7 @@
     <Sql><![CDATA[
       SELECT COUNT(*) 
       FROM C_DEBT_PAYMENT DP 
-      WHERE DP.C_DEBT_PAYMENT_ID = ? 
+      WHERE DP.C_DEBT_PAYMENT_ID = TO_NUMBER(?) 
       AND C_DEBT_PAYMENT_STATUS(DP.C_Settlement_Cancel_ID, DP.Cancel_Processed, DP.Generate_Processed, 
       DP.IsPaid, DP.IsValid, DP.C_CashLine_ID, DP.C_BankStatementLine_ID)='P' 
       AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE DP.C_DEBT_Payment_ID=l.C_DEBT_PAYMENT_ID) 
@@ -93,7 +93,7 @@
     <Sql>
       <![CDATA[
         UPDATE C_DEBT_PAYMENT SET UPDATED=now(), UPDATEDBY=TO_NUMBER(?), C_SETTLEMENT_CANCEL_ID=TO_NUMBER(?), WRITEOFFAMT=TO_NUMBER(?), ISPAID=? 
-        WHERE C_DEBT_PAYMENT_ID = ?
+        WHERE C_DEBT_PAYMENT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="adUserId"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Shipment_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Shipment_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -42,7 +42,7 @@
         AND o.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID=uom.C_UOM_ID
         AND l.M_Product_ID=p.M_Product_ID
-        AND l.C_Order_ID = ? 
+        AND l.C_Order_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal, l.QtyOrdered,l.qtydelivered, 
         l.C_UOM_ID,uom.UOMSymbol,l.M_Product_ID,p.NAME,l.Line,l.C_OrderLine_ID, l.ad_org_id
         HAVING (l.QtyOrdered-SUM(COALESCE(m.Qty,0))) <> 0
@@ -65,7 +65,7 @@
         AND o.DocStatus IN ('CL','CO') 
         AND o.AD_Client_ID IN ('1') 
         AND o.AD_Org_ID IN ('1') 
-        AND o.C_BPartner_ID = ? 
+        AND o.C_BPartner_ID = TO_NUMBER(?) 
         AND EXISTS (SELECT 1 
                       FROM C_ORDERLINE l left join M_MATCHPO m on l.C_OrderLine_ID=m.C_OrderLine_ID
                                                               and  m.M_InOutLine_ID IS NOT NULL
@@ -95,7 +95,7 @@
         AND ic.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID = uom.C_UOM_ID
         AND l.M_Product_ID=p.M_Product_ID 
-        AND ic.C_Order_ID = ? 
+        AND ic.C_Order_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal, l.QtyOrdered,l.qtydelivered, 
         l.C_UOM_ID,uom.UOMSymbol,l.M_Product_ID,p.NAME,l.Line,l.C_OrderLine_ID, l.ad_org_id
         ORDER BY NAME, l.Line
@@ -116,7 +116,7 @@
         WHERE o.C_ORDER_ID = ic.C_ORDER_ID 
         AND ic.AD_Client_ID IN ('1') 
         AND ic.AD_Org_ID IN ('1') 
-        AND ic.C_BPartner_ID = ? 
+        AND ic.C_BPartner_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal 
         ORDER BY NAME
       ]]>
@@ -146,7 +146,7 @@
         AND o.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID=uom.C_UOM_ID 
         AND l.M_Product_ID=p.M_Product_ID
-        AND l.C_Order_ID = ? 
+        AND l.C_Order_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal, l.QtyOrdered,l.qtydelivered, 
         l.C_UOM_ID,uom.UOMSymbol, uomt.UOMSymbol,l.M_Product_ID,p.NAME,l.Line,l.C_OrderLine_ID 
         HAVING (l.QtyOrdered-SUM(COALESCE(m.Qty,0))) <> 0
@@ -176,7 +176,7 @@
         AND ic.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID = uom.C_UOM_ID 
         AND l.M_Product_ID=p.M_Product_ID 
-        AND ic.C_Order_ID = ? 
+        AND ic.C_Order_ID = TO_NUMBER(?) 
         GROUP BY o.C_ORDER_ID, o.DocumentNo, o.DateOrdered, o.GrandTotal, l.QtyOrdered,l.qtydelivered, 
         l.C_UOM_ID,uom.UOMSymbol,uomt.UOMSymbol,l.M_Product_ID,p.NAME,l.Line,l.C_OrderLine_ID 
         ORDER BY NAME, l.Line
@@ -252,7 +252,7 @@
         AND i.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID=uom.C_UOM_ID 
         AND l.M_Product_ID=p.M_Product_ID 
-        AND l.C_Invoice_ID = ? 
+        AND l.C_Invoice_ID = TO_NUMBER(?) 
         GROUP BY i.C_Invoice_ID, i.DocumentNo, DateInvoiced, GrandTotal, l.QtyInvoiced, 
         l.C_UOM_ID,uom.UOMSymbol,l.M_Product_ID,p.NAME, l.C_InvoiceLine_ID,l.Line,l.C_OrderLine_ID 
         HAVING (l.QtyInvoiced-SUM(COALESCE(mi.Qty,0))) <> 0 
@@ -275,7 +275,7 @@
         AND i.DocStatus IN ('CL','CO') 
         AND i.AD_Client_ID IN ('1') 
         AND i.AD_Org_ID IN ('1')
-        AND i.C_BPartner_ID = ?  
+        AND i.C_BPartner_ID = TO_NUMBER(?)  
         AND EXISTS (SELECT 1 
                      FROM C_INVOICELINE l left join M_MATCHINV mi on l.C_InvoiceLine_ID=mi.C_InvoiceLine_ID
                       WHERE l.C_INVOICE_ID = i.C_INVOICE_ID 
@@ -308,7 +308,7 @@
         AND i.AD_Org_ID IN ('1') 
         AND l.C_UOM_ID=uom.C_UOM_ID 
         AND l.M_Product_ID=p.M_Product_ID 
-        AND l.C_Invoice_ID = ? 
+        AND l.C_Invoice_ID = TO_NUMBER(?) 
         GROUP BY i.C_Invoice_ID, i.DocumentNo, DateInvoiced, GrandTotal, l.QtyInvoiced, 
         l.C_UOM_ID,uom.UOMSymbol, uomt.UOMSymbol,l.M_Product_ID,p.NAME, l.C_InvoiceLine_ID,l.Line,l.C_OrderLine_ID 
         HAVING (l.QtyInvoiced-SUM(COALESCE(mi.Qty,0))) <> 0 
@@ -353,21 +353,21 @@
   <SqlMethod name="selectLocator" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT VALUE FROM M_LOCATOR WHERE M_LOCATOR_ID=?
+      SELECT VALUE FROM M_LOCATOR WHERE M_LOCATOR_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mLocatorId"/>
   </SqlMethod>
   <SqlMethod name="selectBPartner" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID=?
+      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
   <SqlMethod name="isInvoiced" type="preparedStatement" connection="true" return="String" default="N">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT PROCESSED FROM C_INVOICE WHERE C_INVOICE_ID=(SELECT C_INVOICE_ID FROM C_INVOICELINE WHERE C_INVOICELINE_ID = ?)
+      SELECT PROCESSED FROM C_INVOICE WHERE C_INVOICE_ID=(SELECT C_INVOICE_ID FROM C_INVOICELINE WHERE C_INVOICELINE_ID = TO_NUMBER(?))
     </Sql>
     <Parameter name="cInvoicelineId"/>
   </SqlMethod>
@@ -377,7 +377,7 @@
       INSERT INTO M_INOUTLINE (M_InOutLine_ID,M_InOut_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,
       UpdatedBy, Line,Description, M_Product_ID,C_UOM_ID,MovementQty,C_OrderLine_ID,M_Locator_ID,IsInvoiced, QUANTITYORDER, 
       M_PRODUCT_UOM_ID, M_ATTRIBUTESETINSTANCE_ID)
-      VALUES (TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 'Y', now(), TO_NUMBER(?), now(), TO_NUMBER(?), (SELECT (COALESCE(Max(Line),0))+10 FROM M_InOutLine WHERE M_InOut_ID=?), 
+      VALUES (TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 'Y', now(), TO_NUMBER(?), now(), TO_NUMBER(?), (SELECT (COALESCE(Max(Line),0))+10 FROM M_InOutLine WHERE M_InOut_ID = TO_NUMBER(?)), 
       NULL, TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), ?, TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?))
     </Sql>
     <Parameter name="mInoutlineId"/>
@@ -401,7 +401,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       UPDATE C_InvoiceLine SET M_InoutLine_ID= TO_NUMBER(?)
-      WHERE C_InvoiceLine_ID= ? 
+      WHERE C_InvoiceLine_ID = TO_NUMBER(?) 
       AND M_InOutLine_ID IS NULL
     </Sql>
     <Parameter name="mInoutlineId"/>
@@ -411,7 +411,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       UPDATE C_InvoiceLine SET M_InoutLine_ID= TO_NUMBER(?)
-      WHERE C_OrderLine_ID= ? 
+      WHERE C_OrderLine_ID = TO_NUMBER(?) 
       AND M_InOutLine_ID IS NULL
     </Sql>
     <Parameter name="mInoutlineId"/>
@@ -420,8 +420,8 @@
   <SqlMethod name="updateC_Order_ID" type="preparedStatement" connection="true" return="rowCount">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      UPDATE M_InOut SET C_Order_ID= TO_NUMBER(?), DATEORDERED = (SELECT DATEORDERED FROM C_ORDER WHERE C_ORDER_ID=?)
-      WHERE M_InOut_ID=?
+      UPDATE M_InOut SET C_Order_ID= TO_NUMBER(?), DATEORDERED = (SELECT DATEORDERED FROM C_ORDER WHERE C_ORDER_ID = TO_NUMBER(?))
+      WHERE M_InOut_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cOrderId"/>
     <Parameter name="cOrderId"/>
@@ -431,7 +431,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       UPDATE M_InOut SET C_Invoice_ID= TO_NUMBER(?)
-      WHERE M_InOut_ID= ?
+      WHERE M_InOut_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cInvoiceId"/>
     <Parameter name="mInoutId"/>
@@ -440,9 +440,9 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
       UPDATE M_InOut SET C_Order_ID=NULL 
-      WHERE M_InOut_ID= ?
+      WHERE M_InOut_ID = TO_NUMBER(?)
       AND C_Order_ID IS NOT NULL 
-      AND C_Order_ID <> ?
+      AND C_Order_ID <> TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="mInoutId"/>
     <Parameter name="cOrderId"/>
@@ -451,9 +451,9 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
       UPDATE M_InOut SET C_Invoice_ID=NULL 
-      WHERE M_InOut_ID= ?
+      WHERE M_InOut_ID = TO_NUMBER(?)
       AND C_Invoice_ID IS NOT NULL 
-      AND C_Invoice_ID <> ?
+      AND C_Invoice_ID <> TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="mInoutId"/>
     <Parameter name="cInvoiceId"/>
@@ -461,7 +461,7 @@
   <SqlMethod name="multiplyRate" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT MULTIPLYRATE FROM C_UOM_CONVERSION WHERE C_UOM_ID = ? AND C_UOM_TO_ID = ?
+      SELECT MULTIPLYRATE FROM C_UOM_CONVERSION WHERE C_UOM_ID = TO_NUMBER(?) AND C_UOM_TO_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductUOM"/>
     <Parameter name="mProduct"/>
@@ -469,7 +469,7 @@
   <SqlMethod name="divideRate" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT DIVIDERATE FROM C_UOM_CONVERSION WHERE C_UOM_ID = ? AND C_UOM_TO_ID = ?
+      SELECT DIVIDERATE FROM C_UOM_CONVERSION WHERE C_UOM_ID = TO_NUMBER(?) AND C_UOM_TO_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProduct"/>
     <Parameter name="mProductUOM"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,11 +30,11 @@
         SELECT C_PERIOD_ID AS ID, NAME, '' AS TOTALAMTDR, '' AS TOTALAMTCR, '' AS ACCOUNT_ID, '' as org, '' as acctvalue, '' as acctdescription, '' as value,
         '' as c_bpartner_id, '' as record_id2, '' as m_product_id, '' as a_asset_id
         FROM C_PERIOD
-        WHERE C_YEAR_ID = ?
+        WHERE C_YEAR_ID = TO_NUMBER(?)
         AND PERIODNO>=(
                 SELECT MIN(PERIODNO)
                 FROM C_PERIOD
-                WHERE C_YEAR_ID = ?
+                WHERE C_YEAR_ID = TO_NUMBER(?)
                 AND REG_FACT_ACCT_GROUP_ID IS NULL)
         ORDER BY PERIODNO
       ]]>
@@ -50,16 +50,16 @@
         (CASE SIGN(SUM(AMTACCTCR)-SUM(AMTACCTDR)) WHEN -1 THEN 0 ELSE (SUM(AMTACCTCR)-SUM(AMTACCTDR)) END) AS TOTALAMTDR, ACCOUNT_ID, ACCTDESCRIPTION, ACCTVALUE,
         RECORD_ID2, C_BPARTNER_ID, M_PRODUCT_ID, A_ASSET_ID
         FROM FACT_ACCT
-        WHERE C_PERIOD_ID BETWEEN (SELECT C_PERIOD_ID FROM  C_PERIOD WHERE C_YEAR_ID = ? AND PERIODNO = (SELECT MIN(PERIODNO)
+        WHERE C_PERIOD_ID BETWEEN (SELECT C_PERIOD_ID FROM  C_PERIOD WHERE C_YEAR_ID = TO_NUMBER(?) AND PERIODNO = (SELECT MIN(PERIODNO)
                 FROM C_PERIOD
-                WHERE C_YEAR_ID = ?
+                WHERE C_YEAR_ID = TO_NUMBER(?)
                 AND REG_FACT_ACCT_GROUP_ID IS NULL)) AND ?
         AND ACCOUNT_ID IN (SELECT ACCOUNT_ID 
                 FROM C_ELEMENTVALUE, C_VALIDCOMBINATION
                 WHERE C_VALIDCOMBINATION.ACCOUNT_ID = C_ELEMENTVALUE.C_ELEMENTVALUE_ID
                 AND C_ELEMENTVALUE.ACCOUNTTYPE = ?)
-        AND AD_ORG_ID = ?
-        AND C_ACCTSCHEMA_ID = ?
+        AND AD_ORG_ID = TO_NUMBER(?)
+        AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
         GROUP BY ACCOUNT_ID, ACCTDESCRIPTION, ACCTVALUE, RECORD_ID2, C_BPARTNER_ID, M_PRODUCT_ID, A_ASSET_ID
       ]]>
     </Sql>
@@ -78,16 +78,16 @@
         (CASE sign(SUM(AMTACCTCR)-sum(amtacctdr)) WHEN -1 THEN 0 ELSE (SUM(AMTACCTCR)-sum(amtacctdr)) END) AS TOTALAMTDR, ACCOUNT_ID, 
         ACCTDESCRIPTION, ACCTVALUE, RECORD_ID2, C_BPARTNER_ID, M_PRODUCT_ID, A_ASSET_ID
         FROM FACT_ACCT
-        WHERE C_PERIOD_ID BETWEEN (SELECT C_PERIOD_ID FROM  C_PERIOD WHERE C_YEAR_ID = ? AND PERIODNO = (SELECT MIN(PERIODNO)
+        WHERE C_PERIOD_ID BETWEEN (SELECT C_PERIOD_ID FROM  C_PERIOD WHERE C_YEAR_ID = TO_NUMBER(?) AND PERIODNO = (SELECT MIN(PERIODNO)
                 FROM C_PERIOD
-                WHERE C_YEAR_ID = ?
+                WHERE C_YEAR_ID = TO_NUMBER(?)
                 AND CLOSE_FACT_ACCT_GROUP_ID IS NULL)) AND ?
         AND ACCOUNT_ID IN (SELECT ACCOUNT_ID 
                 FROM C_ELEMENTVALUE, C_VALIDCOMBINATION
                 WHERE C_VALIDCOMBINATION.ACCOUNT_ID = C_ELEMENTVALUE.C_ELEMENTVALUE_ID
                 AND C_ELEMENTVALUE.ACCOUNTTYPE IN ('1'))
-        AND AD_ORG_ID = ?
-        AND C_ACCTSCHEMA_ID = ?
+        AND AD_ORG_ID = TO_NUMBER(?)
+        AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
         GROUP BY ACCOUNT_ID, ACCTDESCRIPTION, ACCTVALUE, RECORD_ID2, C_BPARTNER_ID, M_PRODUCT_ID, A_ASSET_ID
       ]]>
     </Sql>
@@ -142,7 +142,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT ENDDATE FROM C_PERIOD WHERE C_PERIOD_ID = ?
+        SELECT ENDDATE FROM C_PERIOD WHERE C_PERIOD_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cPeriodId"/>
@@ -159,7 +159,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT C_CURRENCY_ID FROM C_ACCTSCHEMA WHERE C_ACCTSCHEMA_ID = ?
+        SELECT C_CURRENCY_ID FROM C_ACCTSCHEMA WHERE C_ACCTSCHEMA_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cAcctschemaId"/>
@@ -172,7 +172,7 @@
       FROM C_ACCTSCHEMA_GL, C_VALIDCOMBINATION, C_ELEMENTVALUE
       WHERE C_ACCTSCHEMA_GL.INCOMESUMMARY_ACCT = C_VALIDCOMBINATION.C_VALIDCOMBINATION_ID
       AND C_VALIDCOMBINATION.ACCOUNT_ID = C_ELEMENTVALUE.C_ELEMENTVALUE_ID
-      AND C_ACCTSCHEMA_GL.C_ACCTSCHEMA_ID = ?
+      AND C_ACCTSCHEMA_GL.C_ACCTSCHEMA_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cAcctschemaId"/>
@@ -185,7 +185,7 @@
       FROM C_ACCTSCHEMA_GL, C_VALIDCOMBINATION, C_ELEMENTVALUE
       WHERE C_ACCTSCHEMA_GL.RETAINEDEARNING_ACCT = C_VALIDCOMBINATION.C_VALIDCOMBINATION_ID
       AND C_VALIDCOMBINATION.ACCOUNT_ID = C_ELEMENTVALUE.C_ELEMENTVALUE_ID
-      AND C_ACCTSCHEMA_GL.C_ACCTSCHEMA_ID = ?
+      AND C_ACCTSCHEMA_GL.C_ACCTSCHEMA_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cAcctschemaId"/>
@@ -197,8 +197,8 @@
         UPDATE C_PERIOD SET REG_FACT_ACCT_GROUP_ID = TO_NUMBER(?), UPDATED = now(), UPDATEDBY = TO_NUMBER(?)
         WHERE C_PERIOD_ID IN (SELECT C_PERIOD_ID 
                          FROM C_PERIOD 
-                         WHERE C_YEAR_ID = ?    
-                         AND PERIODNO <= (SELECT PERIODNO FROM C_PERIOD WHERE C_PERIOD_ID = ?)
+                         WHERE C_YEAR_ID = TO_NUMBER(?)    
+                         AND PERIODNO <= (SELECT PERIODNO FROM C_PERIOD WHERE C_PERIOD_ID = TO_NUMBER(?))
                          AND REG_FACT_ACCT_GROUP_ID IS NULL)
       ]]>
     </Sql>
@@ -213,7 +213,7 @@
       <![CDATA[
         SELECT C_PERIOD_ID
         FROM C_PERIOD 
-        WHERE STARTDATE = (SELECT ENDDATE + 1 FROM C_PERIOD WHERE C_PERIOD_ID = ?)
+        WHERE STARTDATE = (SELECT ENDDATE + 1 FROM C_PERIOD WHERE C_PERIOD_ID = TO_NUMBER(?))
       ]]>
     </Sql>
     <Parameter name="cPeriodId"/>
@@ -263,7 +263,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT STARTDATE FROM C_PERIOD WHERE C_PERIOD_ID = ?
+        SELECT STARTDATE FROM C_PERIOD WHERE C_PERIOD_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cPeriodId"/>
@@ -275,8 +275,8 @@
         UPDATE C_PERIOD SET CLOSE_FACT_ACCT_GROUP_ID = TO_NUMBER(?), DIVIDEUP_FACT_ACCT_GROUP_ID = TO_NUMBER(?), UPDATED = now(), UPDATEDBY = TO_NUMBER(?)
         WHERE C_PERIOD_ID IN (SELECT C_PERIOD_ID 
                          FROM C_PERIOD 
-                         WHERE C_YEAR_ID = ?
-                         AND PERIODNO <= (SELECT PERIODNO FROM C_PERIOD WHERE C_PERIOD_ID = ?)
+                         WHERE C_YEAR_ID = TO_NUMBER(?)
+                         AND PERIODNO <= (SELECT PERIODNO FROM C_PERIOD WHERE C_PERIOD_ID = TO_NUMBER(?))
                          AND CLOSE_FACT_ACCT_GROUP_ID IS NULL)
       ]]>
     </Sql>
@@ -295,7 +295,7 @@
         WHERE PeriodStatus <> 'P'
         AND C_PERIOD_ID IN (SELECT C_PERIOD_ID 
                 FROM C_PERIOD 
-                WHERE CLOSE_FACT_ACCT_GROUP_ID = ?)
+                WHERE CLOSE_FACT_ACCT_GROUP_ID = TO_NUMBER(?))
       ]]>
     </Sql>
     <Parameter name="user"/>
@@ -310,7 +310,7 @@
         AND A_R_O.ISACTIVE = 'Y' 
         AND A_R_O.AD_ROLE_ID = R.AD_ROLE_ID 
         AND R.ISACTIVE = 'Y' 
-        AND A_R_O.AD_ROLE_ID = ? 
+        AND A_R_O.AD_ROLE_ID = TO_NUMBER(?) 
         ORDER BY A_O.NAME
       ]]></Sql>
         <Parameter name="rol"/>
@@ -320,7 +320,7 @@
       <Sql><![CDATA[
         SELECT AD_ORG_id as org
         FROM AD_ORG
-        WHERE AD_CLIENT_ID = ?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?)
         AND AD_ISORGINCLUDED(AD_ORG_ID,to_number(?),AD_CLIENT_ID) <> -1
       ]]></Sql>
         <Parameter name="clientId"/>
@@ -331,7 +331,7 @@
       <Sql><![CDATA[
         SELECT C_ACCTSCHEMA_id as id
         FROM C_ACCTSCHEMA
-        WHERE AD_CLIENT_ID = ?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?)
       ]]></Sql>
         <Parameter name="clientId"/>
    </SqlMethod>
@@ -339,7 +339,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
         SELECT AD_TREE_ORG_ID FROM AD_CLIENTINFO
-        WHERE AD_CLIENT_ID = ?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="client"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_actionButton/DropCloseFactAcct_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/DropCloseFactAcct_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
         SELECT CLOSE_FACT_ACCT_GROUP_ID AS ID, GETPERIODNAME(MIN(PERIODNO), TO_NUMBER(?))|| ' - ' || GETPERIODNAME(MAX(PERIODNO),TO_NUMBER(?)) AS NAME
         FROM C_PERIOD 
         WHERE CLOSE_FACT_ACCT_GROUP_ID IS NOT NULL
-        AND C_YEAR_ID = ?
+        AND C_YEAR_ID = TO_NUMBER(?)
         GROUP BY CLOSE_FACT_ACCT_GROUP_ID
       ]]>
     </Sql>
@@ -43,7 +43,7 @@
     <Sql>
       <![CDATA[
 	UPDATE C_PERIOD SET CLOSE_FACT_ACCT_GROUP_ID = NULL
-	WHERE CLOSE_FACT_ACCT_GROUP_ID = ?
+	WHERE CLOSE_FACT_ACCT_GROUP_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="CLOSE_FACT_ACCT_GROUP_ID"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/DropRegFactAcct_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/DropRegFactAcct_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,8 +30,8 @@
         SELECT REG_FACT_ACCT_GROUP_ID AS ID, GETPERIODNAME(MIN(PERIODNO), TO_NUMBER(?))|| ' - ' || GETPERIODNAME(MAX(PERIODNO),TO_NUMBER(?)) AS NAME
         FROM C_PERIOD 
         WHERE REG_FACT_ACCT_GROUP_ID IS NOT NULL
-        AND C_YEAR_ID = ?
-        AND REG_FACT_ACCT_GROUP_ID = (select MAX(REG_FACT_ACCT_GROUP_ID) FROM C_PERIOD WHERE C_YEAR_ID = ?)
+        AND C_YEAR_ID = TO_NUMBER(?)
+        AND REG_FACT_ACCT_GROUP_ID = (select MAX(REG_FACT_ACCT_GROUP_ID) FROM C_PERIOD WHERE C_YEAR_ID = TO_NUMBER(?))
         GROUP BY REG_FACT_ACCT_GROUP_ID
       ]]>
     </Sql>
@@ -45,7 +45,7 @@
     <Sql>
       <![CDATA[
   UPDATE C_PERIOD SET REG_FACT_ACCT_GROUP_ID = NULL, UPDATED = now(), UPDATEDBY = TO_NUMBER(?)
-  WHERE REG_FACT_ACCT_GROUP_ID = ?
+  WHERE REG_FACT_ACCT_GROUP_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="user"/>
@@ -55,7 +55,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-  DELETE FROM FACT_ACCT WHERE FACT_ACCT_GROUP_ID = ?
+  DELETE FROM FACT_ACCT WHERE FACT_ACCT_GROUP_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="fact_acct_group_id"/>
@@ -69,7 +69,7 @@
         WHERE PeriodStatus <> 'P'
         AND C_PERIOD_ID IN (SELECT C_PERIOD_ID 
                 FROM C_PERIOD 
-                WHERE CLOSE_FACT_ACCT_GROUP_ID = ?)
+                WHERE CLOSE_FACT_ACCT_GROUP_ID = TO_NUMBER(?))
       ]]>
     </Sql>
     <Parameter name="user"/>
@@ -79,7 +79,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT DISTINCT CLOSE_FACT_ACCT_GROUP_ID AS ID FROM C_PERIOD WHERE REG_FACT_ACCT_GROUP_ID = ?
+        SELECT DISTINCT CLOSE_FACT_ACCT_GROUP_ID AS ID FROM C_PERIOD WHERE REG_FACT_ACCT_GROUP_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="reg_fact_acct_group_id"/>
@@ -88,7 +88,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT DISTINCT DIVIDEUP_FACT_ACCT_GROUP_ID AS ID FROM C_PERIOD WHERE REG_FACT_ACCT_GROUP_ID = ?
+        SELECT DISTINCT DIVIDEUP_FACT_ACCT_GROUP_ID AS ID FROM C_PERIOD WHERE REG_FACT_ACCT_GROUP_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="reg_fact_acct_group_id"/>
@@ -98,7 +98,7 @@
     <Sql>
       <![CDATA[
   UPDATE C_PERIOD SET CLOSE_FACT_ACCT_GROUP_ID = NULL, UPDATED = now(), UPDATEDBY = TO_NUMBER(?)
-  WHERE CLOSE_FACT_ACCT_GROUP_ID = ?
+  WHERE CLOSE_FACT_ACCT_GROUP_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="user"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues_Hours_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues_Hours_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -32,12 +32,12 @@
         from (
         select TO_CHAR(MEASUREHOUR, 'HH24:MI') as hour
                 from MA_MEASURE_TIME
-                where MA_Measure_Group_ID = ?
+                where MA_Measure_Group_ID = TO_NUMBER(?)
             union all
             select null as hour
             from ad_integer
             where value <= (select 10-count(*) from MA_Measure_time
-                   where ma_measure_group_id=?)
+                   where ma_measure_group_ID = TO_NUMBER(?))
             ORDER BY hour) A
       ]]>
       </Sql>
--- a/src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues_Values_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues_Values_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -32,15 +32,15 @@
             from MA_MEASURE_TIME t, MA_MEASURE_VALUES v, MA_CCP c
             where t.MA_MEASURE_TIME_ID = v.MA_MEASURE_TIME_ID
               and v.MA_CCP_ID = c.MA_CCP_ID 
-              and t.MA_MEASURE_GROUP_ID = ?
+              and t.MA_MEASURE_GROUP_ID = TO_NUMBER(?)
             union all
               select to_date('31/12/9999'), v.seqno, c.name || (CASE c.CRITICAL WHEN 'Y' THEN ' (PC)' ELSE '' END) AS name, ' ' as value, identific, 0 as valueid, 'hidden' as type, 'N' as valuec
               from ma_measure_time t, ma_measure_values v, ma_ccp c, 
                 (select VALUE-1 as identific from ad_INTEGER 
                  where VALUE<=(
                    select 10-count(*) from MA_Measure_time
-                   where ma_measure_group_id=?)) AAA
-              where t.ma_measure_group_id = ?
+                   where ma_measure_group_ID = TO_NUMBER(?))) AAA
+              where t.ma_measure_group_ID = TO_NUMBER(?)
                 and t.MA_MEASURE_TIME_ID = v.MA_MEASURE_TIME_ID
                 and v.MA_CCP_ID = c.MA_CCP_ID
         ) AA
--- a/src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/EditCCPMeasureValues_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
         FROM MA_Measure_Shift s, MA_Measure_Group g, MA_CCP_Group cg
         WHERE g.MA_CCP_GROUP_ID = cg.MA_CCP_GROUP_ID
           AND s.MA_Measure_Shift_ID = g.MA_Measure_Shift_ID
-          AND s.MA_Measure_Shift_ID = ?
+          AND s.MA_Measure_Shift_ID = TO_NUMBER(?)
         ORDER BY g.MA_MEASURE_GROUP_ID, cg.seqno
       ]]>
       </Sql>
@@ -67,7 +67,7 @@
       <![CDATA[
         SELECT VALUETYPE AS TYPE
         FROM MA_MEASURE_VALUES
-        WHERE MA_MEASURE_VALUES_ID = ?
+        WHERE MA_MEASURE_VALUES_ID = TO_NUMBER(?)
       ]]>
       </Sql>
       <Parameter name="maMeasureValueID"/>
@@ -80,7 +80,7 @@
         SET V_NUMBER = TO_NUMBER(?),
             V_STRING = ?,
             V_CHAR = ?
-        WHERE MA_MEASURE_VALUES_ID = ?
+        WHERE MA_MEASURE_VALUES_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="vnumber"/>
@@ -94,7 +94,7 @@
       <![CDATA[
         UPDATE MA_MEASURE_GROUP
         SET PRODUCT = ?
-        WHERE MA_MEASURE_GROUP_ID = ?
+        WHERE MA_MEASURE_GROUP_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="product"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -44,7 +44,7 @@
         ORDER BY E.AD_ORG_ID, el.C_BPartner_ID, el.C_Project_ID, e.S_TimeExpense_ID, el.Line
       ]]>
     </Sql>
-    <Parameter name="bpartner" optional="true" after="WHERE "><![CDATA[ el.C_BPartner_ID=? AND ]]></Parameter>
+    <Parameter name="bpartner" optional="true" after="WHERE "><![CDATA[ el.C_BPartner_ID = TO_NUMBER(?) AND ]]></Parameter>
     <Parameter name="dateFrom" optional="true" after="WHERE "><![CDATA[ e.DateReport >= TO_DATE(?) AND ]]></Parameter>
     <Parameter name="dateTo" optional="true" after="WHERE "><![CDATA[ e.DateReport  < TO_DATE(?) AND ]]></Parameter>
     <Parameter name="adUserClient" type="replace" optional="true" after="E.AD_CLIENT_ID IN (" text="'1'"/>
@@ -55,7 +55,7 @@
     <Sql>
       <![CDATA[
         UPDATE S_TimeExpenseLine SET C_OrderLine_ID= TO_NUMBER(?)
-        WHERE S_TimeExpenseLine_ID= ?
+        WHERE S_TimeExpenseLine_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="COrderlineId"/>
@@ -167,7 +167,7 @@
     <Sql>
       <![CDATA[
         SELECT MAX(C_BPARTNER_LOCATION_ID) FROM C_BPARTNER_LOCATION
-        WHERE C_BPARTNER_ID = ?
+        WHERE C_BPARTNER_ID = TO_NUMBER(?)
         AND C_BPartner_Location.IsActive='Y'
       ]]>
     </Sql>
@@ -180,7 +180,7 @@
         SELECT MAX(C_BPARTNER_LOCATION_ID) FROM C_BPARTNER_LOCATION
         WHERE  C_BPartner_Location.IsBillTo='Y' 
         AND C_BPartner_Location.IsActive='Y'
-        AND C_BPARTNER_ID = ?
+        AND C_BPARTNER_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cBpartnerId"/>
@@ -190,7 +190,7 @@
     <Sql><![CDATA[
       SELECT Name
       FROM C_BPartner 
-      WHERE C_BPartner_ID = ? 
+      WHERE C_BPartner_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_actionButton/ImportProduct_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ImportProduct_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
       SELECT I_Product_ID, M_Product_ID, C_BPartner_ID, 0 as C_TaxCategory_ID, '' AS ID, '' AS NAME
       FROM I_Product WHERE I_IsImported='N'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -39,7 +39,7 @@
     <Sql>
       <![CDATA[
       DELETE FROM I_Product WHERE I_IsImported='Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -73,7 +73,7 @@
       WHERE I_Product.BPartner_Value=p.Value AND I_Product.AD_Client_ID=p.AD_Client_ID) 
       WHERE C_BPartner_ID IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -86,7 +86,7 @@
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid BPartner,' 
       WHERE C_BPartner_ID IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -100,7 +100,7 @@
       WHERE I_Product.UPC=p.UPC AND I_Product.AD_Client_ID=p.AD_Client_ID) 
       WHERE M_Product_ID IS NULL
       AND I_IsImported='N'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -114,7 +114,7 @@
       WHERE I_Product.Value=p.Value AND I_Product.AD_Client_ID=p.AD_Client_ID) 
       WHERE M_Product_ID IS NULL
       AND I_IsImported='N'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -129,7 +129,7 @@
       AND I_Product.VendorProductNo=p.VendorProductNo AND I_Product.AD_Client_ID=p.AD_Client_ID) 
       WHERE M_Product_ID IS NULL
       AND I_IsImported='N'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -144,7 +144,7 @@
       WHERE M_Product_ID IS NOT NULL
       AND    value   IS NULL
       AND I_IsImported='N'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
      <Parameter name="field" type="replace" optional="true" after="SET    " text="value"/>
@@ -162,7 +162,7 @@
       WHERE M_Product_ID IS NOT NULL
       AND (   C_UOM_ID  IS NULL OR      C_UOM_ID=0)
       AND I_IsImported='N'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
      <Parameter name="field" type="replace" optional="true" after="SET    " text="C_UOM_ID"/>
@@ -181,7 +181,7 @@
       WHERE M_Product_ID IS NOT NULL AND C_BPartner_ID IS NOT NULL
       AND    UPC   IS NULL
       AND I_IsImported='N'      
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
      <Parameter name="field" type="replace" optional="true" after="SET    " text="UPC"/>
@@ -200,7 +200,7 @@
       WHERE M_Product_ID IS NOT NULL AND C_BPartner_ID IS NOT NULL
       AND (     C_UOM_ID      IS NULL OR     C_UOM_ID     =0)
       AND I_IsImported='N'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
      <Parameter name="field" type="replace" optional="true" after="SET    " text="C_UOM_ID"/>
@@ -221,7 +221,7 @@
       WHERE X12DE355 IS NULL AND C_UOM_ID IS NULL
       AND I_IsImported<>'Y'
       AND C_UOM_ID IS NULL      
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -234,7 +234,7 @@
       SET C_UOM_ID = (SELECT max(C_UOM_ID) FROM C_UOM u WHERE u.X12DE355=I_Product.X12DE355 AND u.AD_Client_ID IN (0,I_Product.AD_Client_ID)) 
       WHERE C_UOM_ID IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -247,7 +247,7 @@
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid UOM, ' 
       WHERE C_UOM_ID IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -258,10 +258,10 @@
       <![CDATA[
       UPDATE I_Product 
       SET ProductCategory_Value=(SELECT MIN(Value) FROM M_Product_Category
-      WHERE IsDefault='Y' AND AD_Client_ID=   ? ) 
+      WHERE IsDefault='Y' AND AD_Client_ID = TO_NUMBER(?) ) 
       WHERE ProductCategory_Value IS NULL AND M_Product_Category_ID IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -276,7 +276,7 @@
       WHERE I_Product.ProductCategory_Value=c.Value AND I_Product.AD_Client_ID=c.AD_Client_ID) 
       WHERE M_Product_Category_ID IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -289,7 +289,7 @@
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ProdCategorty,' 
       WHERE M_Product_Category_ID IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -305,7 +305,7 @@
       and ci.AD_Client_ID=I_Product.AD_Client_ID) 
       WHERE C_Currency_ID IS NULL AND ISO_Code IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -319,7 +319,7 @@
       WHERE I_Product.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,I_Product.AD_Client_ID)) 
       WHERE C_Currency_ID IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -332,7 +332,7 @@
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Currency,' 
       WHERE C_Currency_ID IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -345,7 +345,7 @@
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ProductType,' 
       WHERE ProductType NOT IN ('I','S')
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -358,7 +358,7 @@
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Value not unique,' 
       WHERE I_IsImported<>'Y'
       AND Value IN (SELECT Value FROM I_Product ii WHERE I_Product.AD_Client_ID=ii.AD_Client_ID GROUP BY Value HAVING COUNT(*) > 1)
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -371,7 +371,7 @@
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=UPC not unique,' 
       WHERE I_IsImported<>'Y'
       AND UPC IN (SELECT UPC FROM I_Product ii WHERE I_Product.AD_Client_ID=ii.AD_Client_ID GROUP BY UPC HAVING COUNT(*) > 1)
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -384,7 +384,7 @@
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Mandatory Value,' 
       WHERE Value IS NULL
       AND I_IsImported<>'Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -397,7 +397,7 @@
       SET VendorProductNo=Value 
       WHERE C_BPartner_ID IS NOT NULL AND VendorProductNo IS NULL
       AND I_IsImported='N'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -412,7 +412,7 @@
         AND C_BPartner_ID IS NOT NULL
         AND (C_BPartner_ID, VendorProductNo) IN 
         (SELECT C_BPartner_ID, VendorProductNo FROM I_Product ii WHERE I_Product.AD_Client_ID=ii.AD_Client_ID GROUP BY C_BPartner_ID, VendorProductNo HAVING COUNT(*) > 1)
-        AND AD_Client_ID = ?
+        AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -422,7 +422,7 @@
     <Sql>
       <![CDATA[
       SELECT C_TaxCategory_ID FROM C_TaxCategory WHERE IsDefault='Y'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -433,7 +433,7 @@
       <![CDATA[
       SELECT I_Product_ID, M_Product_ID, C_BPartner_ID 
       FROM I_Product WHERE I_IsImported='N'
-      AND AD_Client_ID = ?
+      AND AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_client_id"/>
@@ -453,7 +453,7 @@
       UPC,SKU,C_UOM_ID,'N',M_Product_Category_ID,TO_NUMBER(?) ,
       ProductType,ImageURL,DescriptionURL 
       FROM I_Product 
-      WHERE I_Product_ID=?
+      WHERE I_Product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="MProductID"/>
@@ -466,47 +466,47 @@
       <![CDATA[
       UPDATE M_PRODUCT 
       SET Value=(SELECT Value
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       Name=(SELECT Name
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       Description=(SELECT Description
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       DocumentNote=(SELECT DocumentNote
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       Help=(SELECT Help
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       UPC=(SELECT UPC
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       SKU=(SELECT SKU
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       C_UOM_ID=(SELECT C_UOM_ID
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       M_Product_Category_ID=(SELECT M_Product_Category_ID
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       Classification=(SELECT Classification
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       ProductType=(SELECT ProductType
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       Volume=(SELECT Volume
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       Weight=(SELECT Weight
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       ShelfWidth=(SELECT ShelfWidth
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       ShelfHeight=(SELECT ShelfHeight
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       ShelfDepth=(SELECT ShelfDepth
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       UnitsPerPallet=(SELECT UnitsPerPallet
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       Discontinued=(SELECT Discontinued
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       DiscontinuedBy=(SELECT DiscontinuedBy
-      FROM I_Product WHERE I_Product_ID=?),
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)),
       Updated=now(),
       UpdatedBy=(SELECT UpdatedBy
-      FROM I_Product WHERE I_Product_ID=?) 
-      WHERE M_Product_ID=?
+      FROM I_Product WHERE I_Product_ID = TO_NUMBER(?)) 
+      WHERE M_Product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="IProductID"/>
@@ -539,73 +539,73 @@
       C_UOM_ID= 
       (SELECT C_UOM_ID
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       C_Currency_ID= 
       (SELECT C_Currency_ID
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       UPC= 
       (SELECT UPC
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       PriceList= 
       (SELECT PriceList
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       PricePO= 
       (SELECT PricePO
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       RoyaltyAmt= 
       (SELECT RoyaltyAmt
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       PriceEffective= 
       (SELECT PriceEffective
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       VendorProductNo= 
       (SELECT VendorProductNo
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       VendorCategory= 
       (SELECT VendorCategory
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       Manufacturer= 
       (SELECT Manufacturer
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       Discontinued= 
       (SELECT Discontinued
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       DiscontinuedBy= 
       (SELECT DiscontinuedBy
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       Order_Min= 
       (SELECT Order_Min
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       Order_Pack= 
       (SELECT Order_Pack
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       CostPerOrder= 
       (SELECT CostPerOrder
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       DeliveryTime_Promised= 
       (SELECT DeliveryTime_Promised
       FROM I_Product
-      WHERE I_Product_ID=?),
+      WHERE I_Product_ID = TO_NUMBER(?)),
       Updated=now(),
       UpdatedBy= 
       (SELECT UpdatedBy
       FROM I_Product
-      WHERE I_Product_ID=?) 
-      WHERE M_Product_ID=? AND C_BPartner_ID=?
+      WHERE I_Product_ID = TO_NUMBER(?)) 
+      WHERE M_Product_ID = TO_NUMBER(?) AND C_BPartner_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="IProductID"/>
@@ -641,7 +641,7 @@
       Discontinued,DiscontinuedBy,Order_Min,Order_Pack,
       CostPerOrder,DeliveryTime_Promised 
       FROM I_Product 
-      WHERE I_Product_ID=?
+      WHERE I_Product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="MProductID"/>
@@ -653,7 +653,7 @@
     <Sql>
       <![CDATA[
       UPDATE I_Product SET I_IsImported='Y', M_Product_ID=TO_NUMBER(?), 
-      Updated=now(), Processed='Y' WHERE I_Product_ID=?
+      Updated=now(), Processed='Y' WHERE I_Product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="MProductID"/>
@@ -665,7 +665,7 @@
       <![CDATA[
       UPDATE I_Product 
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg || 'Insert Product: ' || ?
-      WHERE I_Product_ID = ?
+      WHERE I_Product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="error"/>
@@ -677,7 +677,7 @@
       <![CDATA[
       UPDATE I_Product 
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Update Product: ' || ?
-      WHERE I_Product_ID = ?
+      WHERE I_Product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="error"/>
@@ -689,7 +689,7 @@
       <![CDATA[
       UPDATE I_Product 
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Update Product_PO: ' || ?
-      WHERE I_Product_ID = ?
+      WHERE I_Product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="error"/>
@@ -701,7 +701,7 @@
       <![CDATA[
       UPDATE I_Product 
       SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Insert Product_PO: ' || ?
-      WHERE I_Product_ID = ?
+      WHERE I_Product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="error"/>
@@ -714,7 +714,7 @@
       UPDATE I_Product 
       SET I_IsImported='N', Updated=now()
       WHERE I_IsImported<>'Y'
-      AND AD_CLIENT_ID = ?
+      AND AD_CLIENT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="client"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/InsertAcces_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/InsertAcces_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -43,8 +43,8 @@
     <Sql>
     <![CDATA[
         select 1 from ad_window_Access
-        where ad_role_id=?
-        and ad_window_id=?
+        where ad_role_ID = TO_NUMBER(?)
+        and ad_window_ID = TO_NUMBER(?)
     ]]>
     </Sql>
         <Parameter name="roleId"/>
@@ -72,8 +72,8 @@
     <Sql>
     <![CDATA[
         select 1 from ad_process_Access
-        where ad_role_id=?
-        and ad_process_id=?
+        where ad_role_ID = TO_NUMBER(?)
+        and ad_process_ID = TO_NUMBER(?)
     ]]>
     </Sql>
         <Parameter name="roleId"/>
@@ -101,8 +101,8 @@
     <Sql>
     <![CDATA[
         select 1 from ad_form_Access
-        where ad_role_id=?
-        and ad_form_id=?
+        where ad_role_ID = TO_NUMBER(?)
+        and ad_form_ID = TO_NUMBER(?)
     ]]>
     </Sql>
         <Parameter name="roleId"/>
@@ -130,8 +130,8 @@
     <Sql>
     <![CDATA[
         select 1 from ad_workflow_Access
-        where ad_role_id=?
-        and ad_workflow_id=?
+        where ad_role_ID = TO_NUMBER(?)
+        and ad_workflow_ID = TO_NUMBER(?)
     ]]>
     </Sql>
         <Parameter name="roleId"/>
@@ -159,8 +159,8 @@
     <Sql>
     <![CDATA[
         select 1 from ad_task_Access
-        where ad_role_id=?
-        and ad_task_id=?
+        where ad_role_ID = TO_NUMBER(?)
+        and ad_task_ID = TO_NUMBER(?)
     ]]>
     </Sql>
         <Parameter name="roleId"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/InvoicingSchedule_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/InvoicingSchedule_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -40,7 +40,7 @@
       AND IOL.ISINVOICED = 'N'
       AND IO.MOVEMENTDATE >= TO_DATE(?)
       AND IO.MOVEMENTDATE < TO_DATE(?)
-      AND IO.C_BPARTNER_ID = ?
+      AND IO.C_BPARTNER_ID = TO_NUMBER(?)
       GROUP BY IO.AD_ORG_ID, IO.MOVEMENTTYPE, IOLT.INVOICINGMODE,IOLT.IN_PRODUCT_ID, IOLT.OUT_PRODUCT_ID
       ORDER BY IO.AD_ORG_ID
     ]]></Sql>
@@ -72,9 +72,9 @@
       ) ST
       WHERE ST.M_LOCATOR_ID = M_LOCATOR.M_LOCATOR_ID
       AND ST.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
-      AND M_PRODUCT.C_BPARTNER_ID = ?
+      AND M_PRODUCT.C_BPARTNER_ID = TO_NUMBER(?)
       AND M_WH_SCHEDULE_PRODUCT.INVOICINGTYPE = M_LOCATOR.INVOICINGTYPE
-      AND M_WH_SCHEDULE_PRODUCT.M_WH_SCHEDULE_ID = ?
+      AND M_WH_SCHEDULE_PRODUCT.M_WH_SCHEDULE_ID = TO_NUMBER(?)
       GROUP BY ST.AD_ORG_ID, M_WH_SCHEDULE_PRODUCT.M_PRODUCT_ID,  ST.DAY) AAA
       GROUP BY AD_ORG_ID, M_PRODUCT_ID) AA
       ORDER BY AD_ORG_ID
@@ -123,16 +123,16 @@
       HAVING SUM(M_TRANSACTION.MOVEMENTQTY) <> 0) 
       AND 1=1 
       AND EXISTS (SELECT p.M_WH_PERIOD_ID FROM M_WH_PERIOD p 
-      WHERE p.M_WH_SCHEDULE_ID = ? 
+      WHERE p.M_WH_SCHEDULE_ID = TO_NUMBER(?) 
       AND p.STARTDATE >= TO_DATE(?)
       AND p.ENDDATE < TO_DATE(?)
       AND NOT EXISTS (SELECT 1 FROM M_WH_PERIOD_INVOICED i 
       WHERE i.M_WH_PERIOD_ID = p.M_WH_PERIOD_ID 
       AND i.C_BPARTNER_ID = M_PRODUCT.C_BPARTNER_ID
-      AND i.AD_ORG_ID = ?))) A
-      WHERE EXISTS (SELECT 1 FROM C_BPARTNER bp WHERE bp.M_WH_SCHEDULE_ID = ? AND bp.C_BPARTNER_ID = A.C_BPARTNER_ID)
+      AND i.AD_ORG_ID = TO_NUMBER(?)))) A
+      WHERE EXISTS (SELECT 1 FROM C_BPARTNER bp WHERE bp.M_WH_SCHEDULE_ID = TO_NUMBER(?) AND bp.C_BPARTNER_ID = A.C_BPARTNER_ID)
     ]]></Sql>
-    <Parameter name="cBpartnerId" optional="true" after="AND IOL.ISINVOICED = 'N' " text=" AND IO.C_BPARTNER_ID = ? "/>
+    <Parameter name="cBpartnerId" optional="true" after="AND IOL.ISINVOICED = 'N' " text=" AND IO.C_BPARTNER_ID = TO_NUMBER(?) "/>
     <Parameter name="adOrgClient" type="replace" optional="true" after="AND IO.AD_ORG_ID IN (" text="'1'"/>
     <Parameter name="adUserClient" type="replace" optional="true" after="AND IO.AD_CLIENT_ID IN (" text="'1'"/>
     <Parameter name="periodfrom"/>
@@ -140,7 +140,7 @@
     <Parameter name="periodfrom"/>
     <Parameter name="adOrgClient" type="replace" optional="true" after="AND M_WAREHOUSE.AD_ORG_ID IN (" text="'1'"/>
     <Parameter name="adUserClient" type="replace" optional="true" after="AND M_WAREHOUSE.AD_CLIENT_ID IN (" text="'1'"/>
-    <Parameter name="cBpartnerId" optional="true" after="AND 1=1 " text=" AND M_PRODUCT.C_BPARTNER_ID = ? "/>
+    <Parameter name="cBpartnerId" optional="true" after="AND 1=1 " text=" AND M_PRODUCT.C_BPARTNER_ID = TO_NUMBER(?) "/>
     <Parameter name="mWhScheduleId"/>
     <Parameter name="periodfrom"/>
     <Parameter name="periodto"/>
@@ -151,13 +151,13 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
       SELECT p.M_WH_PERIOD_ID AS ID, p.STARTDATE, p.ENDDATE FROM M_WH_PERIOD p 
-      WHERE p.M_WH_SCHEDULE_ID = ? 
+      WHERE p.M_WH_SCHEDULE_ID = TO_NUMBER(?) 
       AND p.STARTDATE >= TO_DATE(?)
       AND p.ENDDATE <= TO_DATE(?)
       AND NOT EXISTS (SELECT 1 FROM M_WH_PERIOD_INVOICED i 
       WHERE i.M_WH_PERIOD_ID = p.M_WH_PERIOD_ID 
-      AND i.C_BPARTNER_ID = ?
-      AND i.AD_ORG_ID = ? )
+      AND i.C_BPARTNER_ID = TO_NUMBER(?)
+      AND i.AD_ORG_ID = TO_NUMBER(?) )
       ORDER BY p.STARTDATE
     ]]></Sql>
     <Parameter name="mWhScheduleId"/>
@@ -174,7 +174,7 @@
       WHERE M_WH_Period.AD_Org_ID IN('1') 
       AND M_WH_Period.AD_Client_ID IN('1') 
       AND M_WH_Period.isActive = 'Y' 
-      AND M_WH_Schedule_ID = ?
+      AND M_WH_Schedule_ID = TO_NUMBER(?)
       ORDER BY M_WH_Period.StartDate
     ]]></Sql>
     <Parameter name="adOrgClient" type="replace" optional="true" after="M_WH_Period.AD_Org_ID IN(" text="'1'"/>
@@ -195,7 +195,7 @@
     <Sql><![CDATA[
       SELECT STARTDATE
       FROM M_WH_PERIOD 
-      WHERE M_WH_PERIOD_ID = ? 
+      WHERE M_WH_PERIOD_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="mWhPeriodId"/>
   </SqlMethod>
@@ -204,7 +204,7 @@
     <Sql><![CDATA[
       SELECT ENDDATE
       FROM M_WH_PERIOD 
-      WHERE M_WH_PERIOD_ID = ? 
+      WHERE M_WH_PERIOD_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="mWhPeriodId"/>
   </SqlMethod>
@@ -213,7 +213,7 @@
     <Sql><![CDATA[
       SELECT C_Currency_ID
       FROM M_PriceList 
-      WHERE M_PriceList_ID = ? 
+      WHERE M_PriceList_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="mPricelistId"/>
   </SqlMethod>
@@ -222,7 +222,7 @@
     <Sql><![CDATA[
       SELECT M_PriceList_ID
       FROM C_Bpartner 
-      WHERE C_Bpartner_ID = ? 
+      WHERE C_Bpartner_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -231,7 +231,7 @@
     <Sql><![CDATA[
       SELECT C_UOM_ID
       FROM M_PRODUCT 
-      WHERE M_Product_ID = ? 
+      WHERE M_Product_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="mProductId"/>
   </SqlMethod>
@@ -240,7 +240,7 @@
     <Sql><![CDATA[
       SELECT STORAGEPAYMENTRULE
       FROM C_Bpartner 
-      WHERE C_Bpartner_ID = ? 
+      WHERE C_Bpartner_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -249,7 +249,7 @@
     <Sql><![CDATA[
       SELECT Name
       FROM C_BPartner 
-      WHERE C_BPartner_ID = ? 
+      WHERE C_BPartner_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -258,7 +258,7 @@
     <Sql><![CDATA[
       SELECT dateordered
       FROM C_ORDER
-      WHERE C_ORDER_ID = ? 
+      WHERE C_ORDER_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -267,7 +267,7 @@
     <Sql><![CDATA[
       SELECT C_Project_ID
       FROM C_ORDER
-      WHERE C_ORDER_ID = ? 
+      WHERE C_ORDER_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cOrderId"/>
   </SqlMethod>
@@ -279,7 +279,7 @@
       FROM M_INOUT IO, M_INOUTLINE IOL, M_INOUTLINE_TYPE IOLT
       WHERE IO.M_INOUT_ID = IOL.M_INOUT_ID
       AND IOL.M_INOUTLINE_TYPE_ID = IOLT.M_INOUTLINE_TYPE_ID 
-      AND IO.C_BPARTNER_ID = ?
+      AND IO.C_BPARTNER_ID = TO_NUMBER(?)
       AND IO.AD_ORG_ID IN ('1')
       AND IO.AD_CLIENT_ID IN ('1') 
       AND IO.ISLOGISTIC  = 'Y'
--- a/src/org/openbravo/erpCommon/ad_actionButton/Locator_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/Locator_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -27,7 +27,7 @@
             SELECT L.M_WAREHOUSE_ID AS PADRE ,L.M_LOCATOR_ID AS ID, AD_COLUMN_IDENTIFIER(TO_CHAR('M_Locator'),TO_CHAR(M_LOCATOR_ID),TO_CHAR(?)) AS NAME 
             FROM M_LOCATOR L
 			WHERE L.IsActive='Y' 
-            AND L.AD_Client_ID = ? 
+            AND L.AD_Client_ID = TO_NUMBER(?) 
             ORDER BY L.M_WAREHOUSE_ID,NAME	
       ]]></Sql>
       <Parameter name="language"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/Posted_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/Posted_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -28,8 +28,8 @@
     <Sql>
       <![CDATA[
         SELECT MAX(FACT_ACCT_GROUP_ID) AS ID, MAX(AD_ORG_ID) AS ORG, MAX(AD_CLIENT_ID) AS CLIENT FROM FACT_ACCT
-        WHERE RECORD_ID = ?
-        AND AD_TABLE_ID = ?
+        WHERE RECORD_ID = TO_NUMBER(?)
+        AND AD_TABLE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="record_id"/>
@@ -40,7 +40,7 @@
     <Sql>
       <![CDATA[
         SELECT AD_CLIENT_ID FROM FACT_ACCT
-        WHERE RECORD_ID = ?
+        WHERE RECORD_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="tablename" optional="true" type="replace" after="FROM " text="FACT_ACCT"/>
@@ -52,7 +52,7 @@
     <Sql>
       <![CDATA[
         SELECT TABLENAME FROM AD_TABLE
-        WHERE AD_TABLE_ID = ?
+        WHERE AD_TABLE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="adTableId"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/ProjectClose_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ProjectClose_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -35,7 +35,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        UPDATE C_PROJECT SET PROCESSED = 'Y' WHERE C_PROJECT_ID = ?
+        UPDATE C_PROJECT SET PROCESSED = 'Y' WHERE C_PROJECT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="c_project_id"/>
@@ -44,7 +44,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        UPDATE C_PROJECTLINE SET PROCESSED = 'Y' WHERE C_PROJECT_ID = ?
+        UPDATE C_PROJECTLINE SET PROCESSED = 'Y' WHERE C_PROJECT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="c_project_id"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/ProjectCopyFrom_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ProjectCopyFrom_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
         SELECT P.C_PHASE_ID, P.C_PROJECTPHASE_ID, P.NAME, P.SEQNO, P.DESCRIPTION, P.HELP,
         P.M_PRODUCT_ID, P.QTY, '' as C_TASK_ID, '' as id
         FROM C_PROJECTPHASE P 
-	WHERE P.C_PROJECT_ID = ?
+	WHERE P.C_PROJECT_ID = TO_NUMBER(?)
         ORDER BY P.SEQNO
       ]]>
     </Sql>
@@ -42,7 +42,7 @@
       <![CDATA[
 	SELECT C_PROJECTTYPE_ID
 	FROM C_PROJECT
-	WHERE C_PROJECT_ID = ?
+	WHERE C_PROJECT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="c_project_id"/>
@@ -53,8 +53,8 @@
       <![CDATA[
         SELECT COUNT(C_PROJECTPHASE_ID) AS TOTAL 
         FROM C_PROJECTPHASE
-        WHERE C_PROJECT_ID = ?
-        AND C_PHASE_ID = ?
+        WHERE C_PROJECT_ID = TO_NUMBER(?)
+        AND C_PHASE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="c_project_id"/>
@@ -67,7 +67,7 @@
         SELECT T.C_TASK_ID, T.SEQNO, T.NAME, T.DESCRIPTION, T.HELP,
         T.M_PRODUCT_ID, T.QTY
         FROM C_PROJECTTASK T
-        WHERE T.C_PROJECTPHASE_ID = ?
+        WHERE T.C_PROJECTPHASE_ID = TO_NUMBER(?)
         ORDER BY T.SEQNO
       ]]>
     </Sql>
@@ -132,7 +132,7 @@
         PLANNEDMARGINAMT, COMMITTEDAMT,M_PRODUCT_ID, M_PRODUCT_CATEGORY_ID, INVOICEDAMT, INVOICEDQTY, COMMITTEDQTY, 
         C_PROJECTISSUE_ID,C_ORDER_ID, C_ORDERPO_ID, ISPRINTED, PROCESSED, DOPRICING, PLANNEDPRICE 
         FROM C_PROJECTLINE
-        WHERE C_PROJECT_ID = ?
+        WHERE C_PROJECT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="new_cprojectlineid"/>
@@ -148,7 +148,7 @@
     <Sql>
       <![CDATA[
         SELECT PROJECTCATEGORY FROM C_PROJECT
-        WHERE C_PROJECT_ID = ?
+        WHERE C_PROJECT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cprojectid"/>
@@ -158,7 +158,7 @@
     <Sql><![CDATA[
       SELECT C_Project.C_Project_ID as id, (C_Project.Value || ' - ' || C_Project.Name) as name FROM C_Project
       WHERE C_Project.AD_Org_ID IN('1') AND C_Project.AD_Client_ID IN('1') AND C_Project.isActive = 'Y' 
-      AND C_Project.projectcategory in (select projectcategory from c_project where c_project_id = ?)
+      AND C_Project.projectcategory in (select projectcategory from c_project where c_project_ID = TO_NUMBER(?))
       ORDER BY name
     ]]></Sql>
     <Parameter name="adOrgClient" type="replace" optional="true" after="C_Project.AD_Org_ID IN(" text="'1'"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/ProjectSetType_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ProjectSetType_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
         SELECT P.C_PHASE_ID, P.NAME, P.SEQNO, P.DESCRIPTION, P.HELP,
         P.M_PRODUCT_ID, P.STANDARDQTY, P.AD_CLIENT_ID, P.AD_ORG_ID, '' as C_TASK_ID, '' AS C_PROJECT_ID
-        FROM C_PHASE P WHERE C_PROJECTTYPE_ID = ?
+        FROM C_PHASE P WHERE C_PROJECTTYPE_ID = TO_NUMBER(?)
         ORDER BY P.SEQNO
       ]]>
     </Sql>
@@ -41,7 +41,7 @@
       <![CDATA[
 	SELECT C_PROJECT_ID, AD_CLIENT_ID, AD_ORG_ID
 	FROM C_PROJECT
-	WHERE C_PROJECT_ID = ?
+	WHERE C_PROJECT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="c_project_id"/>
@@ -51,7 +51,7 @@
     <Sql>
       <![CDATA[
         SELECT COUNT(*) AS TOTAL
-        FROM C_Project WHERE C_PROJECT_ID = ?
+        FROM C_Project WHERE C_PROJECT_ID = TO_NUMBER(?)
         AND C_ProjectType_ID IS NOT NULL
       ]]>
     </Sql>
@@ -64,7 +64,7 @@
         SELECT T.C_TASK_ID, T.SEQNO, T.NAME, T.DESCRIPTION, T.HELP,
         T.M_PRODUCT_ID, T.STANDARDQTY
         FROM C_TASK T
-        WHERE T.C_PHASE_ID = ?
+        WHERE T.C_PHASE_ID = TO_NUMBER(?)
         ORDER BY T.SEQNO
       ]]>
     </Sql>
@@ -74,7 +74,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT PROJECTCATEGORY FROM C_PROJECTTYPE WHERE C_PROJECTTYPE_ID = ?
+        SELECT PROJECTCATEGORY FROM C_PROJECTTYPE WHERE C_PROJECTTYPE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="c_projecttype_id"/>
@@ -84,7 +84,7 @@
     <Sql>
       <![CDATA[
         UPDATE C_PROJECT SET UPDATEDBY=TO_NUMBER(?), UPDATED=now(), C_PROJECTTYPE_ID=TO_NUMBER(?) , PROJECTCATEGORY = ?
-        WHERE C_PROJECT_ID=?
+        WHERE C_PROJECT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="user"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/RequestAction_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/RequestAction_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
         SELECT AD_Client_ID, DocumentNo, ActionType, Summary, MailSubject,MailText, 
         C_BPartner_ID,AD_User_ID, SalesRep_ID, UpdatedBy, '' AS EMail, '' AS EMailUser, '' AS EMailUserPw, '' AS NAME 
         FROM R_Request 
-        WHERE R_Request_ID = ? 
+        WHERE R_Request_ID = TO_NUMBER(?) 
       ]]>
     </Sql>
     <Parameter name="rRequestId"/>
@@ -39,7 +39,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT EMail, EMailUser, EMailUserPw, Name FROM AD_User WHERE AD_User_ID=?
+        SELECT EMail, EMailUser, EMailUserPw, Name FROM AD_User WHERE AD_User_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="adUserId"/>
@@ -48,7 +48,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT RequestEMail AS EMail, RequestUser AS EMailUser, RequestUserPw AS EMailUserPw FROM AD_Client WHERE AD_Client_ID=?
+        SELECT RequestEMail AS EMail, RequestUser AS EMailUser, RequestUserPw AS EMailUserPw FROM AD_Client WHERE AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="adClientId"/>
@@ -59,17 +59,17 @@
       <![CDATA[
         SELECT bpc.EMail AS NAME 
         FROM C_BPartner bp INNER JOIN AD_User bpc ON (bp.C_BPartner_ID=bpc.C_BPartner_ID) 
-        WHERE bp.C_BPartner_ID = ? 
+        WHERE bp.C_BPartner_ID = TO_NUMBER(?) 
       ]]>
     </Sql>
-    <Parameter name="adUserId" optional="true" after="WHERE " text=" bpc.AD_User_ID = ? AND "/>
+    <Parameter name="adUserId" optional="true" after="WHERE " text=" bpc.AD_User_ID = TO_NUMBER(?) AND "/>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
   <SqlMethod name="selectSMTPHost" type="preparedStatement" connection="true" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT SMTPHost AS NAME FROM AD_Client WHERE AD_Client_ID=?
+        SELECT SMTPHost AS NAME FROM AD_Client WHERE AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="adClientId"/>
@@ -78,7 +78,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        UPDATE R_Request SET Result=? WHERE R_Request_ID=?
+        UPDATE R_Request SET Result=? WHERE R_Request_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="resulttxt"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/TestLine_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/TestLine_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -28,7 +28,7 @@
         SELECT w.NAME as name, '' as fieldlength, '' as tab
         FROM AD_WINDOW w, AD_MENU m
 	WHERE w.AD_WINDOW_ID=m.AD_WINDOW_ID
-	AND m.AD_MENU_ID=?
+	AND m.AD_MENU_ID = TO_NUMBER(?)
       ]]>
     </Sql>
       <Parameter name="adMenuId"/>
@@ -40,7 +40,7 @@
 	SELECT p.NAME as name 
 	FROM AD_PROCESS p, AD_MENU m
 	WHERE p.AD_PROCESS_ID=m.AD_PROCESS_ID
-	AND m.ad_menu_id=?
+	AND m.ad_menu_ID = TO_NUMBER(?)
 	AND p.CLASSNAME is null
       ]]>
     </Sql>
@@ -52,7 +52,7 @@
       <![CDATA[
 	SELECT m.NAME as name 
 	FROM AD_WINDOW w, AD_TAB t, ad_menu m
-	WHERE m.AD_MENU_ID=?
+	WHERE m.AD_MENU_ID = TO_NUMBER(?)
 	AND t.AD_WINDOW_ID=w.AD_WINDOW_ID
 	AND m.AD_WINDOW_ID=w.AD_WINDOW_ID
       ]]>
@@ -66,7 +66,7 @@
         select fieldlength from ad_column 
         where ad_Table_id=(
                 select ad_table_id from ad_tab 
-                where ad_tab_id=?) 
+                where ad_tab_ID = TO_NUMBER(?)) 
         and columnname like ?
       ]]>
     </Sql>
@@ -82,7 +82,7 @@
         where ad_table_id=
                 (select ad_table_id 
                 from ad_tab 
-                where ad_tab_id=?) 
+                where ad_tab_ID = TO_NUMBER(?)) 
         and columnname=?
       ]]>
     </Sql>
@@ -98,12 +98,12 @@
         FROM AD_TAB t, AD_WINDOW w, AD_MENU m
         WHERE t.AD_WINDOW_ID = w.AD_WINDOW_ID
         AND w.AD_WINDOW_ID = m.AD_WINDOW_ID
-        AND m.AD_MENU_ID = ?
+        AND m.AD_MENU_ID = TO_NUMBER(?)
         AND t.seqno = (SELECT min(t.seqno)  
         FROM AD_TAB t, AD_WINDOW w, AD_MENU m
         WHERE t.AD_WINDOW_ID = w.AD_WINDOW_ID
         AND w.AD_WINDOW_ID = m.AD_WINDOW_ID
-        AND m.AD_MENU_ID = ?)
+        AND m.AD_MENU_ID = TO_NUMBER(?))
     ]]>
     </Sql>
     <Parameter name="admenuid"/>
--- a/src/org/openbravo/erpCommon/ad_actionButton/Test_In_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/Test_In_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -27,7 +27,7 @@
       <Sql>
         SELECT ARGNO AS argno, ARGHELP1 AS arghelp1, ARGHELP2 AS arghelp2, ARGHELP3 AS arghelp3
         FROM AT_Command
-        WHERE AT_Command_Id = ?
+        WHERE AT_Command_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="atCommandId"/>
    </SqlMethod>
@@ -59,7 +59,7 @@
       <Sql>
         SELECT count(*)
         FROM AT_Line
-        WHERE AT_Test_Id = ?
+        WHERE AT_Test_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="atTestId"/>
    </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_actionButton/UpdateMaintenanceScheduled_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/UpdateMaintenanceScheduled_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -48,7 +48,7 @@
             UPDATED = now(),
             UPDATEDBY = TO_NUMBER(?),
             MA_MAINT_PART_ID = TO_NUMBER(?)
-        WHERE MA_MAINT_SCHEDULED_ID = ?
+        WHERE MA_MAINT_SCHEDULED_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="result"/>
--- a/src/org/openbravo/erpCommon/ad_background/PeriodicAcctServer_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_background/PeriodicAcctServer_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -26,7 +26,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql><![CDATA[
       SELECT CREATEDBY AS AD_USER_ID, AD_ORG_ID, '' AS AD_TABLE_ID FROM AD_PROCESS
-      WHERE AD_PROCESS_ID = ?
+      WHERE AD_PROCESS_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="adProcessId"/>
    </SqlMethod>
@@ -34,7 +34,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql><![CDATA[
       SELECT P_NUMBER FROM AD_PINSTANCE_PARA
-      WHERE AD_PINSTANCE_ID = ?
+      WHERE AD_PINSTANCE_ID = TO_NUMBER(?)
       AND PARAMETERNAME = 'AD_Table_ID'
     ]]></Sql>
     <Parameter name="adPinstanceId"/>
--- a/src/org/openbravo/erpCommon/ad_background/PeriodicAlert_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_background/PeriodicAlert_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -65,7 +65,7 @@
       <Sql><![CDATA[
           SELECT COUNT(*) AS EXISTING
             FROM AD_ALERT
-           WHERE AD_ALERTRULE_ID = ?
+           WHERE AD_ALERTRULE_ID = TO_NUMBER(?)
              AND REFERENCEKEY_ID = ?
              AND ISACTIVE = 'Y'
       ]]></Sql>
@@ -121,7 +121,7 @@
            SET ISACTIVE  = 'N',
                UPDATED   = NOW(),
                UPDATEDBY = 0 
-         WHERE AD_ALERTRULE_ID = ?
+         WHERE AD_ALERTRULE_ID = TO_NUMBER(?)
            AND ISACTIVE = 'Y'
            AND NOT EXISTS 
                    (SELECT 1 FROM (SELECT '' AS AD_REFERENCEKEY_ID FROM DUAL) A WHERE 1=1
@@ -142,7 +142,7 @@
             FROM AD_ALERTRECIPIENT R,
                  AD_USER U,
                  AD_CLIENT C
-           WHERE AD_ALERTRULE_ID = ?
+           WHERE AD_ALERTRULE_ID = TO_NUMBER(?)
              AND SENDEMAIL = 'Y'
              AND R.AD_USER_ID = U.AD_USER_ID
              AND C.AD_CLIENT_ID = U.AD_CLIENT_ID
@@ -156,7 +156,7 @@
             FROM AD_ALERTRECIPIENT R,
                  AD_CLIENT C,
                  AD_USER U
-           WHERE AD_ALERTRULE_ID = ?
+           WHERE AD_ALERTRULE_ID = TO_NUMBER(?)
              AND SENDEMAIL = 'Y'
              AND C.AD_CLIENT_ID = U.AD_CLIENT_ID
              and u.ad_user_id in (select ad_user_id
--- a/src/org/openbravo/erpCommon/ad_background/PeriodicBackground_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_background/PeriodicBackground_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
       SELECT AD_CLIENT_ID, '' AS AD_USER_ID, '' as AD_ORG_ID
       FROM AD_CLIENT WHERE ISACTIVE='Y'
       ]]></Sql>
-      <Parameter name="adClientId" optional="true" after="WHERE " text=" AD_CLIENT_ID = ? AND "/>
+      <Parameter name="adClientId" optional="true" after="WHERE " text=" AD_CLIENT_ID = TO_NUMBER(?) AND "/>
    </SqlMethod>
    <SqlMethod name="checkPlannedRange" type="preparedStatement" return="Boolean" default="false">
       <SqlMethodComment></SqlMethodComment>
@@ -42,8 +42,8 @@
         AND to_char(timefrom, 'HH24:MI:SS')<= to_char(now(), 'HH24:MI:SS') 
         AND (timeto is null OR
         to_char(timeto, 'HH24:MI:SS') > to_char(now(), 'HH24:MI:SS'))
-        AND AD_Client_ID = ? 
-        AND AD_Process_ID = ? 
+        AND AD_Client_ID = TO_NUMBER(?) 
+        AND AD_Process_ID = TO_NUMBER(?) 
       ]]></Sql>
       <Parameter name="adClientId"/>
       <Parameter name="adProcessId"/>
@@ -58,14 +58,14 @@
         AND to_char(timefrom, 'HH24:MI:SS')<= to_char(now(), 'HH24:MI:SS') 
         AND (timeto is null OR
         to_char(timeto, 'HH24:MI:SS') > to_char(now(), 'HH24:MI:SS'))
-        AND AD_Client_ID = ?
+        AND AD_Client_ID = TO_NUMBER(?)
       ]]></Sql>
       <Parameter name="adClientId"/>
    </SqlMethod>
    <SqlMethod name="selectClientId" type="preparedStatement" return="String" default="">
       <SqlMethodComment></SqlMethodComment>
       <Sql><![CDATA[
-      SELECT AD_CLIENT_ID FROM AD_PINSTANCE WHERE AD_PINSTANCE_ID=?
+      SELECT AD_CLIENT_ID FROM AD_PINSTANCE WHERE AD_PINSTANCE_ID = TO_NUMBER(?)
       ]]></Sql>
       <Parameter name="adPinstanceId"/>
    </SqlMethod>
@@ -84,7 +84,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
         UPDATE AD_NOTE SET UPDATED=now(), UPDATEDBY=0, TEXT=? 
-        WHERE AD_NOTE_ID = ?
+        WHERE AD_NOTE_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="text"/>
       <Parameter name="adNoteId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_Expense_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_Expense_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -33,8 +33,8 @@
         AND pp.M_PriceList_Version_ID=pv.M_PriceList_Version_ID
         AND pv.M_PriceList_ID=pl.M_PriceList_ID
         AND pv.IsActive='Y'
-        AND p.M_Product_ID = ?
-        AND pl.M_PriceList_ID = ?
+        AND p.M_Product_ID = TO_NUMBER(?)
+        AND pl.M_PriceList_ID = TO_NUMBER(?)
         ORDER BY pv.ValidFrom DESC
       ]]>
     </Sql>
@@ -55,8 +55,8 @@
         AND pv.M_PriceList_ID=bpl.M_PriceList_ID
         AND pv.IsActive='Y'
         AND bpl.M_PriceList_ID=pl.BasePriceList_ID
-        AND p.M_Product_ID=?
-        AND pl.M_PriceList_ID=?
+        AND p.M_Product_ID = TO_NUMBER(?)
+        AND pl.M_PriceList_ID = TO_NUMBER(?)
         ORDER BY pv.ValidFrom DESC
       ]]>
     </Sql>
@@ -70,7 +70,7 @@
         SELECT PO_PRICELIST_ID
         FROM S_TIMEEXPENSE, C_BPARTNER
         WHERE S_TIMEEXPENSE.C_BPARTNER_ID = C_BPARTNER.C_BPARTNER_ID
-        AND S_TIMEEXPENSE.S_TIMEEXPENSE_ID = ?
+        AND S_TIMEEXPENSE.S_TIMEEXPENSE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="sTimeexpenseId"/>
@@ -81,7 +81,7 @@
       <![CDATA[
         SELECT C_UOM_ID
         FROM M_PRODUCT
-        WHERE M_PRODUCT_ID = ?
+        WHERE M_PRODUCT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="mProductId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_InOut_DocType_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_InOut_DocType_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
         SELECT d.HasCharges,d.IsApproved,d.IsDocNoControlled,
         s.CurrentNext, d.DocBaseType
         FROM C_DocType d left join AD_Sequence s on d.DocNoSequence_ID=s.AD_Sequence_ID
-        WHERE C_DocType_ID=?
+        WHERE C_DocType_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cDocTypeId"/>
@@ -41,7 +41,7 @@
       <![CDATA[
         SELECT C_DOCTYPETARGET_ID
         FROM C_INVOICE
-        WHERE C_INVOICE_ID = ?
+        WHERE C_INVOICE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cInvoiceId"/>
@@ -52,7 +52,7 @@
       <![CDATA[
         SELECT DOCUMENTNO
         FROM C_INVOICE
-        WHERE C_INVOICE_ID = ?
+        WHERE C_INVOICE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cInvoiceId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_BPartner_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_BPartner_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -35,7 +35,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT C_DocType.DocBaseType FROM C_DocType WHERE C_DocType.C_DocType_ID = ?
+      SELECT C_DocType.DocBaseType FROM C_DocType WHERE C_DocType.C_DocType_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cDoctypeId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_Project_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_Project_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
         SELECT C_PROJECT.C_PAYMENTTERM_ID AS PAYMENTTERM, C_PROJECT.PAYMENTRULE AS PAYMENTRULE
         FROM C_PROJECT
-        WHERE C_PROJECT_ID=?
+        WHERE C_PROJECT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cProjectId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_Order_BPartner_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_Order_BPartner_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -34,7 +34,7 @@
       COALESCE(p.SO_CreditLimit-p.SO_CreditUsed,-1) AS CreditAvailable,
       p.PO_PriceList_ID, p.PaymentRulePO, p.PO_PaymentTerm_ID, p.salesrep_Id
       FROM C_BPartner p
-      WHERE p.C_BPartner_ID=?
+      WHERE p.C_BPartner_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cBpartnerId"/>
@@ -44,7 +44,7 @@
     <Sql>
       <![CDATA[
         SELECT MAX(M_WAREHOUSE_ID) AS ID FROM M_WAREHOUSE_SHIPPER
-        WHERE M_WAREHOUSE_SHIPPER.C_BPARTNER_ID = ?
+        WHERE M_WAREHOUSE_SHIPPER.C_BPARTNER_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cBpartnerId"/>
@@ -71,7 +71,7 @@
         where ad_user.c_bpartner_id = c_bpartner.c_bpartner_id
         and c_bpartner.issalesrep='Y'
         and ad_user.isactive='Y' 
-        and ad_user.c_bpartner_id= ?
+        and ad_user.c_bpartner_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cBpartnerId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_Order_Project_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_Order_Project_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
         SELECT MAX(C_PAYMENTTERM_ID) AS PAYMENTTERM, MAX(PAYMENTRULE) AS PAYMENTRULE
         FROM C_PROJECT
-        WHERE C_PROJECT_ID = ?
+        WHERE C_PROJECT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cProjectId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_ProjectLine_Value_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_ProjectLine_Value_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -26,7 +26,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        select value, name, description from m_product where m_product_id = ?
+        select value, name, description from m_product where m_product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="product"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_Proposal_BPartner_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_Proposal_BPartner_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,7 +36,7 @@
     <Sql>
       <![CDATA[
         select paymentrule from c_bpartner
-        where c_bpartner_id = ?
+        where c_bpartner_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cBPartnerId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_Request_CopyText_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_Request_CopyText_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
         SELECT MailHeader, MailText 
         FROM R_MailText 
-        WHERE R_MailText_ID = ?
+        WHERE R_MailText_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="r_mailtext_id"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_BankStmt_Amount_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_BankStmt_Amount_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,7 +36,7 @@
       SELECT CASE WHEN B.C_CURRENCY_ID = P.C_CURRENCY_ID THEN 'N' ELSE 'Y'  END AS CONVERSION
       FROM C_BANKSTATEMENTLINE B, C_DEBT_PAYMENT P 
       WHERE B.C_DEBT_PAYMENT_ID = P.C_DEBT_PAYMENT_ID 
-      AND B.C_BANKSTATEMENTLINE_ID = ?
+      AND B.C_BANKSTATEMENTLINE_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="bankstmtline"/>
   </SqlMethod-->
@@ -44,9 +44,9 @@
   <SqlMethod name="isConversion" type="preparedStatement" return="String">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT (CASE WHEN C_CURRENCY_ID = ? THEN 'N' ELSE 'Y' END) as CONVERSION
+      SELECT (CASE WHEN C_CURRENCY_ID = TO_NUMBER(?) THEN 'N' ELSE 'Y' END) as CONVERSION
       FROM C_DEBT_PAYMENT
-	    WHERE C_DEBT_PAYMENT_ID = ?
+	    WHERE C_DEBT_PAYMENT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="currency"/>
     <Parameter name="dp"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_CCPMeasure_Group_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_CCPMeasure_Group_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
       SELECT seqno, hassecproduct 
       FROM MA_CCP_Group
-      WHERE MA_CCP_Group_ID = ?
+      WHERE MA_CCP_Group_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="maCCPGroupId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_CashJournal_Amounts_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_CashJournal_Amounts_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -34,7 +34,7 @@
     <Sql>
       SELECT (CASE ISSOTRX WHEN 'Y' THEN C_ORDER.GRANDTOTAL ELSE -C_ORDER.GRANDTOTAL END) AS AMOUNT
       FROM C_ORDER 
-      WHERE C_ORDER_ID = ?
+      WHERE C_ORDER_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cOrderId"/>
   </SqlMethod>
@@ -44,10 +44,10 @@
       SELECT C_Currency_Convert((CASE ISRECEIPT WHEN 'Y' THEN p.AMOUNT ELSE -p.AMOUNT END), p.C_Currency_ID, (SELECT b.C_CURRENCY_ID
                                                                               FROM C_CASH C, C_CASHBOOK B 
                                                                               WHERE C.C_CASHBOOK_ID = B.C_CASHBOOK_ID
-                                                                              AND C.C_CASH_ID = ?),
-                                                    (SELECT STATEMENTDATE FROM C_CASH WHERE C_CASH_ID = ?),null,p.AD_Client_ID,p.AD_Org_ID) as amount
+                                                                              AND C.C_CASH_ID = TO_NUMBER(?)),
+                                                    (SELECT STATEMENTDATE FROM C_CASH WHERE C_CASH_ID = TO_NUMBER(?)),null,p.AD_Client_ID,p.AD_Org_ID) as amount
       FROM C_DEBT_PAYMENT p
-      WHERE C_DEBT_PAYMENT_ID = ?
+      WHERE C_DEBT_PAYMENT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cCash"/> 
     <Parameter name="cCash"/>
@@ -59,10 +59,10 @@
       SELECT C_Currency_Convert((CASE ISRECEIPT WHEN 'Y' THEN p.AMOUNT ELSE -p.AMOUNT END), p.C_Currency_ID,(SELECT A.C_CURRENCY_ID
                                                                               FROM C_BANKSTATEMENT S, C_BANKACCOUNT A 
                                                                               WHERE S.C_BANKACCOUNT_ID = A.C_BANKACCOUNT_ID 
-                                                                              AND S.C_BankStatement_ID = ?),
-                                                                        (SELECT STATEMENTDATE FROM C_BANKSTATEMENT WHERE C_BANKSTATEMENT_ID = ?),null,p.AD_Client_ID,p.AD_Org_ID) as amount
+                                                                              AND S.C_BankStatement_ID = TO_NUMBER(?)),
+                                                                        (SELECT STATEMENTDATE FROM C_BANKSTATEMENT WHERE C_BANKSTATEMENT_ID = TO_NUMBER(?)),null,p.AD_Client_ID,p.AD_Org_ID) as amount
       FROM C_DEBT_PAYMENT p
-      WHERE C_DEBT_PAYMENT_ID = ?
+      WHERE C_DEBT_PAYMENT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cBankstatement"/>
     <Parameter name="cBankstatement"/>
@@ -73,7 +73,7 @@
     <Sql>
       SELECT DESCRIPTION
       FROM C_DEBT_PAYMENT
-      WHERE C_DEBT_PAYMENT_ID = ?
+      WHERE C_DEBT_PAYMENT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cDebtPaymentId"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Charge_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Charge_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -35,7 +35,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT ChargeAmt FROM C_Charge WHERE C_Charge_ID=?
+      SELECT ChargeAmt FROM C_Charge WHERE C_Charge_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cChargeId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Command_ArgNumber_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Command_ArgNumber_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -27,7 +27,7 @@
       <![CDATA[
       SELECT ArgNo AS argno, ArgHelp1 AS help1, ArgHelp2 AS help2, ArgHelp3 AS help3 
       FROM AT_Command 
-      WHERE AT_Command_ID = ? 
+      WHERE AT_Command_ID = TO_NUMBER(?) 
       ]]>
     </Sql>
     <Parameter name="atCommandId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_CostcenterEmployee_SalaryCategory_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_CostcenterEmployee_SalaryCategory_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -31,7 +31,7 @@
         FROM  C_SALARY_CATEGORY_COST scc
         WHERE scc.c_salary_category_cost_id = (SELECT MAX(scc1.c_salary_category_cost_id) 
                                                FROM C_SALARY_CATEGORY_COST scc1 
-                                               WHERE scc1.c_salary_category_id = ?
+                                               WHERE scc1.c_salary_category_ID = TO_NUMBER(?)
                                                AND scc1.datefrom = (SELECT MAX(scc2.datefrom) 
                                                                     FROM C_SALARY_CATEGORY_COST scc2 
                                                                     WHERE scc2.c_salary_category_id = scc1.c_salary_category_id
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_GlobalUse_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_GlobalUse_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,14 +36,14 @@
     <Sql>
       SELECT C_UOM_ID
       FROM M_PRODUCT
-      WHERE M_PRODUCT_ID = ?
+      WHERE M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
   </SqlMethod>
   <SqlMethod name="strMProductUOMID" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT M_PRODUCT_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_ID = ? AND C_UOM_ID = ?
+      SELECT M_PRODUCT_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_ID = TO_NUMBER(?) AND C_UOM_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
     <Parameter name="cUOMId"/>
@@ -53,7 +53,7 @@
     <Sql>
       SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE 1 END) AS TOTAL 
       FROM M_PRODUCT_UOM 
-      WHERE M_PRODUCT_ID = ?
+      WHERE M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
   </SqlMethod>
@@ -66,11 +66,11 @@
       WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
       AND C_ORDER.DATEORDERED = (SELECT MAX(C_ORDER.DATEORDERED) FROM C_ORDER, C_ORDERLINE
       WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
-      AND C_ORDER.C_BPARTNER_ID = ?
-      AND C_ORDERLINE.M_PRODUCT_ID = ?
+      AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+      AND C_ORDERLINE.M_PRODUCT_ID = TO_NUMBER(?)
       AND C_ORDER.DOCSTATUS = 'CO')
-      AND C_ORDER.C_BPARTNER_ID = ?
-      AND C_ORDERLINE.M_PRODUCT_ID = ?
+      AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+      AND C_ORDERLINE.M_PRODUCT_ID = TO_NUMBER(?)
       AND C_ORDER.DOCSTATUS = 'CO'
     </Sql>
     <Parameter name="cBpartnerId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Locator_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Locator_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -35,7 +35,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       SELECT COALESCE(SUM(QTYONHAND),0) AS QTYONHAND FROM M_STORAGE_DETAIL
-      WHERE M_LOCATOR_ID = ?
+      WHERE M_LOCATOR_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mLocatorId"/>
   </SqlMethod>
@@ -44,8 +44,8 @@
     <Sql>
     <![CDATA[
       SELECT COALESCE(SUM(QTYONHAND),0) AS QTYONHAND FROM M_STORAGE_DETAIL
-      WHERE M_LOCATOR_ID = ?
-      AND M_PRODUCT_ID <> ?
+      WHERE M_LOCATOR_ID = TO_NUMBER(?)
+      AND M_PRODUCT_ID <> TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="mLocatorId"/>
@@ -56,8 +56,8 @@
     <Sql>   
       SELECT COALESCE(MAX(M_INOUTLINE.M_INOUTLINE_ID),0) AS FILLEDLOCATOR FROM M_INOUT, M_INOUTLINE
       WHERE M_INOUT.M_INOUT_ID = M_INOUTLINE.M_INOUT_ID
-      AND M_INOUT.M_INOUT_ID = ?
-      AND M_INOUTLINE.M_LOCATOR_ID = ?
+      AND M_INOUT.M_INOUT_ID = TO_NUMBER(?)
+      AND M_INOUTLINE.M_LOCATOR_ID = TO_NUMBER(?)
     </Sql>  
     <Parameter name="mInoutId"/>
     <Parameter name="mLocatorId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -45,7 +45,7 @@
     <Sql>
       SELECT description 
       FROM M_AttributeSetInstance 
-      WHERE M_AttributeSetInstance_ID = ? 
+      WHERE M_AttributeSetInstance_ID = TO_NUMBER(?) 
     </Sql>
     <Parameter name="mAttributesetinstanceId"/>
   </SqlMethod>
@@ -54,7 +54,7 @@
     <Sql>
       SELECT COALESCE(count (*),0) AS orders
       FROM M_INOUTLINE
-      WHERE M_INOUTLINE_ID=?
+      WHERE M_INOUTLINE_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="strmInoutlineId"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Internal_Consumption_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Internal_Consumption_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,7 +36,7 @@
     <Sql>
       SELECT DESCRIPTION 
       FROM M_ATTRIBUTESETINSTANCE 
-      WHERE M_ATTRIBUTESETINSTANCE_ID = ?
+      WHERE M_ATTRIBUTESETINSTANCE_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mAttributesetinstanceId"/>
   </SqlMethod>
@@ -45,7 +45,7 @@
     <Sql>
       SELECT VALUE 
       FROM M_LOCATOR 
-      WHERE M_LOCATOR_ID = ?
+      WHERE M_LOCATOR_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mLocatorId"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,7 +36,7 @@
     <Sql>
       <![CDATA[
         SELECT C_UOM_ID FROM M_Product 
-        WHERE M_Product_ID=?
+        WHERE M_Product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="product"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_InvoiceTax_Amt_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_InvoiceTax_Amt_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,9 +30,9 @@
         from c_tax        t,
              c_currency   c,
              c_invoice    i
-        where t.c_tax_id = ?
+        where t.c_tax_ID = TO_NUMBER(?)
         and c.c_currency_id = i.c_currency_id
-        and i.c_invoice_id = ?
+        and i.c_invoice_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cTaxId"/>
     <Parameter name="cInvoiceId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Amt_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Amt_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       FROM C_Invoice, M_PriceList, C_Currency 
       WHERE C_Invoice.M_PriceList_ID = M_PriceList.M_PriceList_ID
       AND M_PriceList.C_Currency_ID = C_Currency.C_Currency_ID
-      AND C_Invoice.C_Invoice_ID = ?
+      AND C_Invoice.C_Invoice_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cInvoiceId"/>
   </SqlMethod>
@@ -38,8 +38,8 @@
     <Sql>
       SELECT PRICELIMIT 
       FROM M_PRODUCTPRICE 
-      WHERE M_PRICELIST_VERSION_ID = ? 
-      AND M_PRODUCT_ID=?
+      WHERE M_PRICELIST_VERSION_ID = TO_NUMBER(?) 
+      AND M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mPricelistVersionId"/>
     <Parameter name="mProductId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Conversion_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Conversion_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -34,21 +34,21 @@
   <SqlMethod name="initUOMId" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT C_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_UOM_ID = ? 
+      SELECT C_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_UOM_ID = TO_NUMBER(?) 
     </Sql>
     <Parameter name="mProductUOMId"/>
   </SqlMethod>
   <SqlMethod name="stdPrecision" type="preparedStatement" return="String" default="0">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT STDPRECISION FROM C_UOM WHERE C_UOM_ID = ? 
+      SELECT STDPRECISION FROM C_UOM WHERE C_UOM_ID = TO_NUMBER(?) 
     </Sql>
     <Parameter name="mProductUOMId"/>
   </SqlMethod>
   <SqlMethod name="multiplyRate" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT MULTIPLYRATE FROM C_UOM_CONVERSION WHERE C_UOM_ID = ? AND C_UOM_TO_ID = ?
+      SELECT MULTIPLYRATE FROM C_UOM_CONVERSION WHERE C_UOM_ID = TO_NUMBER(?) AND C_UOM_TO_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductUOM"/>
     <Parameter name="mProduct"/>
@@ -56,7 +56,7 @@
   <SqlMethod name="divideRate" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT DIVIDERATE FROM C_UOM_CONVERSION WHERE C_UOM_ID = ? AND C_UOM_TO_ID = ?
+      SELECT DIVIDERATE FROM C_UOM_CONVERSION WHERE C_UOM_ID = TO_NUMBER(?) AND C_UOM_TO_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProduct"/>
     <Parameter name="mProductUOM"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Tax_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Tax_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
       SELECT C_Invoice.C_BPartner_Location_ID, C_Invoice.DateInvoiced, C_Invoice.C_Project_ID
       FROM C_Invoice
-      WHERE C_Invoice_ID = ?
+      WHERE C_Invoice_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cInvoiceId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_JournalLineAmt_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_JournalLineAmt_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
 	SELECT c.C_Currency_ID, c.StdPrecision 
 	FROM C_AcctSchema a, C_Currency c 
 	WHERE a.C_Currency_ID=c.C_Currency_ID 
-	AND a.C_AcctSchema_ID = ?
+	AND a.C_AcctSchema_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cAcctSchemaId"/>
   </SqlMethod>
@@ -50,8 +50,8 @@
     <Sql>
 	SELECT CurrencyRate 
 	FROM GL_Journal 
-	WHERE GL_Journal_ID=? 
-	AND C_Currency_ID=? 
+	WHERE GL_Journal_ID = TO_NUMBER(?) 
+	AND C_Currency_ID = TO_NUMBER(?) 
 	AND CurrencyRateType=?
     </Sql>
     <Parameter name="GLJournalId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Journal_Period_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Journal_Period_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -27,7 +27,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       SELECT PeriodType, StartDate, EndDate 
-      FROM C_Period WHERE C_Period_ID=?
+      FROM C_Period WHERE C_Period_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cPeriodId"/>
   </SqlMethod>
@@ -38,7 +38,7 @@
       FROM C_Period 
       WHERE C_Year_ID IN 
       (SELECT C_Year_ID FROM C_Year WHERE C_Calendar_ID =
-      (SELECT C_Calendar_ID FROM AD_ClientInfo WHERE AD_Client_ID=?))
+      (SELECT C_Calendar_ID FROM AD_ClientInfo WHERE AD_Client_ID = TO_NUMBER(?)))
       AND to_date(?) BETWEEN StartDate AND EndDate
       AND PeriodType='S'
       AND exists (select 1 from c_periodcontrol where c_periodcontrol.c_period_id = c_period.c_period_id
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Locator_Renting_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Locator_Renting_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,7 +36,7 @@
     <Sql><![CDATA[
       SELECT 1
       FROM M_LOCATOR_RENTING ML
-      WHERE M_LOCATOR_ID= ?
+      WHERE M_LOCATOR_ID = TO_NUMBER(?)
       AND VALIDFROM < now()
       AND COALESCE(VALIDTO, TO_DATE('31/12/9999','DD/MM/YYYY')) > now()
       ]]>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_MInOutTraceReports_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_MInOutTraceReports_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -31,7 +31,7 @@
        FROM M_TRANSACTION
        WHERE 1=1
         AND M_ATTRIBUTESETINSTANCE_ID <> 0
-        AND M_PRODUCT_ID = ?
+        AND M_PRODUCT_ID = TO_NUMBER(?)
        ORDER BY NAME
        ]]></Sql>
      <Parameter name="adLanguage"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,14 +30,14 @@
       FROM C_Order, M_PriceList, C_Currency 
       WHERE C_Order.M_PriceList_ID = M_PriceList.M_PriceList_ID
       AND M_PriceList.C_Currency_ID = C_Currency.C_Currency_ID
-      AND C_Order.C_Order_ID = ?
+      AND C_Order.C_Order_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cOrderId"/>
   </SqlMethod>
   <SqlMethod name="listPriceType" type="preparedStatement" return="boolean">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT (CASE ENFORCEPRICELIMIT WHEN 'Y' THEN 1 ELSE 0 END) AS TYPE FROM M_PRICELIST WHERE M_PRICELIST_ID = ?
+      SELECT (CASE ENFORCEPRICELIMIT WHEN 'Y' THEN 1 ELSE 0 END) AS TYPE FROM M_PRICELIST WHERE M_PRICELIST_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="priceList"/>
   </SqlMethod>
@@ -46,8 +46,8 @@
     <Sql>
       SELECT PRICELIMIT 
       FROM M_PRODUCTPRICE 
-      WHERE M_PRICELIST_VERSION_ID = ? 
-      AND M_PRODUCT_ID=?
+      WHERE M_PRICELIST_VERSION_ID = TO_NUMBER(?) 
+      AND M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mPricelistVersionId"/>
     <Parameter name="mProductId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_DocType_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_DocType_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -35,7 +35,7 @@
         '' as FreightCostRule, '' as DeliveryViaRule,
         '' as PaymentRulePO, '' as PO_PaymentTerm_ID
         FROM C_DocType d left join AD_Sequence s on d.DocNoSequence_ID=s.AD_Sequence_ID
-        WHERE C_DocType_ID = ? 
+        WHERE C_DocType_ID = TO_NUMBER(?) 
       ]]>
     </Sql>
     <Parameter name="cDoctypeId"/>
@@ -49,7 +49,7 @@
         FreightCostRule,DeliveryViaRule,
         PaymentRulePO,PO_PaymentTerm_ID
         FROM C_BPartner
-        WHERE C_BPartner_ID=?
+        WHERE C_BPartner_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cBpartnerId"/>
@@ -59,7 +59,7 @@
     <Sql>
       <![CDATA[
       SELECT DOCSUBTYPESO FROM C_DOCTYPE
-      WHERE C_DOCTYPE_ID IN (SELECT C_DOCTYPETARGET_ID FROM C_ORDER WHERE C_ORDER_ID = ?)
+      WHERE C_DOCTYPE_ID IN (SELECT C_DOCTYPETARGET_ID FROM C_ORDER WHERE C_ORDER_ID = TO_NUMBER(?))
       ]]>
     </Sql>
     <Parameter name="cOrderId"/>
@@ -68,7 +68,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT DocumentNo FROM C_ORDER WHERE C_ORDER_ID = ?
+      SELECT DocumentNo FROM C_ORDER WHERE C_ORDER_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cOrderId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_PriceList_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_PriceList_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
         SELECT pl.IsTaxIncluded, pl.C_Currency_ID 
         FROM M_PriceList pl 
-        WHERE pl.M_PriceList_ID=?
+        WHERE pl.M_PriceList_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="mPricelistId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -25,7 +25,7 @@
     <Sql>
       <![CDATA[
       SELECT C_ORDER_ID AS ID, DATEORDERED, C_BPARTNER_ID, M_PRICELIST_ID, '' AS DATEINVOICED 
-        FROM C_ORDER WHERE C_ORDER_ID = ?
+        FROM C_ORDER WHERE C_ORDER_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cOrderId"/>
@@ -35,7 +35,7 @@
     <Sql>
       <![CDATA[
       SELECT C_INVOICE_ID AS ID, DATEINVOICED, C_BPARTNER_ID, M_PRICELIST_ID
-      	FROM C_INVOICE WHERE C_INVOICE_ID = ?
+      	FROM C_INVOICE WHERE C_INVOICE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cInvoiceId"/>
@@ -43,7 +43,7 @@
   <!--SqlMethod name="strMProductUOMID" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT M_PRODUCT_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_ID = ? AND C_UOM_ID = ?
+      SELECT M_PRODUCT_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_ID = TO_NUMBER(?) AND C_UOM_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
     <Parameter name="cUOMId"/>
@@ -53,7 +53,7 @@
     <Sql>
       SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE 1 END) AS TOTAL 
       FROM M_PRODUCT_UOM 
-      WHERE M_PRODUCT_ID = ?
+      WHERE M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
   </SqlMethod>
@@ -65,11 +65,11 @@
       WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
       AND C_ORDER.DATEORDERED = (SELECT MAX(C_ORDER.DATEORDERED) FROM C_ORDER, C_ORDERLINE
       WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
-      AND C_ORDER.C_BPARTNER_ID = ?
-      AND C_ORDERLINE.M_PRODUCT_ID = ?
+      AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+      AND C_ORDERLINE.M_PRODUCT_ID = TO_NUMBER(?)
       AND C_ORDER.DOCSTATUS = 'CO')
-      AND C_ORDER.C_BPARTNER_ID = ?
-      AND C_ORDERLINE.M_PRODUCT_ID = ?
+      AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+      AND C_ORDERLINE.M_PRODUCT_ID = TO_NUMBER(?)
       AND C_ORDER.DOCSTATUS = 'CO'
     </Sql>
     <Parameter name="cBpartnerId"/>
@@ -87,7 +87,7 @@
                        FROM C_CURRENCY C,
                             C_ORDER    O 
                       WHERE C.C_CURRENCY_ID = O.C_CURRENCY_ID
-                        AND O.C_ORDER_ID    = ?)) AS TOTAL FROM DUAL
+                        AND O.C_ORDER_ID = TO_NUMBER(?))) AS TOTAL FROM DUAL
     </Sql>
     <Parameter name="dateordered"/>
     <Parameter name="cBpartnerId"/>
@@ -107,7 +107,7 @@
                        FROM C_CURRENCY C,
                             C_INVOICE  I 
                       WHERE C.C_CURRENCY_ID = I.C_CURRENCY_ID
-                        AND I.C_INVOICE_ID  = ?)) AS TOTAL FROM DUAL
+                        AND I.C_INVOICE_ID = TO_NUMBER(?))) AS TOTAL FROM DUAL
     </Sql>
     <Parameter name="dateordered"/>
     <Parameter name="cBpartnerId"/>
@@ -127,7 +127,7 @@
                        FROM C_CURRENCY C,
                             C_ORDER    O 
                       WHERE C.C_CURRENCY_ID = O.C_CURRENCY_ID
-                        AND O.C_ORDER_ID    = ?)) as TOTAL FROM DUAL
+                        AND O.C_ORDER_ID = TO_NUMBER(?))) as TOTAL FROM DUAL
 	 </Sql>
     <Parameter name="cBpartnerId"/>
 	<Parameter name="pricestd"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Stock_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Stock_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -28,7 +28,7 @@
     <Sql>
       SELECT COALESCE(Stock_Min,0) as Stock, Enforce_Attribute
       FROM M_Product
-      WHERE M_Product_ID = ?
+      WHERE M_Product_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
   </SqlMethod>
@@ -36,8 +36,8 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       SELECT SUM (QTYONHAND) AS QTY FROM M_STORAGE_DETAIL
-      WHERE M_PRODUCT_ID = ?
-      AND C_UOM_ID = ?
+      WHERE M_PRODUCT_ID = TO_NUMBER(?)
+      AND C_UOM_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
     <Parameter name="cUOMId"/>
@@ -46,9 +46,9 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       SELECT SUM (QTYONHAND) AS QTY FROM M_STORAGE_DETAIL
-      WHERE M_PRODUCT_ID = ?
-      AND C_UOM_ID = ?
-      AND M_ATTRIBUTESETINSTANCE_ID = ?
+      WHERE M_PRODUCT_ID = TO_NUMBER(?)
+      AND C_UOM_ID = TO_NUMBER(?)
+      AND M_ATTRIBUTESETINSTANCE_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
     <Parameter name="cUOMId"/>
@@ -58,7 +58,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       SELECT ISSOTRX FROM C_ORDER
-      WHERE C_ORDER_ID = ?
+      WHERE C_ORDER_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cOrderId"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Tax_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Tax_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
       SELECT C_Order.BillTo_ID, C_Order.DateOrdered, C_Order.C_Project_ID
       FROM C_Order
-      WHERE C_Order_ID = ?
+      WHERE C_Order_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cOrderId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Payment_Amounts_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Payment_Amounts_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
         SELECT C_INVOICE.GRANDTOTAL AS GRAND, C_CURRENCY.C_CURRENCY_ID as CURRENCYID
         FROM C_INVOICE, C_CURRENCY
         WHERE C_INVOICE.C_CURRENCY_ID = C_CURRENCY.C_CURRENCY_ID
-        AND C_INVOICE.C_INVOICE_ID = ?
+        AND C_INVOICE.C_INVOICE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cInvoiceId"/>
@@ -42,8 +42,8 @@
       <![CDATA[
         SELECT C_CONVERSION_RATE.MULTIPLYRATE 
         FROM C_CONVERSION_RATE
-        WHERE C_CONVERSION_RATE.C_CURRENCY_ID = ?
-        AND C_CONVERSION_RATE.C_CURRENCY_ID_TO = ?
+        WHERE C_CONVERSION_RATE.C_CURRENCY_ID = TO_NUMBER(?)
+        AND C_CONVERSION_RATE.C_CURRENCY_ID_TO = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cCurrencyId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Payment_DocType_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Payment_DocType_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -39,8 +39,8 @@
          ELSE 'N' 
          END) AS TOTAL
          FROM C_INVOICE i, C_DOCTYPE dt 
-         WHERE i.C_Invoice_ID=?
-         AND dt.C_DocType_ID=?
+         WHERE i.C_Invoice_ID = TO_NUMBER(?)
+         AND dt.C_DocType_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cInvoiceId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_ProductionPlan_WRPhase_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_ProductionPlan_WRPhase_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -35,8 +35,8 @@
                                         WHERE maccv2.Ma_Costcenter_id = maccv3.Ma_Costcenter_id
                                           AND validfrom < (SELECT pr.Movementdate
                                                            FROM M_Production pr
-                                                           WHERE pr.M_Production_ID = ?))) ccv ON cc.MA_Costcenter_ID  = ccv.MA_COstCenter_ID
-      WHERE wrp.MA_WRPhase_ID = ?
+                                                           WHERE pr.M_Production_ID = TO_NUMBER(?)))) ccv ON cc.MA_Costcenter_ID  = ccv.MA_COstCenter_ID
+      WHERE wrp.MA_WRPhase_ID = TO_NUMBER(?)
       AND wrp.MA_Process_ID = p.MA_Process_ID
       AND wrp.MA_WorkRequirement_ID = w.MA_WorkRequirement_ID
       ]]>
@@ -56,7 +56,7 @@
        <![CDATA[
        SELECT coalesce(wrp.Outsourced, 'N') as Outsourced
        FROM MA_WRPhase wrp
-       WHERE wrp.MA_WRPhase_ID = ?
+       WHERE wrp.MA_WRPhase_ID = TO_NUMBER(?)
        ]]>
      </Sql>
      <Parameter name="mProductionPlanId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Production_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Production_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,7 +36,7 @@
     <Sql>
       SELECT DESCRIPTION 
       FROM M_ATTRIBUTESETINSTANCE 
-      WHERE M_ATTRIBUTESETINSTANCE_ID = ?
+      WHERE M_ATTRIBUTESETINSTANCE_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mAttributesetinstanceId"/>
   </SqlMethod>
@@ -45,7 +45,7 @@
     <Sql>
       SELECT VALUE 
       FROM M_LOCATOR 
-      WHERE M_LOCATOR_ID = ?
+      WHERE M_LOCATOR_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mLocatorId"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_ProjectPlanned_Amt_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_ProjectPlanned_Amt_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -31,7 +31,7 @@
       WHERE C_Projectline.C_Project_ID = C_Project.C_Project_ID
       AND C_Project.M_PriceList_ID = M_PriceList.M_PriceList_ID
       AND M_PriceList.C_Currency_ID = C_Currency.C_Currency_ID
-      AND C_Projectline.C_Projectline_ID = ?
+      AND C_Projectline.C_Projectline_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cProjectId"/>
   </SqlMethod>
@@ -40,8 +40,8 @@
     <Sql>
       SELECT PRICELIMIT 
       FROM M_PRODUCTPRICE 
-      WHERE M_PRICELIST_VERSION_ID = ? 
-      AND M_PRODUCT_ID=?
+      WHERE M_PRICELIST_VERSION_ID = TO_NUMBER(?) 
+      AND M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mPricelistVersionId"/>
     <Parameter name="mProductId"/>
@@ -51,7 +51,7 @@
       <Sql>
         UPDATE C_PROJECTLINE SET 
         PLANNEDAMT = TO_NUMBER(?), UPDATED = now(), UPDATEDBY = TO_NUMBER(?)
-        WHERE C_PROJECTLINE_ID = ?
+        WHERE C_PROJECTLINE_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="plannedAmt"/>
       <Parameter name="updatedby"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Proposal_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Proposal_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -27,7 +27,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        select value, name, description from m_product where m_product_id = ?
+        select value, name, description from m_product where m_product_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="product"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Request_Action_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Request_Action_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
         SELECT EMAIL, EMAILUSER, EMAILUSERPW, NAME 
         FROM AD_USER 
-        WHERE AD_USER_ID = ?
+        WHERE AD_USER_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="ad_user_id"/>
@@ -38,7 +38,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
         SELECT SMTPHost FROM AD_Client 
-        WHERE AD_Client_ID = ?
+        WHERE AD_Client_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="ad_client_id"/>
   </SqlMethod>
@@ -48,8 +48,8 @@
         SELECT U.EMAIL
         FROM C_BPARTNER BP, AD_USER U
         WHERE BP.C_BPARTNER_ID = U.C_BPARTNER_ID
-        AND BP.C_BPARTNER_ID = ?
-        AND U.AD_USER_ID = ?
+        AND BP.C_BPARTNER_ID = TO_NUMBER(?)
+        AND U.AD_USER_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="c_bpartner_id"/>
     <Parameter name="ad_user_id"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_ScheduledMaintenance_Maintenance_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_ScheduledMaintenance_Maintenance_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
       SELECT MA_MACHINE_ID, MA_MACHINE_TYPE_ID, MAINTENANCE_TYPE, MA_MAINT_OPERATION_ID
       FROM MA_MAINTENANCE
-      WHERE MA_MAINTENANCE_ID = ?
+      WHERE MA_MAINTENANCE_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="strmaMaintenanceId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,7 +36,7 @@
     <Sql>
       SELECT C_UOM_ID
       FROM M_PRODUCT
-      WHERE M_PRODUCT_ID = ?
+      WHERE M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
 </SqlMethod>
@@ -44,7 +44,7 @@
   <SqlMethod name="strMProductUOMID" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT M_PRODUCT_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_ID = ? AND C_UOM_ID = ?
+      SELECT M_PRODUCT_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_ID = TO_NUMBER(?) AND C_UOM_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
     <Parameter name="cUOMId"/>
@@ -54,7 +54,7 @@
     <Sql>
       SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE 1 END) AS TOTAL 
       FROM M_PRODUCT_UOM 
-      WHERE M_PRODUCT_ID = ?
+      WHERE M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
   </SqlMethod>
@@ -67,11 +67,11 @@
       WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
       AND C_ORDER.DATEORDERED = (SELECT MAX(C_ORDER.DATEORDERED) FROM C_ORDER, C_ORDERLINE
       WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
-      AND C_ORDER.C_BPARTNER_ID = ?
-      AND C_ORDERLINE.M_PRODUCT_ID = ?
+      AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+      AND C_ORDERLINE.M_PRODUCT_ID = TO_NUMBER(?)
       AND C_ORDER.DOCSTATUS = 'CO')
-      AND C_ORDER.C_BPARTNER_ID = ?
-      AND C_ORDERLINE.M_PRODUCT_ID = ?
+      AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+      AND C_ORDERLINE.M_PRODUCT_ID = TO_NUMBER(?)
       AND C_ORDER.DOCSTATUS = 'CO'
     </Sql>
     <Parameter name="cBpartnerId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_WRPhaseProduct_Product_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_WRPhaseProduct_Product_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,14 +36,14 @@
     <Sql>
       SELECT C_UOM_ID
       FROM M_PRODUCT
-      WHERE M_PRODUCT_ID = ?
+      WHERE M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
 </SqlMethod>
   <SqlMethod name="strMProductUOMID" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
-      SELECT M_PRODUCT_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_ID = ? AND C_UOM_ID = ?
+      SELECT M_PRODUCT_UOM_ID FROM M_PRODUCT_UOM WHERE M_PRODUCT_ID = TO_NUMBER(?) AND C_UOM_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
     <Parameter name="cUOMId"/>
@@ -53,7 +53,7 @@
     <Sql>
       SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE 1 END) AS TOTAL 
       FROM M_PRODUCT_UOM 
-      WHERE M_PRODUCT_ID = ?
+      WHERE M_PRODUCT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="mProductId"/>
   </SqlMethod>
@@ -66,11 +66,11 @@
       WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
       AND C_ORDER.DATEORDERED = (SELECT MAX(C_ORDER.DATEORDERED) FROM C_ORDER, C_ORDERLINE
       WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
-      AND C_ORDER.C_BPARTNER_ID = ?
-      AND C_ORDERLINE.M_PRODUCT_ID = ?
+      AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+      AND C_ORDERLINE.M_PRODUCT_ID = TO_NUMBER(?)
       AND C_ORDER.DOCSTATUS = 'CO')
-      AND C_ORDER.C_BPARTNER_ID = ?
-      AND C_ORDERLINE.M_PRODUCT_ID = ?
+      AND C_ORDER.C_BPARTNER_ID = TO_NUMBER(?)
+      AND C_ORDERLINE.M_PRODUCT_ID = TO_NUMBER(?)
       AND C_ORDER.DOCSTATUS = 'CO'
     </Sql>
     <Parameter name="cBpartnerId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_WRPhase_Sequence_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_WRPhase_Sequence_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
       SELECT MA_Process_Id as process, costcenteruse as ccuse, preptime, '' as quantity, COALESCE(Outsourced, 'N') as outsourced
       FROM MA_Sequence
-      WHERE MA_Sequence_Id = ?
+      WHERE MA_Sequence_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="maSequenceId"/>
@@ -39,8 +39,8 @@
     <Sql>
       SELECT wr.quantity*s.multiplier AS quantity
       FROM MA_WorkRequirement wr, MA_Sequence s
-      WHERE s.MA_Sequence_Id = ?
-      AND wr.MA_WorkRequirement_ID = ?
+      WHERE s.MA_Sequence_ID = TO_NUMBER(?)
+      AND wr.MA_WorkRequirement_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="maSequenceId"/>
     <Parameter name="maWRequirementId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_ProcessPlan_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_ProcessPlan_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
       SELECT explodephases, secondaryunit, conversionrate
       FROM MA_ProcessPlan p
-      WHERE p.MA_ProcessPlan_ID = ?
+      WHERE p.MA_ProcessPlan_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="maProcessPlanId"/>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_Sequence.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_WorkRequirement_Sequence.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
         SELECT  s.MA_Process_ID, s.COSTCENTERUSE, s.PREPTIME, s.NOQTY, s.GROUPUSE, '' AS quantity
         FROM    MA_Sequence s
-        WHERE   MA_Sequence_ID = ?
+        WHERE   MA_Sequence_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="maSequenceId"/>
@@ -40,8 +40,8 @@
       <![CDATA[
         SELECT  (s.multiplier * w.quantity) AS quantity
         FROM    MA_Sequence s, MA_WorkRequirement w
-        WHERE   s.MA_Sequence_ID = ?
-        AND     w.MA_WorkRequirement_ID = ?
+        WHERE   s.MA_Sequence_ID = TO_NUMBER(?)
+        AND     w.MA_WorkRequirement_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="maSequenceId"/>
@@ -53,8 +53,8 @@
       <![CDATA[
         SELECT  (s.multiplier * w.quantity) AS quantity
         FROM    MA_Sequence s, MA_WorkRequirement w
-        WHERE   s.MA_Sequence_ID = ?
-        AND     w.MA_WorkRequirement_ID = ?
+        WHERE   s.MA_Sequence_ID = TO_NUMBER(?)
+        AND     w.MA_WorkRequirement_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="maSequenceId"/>
--- a/src/org/openbravo/erpCommon/ad_combos/AdOrgTreeCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/AdOrgTreeCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -26,7 +26,7 @@
     <![CDATA[
         SELECT AD_ORG.AD_ORG_ID AS ID, AD_ORG.NAME AS NAME
         FROM AD_ORG 
-        WHERE AD_CLIENT_ID = ?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?)
         AND AD_ISORGINCLUDED(AD_ORG_ID,to_number(?),AD_CLIENT_ID) <> -1
      ]]></Sql>
      <Parameter name="adClientId"/>
--- a/src/org/openbravo/erpCommon/ad_combos/AttributeSetInstanceCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/AttributeSetInstanceCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
        SELECT DISTINCT M_PRODUCT_ID AS PADRE, M_ATTRIBUTESETINSTANCE_ID AS ID, AD_COLUMN_IDENTIFIER(TO_CHAR('M_ATTRIBUTESETINSTANCE'), TO_CHAR(M_ATTRIBUTESETINSTANCE_ID), TO_CHAR(?)) AS NAME
        FROM M_TRANSACTION
        WHERE 1=1
-        AND M_PRODUCT_ID = ?
+        AND M_PRODUCT_ID = TO_NUMBER(?)
         AND AD_CLIENT_ID IN ('1')
         AND AD_ORG_ID IN ('1')
         AND M_ATTRIBUTESETINSTANCE_ID <> 0
--- a/src/org/openbravo/erpCommon/ad_combos/ClientCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/ClientCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <Sql>
         SELECT A_C.AD_CLIENT_ID, A_C.NAME, '' AS ID 
         FROM AD_CLIENT A_C
-        WHERE A_C.AD_CLIENT_ID IN (SELECT CLIENTLIST FROM AD_ROLE WHERE AD_ROLE_ID = ?)
+        WHERE A_C.AD_CLIENT_ID IN (SELECT CLIENTLIST FROM AD_ROLE WHERE AD_ROLE_ID = TO_NUMBER(?))
         ORDER BY A_C.NAME
       </Sql>
         <Parameter name="rol"/>
@@ -39,8 +39,8 @@
       <Sql>
         SELECT COUNT(*) AS TOTAL
         FROM AD_CLIENT A_C
-        WHERE A_C.AD_CLIENT_ID IN (SELECT CLIENTLIST FROM AD_ROLE WHERE AD_ROLE_ID = ?) 
-        AND A_C.AD_CLIENT_ID = ?
+        WHERE A_C.AD_CLIENT_ID IN (SELECT CLIENTLIST FROM AD_ROLE WHERE AD_ROLE_ID = TO_NUMBER(?)) 
+        AND A_C.AD_CLIENT_ID = TO_NUMBER(?)
       </Sql>
         <Parameter name="rol"/>
         <Parameter name="client"/>
--- a/src/org/openbravo/erpCommon/ad_combos/LocatorCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/LocatorCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -28,8 +28,8 @@
             FROM M_LOCATOR L, M_WAREHOUSE W
 			WHERE W.M_WAREHOUSE_ID = L.M_WAREHOUSE_ID
             AND L.IsActive='Y' 
-            AND W.M_WAREHOUSE_ID = ? 
-            AND L.AD_Client_ID = ? 
+            AND W.M_WAREHOUSE_ID = TO_NUMBER(?) 
+            AND L.AD_Client_ID = TO_NUMBER(?) 
             ORDER BY NAME
             
           ]]></Sql>
--- a/src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -33,8 +33,8 @@
         AND A_R_O.ISACTIVE = 'Y' 
         AND A_R_O.AD_ROLE_ID = R.AD_ROLE_ID 
         AND R.ISACTIVE = 'Y' 
-        AND (LPAD(R.USERLEVEL, 1, 1)='S' OR A_O.AD_ORG_ID <> 0) 
-        AND A_R_O.AD_ROLE_ID = ? 
+        AND (LPAD(R.USERLEVEL, 1, '1')='S' OR A_O.AD_ORG_ID <> 0) 
+        AND A_R_O.AD_ROLE_ID = TO_NUMBER(?) 
         ORDER BY A_O.NAME
       ]]></Sql>
         <Parameter name="rol"/>
@@ -48,8 +48,8 @@
         AND A_R_O.ISACTIVE = 'Y' 
         AND A_R_O.AD_ROLE_ID = R.AD_ROLE_ID 
         AND R.ISACTIVE = 'Y' 
-        AND (LPAD(R.USERLEVEL, 1, 1)='S' OR A_O.AD_ORG_ID <> 0) 
-        AND A_R_O.AD_ROLE_ID = ? 
+        AND (LPAD(R.USERLEVEL, 1, '1')='S' OR A_O.AD_ORG_ID <> 0) 
+        AND A_R_O.AD_ROLE_ID = TO_NUMBER(?) 
         ORDER BY A_O.NAME
       ]]></Sql>
         <Parameter name="rol"/>
@@ -62,9 +62,9 @@
         WHERE A_R_O.ISACTIVE = 'Y' 
         AND A_R_O.AD_ROLE_ID = R.AD_ROLE_ID 
         AND R.ISACTIVE = 'Y' 
-        AND (LPAD(R.USERLEVEL, 1, 1)='S' OR A_R_O.AD_ORG_ID <> 0) 
-        AND A_R_O.AD_ROLE_ID = ? 
-        AND A_R_O.AD_ORG_ID = ?
+        AND (LPAD(R.USERLEVEL, 1, '1')='S' OR A_R_O.AD_ORG_ID <> 0) 
+        AND A_R_O.AD_ROLE_ID = TO_NUMBER(?) 
+        AND A_R_O.AD_ORG_ID = TO_NUMBER(?)
       ]]></Sql>
         <Parameter name="rol"/>
         <Parameter name="org"/>
--- a/src/org/openbravo/erpCommon/ad_combos/PaymentRuleCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/PaymentRuleCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -31,7 +31,7 @@
       WHERE AD_REFERENCE_ID=195
       AND R_L.VALUE IN (SELECT B.PAYMENTRULE
       FROM C_BANKACCOUNTDOC B
-      WHERE C_BANKACCOUNT_ID=?)
+      WHERE C_BANKACCOUNT_ID = TO_NUMBER(?))
       </Sql>
       <Parameter name="cuenta"/>
    </SqlMethod>
@@ -44,7 +44,7 @@
       WHERE arl.ad_reference_id = 195 
       AND arl.VALUE IN (SELECT B.PAYMENTRULE
                           FROM C_BANKACCOUNTDOC B
-                          WHERE C_BANKACCOUNT_ID=?)
+                          WHERE C_BANKACCOUNT_ID = TO_NUMBER(?))
       </Sql>
       <Parameter name="cuenta"/>
       <Parameter name="idioma"/>
--- a/src/org/openbravo/erpCommon/ad_combos/PriceListVersionCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/PriceListVersionCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -36,7 +36,7 @@
         AND M_PriceList_Version.AD_Client_ID IN ('1') 
         ORDER BY M_PriceList_Version.Name
       ]]></Sql>
-      <Parameter name="priceList" optional="true" after="AND M_PriceList_Version.IsActive='Y' " text="AND EXISTS (SELECT * FROM M_PriceList xp WHERE xp.M_PriceList_ID= ? AND p.C_Currency_ID=xp.C_Currency_ID)"/>
+      <Parameter name="priceList" optional="true" after="AND M_PriceList_Version.IsActive='Y' " text="AND EXISTS (SELECT * FROM M_PriceList xp WHERE xp.M_PriceList_ID = TO_NUMBER(?) AND p.C_Currency_ID=xp.C_Currency_ID)"/>
       <Parameter name="adUserClient" type="replace" optional="true" after="M_PriceList_Version.AD_Client_ID IN (" text="'1'"/>
    </SqlMethod>
 
@@ -47,7 +47,7 @@
         FROM M_PriceList pl, M_PriceList_Version plv 
         WHERE pl.M_PriceList_ID=plv.M_PriceList_ID 
         AND plv.IsActive= 'Y' 
-        AND pl.M_PriceList_ID = ? 
+        AND pl.M_PriceList_ID = TO_NUMBER(?) 
         AND plv.ValidFrom <= TO_DATE(?) 
         AND plv.AD_Client_ID IN ('1') 
         ORDER BY plv.ValidFrom Desc
--- a/src/org/openbravo/erpCommon/ad_combos/RegionCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/RegionCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
         SELECT R.C_REGION_ID AS ID, R.NAME  AS NAME, '' AS PADRE
         FROM C_REGION R, C_COUNTRY C
         WHERE R.C_COUNTRY_ID = C.C_COUNTRY_ID
-        AND C.C_COUNTRY_ID = ?
+        AND C.C_COUNTRY_ID = TO_NUMBER(?)
         ORDER BY R.C_COUNTRY_ID, R.NAME
       </Sql>
     <Parameter name="pais"/>
--- a/src/org/openbravo/erpCommon/ad_combos/ReportTypeCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/ReportTypeCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -34,7 +34,7 @@
                                                             and  ET.AD_Language  = 'es_ES' , 
       AD_TREENODE T
       WHERE E.C_ELEMENTVALUE_ID = T.NODE_ID 
-      AND T.AD_TREE_ID = ?
+      AND T.AD_TREE_ID = TO_NUMBER(?)
       AND (T.PARENT_ID IS NULL 
       OR T.PARENT_ID = 0)
       AND E.AD_Org_ID IN('1') 
@@ -47,7 +47,7 @@
                                                             and ET.AD_Language = 'es_ES' , 
       AD_TREENODE T
       WHERE E.C_ELEMENTVALUE_ID = T.NODE_ID 
-      AND T.AD_TREE_ID = ?
+      AND T.AD_TREE_ID = TO_NUMBER(?)
       AND (T.PARENT_ID IS NULL 
       OR T.PARENT_ID = 0)  
       AND E.AD_Org_ID IN ('2') 
--- a/src/org/openbravo/erpCommon/ad_combos/RoleCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/RoleCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -32,7 +32,7 @@
         WHERE A_R.AD_ROLE_ID = A_U_R.AD_ROLE_ID 
         AND A_U_R.ISACTIVE = 'Y' 
         AND A_R.ISACTIVE = 'Y' 
-        AND A_U_R.AD_USER_ID = ?
+        AND A_U_R.AD_USER_ID = TO_NUMBER(?)
         ORDER BY A_R.NAME
       </Sql>
         <Parameter name="user"/>
@@ -43,8 +43,8 @@
         SELECT COUNT(*) AS TOTAL 
         FROM AD_USER_ROLES A_U_R 
         WHERE A_U_R.ISACTIVE = 'Y' 
-        AND A_U_R.AD_USER_ID = ?
-        AND A_U_R.AD_ROLE_ID = ?
+        AND A_U_R.AD_USER_ID = TO_NUMBER(?)
+        AND A_U_R.AD_ROLE_ID = TO_NUMBER(?)
       </Sql>
         <Parameter name="user"/>
         <Parameter name="role"/>
--- a/src/org/openbravo/erpCommon/ad_combos/WarehouseCombo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_combos/WarehouseCombo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -32,8 +32,8 @@
         WHERE M_Warehouse.AD_ORG_ID = AD_ORG.AD_ORG_ID
         AND AD_ORG.AD_ORG_ID = AD_ROLE_ORGACCESS.AD_ORG_ID
         AND M_Warehouse.IsActive='Y' 
-        AND AD_ROLE_ORGACCESS.AD_ROLE_ID = ? 
-        AND M_Warehouse.AD_Client_ID = ? 
+        AND AD_ROLE_ORGACCESS.AD_ROLE_ID = TO_NUMBER(?) 
+        AND M_Warehouse.AD_Client_ID = TO_NUMBER(?) 
         ORDER BY M_Warehouse.Value
       </Sql>
       <Parameter name="rol"/>
@@ -58,9 +58,9 @@
         WHERE M_Warehouse.AD_ORG_ID = AD_ORG.AD_ORG_ID
         AND AD_ORG.AD_ORG_ID = AD_ROLE_ORGACCESS.AD_ORG_ID
         AND M_Warehouse.IsActive='Y' 
-        AND AD_ROLE_ORGACCESS.AD_ROLE_ID = ? 
-        AND M_Warehouse.AD_Client_ID = ? 
-        AND M_Warehouse.M_Warehouse_ID = ?
+        AND AD_ROLE_ORGACCESS.AD_ROLE_ID = TO_NUMBER(?) 
+        AND M_Warehouse.AD_Client_ID = TO_NUMBER(?) 
+        AND M_Warehouse.M_Warehouse_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="rol"/>
       <Parameter name="client"/>
--- a/src/org/openbravo/erpCommon/ad_forms/Account_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/Account_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -32,7 +32,7 @@
       '' as UseSuspenseError, '' as SuspenseError_Acct, '' as UseCurrencyBalancing, '' as CurrencyBalancing_Acct, 
       '' as RetainedEarning_Acct, '' as IncomeSummary_Acct, '' as InterCompanyDueTo_Acct, '' as InterCompanyDueFrom_Acct
       FROM C_ValidCombination 
-      WHERE C_ValidCombination_ID=?
+      WHERE C_ValidCombination_ID = TO_NUMBER(?)
       </Sql>
     <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
@@ -45,7 +45,7 @@
       '' as UseSuspenseError, '' as SuspenseError_Acct, '' as UseCurrencyBalancing, '' as CurrencyBalancing_Acct, 
       '' as RetainedEarning_Acct, '' as IncomeSummary_Acct, '' as InterCompanyDueTo_Acct, '' as InterCompanyDueFrom_Acct
       FROM C_ValidCombination 
-      WHERE C_ValidCombination_ID=?
+      WHERE C_ValidCombination_ID = TO_NUMBER(?)
       </Sql>
     <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
@@ -55,7 +55,7 @@
       SELECT UseSuspenseBalancing,SuspenseBalancing_Acct, UseSuspenseError,SuspenseError_Acct, UseCurrencyBalancing,
       CurrencyBalancing_Acct, RetainedEarning_Acct,IncomeSummary_Acct, InterCompanyDueTo_Acct,InterCompanyDueFrom_Acct 
       FROM C_AcctSchema_GL 
-      WHERE C_AcctSchema_ID=?
+      WHERE C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
     <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_forms/AcctSchemaElement_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/AcctSchemaElement_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
       Org_ID,C_ElementValue_ID,C_BPartner_ID,M_Product_ID,C_Activity_ID,C_Location_ID,
       C_Campaign_ID,C_Project_ID,C_SalesRegion_ID 
       FROM C_AcctSchema_Element 
-      WHERE C_AcctSchema_ID=? 
+      WHERE C_AcctSchema_ID = TO_NUMBER(?) 
       AND IsActive='Y' 
       ORDER BY SeqNo
       </Sql>
--- a/src/org/openbravo/erpCommon/ad_forms/AcctSchema_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/AcctSchema_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -32,7 +32,7 @@
       '' as RetainedEarning_Acct, '' as IncomeSummary_Acct, '' as InterCompanyDueTo_Acct, '' as InterCompanyDueFrom_Acct,
       '' as C_AcctSchema1_ID, '' as Acct2_Active, '' as C_AcctSchema2_ID,'' as Acct3_Active, '' as C_AcctSchema3_ID
       FROM C_AcctSchema 
-      WHERE C_AcctSchema_ID=?
+      WHERE C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
     <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
@@ -42,7 +42,7 @@
       SELECT UseSuspenseBalancing,SuspenseBalancing_Acct, UseSuspenseError,SuspenseError_Acct, UseCurrencyBalancing,
       CurrencyBalancing_Acct, RetainedEarning_Acct,IncomeSummary_Acct, InterCompanyDueTo_Acct,InterCompanyDueFrom_Acct 
       FROM C_AcctSchema_GL 
-      WHERE C_AcctSchema_ID=?
+      WHERE C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
     <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
@@ -51,7 +51,7 @@
       <Sql>
 	SELECT C_AcctSchema1_ID, Acct2_Active,C_AcctSchema2_ID, Acct3_Active,C_AcctSchema3_ID 
 	FROM AD_ClientInfo 
-	WHERE AD_Client_ID=?
+	WHERE AD_Client_ID = TO_NUMBER(?)
       </Sql>
     <Parameter name="AD_Client_ID"/>
    </SqlMethod>
@@ -60,8 +60,8 @@
     <Sql>
       <![CDATA[
         SELECT count(C_ACCTSCHEMA_TABLE_ID) AS TOTAL FROM C_ACCTSCHEMA_TABLE
-        WHERE C_ACCTSCHEMA_ID = ?
-        AND AD_TABLE_ID = ?
+        WHERE C_ACCTSCHEMA_ID = TO_NUMBER(?)
+        AND AD_TABLE_ID = TO_NUMBER(?)
         AND ISACTIVE = 'Y'
      ]]>
      </Sql>
--- a/src/org/openbravo/erpCommon/ad_forms/AcctServer_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/AcctServer_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -38,7 +38,7 @@
         '' AS CREATEFROM, '' AS GENERATETO, '' AS SENDEMAIL, '' AS AD_USER_ID, '' AS COPYFROM, '' AS ISSELFSERVICE, '' AS AD_ORGTRX_ID,
         '' AS USER1_ID, '' AS USER2_ID, '' AS CONVERTED, '' AS PERIOD, '' AS C_INVOICELINE_ID,'' AS M_INOUTLINE_ID, '' AS M_PRODUCT_ID,
         '' AS DATETRX1, '' AS DATETRX2, '' AS QTY1, '' AS QTY2, '' AS ACCOUNT_ID, '' AS C_INVOICE_ID, '' AS NAME
-        FROM C_INVOICE WHERE AD_CLIENT_ID=?
+        FROM C_INVOICE WHERE AD_CLIENT_ID = TO_NUMBER(?)
         AND PROCESSED='Y' 
         AND (PROCESSING='N' OR PROCESSING IS NULL)
         AND POSTED='N' 
@@ -55,7 +55,7 @@
     <Sql>
       <![CDATA[
         UPDATE DUAL SET Processing='Y' 
-        WHERE CLAVE_ID = ?
+        WHERE CLAVE_ID = TO_NUMBER(?)
         AND Processed='Y'
         AND (Processing='N' OR Processing IS NULL) 
         AND Posted='N'
@@ -69,7 +69,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT DocBaseType, GL_Category_ID FROM C_DocType WHERE C_DocType_ID=?
+        SELECT DocBaseType, GL_Category_ID FROM C_DocType WHERE C_DocType_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="docType"/>
@@ -78,7 +78,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT GL_Category_ID FROM C_DocType WHERE AD_Client_ID=? AND DocBaseType=?
+        SELECT GL_Category_ID FROM C_DocType WHERE AD_Client_ID = TO_NUMBER(?) AND DocBaseType=?
      ]]>
      </Sql>
      <Parameter name="client"/>
@@ -89,7 +89,7 @@
     <Sql>
       <![CDATA[
         SELECT GL_Category_ID FROM GL_Category
-        WHERE AD_Client_ID=?
+        WHERE AD_Client_ID = TO_NUMBER(?)
         ORDER BY IsDefault DESC
      ]]>
      </Sql>
@@ -99,7 +99,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        DELETE FROM Fact_Acct WHERE AD_Table_ID = ? AND Record_ID = ?
+        DELETE FROM Fact_Acct WHERE AD_Table_ID = TO_NUMBER(?) AND Record_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="Table"/>
@@ -148,7 +148,7 @@
       where c_year.c_year_id = c_period.c_year_id
       and c_period.c_period_id = c_periodcontrol.c_period_id
       and c_year.c_calendar_id = ad_clientinfo.c_calendar_id
-      and ad_clientinfo.ad_client_id = ?
+      and ad_clientinfo.ad_client_ID = TO_NUMBER(?)
       and c_periodcontrol.docbasetype = ?
       and c_periodcontrol.periodstatus = 'O'
       and to_date(?) >= c_period.StartDate
@@ -165,7 +165,7 @@
     <Sql>
       <![CDATA[
         UPDATE DUAL SET Processing='N' 
-        WHERE CLAVE_ID = ?
+        WHERE CLAVE_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="tableName" type="replace" optional="true" after="UPDATE " text="DUAL"/>
@@ -205,7 +205,7 @@
     <Sql>
       <![CDATA[
         UPDATE DUAL SET Posted= ? ,Processing='N'
-        WHERE CLAVE_ID = ?
+        WHERE CLAVE_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="tableName" type="replace" optional="true" after="UPDATE " text="DUAL"/>
@@ -224,7 +224,7 @@
         AND m1.M_InOutLine_ID IS NULL
         AND m2.C_InvoiceLine_ID IS NULL
         AND m1.M_Product_ID=m2.M_Product_ID
-        AND m1.AD_Client_ID=?
+        AND m1.AD_Client_ID = TO_NUMBER(?)
         AND NOT EXISTS (SELECT * FROM M_MatchInv mi 
         WHERE mi.C_InvoiceLine_ID=m1.C_InvoiceLine_ID AND mi.M_InOutLine_ID=m2.M_InOutLine_ID)
      ]]>
@@ -253,7 +253,7 @@
    <SqlMethod name="selectExpenseAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT CH_Expense_Acct as account_ID FROM C_Charge_Acct WHERE C_Charge_ID = ? AND C_AcctSchema_ID = ?
+        SELECT CH_Expense_Acct as account_ID FROM C_Charge_Acct WHERE C_Charge_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_Charge_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -261,7 +261,7 @@
    <SqlMethod name="selectRevenueAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT CH_Revenue_Acct as account_ID FROM C_Charge_Acct WHERE C_Charge_ID=? AND C_AcctSchema_ID=?
+        SELECT CH_Revenue_Acct as account_ID FROM C_Charge_Acct WHERE C_Charge_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_Charge_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -269,7 +269,7 @@
    <SqlMethod name="selectLiabilityAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT V_Liability_Acct as account_ID FROM C_BP_Vendor_Acct WHERE C_BPartner_ID=? AND C_AcctSchema_ID=?
+        SELECT V_Liability_Acct as account_ID FROM C_BP_Vendor_Acct WHERE C_BPartner_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
         AND STATUS IS NULL
       </Sql>
       <Parameter name="C_BPartner_ID"/>
@@ -278,7 +278,7 @@
    <SqlMethod name="selectLiabilityServicesAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT V_Liability_Services_Acct as account_ID FROM C_BP_Vendor_Acct WHERE C_BPartner_ID=? AND C_AcctSchema_ID=?
+        SELECT V_Liability_Services_Acct as account_ID FROM C_BP_Vendor_Acct WHERE C_BPartner_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
         AND STATUS IS NULL
       </Sql>
       <Parameter name="C_BPartner_ID"/>
@@ -287,7 +287,7 @@
    <SqlMethod name="selectReceivableAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT C_Receivable_Acct as account_ID FROM C_BP_Customer_Acct WHERE C_BPartner_ID=? AND C_AcctSchema_ID=?
+        SELECT C_Receivable_Acct as account_ID FROM C_BP_Customer_Acct WHERE C_BPartner_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
         AND STATUS IS NULL
       </Sql>
       <Parameter name="C_BPartner_ID"/>
@@ -296,7 +296,7 @@
    <SqlMethod name="selectUnallocatedCashAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT B_UnallocatedCash_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID=? AND C_AcctSchema_ID=?
+        SELECT B_UnallocatedCash_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_BankAccount_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -304,7 +304,7 @@
    <SqlMethod name="selectInTransitAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT B_InTransit_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID=? AND C_AcctSchema_ID=?
+        SELECT B_InTransit_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_BankAccount_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -313,7 +313,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
 	SELECT B_INTRANSIT_ACCT AS ACCOUNT_ID FROM C_Acctschema_Default
-	WHERE C_ACCTSCHEMA_ID = ?
+	WHERE C_ACCTSCHEMA_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
@@ -321,7 +321,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
 	SELECT B_Revaluationloss_Acct AS ACCOUNT_ID FROM C_ACCTSCHEMA_DEFAULT
-	WHERE C_ACCTSCHEMA_ID = ?
+	WHERE C_ACCTSCHEMA_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
@@ -329,14 +329,14 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
 	SELECT B_Revaluationgain_Acct AS ACCOUNT_ID FROM C_ACCTSCHEMA_DEFAULT
-	WHERE C_ACCTSCHEMA_ID = ?
+	WHERE C_ACCTSCHEMA_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
    <SqlMethod name="selectPaymentSelectAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT B_PaymentSelect_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID=? AND C_AcctSchema_ID=?
+        SELECT B_PaymentSelect_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_BankAccount_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -345,7 +345,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
         SELECT WRITEOFF_ACCT AS ACCOUNT_ID FROM C_ACCTSCHEMA_DEFAULT
-        WHERE C_ACCTSCHEMA_ID = ?
+        WHERE C_ACCTSCHEMA_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
@@ -353,7 +353,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
         SELECT a.PayDiscount_Exp_Acct as account_ID FROM C_BP_Group_Acct a, C_BPartner bp 
-        WHERE a.C_BP_Group_ID=bp.C_BP_Group_ID AND bp.C_BPartner_ID=? AND a.C_AcctSchema_ID=?
+        WHERE a.C_BP_Group_ID=bp.C_BP_Group_ID AND bp.C_BPartner_ID = TO_NUMBER(?) AND a.C_AcctSchema_ID = TO_NUMBER(?)
         AND STATUS IS NULL
       </Sql>
       <Parameter name="C_BPartner_ID"/>
@@ -363,7 +363,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
         SELECT PayDiscount_Rev_Acct as account_ID FROM C_BP_Group_Acct a, C_BPartner bp 
-        WHERE a.C_BP_Group_ID=bp.C_BP_Group_ID AND bp.C_BPartner_ID=? AND a.C_AcctSchema_ID=?
+        WHERE a.C_BP_Group_ID=bp.C_BP_Group_ID AND bp.C_BPartner_ID = TO_NUMBER(?) AND a.C_AcctSchema_ID = TO_NUMBER(?)
         AND STATUS IS NULL
       </Sql>
       <Parameter name="C_BPartner_ID"/>
@@ -373,7 +373,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
         SELECT WriteOff_Acct as account_ID FROM C_BP_Group_Acct a, C_BPartner bp 
-        WHERE a.C_BP_Group_ID=bp.C_BP_Group_ID AND bp.C_BPartner_ID=? AND a.C_AcctSchema_ID=?
+        WHERE a.C_BP_Group_ID=bp.C_BP_Group_ID AND bp.C_BPartner_ID = TO_NUMBER(?) AND a.C_AcctSchema_ID = TO_NUMBER(?)
         AND STATUS IS NULL
       </Sql>
       <Parameter name="C_BPartner_ID"/>
@@ -382,7 +382,7 @@
    <SqlMethod name="selectAssetAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT B_Asset_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID=? AND C_AcctSchema_ID=?
+        SELECT B_Asset_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_BankAccount_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -390,7 +390,7 @@
    <SqlMethod name="selectConvertChargeLossAmt" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT B_REVALUATIONLOSS_ACCT as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID=? AND C_AcctSchema_ID=?
+        SELECT B_REVALUATIONLOSS_ACCT as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_BankAccount_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -398,7 +398,7 @@
    <SqlMethod name="selectConvertChargeGainAmt" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT B_REVALUATIONGAIN_ACCT as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID=? AND C_AcctSchema_ID=?
+        SELECT B_REVALUATIONGAIN_ACCT as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_BankAccount_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -406,7 +406,7 @@
    <SqlMethod name="selectInterestRevAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT B_InterestRev_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID=? AND C_AcctSchema_ID=?
+        SELECT B_InterestRev_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_BankAccount_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -414,7 +414,7 @@
    <SqlMethod name="selectInterestExpAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT B_InterestExp_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID=? AND C_AcctSchema_ID=?
+        SELECT B_InterestExp_Acct as account_ID FROM C_BankAccount_Acct WHERE C_BankAccount_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_BankAccount_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -422,7 +422,7 @@
    <SqlMethod name="selectCBAssetAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT CB_Asset_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID = ? AND C_AcctSchema_ID = ?
+        SELECT CB_Asset_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_CashBook_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -430,7 +430,7 @@
    <SqlMethod name="selectCashTransferAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT CB_CashTransfer_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID=? AND C_AcctSchema_ID=?
+        SELECT CB_CashTransfer_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_CashBook_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -439,7 +439,7 @@
    <SqlMethod name="selectCBExpenseAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT CB_Expense_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID=? AND C_AcctSchema_ID=?
+        SELECT CB_Expense_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_CashBook_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -447,7 +447,7 @@
    <SqlMethod name="selectCBReceiptAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT CB_Receipt_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID=? AND C_AcctSchema_ID=?
+        SELECT CB_Receipt_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_CashBook_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -455,7 +455,7 @@
    <SqlMethod name="selectCBDifferencesAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT CB_Differences_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID=? AND C_AcctSchema_ID=?
+        SELECT CB_Differences_Acct as account_ID FROM C_CashBook_Acct WHERE C_CashBook_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_CashBook_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -463,7 +463,7 @@
    <SqlMethod name="selectWDifferencesAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT W_Differences_Acct as account_ID FROM M_Warehouse_Acct WHERE M_Warehouse_ID=? AND C_AcctSchema_ID=?
+        SELECT W_Differences_Acct as account_ID FROM M_Warehouse_Acct WHERE M_Warehouse_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="M_Warehouse_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -472,7 +472,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
         SELECT NotInvoicedReceipts_Acct as account_ID FROM C_BP_Group_Acct a, C_BPartner bp
-        WHERE a.C_BP_Group_ID=bp.C_BP_Group_ID AND bp.C_BPartner_ID=? AND a.C_AcctSchema_ID=?
+        WHERE a.C_BP_Group_ID=bp.C_BP_Group_ID AND bp.C_BPartner_ID = TO_NUMBER(?) AND a.C_AcctSchema_ID = TO_NUMBER(?)
         and a.status is null
       </Sql>
       <Parameter name="C_BPartner_ID"/>
@@ -481,7 +481,7 @@
    <SqlMethod name="selectPJAssetAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT PJ_Asset_Acct as account_ID FROM C_Project_Acct WHERE C_Project_ID=? AND C_AcctSchema_ID=?
+        SELECT PJ_Asset_Acct as account_ID FROM C_Project_Acct WHERE C_Project_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_Project_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -489,7 +489,7 @@
    <SqlMethod name="selectPJWIPAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT PJ_WIP_Acct  as account_ID FROM C_Project_Acct WHERE C_Project_ID=? AND C_AcctSchema_ID=?
+        SELECT PJ_WIP_Acct  as account_ID FROM C_Project_Acct WHERE C_Project_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_Project_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -497,7 +497,7 @@
    <SqlMethod name="selectPPVOffsetAcct" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT PPVOffset_Acct as account_ID FROM C_AcctSchema_GL WHERE C_AcctSchema_ID=?
+        SELECT PPVOffset_Acct as account_ID FROM C_AcctSchema_GL WHERE C_AcctSchema_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="C_AcctSchema_ID"/>
    </SqlMethod>
@@ -548,8 +548,8 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       select docbasetype as name from c_doctype 
-      where ad_table_id = ?
-      and ad_client_id = ?
+      where ad_table_ID = TO_NUMBER(?)
+      and ad_client_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="table"/>
       <Parameter name="client"/>
@@ -557,7 +557,7 @@
    <SqlMethod name="selectGroupLines" type="preparedStatement" return="string">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT GROUPACCTINVLINES FROM AD_CLIENTINFO WHERE AD_CLIENT_ID = ?
+        SELECT GROUPACCTINVLINES FROM AD_CLIENTINFO WHERE AD_CLIENT_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="client"/>
    </SqlMethod>
@@ -565,8 +565,8 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
         SELECT ACCTDESCRIPTION FROM C_ACCTSCHEMA_TABLE
-        WHERE AD_TABLE_ID = ?
-        AND C_ACCTSCHEMA_ID = ?
+        WHERE AD_TABLE_ID = TO_NUMBER(?)
+        AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="tableId"/>
       <Parameter name="acctschemaId"/>
@@ -575,7 +575,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
         SELECT NAME FROM C_BPARTNER
-        WHERE C_BPARTNER_ID = ?
+        WHERE C_BPARTNER_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="bpartnerId"/>
    </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_forms/AlertManagement_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/AlertManagement_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -58,10 +58,10 @@
           AND A.AD_ORG_ID IN ('1')
           AND R.AD_ALERTRULE_ID = A.AD_ALERTRULE_ID
           AND RE.AD_ALERTRULE_ID = A.AD_ALERTRULE_ID
-          AND ((RE.AD_USER_ID IS NOT NULL AND RE.AD_USER_ID = ?) 
+          AND ((RE.AD_USER_ID IS NOT NULL AND RE.AD_USER_ID = TO_NUMBER(?)) 
                OR 
-              (RE.AD_USER_ID IS NULL AND RE.AD_ROLE_ID = ?)) 
-          AND A.AD_ALERTRULE_ID = ?
+              (RE.AD_USER_ID IS NULL AND RE.AD_ROLE_ID = TO_NUMBER(?))) 
+          AND A.AD_ALERTRULE_ID = TO_NUMBER(?)
           AND 1=1 AND 2=2
           ORDER BY R.AD_ALERTRULE_ID, A.AD_ALERT_ID
           
@@ -89,16 +89,16 @@
               AD_ALERTRECIPIENT R 
         WHERE A.ISACTIVE='Y'
           AND R.AD_ALERTRULE_ID = A.AD_ALERTRULE_ID
-          AND ((R.AD_USER_ID IS NOT NULL AND R.AD_USER_ID = ?) 
+          AND ((R.AD_USER_ID IS NOT NULL AND R.AD_USER_ID = TO_NUMBER(?)) 
                OR 
-              (R.AD_USER_ID IS NULL AND R.AD_ROLE_ID = ?)) 
+              (R.AD_USER_ID IS NULL AND R.AD_ROLE_ID = TO_NUMBER(?))) 
           AND 1=1
       ]]>
     </Sql>
     <Parameter name="lang"/>
     <Parameter name="user"/>
     <Parameter name="role"/>
-    <Parameter name="alertRule" optional="true" after="AND 1=1"><![CDATA[ AND A.AD_ALERTRULE_ID = ?]]></Parameter>
+    <Parameter name="alertRule" optional="true" after="AND 1=1"><![CDATA[ AND A.AD_ALERTRULE_ID = TO_NUMBER(?)]]></Parameter>
   </SqlMethod>
    
   <SqlMethod name="selectComboAlertRules" type="preparedStatement" return="multiple">
@@ -111,9 +111,9 @@
               AD_ALERTRECIPIENT R 
         WHERE A.ISACTIVE='Y'
           AND R.AD_ALERTRULE_ID = A.AD_ALERTRULE_ID
-          AND ((R.AD_USER_ID IS NOT NULL AND R.AD_USER_ID = ?) 
+          AND ((R.AD_USER_ID IS NOT NULL AND R.AD_USER_ID = TO_NUMBER(?)) 
                OR 
-              (R.AD_USER_ID IS NULL AND R.AD_ROLE_ID = ?)) 
+              (R.AD_USER_ID IS NULL AND R.AD_ROLE_ID = TO_NUMBER(?))) 
       ]]>
     </Sql>
     <Parameter name="lang"/>
@@ -129,7 +129,7 @@
           SET NOTE = ?,
               ISFIXED = ?,
               ISACTIVE = ?
-        WHERE AD_ALERT_ID = ?              
+        WHERE AD_ALERT_ID = TO_NUMBER(?)              
      ]]>
      </Sql>
      <Parameter name="note"/>     
--- a/src/org/openbravo/erpCommon/ad_forms/DebtPaymentUnapply_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DebtPaymentUnapply_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -69,7 +69,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       UPDATE C_DEBT_PAYMENT SET ispaid = 'N'
-      WHERE c_debt_payment_id = ?
+      WHERE c_debt_payment_ID = TO_NUMBER(?)
     </Sql>
    <Parameter name="cDebtPaymentId"/>
   </SqlMethod>
@@ -77,7 +77,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       UPDATE C_DEBT_PAYMENT SET ispaid = 'N', c_settlement_cancel_id = NULL, CANCEL_PROCESSED = 'N'
-      WHERE c_debt_payment_id = ?
+      WHERE c_debt_payment_ID = TO_NUMBER(?)
     </Sql>
    <Parameter name="cDebtPaymentId"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_forms/DocAmortization_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocAmortization_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
       C_PROJECT_ID, C_CAMPAIGN_ID, C_ACTIVITY_ID, USER1_ID, USER2_ID, '' AS ACCUMDEPRECIATION,
       '' AS DEPRECIATION
       FROM A_AMORTIZATION
-      WHERE A_AMORTIZATION_ID = ?
+      WHERE A_AMORTIZATION_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="A_AMORTIZATION_ID"/>
@@ -42,8 +42,8 @@
       SELECT AD_CLIENT_ID, AD_ORG_ID, C_CURRENCY_ID, NAME,DESCRIPTION, POSTED, DATEACCT,
       C_PROJECT_ID, C_CAMPAIGN_ID, C_ACTIVITY_ID, USER1_ID, USER2_ID
       FROM A_AMORTIZATION
-      WHERE AD_Client_ID=? 
-      AND A_AMORTIZATION_ID=?
+      WHERE AD_Client_ID = TO_NUMBER(?) 
+      AND A_AMORTIZATION_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
@@ -55,8 +55,8 @@
       <![CDATA[
       SELECT A_depreciation_Acct as depreciation, A_AccumDepreciation_Acct as accumdepreciation
       FROM A_Asset_Acct
-      WHERE A_Asset_ID = ?
-      AND C_AcctSchema_ID = ?
+      WHERE A_Asset_ID = TO_NUMBER(?)
+      AND C_AcctSchema_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="Asset"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocBank_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocBank_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
         '' AS CODEBRANCH, '' AS DIGITCONTROL, '' AS C_CASH_ID, '' AS STATEMENTDATE, '' AS BEGINNINGBALANCE, '' AS ENDINGBALANCE,
         '' AS STATEMENTDIFFERENCE, '' AS PROCESSING, '' AS PROCESSED, '' AS POSTED, '' AS AD_ORGTRX_ID, '' AS C_PROJECT_ID,
         '' AS C_CAMPAIGN_ID, '' AS C_ACTIVITY_ID, '' AS USER1_ID, '' AS USER2_ID, '' AS C_BANKACCOUNT_ID, '' AS ISMANUAL, '' AS CREATEFROM
-        FROM C_BankStatementLine B WHERE C_BankStatement_ID=? ORDER BY Line
+        FROM C_BankStatementLine B WHERE C_BankStatement_ID = TO_NUMBER(?) ORDER BY Line
      ]]>
      </Sql>
      <Parameter name="C_BankAccount_ID"/>
@@ -39,7 +39,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT C_Currency_ID FROM C_BankAccount WHERE C_BankAccount_ID=?
+        SELECT C_Currency_ID FROM C_BankAccount WHERE C_BankAccount_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_BankAccount_ID"/>
@@ -51,8 +51,8 @@
         SELECT B.AD_CLIENT_ID, B.AD_ORG_ID, B.NAME, B.C_BANKACCOUNT_ID, B.POSTED,
         B.STATEMENTDATE, B.STATEMENTDIFFERENCE
         FROM C_BANKSTATEMENT B          
-        WHERE AD_Client_ID=? 
-        AND C_BANKSTATEMENT_ID=?
+        WHERE AD_Client_ID = TO_NUMBER(?) 
+        AND C_BANKSTATEMENT_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocCash_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocCash_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -32,7 +32,7 @@
 	'' AS POSTED, '' AS AD_ORGTRX_ID, '' AS C_PROJECT_ID, '' AS C_CAMPAIGN_ID, '' AS C_ACTIVITY_ID, '' AS USER1_ID, '' AS USER2_ID,
 	'' as ISSOTRX, '' AS C_BPARTNER_ID, '' AS ISRECEIPT
 	FROM C_Cash c, C_CashBook cb 
-	WHERE c.C_CashBook_ID=cb.C_CashBook_ID AND c.C_Cash_ID=?
+	WHERE c.C_CashBook_ID=cb.C_CashBook_ID AND c.C_Cash_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="cash"/>
@@ -44,7 +44,7 @@
 	SELECT O.C_BPARTNER_ID as C_BPARTNER_ID, o.ISSOTRX AS ISSOTRX 
 	FROM C_CASHLINE C, C_ORDER O
 	WHERE C.C_ORDER_ID = O.C_ORDER_ID
-	AND C.C_CASHLINE_ID = ?
+	AND C.C_CASHLINE_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="cashLine"/>
@@ -57,8 +57,8 @@
         C.C_ACTIVITY_ID, C.USER1_ID, C.USER2_ID, C.NAME, C.DATEACCT, C.POSTED, C.STATEMENTDATE,
         C.STATEMENTDIFFERENCE
         FROM C_CASH C
-        WHERE AD_CLIENT_ID=? 
-        AND C_CASH_ID=?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?) 
+        AND C_CASH_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocDPManagement_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocDPManagement_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       SELECT AD_CLIENT_ID, AD_ORG_ID, C_CURRENCY_ID, DESCRIPTION, POSTED, DATEACCT,
       C_PROJECT_ID, C_CAMPAIGN_ID, C_ACTIVITY_ID, USER1_ID, USER2_ID, '' AS ACCT
       FROM c_DP_Management
-      WHERE c_DP_management_ID = ?
+      WHERE c_DP_management_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="c_DP_management_ID"/>
@@ -41,8 +41,8 @@
        SELECT AD_CLIENT_ID, AD_ORG_ID, C_CURRENCY_ID, DESCRIPTION, POSTED, DATEACCT,
       C_PROJECT_ID, C_CAMPAIGN_ID, C_ACTIVITY_ID, USER1_ID, USER2_ID
       FROM c_DP_Management
-      WHERE AD_Client_ID=? 
-        and c_DP_management_ID = ?
+      WHERE AD_Client_ID = TO_NUMBER(?) 
+        and c_DP_management_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
@@ -56,13 +56,13 @@
         select coalesce(
           (SELECT C_RECEIVABLE_ACCT 
           FROM c_bp_customer_acct
-          WHERE C_BPARTNER_ID = ?
-          AND C_AcctSchema_ID = ?
+          WHERE C_BPARTNER_ID = TO_NUMBER(?)
+          AND C_AcctSchema_ID = TO_NUMBER(?)
           AND STATUS = ?),
           (SELECT C_RECEIVABLE_ACCT 
           FROM c_bp_customer_acct
-          WHERE C_BPARTNER_ID = ?
-          AND C_AcctSchema_ID = ?
+          WHERE C_BPARTNER_ID = TO_NUMBER(?)
+          AND C_AcctSchema_ID = TO_NUMBER(?)
           AND STATUS is null)) as ACCT from dual
      ]]>
      </Sql>
@@ -80,13 +80,13 @@
         select coalesce (
           (SELECT V_LIABILITY_ACCT 
           FROM c_bp_vendor_acct
-          WHERE C_BPARTNER_ID = ?
-          AND C_AcctSchema_ID = ?
+          WHERE C_BPARTNER_ID = TO_NUMBER(?)
+          AND C_AcctSchema_ID = TO_NUMBER(?)
           AND STATUS = ?),
           (SELECT V_LIABILITY_ACCT
           FROM c_bp_vendor_acct
-          WHERE C_BPARTNER_ID = ?
-          AND C_AcctSchema_ID = ?
+          WHERE C_BPARTNER_ID = TO_NUMBER(?)
+          AND C_AcctSchema_ID = TO_NUMBER(?)
           AND STATUS is null)) as ACCT from dual
      ]]>
      </Sql>
--- a/src/org/openbravo/erpCommon/ad_forms/DocGLJournal_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocGLJournal_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,8 +29,8 @@
         SELECT G.AD_CLIENT_ID, G.AD_ORG_ID, G.DOCUMENTNO, G.DATEACCT, G.DATEDOC,
         G.C_CURRENCY_ID, G.C_DOCTYPE_ID, G.POSTED, G.POSTINGTYPE, G.ISOPENING
         FROM GL_JOURNAL G
-        WHERE AD_CLIENT_ID=? 
-        AND GL_JOURNAL_ID=?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?) 
+        AND GL_JOURNAL_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocInOut_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInOut_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -48,8 +48,8 @@
         I.C_CAMPAIGN_ID, I.C_ACTIVITY_ID, I.USER1_ID, I.USER2_ID, I.DOCUMENTNO, I.DATEACCT,
         I.C_DOCTYPE_ID, I.C_CHARGE_ID, I.CHARGEAMT, I.POSTED, I.MOVEMENTDATE, I.C_BPARTNER_LOCATION_ID
         FROM M_INOUT I
-        WHERE AD_Client_ID=? 
-        AND M_INOUT_ID=?
+        WHERE AD_Client_ID = TO_NUMBER(?) 
+        AND M_INOUT_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
@@ -63,13 +63,13 @@
         SET CostAverageCumQty=(SELECT CostAverageCumQty - SUM(il.MovementQty)
                                FROM M_InOutLine il 
                                WHERE M_Product_Costing.M_Product_ID=il.M_Product_ID
-                               AND il.M_InOut_ID= ?), 
+                               AND il.M_InOut_ID = TO_NUMBER(?)), 
             CostAverageCumAmt=(SELECT CostAverageCumAmt - SUM(il.MovementQty*CurrentCostPrice) FROM M_InOutLine il 
                                 WHERE M_Product_Costing.M_Product_ID=il.M_Product_ID
-                                AND il.M_InOut_ID= ?)
+                                AND il.M_InOut_ID = TO_NUMBER(?))
         WHERE EXISTS (SELECT * FROM M_InOutLine il 
                                  WHERE M_Product_Costing.M_Product_ID=il.M_Product_ID
-                                 AND il.M_InOut_ID = ?)
+                                 AND il.M_InOut_ID = TO_NUMBER(?))
      ]]>
      </Sql>
      <Parameter name="M_InOut_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocInventory_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInventory_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,8 +29,8 @@
         SELECT I.AD_CLIENT_ID, I.AD_ORG_ID, I.AD_ORGTRX_ID, I.C_PROJECT_ID, I.C_CAMPAIGN_ID, 
         I.C_ACTIVITY_ID, I.USER1_ID, I.USER2_ID, I.NAME, I.POSTED, I.MOVEMENTDATE, '' AS M_WAREHOUSE_ID
         FROM M_INVENTORY I
-        WHERE AD_CLIENT_ID=? 
-        AND M_INVENTORY_ID=?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?) 
+        AND M_INVENTORY_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
@@ -41,7 +41,7 @@
     <Sql>
       <![CDATA[
         SELECT M_WAREHOUSE_ID FROM M_LOCATOR
-        WHERE M_LOCATOR_ID = ?
+        WHERE M_LOCATOR_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="M_LOCATOR_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -37,7 +37,7 @@
         '' AS AD_ORGTRX_ID, '' AS USER1_ID, '' AS USER2_ID, '' as AMOUNT, '' AS STATUS, '' AS ISRECEIPT, '' AS ISMANUAL, '' AS WRITEOFFAMT, 
         '' AS C_DEBT_PAYMENT_ID
         FROM C_Tax t, C_InvoiceTax it
-        WHERE t.C_Tax_ID=it.C_Tax_ID AND it.C_Invoice_ID=?
+        WHERE t.C_Tax_ID=it.C_Tax_ID AND it.C_Invoice_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="invoice"/>
@@ -51,8 +51,8 @@
         I.C_CURRENCY_ID, I.C_DOCTYPE_ID, I.C_CHARGE_ID, I.CHARGEAMT, I.POSTED, I.DATEINVOICED,
         I.ISTAXINCLUDED, I.C_BPARTNER_LOCATION_ID, I.GRANDTOTAL, I.TOTALLINES, I.CHARGEAMT
         FROM C_INVOICE I
-        WHERE AD_Client_ID=? 
-        AND C_INVOICE_ID=?
+        WHERE AD_Client_ID = TO_NUMBER(?) 
+        AND C_INVOICE_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
@@ -64,7 +64,7 @@
       <![CDATA[
       SELECT AMOUNT, C_CURRENCY_ID, STATUS_INITIAL AS STATUS, ISRECEIPT, ISPAID, ISMANUAL, WRITEOFFAMT, C_DEBT_PAYMENT_ID
       FROM C_DEBT_PAYMENT
-      WHERE C_INVOICE_ID =?
+      WHERE C_INVOICE_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="invoice"/>
@@ -79,13 +79,13 @@
                 WHERE i.C_Invoice_ID=il.C_Invoice_ID
                 AND M_Product_PO.M_Product_ID=il.M_Product_ID 
                 AND M_Product_PO.C_BPartner_ID=i.C_BPartner_ID
-                AND i.C_Invoice_ID=?)
+                AND i.C_Invoice_ID = TO_NUMBER(?))
         WHERE EXISTS (SELECT * 
         FROM C_Invoice i, C_InvoiceLine il 
         WHERE i.C_Invoice_ID=il.C_Invoice_ID
         AND M_Product_PO.M_Product_ID=il.M_Product_ID 
         AND M_Product_PO.C_BPartner_ID=i.C_BPartner_ID
-        AND i.C_Invoice_ID=?)
+        AND i.C_Invoice_ID = TO_NUMBER(?))
      ]]>
      </Sql>
      <Parameter name="invoice"/>
@@ -100,26 +100,26 @@
                 FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a 
                 WHERE i.C_Invoice_ID=il.C_Invoice_ID
                 AND M_Product_Costing.M_Product_ID=il.M_Product_ID AND M_Product_Costing.C_AcctSchema_ID=a.C_AcctSchema_ID
-                AND M_Product_Costing.C_AcctSchema_ID= ?
-                AND i.C_Invoice_ID= ?), 
+                AND M_Product_Costing.C_AcctSchema_ID = TO_NUMBER(?)
+                AND i.C_Invoice_ID = TO_NUMBER(?)), 
           TotalInvAmt = (SELECT SUM(C_Currency_Convert(il.LineNetAmt,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,null))
                 FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a 
                 WHERE i.C_Invoice_ID=il.C_Invoice_ID
                 AND M_Product_Costing.M_Product_ID=il.M_Product_ID AND M_Product_Costing.C_AcctSchema_ID=a.C_AcctSchema_ID
-                AND M_Product_Costing.C_AcctSchema_ID= ?
-                AND i.C_Invoice_ID= ?),
+                AND M_Product_Costing.C_AcctSchema_ID = TO_NUMBER(?)
+                AND i.C_Invoice_ID = TO_NUMBER(?)),
           TotalInvQty = (SELECT SUM(il.QtyInvoiced) 
                 FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a 
                 WHERE i.C_Invoice_ID=il.C_Invoice_ID
                 AND M_Product_Costing.M_Product_ID=il.M_Product_ID AND M_Product_Costing.C_AcctSchema_ID=a.C_AcctSchema_ID
-                AND M_Product_Costing.C_AcctSchema_ID= ?
-                AND i.C_Invoice_ID= ?)
+                AND M_Product_Costing.C_AcctSchema_ID = TO_NUMBER(?)
+                AND i.C_Invoice_ID = TO_NUMBER(?))
         WHERE EXISTS (SELECT * FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a 
                 WHERE i.C_Invoice_ID=il.C_Invoice_ID
                 AND M_Product_Costing.M_Product_ID=il.M_Product_ID 
                 AND M_Product_Costing.C_AcctSchema_ID=a.C_AcctSchema_ID
-                AND M_Product_Costing.C_AcctSchema_ID= ?
-                AND i.C_Invoice_ID= ?)
+                AND M_Product_Costing.C_AcctSchema_ID = TO_NUMBER(?)
+                AND i.C_Invoice_ID = TO_NUMBER(?))
      ]]>
      </Sql>
      <Parameter name="C_AcctSchema_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineAmortization_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineAmortization_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
         A_ASSET.M_PRODUCT_ID, A_AMORTIZATIONLINE.A_ASSET_ID
         FROM A_AMORTIZATIONLINE, A_ASSET
         WHERE A_AMORTIZATIONLINE.A_ASSET_ID = A_ASSET.A_ASSET_ID
-        AND A_AMORTIZATIONLINE.A_AMORTIZATION_ID =?
+        AND A_AMORTIZATIONLINE.A_AMORTIZATION_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="A_AMORTIZATION_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineBank_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineBank_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
       BL.DATEACCT, BL.C_BANKSTATEMENTLINE_ID, BL.VALUTADATE, BL.C_DEBT_PAYMENT_ID, BL.ISREVERSAL,
       BL.STMTAMT, BL.TRXAMT, DP.C_BPARTNER_ID AS C_BPARTNER_ID, DP.ISMANUAL AS ISMANUAL,  bl.CONVERTCHARGEAMT, bl.C_Currency_ID
       FROM C_BANKSTATEMENTLINE BL left join C_DEBT_PAYMENT DP on BL.C_DEBT_PAYMENT_ID = DP.C_DEBT_PAYMENT_ID
-      WHERE C_BANKSTATEMENT_ID = ? 
+      WHERE C_BANKSTATEMENT_ID = TO_NUMBER(?) 
       ORDER BY LINE
      ]]>
      </Sql>
@@ -41,8 +41,8 @@
     <Sql>
       <![CDATA[
       select b_expense_acct from c_bankaccount_acct
-      where c_bankaccount_id = ?
-      and c_acctschema_id = ?
+      where c_bankaccount_ID = TO_NUMBER(?)
+      and c_acctschema_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="cBankaccountId"/>
@@ -54,7 +54,7 @@
       <![CDATA[
       SELECT COUNT(*) AS COUNT
       FROM C_BANKSTATEMENTLINE BL left join C_DEBT_PAYMENT DP on BL.C_DEBT_PAYMENT_ID = DP.C_DEBT_PAYMENT_ID
-      WHERE C_BANKSTATEMENT_ID = ?
+      WHERE C_BANKSTATEMENT_ID = TO_NUMBER(?)
       AND EXISTS (SELECT 1
           FROM C_YEAR, C_PERIOD, C_PERIODCONTROL, AD_CLIENTINFO
           WHERE C_YEAR.C_YEAR_ID = C_PERIOD.C_YEAR_ID
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineCash_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineCash_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -33,7 +33,7 @@
       FROM C_CashLine C left join C_DEBT_PAYMENT DP on C.C_DEBT_PAYMENT_ID = DP.C_DEBT_PAYMENT_ID
                         left join C_ORDER O on C.C_ORDER_ID = O.C_ORDER_ID,   
            C_CASHBOOK CB, C_CASH CA
-      WHERE CA.C_Cash_ID= ?
+      WHERE CA.C_Cash_ID = TO_NUMBER(?)
       AND CB.C_CASHBOOK_ID = CA.C_CASHBOOK_ID
       AND CA.C_CASH_ID = C.C_CASH_ID
       ORDER BY Line
@@ -45,7 +45,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT AD_Org_ID, C_Currency_ID, 0 AS C_BPARTNER_ID FROM C_BankAccount WHERE C_BankAccount_ID=?
+      SELECT AD_Org_ID, C_Currency_ID, 0 AS C_BPARTNER_ID FROM C_BankAccount WHERE C_BankAccount_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="bankAccount"/>
@@ -54,7 +54,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT AD_Org_ID, C_Currency_ID, C_BPartner_ID FROM C_Invoice WHERE C_Invoice_ID=?
+      SELECT AD_Org_ID, C_Currency_ID, C_BPartner_ID FROM C_Invoice WHERE C_Invoice_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="invoice"/>
@@ -63,7 +63,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT AD_Org_ID, C_Currency_ID, C_BPartner_ID FROM C_Order WHERE C_Order_ID=?
+      SELECT AD_Org_ID, C_Currency_ID, C_BPartner_ID FROM C_Order WHERE C_Order_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_Order_ID"/>
@@ -72,7 +72,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT AD_Org_ID, C_Currency_ID, C_BPartner_ID FROM C_DEBT_PAYMENT WHERE C_DEBT_PAYMENT_ID = ?
+      SELECT AD_Org_ID, C_Currency_ID, C_BPartner_ID FROM C_DEBT_PAYMENT WHERE C_DEBT_PAYMENT_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_DEBT_PAYMENT_ID"/>
@@ -81,7 +81,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT C_BPartner_ID FROM C_DEBT_PAYMENT WHERE C_DEBT_PAYMENT_ID = ?
+      SELECT C_BPartner_ID FROM C_DEBT_PAYMENT WHERE C_DEBT_PAYMENT_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_DEBT_PAYMENT_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineDPManagement_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineDPManagement_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
         SELECT ml.AD_ORG_ID, ml.C_DP_MANAGEMENTLINE_ID, STATUS_FROM, STATUS_TO, DP.ISRECEIPT, AMOUNT, DP.C_BPARTNER_ID, ML.C_DEBT_PAYMENT_ID
           FROM C_DP_MANAGEMENTLINE ML,
                C_DEBT_PAYMENT   DP
-         WHERE C_DP_MANAGEMENT_ID = ?
+         WHERE C_DP_MANAGEMENT_ID = TO_NUMBER(?)
            AND DP.C_DEBT_PAYMENT_ID = ML.C_DEBT_PAYMENT_ID
      ]]>
      </Sql>
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineGLJournal_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineGLJournal_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -35,7 +35,7 @@
         FROM C_ValidCombination vc, GL_JournalLine jl , GL_Journal j
         WHERE j.GL_JOURNAL_ID = jl.GL_JOURNAL_ID
         and vc.C_ValidCombination_ID=jl.C_ValidCombination_ID
-        AND jl.GL_Journal_ID = ?
+        AND jl.GL_Journal_ID = TO_NUMBER(?)
         AND jl.IsActive='Y' 
         AND vc.IsFullyQualified='Y'
         ORDER BY jl.Line
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineInOut_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineInOut_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
           SELECT IO.AD_ORG_ID, IO.M_PRODUCT_ID, IO.LINE, IO.DESCRIPTION,
           IO.C_UOM_ID, IO.M_INOUTLINE_ID, IO.MOVEMENTQTY, IO.M_LOCATOR_ID
           FROM M_InOutLine IO 
-          WHERE M_InOut_ID=? ORDER BY Line
+          WHERE M_InOut_ID = TO_NUMBER(?) ORDER BY Line
      ]]>
      </Sql>
      <Parameter name="M_InOut_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineInventory_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineInventory_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -28,7 +28,7 @@
       <![CDATA[
 	  SELECT IL.AD_ORG_ID, IL.M_PRODUCT_ID, IL.LINE, IL.DESCRIPTION,
 	  IL.C_UOM_ID, IL.M_INVENTORYLINE_ID, IL.QTYBOOK, IL.QTYCOUNT,
-	  IL.M_LOCATOR_ID FROM M_InventoryLine IL WHERE M_Inventory_ID=? ORDER BY Line
+	  IL.M_LOCATOR_ID FROM M_InventoryLine IL WHERE M_Inventory_ID = TO_NUMBER(?) ORDER BY Line
      ]]>
      </Sql>
      <Parameter name="M_Inventory_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineInvoice_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineInvoice_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -37,7 +37,7 @@
         C_INVOICELINE_ACCTDIMENSION.C_CAMPAIGN_ID, C_INVOICELINE_ACCTDIMENSION.C_PROJECT_ID,
         C_INVOICELINE_ACCTDIMENSION.USER1_ID, C_INVOICELINE_ACCTDIMENSION.USER2_ID
         FROM C_INVOICELINE left join C_INVOICELINE_ACCTDIMENSION on C_INVOICELINE.C_INVOICELINE_ID = C_INVOICELINE_ACCTDIMENSION.C_INVOICELINE_ID
-        WHERE C_INVOICE_ID = ?
+        WHERE C_INVOICE_ID = TO_NUMBER(?)
         ORDER BY LINE
      ]]>
      </Sql>
@@ -60,7 +60,7 @@
         C_INVOICELINE_ACCTDIMENSION.C_CAMPAIGN_ID, C_INVOICELINE_ACCTDIMENSION.C_PROJECT_ID,
         C_INVOICELINE_ACCTDIMENSION.USER1_ID, C_INVOICELINE_ACCTDIMENSION.USER2_ID
         FROM C_INVOICELINE left join C_INVOICELINE_ACCTDIMENSION on C_INVOICELINE.C_INVOICELINE_ID = C_INVOICELINE_ACCTDIMENSION.C_INVOICELINE_ID
-        WHERE  C_INVOICELINE.C_INVOICE_ID = ?
+        WHERE  C_INVOICELINE.C_INVOICE_ID = TO_NUMBER(?)
         GROUP BY C_INVOICELINE.AD_CLIENT_ID, C_INVOICELINE.AD_ORG_ID, C_INVOICELINE.ISACTIVE, C_INVOICELINE.C_INVOICE_ID, 
         C_INVOICELINE.M_PRODUCT_ID,C_INVOICELINE.PRICELIST, C_INVOICELINE.PRICEACTUAL, C_INVOICELINE.PRICELIMIT, 
         C_INVOICELINE.C_UOM_ID, C_INVOICELINE.C_TAX_ID, C_INVOICELINE.S_RESOURCEASSIGNMENT_ID, C_INVOICELINE.A_ASSET_ID, 
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineMovement_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineMovement_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
           SELECT ML.AD_ORG_ID, ML.M_PRODUCT_ID, ML.LINE, ML.DESCRIPTION,
           ML.C_UOM_ID, ML.M_MOVEMENTLINE_ID, ML.M_LOCATOR_ID, ML.M_LOCATORTO_ID,
           ML.MOVEMENTQTY
-          FROM M_MOVEMENTLINE ML WHERE M_MOVEMENT_ID=? ORDER BY LINE
+          FROM M_MOVEMENTLINE ML WHERE M_MOVEMENT_ID = TO_NUMBER(?) ORDER BY LINE
      ]]>
      </Sql>
      <Parameter name="M_Movement_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocLineOrder_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLineOrder_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
           SELECT OL.AD_ORG_ID, OL.C_BPARTNER_ID, OL.M_PRODUCT_ID, OL.LINE, OL.DESCRIPTION,
           OL.C_UOM_ID, OL.C_TAX_ID, OL.C_CHARGE_ID, OL.CHARGEAMT, OL.C_ORDERLINE_ID,
           OL.QTYORDERED, OL.LINENETAMT
-          FROM C_OrderLine OL WHERE C_Order_ID=? ORDER BY Line
+          FROM C_OrderLine OL WHERE C_Order_ID = TO_NUMBER(?) ORDER BY Line
      ]]>
      </Sql>
      <Parameter name="C_Order_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocLinePayment_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLinePayment_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -39,7 +39,7 @@
 							 FROM C_SETTLEMENT ST2
 							 WHERE DP.C_SETTLEMENT_GENERATE_ID = ST2.C_SETTLEMENT_ID))) AS CONVERSIONDATE, DP.C_CURRENCY_ID 
       FROM C_DEBT_PAYMENT DP, C_SETTLEMENT ST
-      WHERE ST.C_SETTLEMENT_ID = ?
+      WHERE ST.C_SETTLEMENT_ID = TO_NUMBER(?)
       AND (DP.C_SETTLEMENT_CANCEL_ID = ST.C_SETTLEMENT_ID 
       OR DP.C_SETTLEMENT_GENERATE_ID = ST.C_SETTLEMENT_ID)
       AND (ST.SETTLEMENTTYPE <> 'I' OR DP.ISDIRECTPOSTING = 'Y')
@@ -55,8 +55,8 @@
       SELECT C_GLITEM_ACCT.GLITEM_CREDIT_ACCT AS CREDIT_ACCT, C_GLITEM_ACCT.GLITEM_DEBIT_ACCT AS DEBIT_ACCT 
       FROM C_DEBT_PAYMENT, C_GLITEM_ACCT
       WHERE C_DEBT_PAYMENT.C_GLITEM_ID = C_GLITEM_ACCT.C_GLITEM_ID 
-      AND C_GLITEM_ACCT.C_ACCTSCHEMA_ID = ?
-      AND C_DEBT_PAYMENT.C_SETTLEMENT_GENERATE_ID = ?
+      AND C_GLITEM_ACCT.C_ACCTSCHEMA_ID = TO_NUMBER(?)
+      AND C_DEBT_PAYMENT.C_SETTLEMENT_GENERATE_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_ACCTSCHEMA_ID"/>
@@ -68,13 +68,13 @@
       <![CDATA[
        SELECT DP.STATUS_INITIAL AS DPSTATUS
          FROM C_DEBT_PAYMENT DP 
-        WHERE C_SETTLEMENT_GENERATE_ID = ?
-          AND C_DEBT_PAYMENT_ID = ?
+        WHERE C_SETTLEMENT_GENERATE_ID = TO_NUMBER(?)
+          AND C_DEBT_PAYMENT_ID = TO_NUMBER(?)
         UNION
        SELECT DP.STATUS
          FROM C_DEBT_PAYMENT DP 
-        WHERE C_SETTLEMENT_CANCEL_ID = ?
-          AND C_DEBT_PAYMENT_ID = ? 
+        WHERE C_SETTLEMENT_CANCEL_ID = TO_NUMBER(?)
+          AND C_DEBT_PAYMENT_ID = TO_NUMBER(?) 
      ]]>
      </Sql>
      <Parameter name="C_SETTLEMENT_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocLine_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLine_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -26,7 +26,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT CH_Expense_Acct as expense, CH_Revenue_Acct as revenue FROM C_Charge_Acct WHERE C_Charge_ID=? AND C_AcctSchema_ID=?
+      SELECT CH_Expense_Acct as expense, CH_Revenue_Acct as revenue FROM C_Charge_Acct WHERE C_Charge_ID = TO_NUMBER(?) AND C_AcctSchema_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_Charge_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocMovement_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocMovement_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,8 +29,8 @@
         SELECT M.AD_CLIENT_ID, M.AD_ORG_ID, M.AD_ORGTRX_ID, M.C_PROJECT_ID, M.C_CAMPAIGN_ID,
         M.C_ACTIVITY_ID, M.USER1_ID, M.USER2_ID, M.NAME, M.POSTED, M.MOVEMENTDATE
         FROM M_MOVEMENT M
-        WHERE AD_CLIENT_ID=? 
-        AND M_MOVEMENT_ID=?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?) 
+        AND M_MOVEMENT_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocOrder_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocOrder_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -38,7 +38,7 @@
         '' AS DROPSHIP_USER_ID, '' AS ISSELFSERVICE, '' AS AD_ORGTRX_ID, '' AS USER1_ID, '' AS USER2_ID, '' AS DELIVERYNOTES, '' AS C_INCOTERMS_ID,
         '' AS INCOTERMSDESCRIPTION, '' AS GENERATETEMPLATE, '' AS ISINVOICED, '' AS ISTRANSFERRED
         FROM C_Tax t, C_OrderTax it 
-        WHERE t.C_Tax_ID=it.C_Tax_ID AND it.C_Order_ID=?
+        WHERE t.C_Tax_ID=it.C_Tax_ID AND it.C_Order_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_Order_ID"/>
@@ -52,8 +52,8 @@
         O.C_CURRENCY_ID, O.C_DOCTYPE_ID, O.C_CHARGE_ID, O.CHARGEAMT, O.POSTED, O.DATEORDERED,
         O.ISTAXINCLUDED, O.GRANDTOTAL, O.TOTALLINES
         FROM C_ORDER O          
-        WHERE AD_Client_ID=? 
-        AND C_ORDER_ID=?
+        WHERE AD_Client_ID = TO_NUMBER(?) 
+        AND C_ORDER_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
@@ -67,11 +67,11 @@
                   FROM C_Order o, C_OrderLine ol 
                   WHERE o.C_Order_ID = ol.C_Order_ID
                   AND M_Product_PO.M_Product_ID = ol.M_Product_ID AND M_Product_PO.C_BPartner_ID=o.C_BPartner_ID
-                  AND o.C_Order_ID = ?)
+                  AND o.C_Order_ID = TO_NUMBER(?))
           WHERE EXISTS (SELECT * FROM C_Order o, C_OrderLine ol 
                   WHERE o.C_Order_ID = ol.C_Order_ID
                   AND M_Product_PO.M_Product_ID = ol.M_Product_ID AND M_Product_PO.C_BPartner_ID=o.C_BPartner_ID
-                  AND o.C_Order_ID = ?)
+                  AND o.C_Order_ID = TO_NUMBER(?))
      ]]>
      </Sql>
      <Parameter name="Record_ID"/>
@@ -86,13 +86,13 @@
                 FROM C_Order o, C_OrderLine ol, C_AcctSchema a 
                 WHERE o.C_Order_ID=ol.C_Order_ID
                 AND M_Product_Costing.M_Product_ID=ol.M_Product_ID AND M_Product_Costing.C_AcctSchema_ID=a.C_AcctSchema_ID
-                AND M_Product_Costing.C_AcctSchema_ID = ?
-                AND o.C_Order_ID = ?)
+                AND M_Product_Costing.C_AcctSchema_ID = TO_NUMBER(?)
+                AND o.C_Order_ID = TO_NUMBER(?))
         WHERE EXISTS (SELECT * FROM C_Order o, C_OrderLine ol, C_AcctSchema a 
                 WHERE o.C_Order_ID = ol.C_Order_ID
                 AND M_Product_Costing.M_Product_ID=ol.M_Product_ID AND M_Product_Costing.C_AcctSchema_ID=a.C_AcctSchema_ID
-                AND M_Product_Costing.C_AcctSchema_ID = ?
-                AND o.C_Order_ID = ?)
+                AND M_Product_Costing.C_AcctSchema_ID = TO_NUMBER(?)
+                AND o.C_Order_ID = TO_NUMBER(?))
      ]]>
      </Sql>
      <Parameter name="C_AcctSchema_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocPayment_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocPayment_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -44,8 +44,8 @@
         S.USER1_ID, S.USER2_ID, S.DOCUMENTNO, S.DATEACCT, S.C_CURRENCY_ID, S.C_DOCTYPE_ID,
         S.CHARGEDAMT, S.POSTED, S.DATETRX, S.SETTLEMENTTYPE
         FROM C_SETTLEMENT S
-        WHERE AD_Client_ID=? 
-        AND C_SETTLEMENT_ID=?
+        WHERE AD_Client_ID = TO_NUMBER(?) 
+        AND C_SETTLEMENT_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
@@ -58,13 +58,13 @@
         SELECT COALESCE(
           (SELECT C_RECEIVABLE_ACCT 
           FROM C_BP_CUSTOMER_ACCT
-          WHERE C_BPARTNER_ID = ?
-          AND C_ACCTSCHEMA_ID = ?
+          WHERE C_BPARTNER_ID = TO_NUMBER(?)
+          AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
           AND STATUS = ?),
           (SELECT C_RECEIVABLE_ACCT 
           FROM C_BP_CUSTOMER_ACCT
-          WHERE C_BPARTNER_ID = ?
-          AND C_ACCTSCHEMA_ID = ?
+          WHERE C_BPARTNER_ID = TO_NUMBER(?)
+          AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
           AND STATUS IS NULL)) AS ACCOUNT_ID FROM DUAL
 
      ]]>
@@ -82,13 +82,13 @@
         SELECT COALESCE(
           (SELECT V_LIABILITY_ACCT 
           FROM C_BP_VENDOR_ACCT
-          WHERE C_BPARTNER_ID = ?
-          AND C_ACCTSCHEMA_ID = ?
+          WHERE C_BPARTNER_ID = TO_NUMBER(?)
+          AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
           AND STATUS = ?),
           (SELECT V_LIABILITY_ACCT
           FROM C_BP_VENDOR_ACCT
-          WHERE C_BPARTNER_ID = ?
-          AND C_ACCTSCHEMA_ID = ?
+          WHERE C_BPARTNER_ID = TO_NUMBER(?)
+          AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
           AND STATUS IS NULL)) AS ACCOUNT_ID FROM DUAL
      ]]>
      </Sql>
@@ -107,8 +107,8 @@
         WHERE D.C_DEBT_PAYMENT_ID = B.C_DEBT_PAYMENT_ID
         AND B.C_GLITEM_ID = G.C_GLITEM_ID
         AND G.C_GLITEM_ID = GA.C_GLITEM_ID
-        AND GA.C_ACCTSCHEMA_ID = ?
-        AND B.C_DEBT_PAYMENT_ID = (SELECT C_DEBT_PAYMENT_ID FROM C_DEBT_PAYMENT WHERE C_SETTLEMENT_CANCEL_ID = ?)
+        AND GA.C_ACCTSCHEMA_ID = TO_NUMBER(?)
+        AND B.C_DEBT_PAYMENT_ID = (SELECT C_DEBT_PAYMENT_ID FROM C_DEBT_PAYMENT WHERE C_SETTLEMENT_CANCEL_ID = TO_NUMBER(?))
      ]]>
      </Sql>
      <Parameter name="C_ACCTSCHEMA_ID"/>
@@ -123,8 +123,8 @@
         WHERE D.C_DEBT_PAYMENT_ID = B.C_DEBT_PAYMENT_ID
         AND B.C_GLITEM_ID = G.C_GLITEM_ID
         AND G.C_GLITEM_ID = GA.C_GLITEM_ID
-        AND GA.C_ACCTSCHEMA_ID = ?
-        AND D.C_DEBT_PAYMENT_ID = ?
+        AND GA.C_ACCTSCHEMA_ID = TO_NUMBER(?)
+        AND D.C_DEBT_PAYMENT_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_ACCTSCHEMA_ID"/>
@@ -138,8 +138,8 @@
         C_GLITEM_ACCT.GLITEM_DEBIT_ACCT AS DEBIT_ACCT, C_DEBT_PAYMENT.AMOUNT AS AMOUNT
         FROM C_DEBT_PAYMENT, C_GLITEM_ACCT
         WHERE C_GLITEM_ACCT.C_GLITEM_ID = C_DEBT_PAYMENT.C_GLITEM_ID
-        AND C_GLITEM_ACCT.C_ACCTSCHEMA_ID = ?
-        AND C_DEBT_PAYMENT.C_DEBT_PAYMENT_ID = ?
+        AND C_GLITEM_ACCT.C_ACCTSCHEMA_ID = TO_NUMBER(?)
+        AND C_DEBT_PAYMENT.C_DEBT_PAYMENT_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_ACCTSCHEMA_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/DocTax_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocTax_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -27,8 +27,8 @@
     <Sql>
       <![CDATA[
 	SELECT T_Due_Acct, T_Liability_Acct, T_Credit_Acct, T_Receivables_Acct, T_Expense_Acct 
-	FROM C_Tax_Acct WHERE C_Tax_ID=? 
-	AND C_AcctSchema_ID=?
+	FROM C_Tax_Acct WHERE C_Tax_ID = TO_NUMBER(?) 
+	AND C_AcctSchema_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="C_Tax_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/EdiFileImport_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/EdiFileImport_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -37,7 +37,7 @@
 				C_ORDERLINE_ID, LINEDESCRIPTION, C_UOM_ID, QTYORDERED, PRICEACTUAL, FREIGHTAMT, C_CAMPAIGN_ID, DATEORDERED,
 				DATEPROMISED, ORDER_REFERENCENO, BPARTNERUPC, BILLTO_UPC, C_BPARTNER_LOCATION_UPC, VENDOR_UPC
 				from i_order
-				where I_ORDER_ID = ?
+				where I_ORDER_ID = TO_NUMBER(?)
 			]]></Sql>
 		<Parameter name="iOrderId"/>
 	</SqlMethod>
@@ -81,7 +81,7 @@
 		<Sql>
 			<![CDATA[
 				DELETE FROM I_ORDER
-				where ad_client_id = ?
+				where ad_client_ID = TO_NUMBER(?)
 		]]>
 		</Sql>
 		<Parameter name="client"/>
--- a/src/org/openbravo/erpCommon/ad_forms/FactLine_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/FactLine_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -28,7 +28,7 @@
       <![CDATA[
         SELECT C_Location_ID as location, '' AS ORG, '' AS SALESREGION, '' AS UNEARNEDREVENUE, '' AS ACCOUNT, '' as value,
         '' AS DESCRIPTION
-        FROM AD_OrgInfo WHERE AD_Org_ID=?
+        FROM AD_OrgInfo WHERE AD_Org_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="AD_Org_ID"/>
@@ -37,7 +37,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT AD_Org_ID as org FROM M_Locator WHERE M_Locator_ID=? AND AD_Client_ID=?
+        SELECT AD_Org_ID as org FROM M_Locator WHERE M_Locator_ID = TO_NUMBER(?) AND AD_Client_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="M_Locator_ID"/>
@@ -47,7 +47,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT C_Location_ID as location FROM C_BPartner_Location WHERE C_BPartner_Location_ID=?
+        SELECT C_Location_ID as location FROM C_BPartner_Location WHERE C_BPartner_Location_ID = TO_NUMBER(?)
         ]]>
      </Sql>
      <Parameter name="C_BPartner_Location_ID"/>
@@ -56,7 +56,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT C_SalesRegion_ID as salesregion FROM C_BPartner_Location WHERE C_BPartner_Location_ID=?
+        SELECT C_SalesRegion_ID as salesregion FROM C_BPartner_Location WHERE C_BPartner_Location_ID = TO_NUMBER(?)
         ]]>
      </Sql>
      <Parameter name="C_BPartner_Location_ID"/>
@@ -69,8 +69,8 @@
         FROM C_BP_Group_Acct ga, C_BPartner p, C_ValidCombination vc 
         WHERE ga.C_BP_Group_ID=p.C_BP_Group_ID
         AND ga.UnearnedRevenue_Acct=vc.C_ValidCombination_ID
-        AND ga.C_AcctSchema_ID = ? 
-        AND p.C_BPartner_ID = ?
+        AND ga.C_AcctSchema_ID = TO_NUMBER(?) 
+        AND p.C_BPartner_ID = TO_NUMBER(?)
         ]]>
      </Sql>
      <Parameter name="C_AcctSchema_ID"/>
@@ -160,8 +160,8 @@
     <Sql>
       <![CDATA[
         UPDATE Fact_Acct SET FACTACCTTYPE = 'O'
-        WHERE AD_TABLE_ID = ?
-        AND RECORD_ID = ?
+        WHERE AD_TABLE_ID = TO_NUMBER(?)
+        AND RECORD_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="table"/>
@@ -172,7 +172,7 @@
     <Sql>
       <![CDATA[
         SELECT w.C_Location_ID as location FROM M_Warehouse w, M_Locator l 
-        WHERE w.M_Warehouse_ID=l.M_Warehouse_ID AND l.M_Locator_ID=?
+        WHERE w.M_Warehouse_ID=l.M_Warehouse_ID AND l.M_Locator_ID = TO_NUMBER(?)
         ]]>
      </Sql>
      <Parameter name="M_Locator_ID"/>
@@ -181,7 +181,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        select value, name as description from c_elementvalue where c_elementvalue_id =?
+        select value, name as description from c_elementvalue where c_elementvalue_ID = TO_NUMBER(?)
         ]]>
      </Sql>
      <Parameter name="cElementvalueId"/>
--- a/src/org/openbravo/erpCommon/ad_forms/FileImport_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/FileImport_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
         SELECT f.SeqNo,c.ColumnName,f.StartNo,f.EndNo,f.DataType,c.FieldLength,
         f.DataFormat,f.DecimalPoint,f.DivideBy100,f.ConstantValue,f.Callout, f.Name
         FROM AD_ImpFormat_Row f,AD_Column c
-        WHERE AD_ImpFormat_ID = ?
+        WHERE AD_ImpFormat_ID = TO_NUMBER(?)
         AND f.AD_Column_ID=c.AD_Column_ID
         ORDER BY SeqNo
       ]]></Sql>
@@ -74,7 +74,7 @@
     <Sql>
       <![CDATA[
         DELETE FROM I_ELEMENTVALUE
-        where ad_client_id = ?
+        where ad_client_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="client"/>
@@ -84,7 +84,7 @@
       <Sql><![CDATA[
       SELECT t.TableName
       FROM AD_Table t
-      WHERE t.AD_Table_ID in (SELECT ad_table_id FROM AD_ImpFormat WHERE ad_impformat_id = ?)
+      WHERE t.AD_Table_ID in (SELECT ad_table_id FROM AD_ImpFormat WHERE ad_impformat_ID = TO_NUMBER(?))
       ]]></Sql>
         <Parameter name="adImpformatId"/>
   </SqlMethod>
@@ -95,14 +95,14 @@
       FROM AD_Table t, AD_Column c 
       WHERE t.AD_Table_ID=c.AD_Table_ID 
       AND c.IsKey='Y' 
-      and t.AD_Table_ID in (SELECT ad_table_id FROM AD_ImpFormat WHERE ad_impformat_id = ?)
+      and t.AD_Table_ID in (SELECT ad_table_id FROM AD_ImpFormat WHERE ad_impformat_ID = TO_NUMBER(?))
       ]]></Sql>
         <Parameter name="adImpformatId"/>
   </SqlMethod>
   <SqlMethod name="parse" type="preparedStatement" return="String">
     <SqlMethodComment></SqlMethodComment>
       <Sql><![CDATA[
-      select substr(to_char(?),to_number(0), to_number(?)) AS FIELD from dual
+      select substr(to_char(?),0, to_number(?)) AS FIELD from dual
       ]]></Sql>
     <Parameter name="text"/>
     <Parameter name="length"/>
@@ -119,7 +119,7 @@
     <SqlMethodComment></SqlMethodComment>
       <Sql><![CDATA[
       SELECT FORMATTYPE FROM AD_IMPFORMAT
-      WHERE AD_IMPFORMAT_ID = ? 
+      WHERE AD_IMPFORMAT_ID = TO_NUMBER(?) 
       ]]></Sql>
     <Parameter name="impFormat"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_forms/GenerateInvoicesmanual_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/GenerateInvoicesmanual_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -43,7 +43,7 @@
     <Field name="rownum" value="count"/>
     <Parameter name="adUserClient" type="replace" optional="true" after="AND ic.ad_client_id in (" text="'1'"/>
     <Parameter name="adUserOrg" type="replace" optional="true" after="AND ic.ad_org_id in (" text="'1'"/>
-    <Parameter name="parBPartner" optional="true" after="AND 1=1">AND ic.C_BPartner_ID= ?</Parameter>
+    <Parameter name="parBPartner" optional="true" after="AND 1=1">AND ic.C_BPartner_ID = TO_NUMBER(?)</Parameter>
     <Parameter name="parDateFrom" optional="true" after="AND 1=1"><![CDATA[ AND ic.DateOrdered >= TO_DATE(?)]]></Parameter>
     <Parameter name="parDateTo" optional="true" after="AND 1=1"><![CDATA[ AND ic.DateOrdered < TO_DATE(?)]]></Parameter>
     <Parameter name="adOrgId" optional="true" type="replace" after="AND 2=2 AND ic.ad_org_id in (" text="'1'"/>
@@ -82,7 +82,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
     SELECT NAME FROM C_BPARTNER 
-    WHERE C_BPARTNER_ID = ?
+    WHERE C_BPARTNER_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -90,7 +90,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
         SELECT AD_TREE_ORG_ID FROM AD_CLIENTINFO
-        WHERE AD_CLIENT_ID = ?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="client"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_forms/GenerateShipmentsmanual_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/GenerateShipmentsmanual_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -43,7 +43,7 @@
     <Field name="rownum" value="count"/>
     <Parameter name="adUserClient" type="replace" optional="true" after="AND ic.ad_client_id in (" text="'1'"/>
     <Parameter name="adUserOrg" type="replace" optional="true" after="AND ic.ad_org_id in (" text="'1'"/>
-    <Parameter name="parBPartner" optional="true" after="AND 1=1">AND ic.C_BPartner_ID= ?</Parameter>
+    <Parameter name="parBPartner" optional="true" after="AND 1=1">AND ic.C_BPartner_ID = TO_NUMBER(?)</Parameter>
     <Parameter name="parDateFrom" optional="true" after="AND 1=1"><![CDATA[ AND ic.DateOrdered >= TO_DATE(?)]]></Parameter>
     <Parameter name="parDateTo" optional="true" after="AND 1=1"><![CDATA[ AND ic.DateOrdered < TO_DATE(?)]]></Parameter>
     <Parameter name="adOrgId" optional="true" type="replace" after="AND 2=2 AND ic.ad_org_id in (" text="'1'"/>
@@ -83,7 +83,7 @@
     <Sql>
     <![CDATA[
     SELECT NAME FROM C_BPARTNER 
-    WHERE C_BPARTNER_ID = ?
+    WHERE C_BPARTNER_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -91,7 +91,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
         SELECT AD_TREE_ORG_ID FROM AD_CLIENTINFO
-        WHERE AD_CLIENT_ID = ?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="client"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_forms/InformeInOut.java	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/InformeInOut.java	Tue Feb 12 18:53:44 2008 +0000
@@ -64,7 +64,7 @@
   void printPage(HttpServletResponse response, VariablesSecureApp vars,  String strDesde, String strHasta, String strCategoriaProducto) throws IOException, ServletException {
     response.setContentType("application/xls");
     XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_forms/InformeInOut_Excel").createXmlDocument();
-    xmlDocument.setData("structure1", InformeInOutData.select(this, vars.getSqlDateFormat(), strHasta, strDesde, strCategoriaProducto));
+    xmlDocument.setData("structure1", InformeInOutData.select(this, strHasta, strDesde,  vars.getSqlDateFormat(), strCategoriaProducto));
 
 
     response.setContentType("application/xls");
--- a/src/org/openbravo/erpCommon/ad_forms/InformeInOut_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/InformeInOut_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -34,7 +34,7 @@
       FROM
       (
       SELECT TO_CHAR(P.NAME) AS ARTICULO, NULL AS CLIENTE,
-      TO_DATE(I_O.MOVEMENTDATE,to_char(?)) AS FECHA_ENTRADA, to_date(NULL) AS FECHA_SALIDA, 
+      TO_DATE(TO_CHAR(I_O.MOVEMENTDATE,to_char(?))) AS FECHA_ENTRADA, to_date(NULL) AS FECHA_SALIDA, 
       SUM(I_O_L.MOVEMENTQTY)  AS CANTIDAD, U.NAME AS UNIDAD, TO_CHAR(I_O_L.SERNO) AS CODIGO 
       FROM M_PRODUCT P, M_INOUT I_O, M_INOUTLINE I_O_L, C_UOM U, M_PRODUCT_CATEGORY P_C
       WHERE I_O.M_INOUT_ID = I_O_L.M_INOUT_ID
@@ -47,7 +47,7 @@
       GROUP BY P.NAME, I_O.MOVEMENTDATE, U.NAME, I_O_L.SERNO
       UNION
       SELECT TO_CHAR(P.NAME) AS ARTICULO, TO_CHAR(BP.NAME) AS CLIENTE, to_date(NULL) AS FECHA_ENTRADA,
-      TO_DATE(I_O.MOVEMENTDATE,to_char(?)) AS FECHA_SALIDA, SUM(I_O_L.MOVEMENTQTY) AS CANTIDAD, U.NAME AS UNIDAD, TO_CHAR(I_O_L.SERNO) AS CODIGO 
+      TO_DATE(TO_CHAR(I_O.MOVEMENTDATE,to_char(?))) AS FECHA_SALIDA, SUM(I_O_L.MOVEMENTQTY) AS CANTIDAD, U.NAME AS UNIDAD, TO_CHAR(I_O_L.SERNO) AS CODIGO 
       FROM M_PRODUCT P, M_INOUT I_O, M_INOUTLINE I_O_L, C_BPARTNER BP, C_UOM U, M_PRODUCT_CATEGORY P_C
       WHERE I_O.M_INOUT_ID = I_O_L.M_INOUT_ID
       AND I_O_L.M_PRODUCT_ID= P.M_PRODUCT_ID
@@ -56,21 +56,21 @@
       AND I_O.C_BPARTNER_ID= BP.C_BPARTNER_ID
       AND I_O.MOVEMENTTYPE='V+'
       AND 2=2
-      AND I_O.MOVEMENTDATE BETWEEN ? AND ?
+      AND I_O.MOVEMENTDATE BETWEEN TO_DATE(?) AND TO_DATE(?)
       GROUP BY P.NAME, BP.NAME, I_O.MOVEMENTDATE, U.NAME, I_O_L.SERNO
       ) A
       GROUP BY CODIGO, ARTICULO, UNIDAD 
       ORDER BY CODIGO
      ]]>
      </Sql>
-     <Parameter name="dateFormat"/>
      <Parameter name="fechaHasta"/>
      <Parameter name="fechaDesde"/>
-     <Parameter name="categoria" optional="true" after="AND 1=1" text=" AND P_C.M_PRODUCT_CATEGORY_ID = ? "/>
-     <Parameter name="dateFormat"/>
+     <Parameter name="dateFormat"/>     
+     <Parameter name="categoria" optional="true" after="AND 1=1" text=" AND P_C.M_PRODUCT_CATEGORY_ID = TO_NUMBER(?) "/>
      <Parameter name="fechaDesde"/>
      <Parameter name="fechaHasta"/>
-     <Parameter name="categoria" optional="true" after="AND 2=2" text=" AND P_C.M_PRODUCT_CATEGORY_ID = ? "/>
+     <Parameter name="dateFormat"/>     
+     <Parameter name="categoria" optional="true" after="AND 2=2" text=" AND P_C.M_PRODUCT_CATEGORY_ID = TO_NUMBER(?) "/>
      <Parameter name="fechaDesde"/>
      <Parameter name="fechaHasta"/>
    </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -85,7 +85,7 @@
     <Sql>
       <![CDATA[
       UPDATE AD_ClientInfo SET C_AcctSchema1_ID = TO_NUMBER(?), C_Calendar_ID = TO_NUMBER(?)
-      WHERE AD_Client_ID = ?
+      WHERE AD_Client_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="C_AcctSchema_ID"/>
@@ -270,7 +270,7 @@
     <Sql>
       <![CDATA[
       UPDATE C_AcctSchema_Element SET Org_ID=  TO_NUMBER(?)
-      WHERE C_AcctSchema_Element_ID= ?
+      WHERE C_AcctSchema_Element_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="AD_Org_ID"/>
@@ -281,7 +281,7 @@
     <Sql>
       <![CDATA[
       UPDATE C_AcctSchema_Element SET C_ElementValue_ID= TO_NUMBER(?), C_Element_ID= TO_NUMBER(?)
-      WHERE C_AcctSchema_Element_ID=?
+      WHERE C_AcctSchema_Element_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="C_ElementValue_ID"/>
@@ -293,7 +293,7 @@
     <Sql>
       <![CDATA[
       UPDATE C_AcctSchema_Element SET C_Project_ID = TO_NUMBER(?)
-      WHERE C_AcctSchema_ID = ?
+      WHERE C_AcctSchema_ID = TO_NUMBER(?)
       AND ElementType='PJ'
       ]]>
     </Sql>
@@ -509,7 +509,7 @@
     <Sql>
         SELECT MAX(AD_TREE_ID) AS ID 
         FROM AD_TREE
-        WHERE AD_CLIENT_ID = ? 
+        WHERE AD_CLIENT_ID = TO_NUMBER(?) 
         AND TREETYPE = 'EV'
     </Sql>
     <Parameter name="client"/>
@@ -520,7 +520,7 @@
         SELECT C_ELEMENTVALUE_ID AS ID 
         FROM C_ELEMENTVALUE
         WHERE VALUE = ? 
-        AND AD_CLIENT_ID = ?
+        AND AD_CLIENT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="value"/>
     <Parameter name="client"/>
@@ -547,7 +547,7 @@
     <Sql>
       SELECT Description
       FROM C_Currency 
-      where  C_Currency_ID = ?
+      where  C_Currency_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="moneda"/>
   </SqlMethod>
@@ -582,7 +582,7 @@
     <Sql>
       UPDATE C_AcctSchema_Element 
       SET C_SalesRegion_ID = TO_NUMBER(?)
-      WHERE C_AcctSchema_ID= ?
+      WHERE C_AcctSchema_ID = TO_NUMBER(?)
       AND ElementType='SR'
     </Sql>
     <Parameter name="C_SalesRegion_ID"/>
@@ -593,7 +593,7 @@
     <Sql>
       UPDATE C_AcctSchema_Element 
       SET C_Campaign_ID = TO_NUMBER(?)
-      WHERE C_AcctSchema_ID= ?
+      WHERE C_AcctSchema_ID = TO_NUMBER(?)
       AND ElementType='MC'
     </Sql>
     <Parameter name="C_Campaign_ID"/>
@@ -604,7 +604,7 @@
     <Sql>
       UPDATE C_AcctSchema_Element 
       SET C_BPartner_ID = TO_NUMBER(?)
-      WHERE C_AcctSchema_ID= ?
+      WHERE C_AcctSchema_ID = TO_NUMBER(?)
       AND ElementType='BP'
     </Sql>
     <Parameter name="C_BPartner_ID"/>
@@ -615,7 +615,7 @@
     <Sql>
       UPDATE C_AcctSchema_Element 
       SET M_Product_ID = TO_NUMBER(?)
-      WHERE C_AcctSchema_ID= ?
+      WHERE C_AcctSchema_ID = TO_NUMBER(?)
       AND ElementType='PR'
     </Sql>
     <Parameter name="M_Product_ID"/>
@@ -738,7 +738,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       UPDATE AD_OrgInfo SET C_Location_ID = TO_NUMBER(?)
-      WHERE AD_Org_ID = ?
+      WHERE AD_Org_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="C_Location_ID"/>
     <Parameter name="AD_Org_ID"/>
@@ -774,7 +774,7 @@
     <Sql>
       UPDATE AD_ClientInfo 
       SET C_BPartnerCashTrx_ID = TO_NUMBER(?), M_ProductFreight_ID = TO_NUMBER(?)
-      WHERE AD_Client_ID = ?
+      WHERE AD_Client_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="C_BPartner_ID"/>
     <Parameter name="M_Product_ID"/>
@@ -856,7 +856,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       UPDATE AD_User SET C_BPartner_ID = TO_NUMBER(?)
-      WHERE AD_User_ID = ?
+      WHERE AD_User_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="C_BPartner_ID"/>
     <Parameter name="AD_User_U_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/InvoiceVendorMultiline_Lines_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/InvoiceVendorMultiline_Lines_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -31,7 +31,7 @@
       SELECT C_INVOICELINE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, C_INVOICE_ID, C_ORDERLINE_ID, M_INOUTLINE_ID, LINE, DESCRIPTION, M_PRODUCT_ID, QTYINVOICED, PRICELIST, PRICEACTUAL, PRICELIMIT, LINENETAMT, C_CHARGE_ID, CHARGEAMT, C_UOM_ID, C_TAX_ID, S_RESOURCEASSIGNMENT_ID, A_ASSET_ID, TAXAMT, M_ATTRIBUTESETINSTANCE_ID, ISDESCRIPTION, QUANTITYORDER, M_PRODUCT_UOM_ID, C_INVOICE_DISCOUNT_ID, 
       AD_COLUMN_IDENTIFIER(TO_CHAR('M_Product'), TO_CHAR(M_PRODUCT_ID), TO_CHAR(?)) AS M_PRODUCT_ID_D, PRICESTD, M_OFFER_ID 
       FROM C_INVOICELINE 
-      WHERE C_INVOICE_ID = ? 
+      WHERE C_INVOICE_ID = TO_NUMBER(?) 
       ORDER BY LINE
      ]]>
      </Sql>
@@ -49,7 +49,7 @@
       <![CDATA[
       SELECT LINE AS TOTAL
       FROM C_INVOICELINE 
-      WHERE C_INVOICELINE_ID = ? 
+      WHERE C_INVOICELINE_ID = TO_NUMBER(?) 
      ]]>
      </Sql>
      <Parameter name="cInvoiceId"/>
@@ -60,7 +60,7 @@
       <![CDATA[
       SELECT COALESCE(MAX(LINE), 0) + 10 AS TOTAL
       FROM C_INVOICELINE 
-      WHERE C_INVOICE_ID = ? 
+      WHERE C_INVOICE_ID = TO_NUMBER(?) 
      ]]>
      </Sql>
      <Parameter name="cInvoiceId"/>
@@ -71,7 +71,7 @@
       <![CDATA[
       SELECT C_UOM_ID AS TOTAL
       FROM M_PRODUCT 
-      WHERE M_PRODUCT_ID = ? 
+      WHERE M_PRODUCT_ID = TO_NUMBER(?) 
      ]]>
      </Sql>
      <Parameter name="mProductId"/>
@@ -83,7 +83,7 @@
         C_CHARGE_ID = TO_NUMBER(?), CHARGEAMT = TO_NUMBER(?), C_UOM_ID = TO_NUMBER(?), S_RESOURCEASSIGNMENT_ID = TO_NUMBER(?), A_ASSET_ID = TO_NUMBER(?), TAXAMT = TO_NUMBER(?), 
         M_ATTRIBUTESETINSTANCE_ID = TO_NUMBER(?), ISDESCRIPTION = ?, QUANTITYORDER = TO_NUMBER(?), M_PRODUCT_UOM_ID = TO_NUMBER(?), C_INVOICE_DISCOUNT_ID = TO_NUMBER(?), 
         PRICESTD = TO_NUMBER(?)
-        WHERE C_INVOICELINE_ID = ? 
+        WHERE C_INVOICELINE_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="updatedby"/>
     <Parameter name="mProductId"/>
@@ -126,7 +126,7 @@
     VALUES ( TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 
     'Y', now(), TO_NUMBER(?), 
     now(), TO_NUMBER(?), TO_NUMBER(?), 
-    TO_NUMBER(?), TO_NUMBER(?), (SELECT COALESCE(MAX(LINE), 0) +10 FROM C_INVOICELINE WHERE C_INVOICE_ID=?), 
+    TO_NUMBER(?), TO_NUMBER(?), (SELECT COALESCE(MAX(LINE), 0) +10 FROM C_INVOICELINE WHERE C_INVOICE_ID = TO_NUMBER(?)), 
     ?, TO_NUMBER(?), TO_NUMBER(?), 
     TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 
     (TO_NUMBER(?)*TO_NUMBER(?)), TO_NUMBER(?), TO_NUMBER(?), 
@@ -169,7 +169,7 @@
   <SqlMethod name="delete" type="preparedStatement" connection="true" static="false" return="rowCount">
     <Sql><![CDATA[
         DELETE FROM C_INVOICELINE 
-        WHERE C_INVOICELINE_ID = ? 
+        WHERE C_INVOICELINE_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cInvoicelineId"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_forms/InvoiceVendorMultiline_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/InvoiceVendorMultiline_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -100,7 +100,7 @@
       WHERE	 I.ISSOTRX  = 'N'
        AND	195  = L.AD_REFERENCE_ID
        AND	I.PAYMENTRULE  = L.VALUE
-       AND	I.C_INVOICE_ID  = ?
+       AND	I.C_INVOICE_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="dateformat"/>
@@ -162,7 +162,7 @@
       FROM C_DocType
       WHERE C_DocType.AD_Org_ID IN('1') 
       AND C_DocType.AD_Client_ID IN('1') 
-      AND C_DocType.AD_Client_ID=? 
+      AND C_DocType.AD_Client_ID = TO_NUMBER(?) 
       AND C_DocType.DocBaseType IN ('ARI', 'API','ARC','APC') 
       AND C_DocType.IsSOTrx=? 
       AND C_DocType.isActive = 'Y'
@@ -221,7 +221,7 @@
         CreateFrom = ?, GenerateTo = ?, C_Project_ID = TO_NUMBER(?), C_Activity_ID = TO_NUMBER(?), C_Campaign_ID = TO_NUMBER(?), AD_OrgTrx_ID = TO_NUMBER(?), 
         User1_ID = TO_NUMBER(?), User2_ID = TO_NUMBER(?), DocStatus = ?, C_DocType_ID = TO_NUMBER(?), CopyFrom = ?, 
         DocAction = ?, Posted = ?, updated = now(), updatedby = TO_NUMBER(?) 
-        WHERE C_Invoice.C_Invoice_ID = ? 
+        WHERE C_Invoice.C_Invoice_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="istransferred"></Parameter> 
     <Parameter name="sendemail"></Parameter> 
@@ -336,7 +336,7 @@
   <SqlMethod name="delete" type="preparedStatement" return="rowCount">
     <Sql><![CDATA[
         DELETE FROM C_INVOICE 
-        WHERE C_INVOICE.C_INVOICE_ID = ? 
+        WHERE C_INVOICE.C_INVOICE_ID = TO_NUMBER(?) 
     ]]></Sql>
     <Parameter name="cInvoiceId"/>
     
--- a/src/org/openbravo/erpCommon/ad_forms/MatchingPOReceiptInvoice_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/MatchingPOReceiptInvoice_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -43,8 +43,8 @@
       lin.Line,lin.C_OrderLine_ID, p.Name,lin.M_Product_ID, lin.QtyOrdered
       HAVING 0 <>SUM(COALESCE(mo.Qty, 0)) 
       ]]></Sql>
-		<Parameter name="parProduct" optional="true" after="WHERE " text=" lin.M_Product_ID = ? AND "/>
-		<Parameter name="parBpartner" optional="true" after="WHERE " text=" hdr.C_BPartner_ID = ? AND "/>
+		<Parameter name="parProduct" optional="true" after="WHERE " text=" lin.M_Product_ID = TO_NUMBER(?) AND "/>
+		<Parameter name="parBpartner" optional="true" after="WHERE " text=" hdr.C_BPartner_ID = TO_NUMBER(?) AND "/>
 		<Parameter name="parQty" optional="true" after="WHERE "><![CDATA[ lin.QtyOrdered = ? AND ]]></Parameter>
 		<Parameter name="parDesde" optional="true" after="WHERE "><![CDATA[ hdr.DateOrdered >= TO_DATE(?) AND ]]></Parameter>
 		<Parameter name="parHasta" optional="true" after="WHERE "><![CDATA[ hdr.DateOrdered <= TO_DATE(?) AND ]]></Parameter>
@@ -71,8 +71,8 @@
       lin.Line,lin.C_InvoiceLine_ID, p.Name,lin.M_Product_ID, lin.QtyInvoiced 
       HAVING 0 <>SUM(COALESCE(mi.Qty, 0)) 
       ]]></Sql>
-		<Parameter name="parProduct" optional="true" after="WHERE " text=" lin.M_Product_ID = ? AND "/>
-		<Parameter name="parBpartner" optional="true" after="WHERE " text=" hdr.C_BPartner_ID = ? AND "/>
+		<Parameter name="parProduct" optional="true" after="WHERE " text=" lin.M_Product_ID = TO_NUMBER(?) AND "/>
+		<Parameter name="parBpartner" optional="true" after="WHERE " text=" hdr.C_BPartner_ID = TO_NUMBER(?) AND "/>
 		<Parameter name="parQty" optional="true" after="WHERE " text=" lin.QtyInvoiced = ? AND "/>
 		<Parameter name="parDesde" optional="true" after="WHERE "><![CDATA[ hdr.DateInvoiced >= TO_DATE(?) AND ]]></Parameter>
 		<Parameter name="parHasta" optional="true" after="WHERE "><![CDATA[ hdr.DateInvoiced <= TO_DATE(?) AND ]]></Parameter>
@@ -100,8 +100,8 @@
       HAVING 0 <>SUM(COALESCE(m.Qty, 0)) 
       ]]></Sql>
 		<Parameter name="parFinalDoc" optional="true" type="replace" after="C_DocType dt, " text="M_MatchPO"/>
-		<Parameter name="parProduct" optional="true" after="WHERE " text=" lin.M_Product_ID = ? AND "/>
-		<Parameter name="parBpartner" optional="true" after="WHERE " text=" hdr.C_BPartner_ID = ? AND "/>
+		<Parameter name="parProduct" optional="true" after="WHERE " text=" lin.M_Product_ID = TO_NUMBER(?) AND "/>
+		<Parameter name="parBpartner" optional="true" after="WHERE " text=" hdr.C_BPartner_ID = TO_NUMBER(?) AND "/>
 		<Parameter name="parQty" optional="true" after="WHERE " text=" lin.MovementQty = ? AND "/>
 		<Parameter name="parDesde" optional="true" after="WHERE "><![CDATA[ hdr.MovementDate >= TO_DATE(?) AND ]]></Parameter>
 		<Parameter name="parHasta" optional="true" after="WHERE "><![CDATA[ hdr.MovementDate <= TO_DATE(?) AND ]]></Parameter>
@@ -119,7 +119,7 @@
 		<Sql><![CDATA[
       SELECT hdr.C_BPartner_ID, lin.M_Product_ID, lin.QtyOrdered as Qty
       FROM C_Order hdr, C_OrderLine lin
-      WHERE lin.C_OrderLine_ID = ? 
+      WHERE lin.C_OrderLine_ID = TO_NUMBER(?) 
       AND hdr.C_Order_ID=lin.C_Order_ID 
       ]]></Sql>
 		<Parameter name="clave"/>
@@ -129,7 +129,7 @@
 		<Sql><![CDATA[
       SELECT hdr.C_BPartner_ID, lin.M_Product_ID, lin.QtyInvoiced as Qty
       FROM C_Invoice hdr, C_InvoiceLine lin
-      WHERE lin.C_InvoiceLine_ID = ? 
+      WHERE lin.C_InvoiceLine_ID = TO_NUMBER(?) 
       AND hdr.C_Invoice_ID=lin.C_Invoice_ID 
       ]]></Sql>
 		<Parameter name="clave"/>
@@ -139,7 +139,7 @@
 		<Sql><![CDATA[
       SELECT hdr.C_BPartner_ID, lin.M_Product_ID, lin.MovementQty as Qty
       FROM M_InOut hdr, M_InOutLine lin
-      WHERE lin.M_InoutLine_ID = ? 
+      WHERE lin.M_InoutLine_ID = TO_NUMBER(?) 
       AND hdr.M_InOut_ID=lin.M_InOut_ID 
       ]]></Sql>
 		<Parameter name="clave"/>
@@ -147,14 +147,14 @@
 	<SqlMethod name="bpartner" type="preparedStatement" return="String" default="">
 		<SqlMethodComment></SqlMethodComment>
 		<Sql><![CDATA[
-      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID=?
+      SELECT NAME FROM C_BPARTNER WHERE C_BPARTNER_ID = TO_NUMBER(?)
       ]]></Sql>
 		<Parameter name="cBpartnerId"/>
 	</SqlMethod>
 	<SqlMethod name="product" type="preparedStatement" return="String" default="">
 		<SqlMethodComment></SqlMethodComment>
 		<Sql><![CDATA[
-      SELECT NAME FROM M_PRODUCT WHERE M_PRODUCT_ID=?
+      SELECT NAME FROM M_PRODUCT WHERE M_PRODUCT_ID = TO_NUMBER(?)
       ]]></Sql>
 		<Parameter name="cProductId"/>
 	</SqlMethod>
@@ -196,8 +196,8 @@
 		<SqlMethodComment></SqlMethodComment>
 		<Sql><![CDATA[
       UPDATE M_Storage_Pending SET QtyOrdered = QtyOrdered-TO_NUMBER(?) 
-      WHERE M_Product_ID = ? 
-      AND M_Warehouse_ID = (SELECT MAX(M_Warehouse_ID) FROM M_Locator WHERE M_Locator_ID = (SELECT M_Locator_ID FROM M_InOutLine WHERE M_InOutLine_ID=?))
+      WHERE M_Product_ID = TO_NUMBER(?) 
+      AND M_Warehouse_ID = (SELECT MAX(M_Warehouse_ID) FROM M_Locator WHERE M_Locator_ID = (SELECT M_Locator_ID FROM M_InOutLine WHERE M_InOutLine_ID = TO_NUMBER(?)))
       ]]></Sql>
 		<Parameter name="qty"/>
     <Parameter name="mProductId"/>
--- a/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPendingLines_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPendingLines_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
     <![CDATA[
       SELECT C_ORDERLINE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, C_ORDER_ID, LINE, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, DATEORDERED, DATEPROMISED, DATEDELIVERED, DATEINVOICED, DESCRIPTION, M_PRODUCT_ID, M_WAREHOUSE_ID, DIRECTSHIP, C_UOM_ID, QTYORDERED, QTYRESERVED, QTYDELIVERED, QTYINVOICED, M_SHIPPER_ID, C_CURRENCY_ID, PRICELIST, PRICEACTUAL, PRICELIMIT, LINENETAMT, DISCOUNT, FREIGHTAMT, C_CHARGE_ID, CHARGEAMT, C_TAX_ID, LOT, SERNO, S_RESOURCEASSIGNMENT_ID, REF_ORDERLINE_ID, M_ATTRIBUTESETINSTANCE_ID, ISDESCRIPTION, QUANTITYORDER, M_PRODUCT_UOM_ID, LASTPRICESO
       FROM C_ORDERLINE
-      WHERE C_ORDERLINE.C_ORDERLINE_ID = ?
+      WHERE C_ORDERLINE.C_ORDERLINE_ID = TO_NUMBER(?)
       ]]></Sql>
 	<Field name="rownum" value="count"/>
     <Parameter name="cOrderlineId"/>
--- a/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -32,7 +32,7 @@
       FROM C_ORDER, C_ORDERLINE
       WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
       AND C_ORDER.DOCSTATUS = 'CO'
-      AND C_ORDERLINE.C_ORDERLINE_ID = ?
+      AND C_ORDERLINE.C_ORDERLINE_ID = TO_NUMBER(?)
       ]]></Sql>
 	<Field name="rownum" value="count"/>
     <Parameter name="cOrderlineId"/>
@@ -73,7 +73,7 @@
     <Parameter name="adOrgId" optional="true" type="replace" after="AND C_ORDER.AD_ORG_ID IN (" text="'1'"/>
     <Parameter name="parDateFrom" optional="true" after="AND C_ORDER.ISSOTRX='N'"><![CDATA[ AND C_ORDER.DATEORDERED >= TO_DATE(?)]]></Parameter>
     <Parameter name="parDateTo" optional="true" after="AND C_ORDER.ISSOTRX='N'"><![CDATA[ AND C_ORDER.DATEORDERED < TO_DATE(?)]]></Parameter>
-    <Parameter name="parBPartner" optional="true" after="AND C_ORDER.ISSOTRX='N'"> AND C_BPARTNER.C_BPARTNER_ID = ?</Parameter>
+    <Parameter name="parBPartner" optional="true" after="AND C_ORDER.ISSOTRX='N'"> AND C_BPARTNER.C_BPARTNER_ID = TO_NUMBER(?)</Parameter>
     <Parameter name="parDocumentNo" optional="true" after="AND C_ORDER.ISSOTRX='N'"> AND C_ORDER.DOCUMENTNO = ?</Parameter>
   </SqlMethod>
   <SqlMethod name="insert" connection="true" type="preparedStatement" return="rowCount">
@@ -157,7 +157,7 @@
       <![CDATA[
         SELECT C_DocTypeShipment_ID
         FROM C_DOCTYPE
-        WHERE C_DocType_ID = ?
+        WHERE C_DocType_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="cDoctypeId"/>
@@ -167,7 +167,7 @@
     <Sql>
     <![CDATA[
     SELECT NAME FROM C_BPARTNER 
-    WHERE C_BPARTNER_ID = ?
+    WHERE C_BPARTNER_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="cBpartnerId"/>
   </SqlMethod>
@@ -175,7 +175,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
         SELECT AD_TREE_ORG_ID FROM AD_CLIENTINFO
-        WHERE AD_CLIENT_ID = ?
+        WHERE AD_CLIENT_ID = TO_NUMBER(?)
     </Sql>
     <Parameter name="client"/>
   </SqlMethod>
--- a/src/org/openbravo/erpCommon/ad_forms/MaterialTransactions_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/MaterialTransactions_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -108,40 +108,40 @@
 		<Field name="rownum" value="count"/>
         <Parameter name="language"/>
         <Parameter name="userClient" optional="true" type="argument" after="AND 1=1 " text="and T.AD_Client_ID IN "/>
-        <Parameter name="organization" optional="true" after="AND 1=1 "><![CDATA[AND T.AD_ORG_ID=? ]]></Parameter>
+        <Parameter name="organization" optional="true" after="AND 1=1 "><![CDATA[AND T.AD_ORG_ID = TO_NUMBER(?) ]]></Parameter>
         <Parameter name="movementType" optional="true" after="AND 1=1 "><![CDATA[AND T.MOVEMENTTYPE=? ]]></Parameter>
-        <Parameter name="locator" optional="true" after="AND 1=1 "><![CDATA[AND T.M_LOCATOR_ID=? ]]></Parameter>
-        <Parameter name="product" optional="true" after="AND 1=1 "><![CDATA[AND T.M_PRODUCT_ID=? ]]></Parameter>
+        <Parameter name="locator" optional="true" after="AND 1=1 "><![CDATA[AND T.M_LOCATOR_ID = TO_NUMBER(?) ]]></Parameter>
+        <Parameter name="product" optional="true" after="AND 1=1 "><![CDATA[AND T.M_PRODUCT_ID = TO_NUMBER(?) ]]></Parameter>
         <Parameter name="userOrganization" optional="true" type="argument" after="AND 1=1 " text="and T.AD_ORG_ID IN "/>
         <Parameter name="desde"/>
         <Parameter name="hasta"/>
         <Parameter name="language"/>
         <Parameter name="language"/>
         <Parameter name="userClient" optional="true" type="argument" after="AND 2=2 " text="and T.AD_Client_ID IN "/>
-        <Parameter name="organization" optional="true" after="AND 2=2 "><![CDATA[AND T.AD_ORG_ID=? ]]></Parameter>
+        <Parameter name="organization" optional="true" after="AND 2=2 "><![CDATA[AND T.AD_ORG_ID = TO_NUMBER(?) ]]></Parameter>
         <Parameter name="movementType" optional="true" after="AND 2=2 "><![CDATA[AND T.MOVEMENTTYPE=? ]]></Parameter>
-        <Parameter name="locator" optional="true" after="AND 2=2 "><![CDATA[AND T.M_LOCATOR_ID=? ]]></Parameter>
-        <Parameter name="product" optional="true" after="AND 2=2 "><![CDATA[AND T.M_PRODUCT_ID=? ]]></Parameter>
+        <Parameter name="locator" optional="true" after="AND 2=2 "><![CDATA[AND T.M_LOCATOR_ID = TO_NUMBER(?) ]]></Parameter>
+        <Parameter name="product" optional="true" after="AND 2=2 "><![CDATA[AND T.M_PRODUCT_ID = TO_NUMBER(?) ]]></Parameter>
         <Parameter name="userOrganization" optional="true" type="argument" after="AND 2=2 " text="and T.AD_ORG_ID IN "/>
         <Parameter name="desde"/>
         <Parameter name="hasta"/>
         <Parameter name="language"/>
         <Parameter name="language"/>
         <Parameter name="userClient" optional="true" type="argument" after="AND 3=3 " text="and T.AD_Client_ID IN "/>
-        <Parameter name="organization" optional="true" after="AND 3=3 "><![CDATA[AND T.AD_ORG_ID=? ]]></Parameter>
+        <Parameter name="organization" optional="true" after="AND 3=3 "><![CDATA[AND T.AD_ORG_ID = TO_NUMBER(?) ]]></Parameter>
         <Parameter name="movementType" optional="true" after="AND 3=3 "><![CDATA[AND T.MOVEMENTTYPE=? ]]></Parameter>
-        <Parameter name="locator" optional="true" after="AND 3=3 "><![CDATA[AND T.M_LOCATOR_ID=? ]]></Parameter>
-        <Parameter name="product" optional="true" after="AND 3=3 "><![CDATA[AND T.M_PRODUCT_ID=? ]]></Parameter>
+        <Parameter name="locator" optional="true" after="AND 3=3 "><![CDATA[AND T.M_LOCATOR_ID = TO_NUMBER(?) ]]></Parameter>
+        <Parameter name="product" optional="true" after="AND 3=3 "><![CDATA[AND T.M_PRODUCT_ID = TO_NUMBER(?) ]]></Parameter>
         <Parameter name="userOrganization" optional="true" type="argument" after="AND 3=3 " text="and T.AD_ORG_ID IN "/>
         <Parameter name="desde"/>
         <Parameter name="hasta"/>
         <Parameter name="language"/>
         <Parameter name="language"/>
         <Parameter name="userClient" optional="true" type="argument" after="AND 4=4 " text="and T.AD_Client_ID IN "/>
-        <Parameter name="organization" optional="true" after="AND 4=4 "><![CDATA[AND T.AD_ORG_ID=? ]]></Parameter>
+        <Parameter name="organization" optional="true" after="AND 4=4 "><![CDATA[AND T.AD_ORG_ID = TO_NUMBER(?) ]]></Parameter>
         <Parameter name="movementType" optional="true" after="AND 4=4 "><![CDATA[AND T.MOVEMENTTYPE=? ]]></Parameter>
-        <Parameter name="locator" optional="true" after="AND 4=4 "><![CDATA[AND T.M_LOCATOR_ID=? ]]></Parameter>
-        <Parameter name="product" optional="true" after="AND 4=4 "><![CDATA[AND T.M_PRODUCT_ID=? ]]></Parameter>
+        <Parameter name="locator" optional="true" after="AND 4=4 "><![CDATA[AND T.M_LOCATOR_ID = TO_NUMBER(?) ]]></Parameter>
+        <Parameter name="product" optional="true" after="AND 4=4 "><![CDATA[AND T.M_PRODUCT_ID = TO_NUMBER(?) ]]></Parameter>
         <Parameter name="userOrganization" optional="true" type="argument" after="AND 4=4 " text="and T.AD_ORG_ID IN "/>
         <Parameter name="desde"/>
         <Parameter name="hasta"/>
@@ -158,19 +158,19 @@
 		SELECT MAX(CLAVE) AS CLAVE FROM(
 		SELECT I_O_L.M_INOUT_ID AS CLAVE FROM M_TRANSACTION T, M_INOUTLINE I_O_L
 		WHERE T.M_INOUTLINE_ID = I_O_L.M_INOUTLINE_ID
-		AND T.M_TRANSACTION_ID = ?
+		AND T.M_TRANSACTION_ID = TO_NUMBER(?)
 		UNION
 		SELECT I_L.M_INVENTORY_ID AS CLAVE FROM M_TRANSACTION T, M_INVENTORYLINE I_L
 		WHERE I_L.M_INVENTORYLINE_ID= T.M_INVENTORYLINE_ID
-		AND T.M_TRANSACTION_ID = ?
+		AND T.M_TRANSACTION_ID = TO_NUMBER(?)
 		UNION
 		SELECT P_L.M_PRODUCTIONPLAN_ID AS CLAVE FROM M_TRANSACTION T, M_PRODUCTIONLINE P_L
 		WHERE T.M_PRODUCTIONLINE_ID= P_L.M_PRODUCTIONLINE_ID
-		AND T.M_TRANSACTION_ID = ?
+		AND T.M_TRANSACTION_ID = TO_NUMBER(?)
 		UNION
 		SELECT M.M_MOVEMENT_ID AS CLAVE FROM M_TRANSACTION T, M_MOVEMENTLINE M
 		WHERE T.M_MOVEMENTLINE_ID= M.M_MOVEMENTLINE_ID
-		AND T.M_TRANSACTION_ID = ?) A
+		AND T.M_TRANSACTION_ID = TO_NUMBER(?)) A
       ]]>
     </Sql>
     <Parameter name="claveTransaccion"/>
@@ -184,13 +184,13 @@
       <![CDATA[
       SELECT MAX(CLAVE) AS LINEA FROM(
       select T.M_INOUTLINE_ID AS CLAVE from m_transaction t
-      WHERE t.M_TRANSACTION_ID =?
+      WHERE t.M_TRANSACTION_ID = TO_NUMBER(?)
       UNION
       SELECT T.M_INVENTORYLINE_ID AS CLAVE FROM M_TRANSACTION T
-      WHERE t.M_TRANSACTION_ID =?
+      WHERE t.M_TRANSACTION_ID = TO_NUMBER(?)
       UNION
       SELECT T.M_PRODUCTIONLINE_ID AS CLAVE FROM M_TRANSACTION T
-      WHERE t.M_TRANSACTION_ID =?) A
+      WHERE t.M_TRANSACTION_ID = TO_NUMBER(?)) A
       ]]>
     </Sql>
     <Parameter name="claveTransaccion"/>
@@ -202,7 +202,7 @@
     <Sql>
       <![CDATA[
       SELECT T.MOVEMENTTYPE FROM M_TRANSACTION T
-      WHERE T.M_TRANSACTION_ID=?
+      WHERE T.M_TRANSACTION_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="claveTransaccion"/>
@@ -215,7 +215,7 @@
       WHERE PP.M_PRODUCTION_ID = P.M_PRODUCTION_ID
       AND T.M_PRODUCTIONLINE_ID = P_L.M_PRODUCTIONLINE_ID
       AND P_L.M_PRODUCTIONPLAN_ID = PP.M_PRODUCTIONPLAN_ID
-      AND T.M_TRANSACTION_ID = ?
+      AND T.M_TRANSACTION_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="claveTransaccion"/>
--- a/src/org/openbravo/erpCommon/ad_forms/ProductInfo_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/ProductInfo_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -32,7 +32,7 @@
   '' AS COSTSTANDARD, '' AS C_CURRENCY_ID, '' AS PRICELIST, '' AS PRICESTD, '' AS PRICELIMIT, '' AS PRICEPO
   FROM M_PRODUCT_CATEGORY PC, M_PRODUCT P 
   WHERE PC.M_PRODUCT_CATEGORY_ID=P.M_PRODUCT_CATEGORY_ID
-  AND P.M_PRODUCT_ID=?
+  AND P.M_PRODUCT_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="Product"/>
@@ -45,8 +45,8 @@
   P_PurchasePriceVariance_Acct as purchasepricevariance, P_InvoicePriceVariance_Acct as invoicepricevariance, 
   P_TradeDiscountRec_Acct as discountrec, P_TradeDiscountGrant_Acct as discountgrant
   FROM M_Product_Acct
-  WHERE M_Product_ID=? 
-  AND C_AcctSchema_ID=?
+  WHERE M_Product_ID = TO_NUMBER(?) 
+  AND C_AcctSchema_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="Product"/>
@@ -61,7 +61,7 @@
   P_TradeDiscountRec_Acct as discountrec, P_TradeDiscountGrant_Acct as discountgrant
   FROM M_Product_Category pc, M_Product_Category_Acct pca 
   WHERE pc.M_Product_Category_ID=pca.M_Product_Category_ID
-  AND pca.C_AcctSchema_ID=? 
+  AND pca.C_AcctSchema_ID = TO_NUMBER(?) 
   ORDER BY pc.IsDefault DESC, pc.Created
      ]]>
      </Sql>
@@ -82,8 +82,8 @@
       <Sql>
   SELECT CURRENTCOSTPRICE,COSTAVERAGE,PRICELASTPO,COSTSTANDARD
   FROM M_PRODUCT_COSTING 
-  WHERE M_PRODUCT_ID=? 
-  AND C_ACCTSCHEMA_ID=?
+  WHERE M_PRODUCT_ID = TO_NUMBER(?) 
+  AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="M_Product_ID"/>
       <Parameter name="C_AcctSchema_ID"/>
@@ -120,7 +120,7 @@
   FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp 
   WHERE pl.M_PriceList_ID = plv.M_PriceList_ID
   AND plv.M_PriceList_Version_ID = pp.M_PriceList_Version_ID
-  AND pp.M_Product_ID=?
+  AND pp.M_Product_ID = TO_NUMBER(?)
   AND 1=1
   ORDER BY pl.IsSOPriceList ASC, plv.ValidFrom DESC
       </Sql>
@@ -132,8 +132,8 @@
     <Sql>
       <![CDATA[
   UPDATE M_Product_Costing SET CurrentCostPrice = TO_NUMBER(?)
-  WHERE M_Product_ID = ?
-  AND C_AcctSchema_ID = ?
+  WHERE M_Product_ID = TO_NUMBER(?)
+  AND C_AcctSchema_ID = TO_NUMBER(?)
      ]]>
      </Sql>
      <Parameter name="cost"/>
@@ -145,7 +145,7 @@
       <Sql>
   SELECT C_Currency_ID, PriceList,PricePO,PriceLastPO 
   FROM M_Product_PO 
-  WHERE M_Product_ID = ? 
+  WHERE M_Product_ID = TO_NUMBER(?) 
   ORDER BY IsCurrentVendor DESC
       </Sql>
       <Parameter name="M_Product_ID"/>
--- a/src/org/openbravo/erpCommon/ad_forms/RemittanceCancel_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/RemittanceCancel_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -50,7 +50,7 @@
       <Parameter name="adLanguage"/>
       <Parameter name="userClient" optional="true" type="replace" after="AND r.AD_CLIENT_ID IN (" text="'1'"/>
       <Parameter name="userOrg" optional="true" type="replace" after="AND r.AD_ORG_ID IN (" text="'1'"/>
-      <Parameter name="cRemittanceId" optional="true" after="AND 1=1 " text=" and r.C_Remittance_ID = ? "/> 
+      <Parameter name="cRemittanceId" optional="true" after="AND 1=1 " text=" and r.C_Remittance_ID = TO_NUMBER(?) "/> 
       <Parameter name="from" optional="true" after="AND 1=1 "><![CDATA[ and r.duedate >= TO_DATE(?) ]]></Parameter>
       <Parameter name="to" optional="true" after="AND 1=1 "><![CDATA[ and r.duedate <= TO_DATE(?) ]]></Parameter>
   </SqlMethod>
@@ -72,7 +72,7 @@
            '*RT*'||?,?, ?,'C', Ad_Get_DocType(?, ?, 'STT'),  (select c_currency_id
                                        from  c_remittanceLine rl,
                                              c_debt_payment   dp
-                                      where c_RemittanceLine_Id = ?
+                                      where c_RemittanceLine_ID = TO_NUMBER(?)
                                         and dp.c_debt_payment_id = rl.c_debt_payment_id),
            '*RT* Cancel','Y')
       ]]></Sql>
@@ -102,7 +102,7 @@
         ?, ?, Ad_Get_DocType(?, ?, 'DPM'), ?, (select c_currency_id
                                  from  c_remittanceLine rl,
                                        c_debt_payment   dp
-                                where c_RemittanceLine_Id = ?
+                                where c_RemittanceLine_ID = TO_NUMBER(?)
                                   and dp.c_debt_payment_id = rl.c_debt_payment_id))
       ]]></Sql>
     <Parameter name="CDPID"/>
@@ -123,7 +123,7 @@
     <![CDATA[
       SELECT C_REMITTANCE.AD_ORG_ID FROM C_REMITTANCE, C_REMITTANCELINE
       WHERE C_REMITTANCE.C_REMITTANCE_ID =  C_REMITTANCELINE.C_REMITTANCE_ID
-      AND C_REMITTANCELINE_ID = ?
+      AND C_REMITTANCELINE_ID = TO_NUMBER(?)
       ]]></Sql>
     <Parameter name="line"/>
   </SqlMethod>
@@ -132,14 +132,14 @@
     <Sql>
     <![CDATA[
         update c_debt_payment
-           set c_Settlement_Cancel_ID = ?
+           set c_Settlement_Cancel_ID = TO_NUMBER(?)
         where c_debt_payment_id in (select c_debt_payment_cancelled
                                       from c_remittanceLine 
-                                     where c_RemittanceLine_ID = ?
+                                     where c_RemittanceLine_ID = TO_NUMBER(?)
                                      union
                                     select c_debt_payment_id
                                       from c_remittanceLine 
-                                     where c_RemittanceLine_ID = ?)
+                                     where c_RemittanceLine_ID = TO_NUMBER(?))
       ]]></Sql>
     <Parameter name="cSettlementID"/>
     <Parameter name="cRemittanceLine"/>
@@ -159,7 +159,7 @@
             ?, (select dp.status
                         from c_debt_payment dp,
                              c_remittanceLine rl
-                       where c_RemittanceLine_ID = ?
+                       where c_RemittanceLine_ID = TO_NUMBER(?)
                          and dp.c_debt_payment_id = rl.c_debt_payment_id), 
                      (select STATUS_RETURNED
                         from c_remittanceLine rl,
@@ -167,10 +167,10 @@
                              c_remittance_type rt
                        where rl.c_remittance_id = r.c_remittance_id
                          and r.c_remittance_type_id  = rt.c_remittance_type_id
-                         and rl.c_RemittanceLine_ID = ?),
+                         and rl.c_RemittanceLine_ID = TO_NUMBER(?)),
                      (select c_debt_payment_id
                         from c_remittanceLine rl
-                       where c_RemittanceLine_ID = ?), ?)
+                       where c_RemittanceLine_ID = TO_NUMBER(?)), ?)
       ]]></Sql>
     <Parameter name="LID"/>
     <Parameter name="client"/>
@@ -196,7 +196,7 @@
             ?, (select dp.status
                         from c_debt_payment dp,
                              c_remittanceLine rl
-                       where c_RemittanceLine_ID = ?
+                       where c_RemittanceLine_ID = TO_NUMBER(?)
                          and dp.c_debt_payment_id = rl.C_DEBT_PAYMENT_CANCELLED), 
                      (select STATUS_RETURNED
                         from c_remittanceLine rl,
@@ -204,10 +204,10 @@
                              c_remittance_type rt
                        where rl.c_remittance_id = r.c_remittance_id
                          and r.c_remittance_type_id  = rt.c_remittance_type_id
-                         and rl.c_RemittanceLine_ID = ?),
+                         and rl.c_RemittanceLine_ID = TO_NUMBER(?)),
                      (select C_DEBT_PAYMENT_CANCELLED
                         from c_remittanceLine rl
-                       where c_RemittanceLine_ID = ?), ?)
+                       where c_RemittanceLine_ID = TO_NUMBER(?)), ?)
       ]]></Sql>
     <Parameter name="LID"/>
     <Parameter name="client"/>
@@ -226,7 +226,7 @@
       <![CDATA[
           SELECT COALESCE(MAX(LINE),0) AS LINE
             FROM C_REMITTANCELINE 
-           WHERE C_REMITTANCE_ID = ?
+           WHERE C_REMITTANCE_ID = TO_NUMBER(?)
         ]]>
     </Sql>
     <Parameter name="remittaceID"/>
@@ -239,7 +239,7 @@
     <![CDATA[
         update c_RemittanceLine
            set returned = 'Y'
-         where c_RemittanceLine_Id = ?
+         where c_RemittanceLine_ID = TO_NUMBER(?)
       ]]></Sql>
     <Parameter name="cRemittanceLineID"/>
   </SqlMethod>
@@ -267,7 +267,7 @@
       <![CDATA[
 	    SELECT COALESCE(MAX(LINE),0) AS LINE
 		  FROM C_DP_ManagementLine
-		 WHERE C_DP_MANAGEMENT_ID = ?
+		 WHERE C_DP_MANAGEMENT_ID = TO_NUMBER(?)
       ]]>
     </Sql>
     <Parameter name="dpmId"/>
--- a/src/org/openbravo/erpCommon/ad_forms/Role_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/Role_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -29,7 +29,7 @@
       <![CDATA[
         SELECT AD_ORG.NAME AS ORGANIZATION, AD_CLIENT.NAME AS CLIENT, AD_ROLE.NAME AS ROLE, '' as password
         FROM AD_ROLE_ORGACCESS, AD_ORG, AD_CLIENT, AD_ROLE
-        WHERE AD_ROLE_ORGACCESS.AD_ROLE_ID = ?
+        WHERE AD_ROLE_ORGACCESS.AD_ROLE_ID = TO_NUMBER(?)
         AND AD_ROLE_ORGACCESS.AD_ORG_ID = AD_ORG.AD_ORG_ID
         AND AD_ORG.AD_CLIENT_ID = AD_CLIENT.AD_CLIENT_ID
         AND AD_ROLE.AD_ROLE_ID = AD_ROLE_ORGACCESS.AD_ROLE_ID
@@ -40,7 +40,7 @@
    <SqlMethod name="nombreUsuario" type="preparedStatement" return="String" default="">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        SELECT NAME FROM AD_USER WHERE AD_USER_ID=?
+        SELECT NAME FROM AD_USER WHERE AD_USER_ID = TO_NUMBER(?)
       </Sql>
       <Parameter name="adUserId"/>
    </SqlMethod>
@@ -48,7 +48,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
         SELECT COUNT(*) AS ROLE FROM AD_USER 
-        WHERE AD_USER_ID = ? 
+        WHERE AD_USER_ID = TO_NUMBER(?) 
         AND PASSWORD = ?
       </Sql>
       <Parameter name="adUserId"/>
@@ -60,14 +60,14 @@
       <Sql>
         SELECT PASSWORD AS password 
         FROM AD_USER 
-        WHERE   AD_USER_ID = ? 
+        WHERE   AD_USER_ID = TO_NUMBER(?) 
       </Sql>
       <Parameter name="adUserId"/>      
    </SqlMethod>
    <SqlMethod name="update" type="preparedStatement" return="rowCount">
       <SqlMethodComment></SqlMethodComment>
       <Sql>
-        UPDATE AD_USER SET PASSWORD = ?, UPDATED=now(), UPDATEDBY=TO_NUMBER(?) WHERE AD_USER_ID = ? 
+        UPDATE AD_USER SET PASSWORD = ?, UPDATED=now(), UPDATEDBY=TO_NUMBER(?) WHERE AD_USER_ID = TO_NUMBER(?) 
       </Sql>
       <Parameter name="password"/>
       <Parameter name="adUserId"/>
--- a/src/org/openbravo/erpCommon/ad_forms/ShowSession_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/ShowSession_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -48,28 +48,28 @@
   <SqlMethod name="usuario" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
-      SELECT USERNAME FROM AD_USER WHERE AD_USER_ID = ?
+      SELECT USERNAME FROM AD_USER WHERE AD_USER_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="adUserId"/>
   </SqlMethod>
   <SqlMethod name="rol" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
-      SELECT NAME FROM AD_ROLE WHERE AD_ROLE_ID = ?
+      SELECT NAME FROM AD_ROLE WHERE AD_ROLE_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="adRoleId"/>
   </SqlMethod>
   <SqlMethod name="cliente" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
-      SELECT NAME FROM AD_CLIENT WHERE AD_CLIENT_ID = ?
+      SELECT NAME FROM AD_CLIENT WHERE AD_CLIENT_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="adClientId"/>
   </SqlMethod>
   <SqlMethod name="organizacion" type="preparedStatement" return="String" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
-      SELECT NAME FROM AD_ORG WHERE AD_ORG_ID = ?
+      SELECT NAME FROM AD_ORG WHERE AD_ORG_ID = TO_NUMBER(?)
     ]]></Sql>
     <Parameter name="adOrgId"/>
   </SqlMethod>
@@ -92,7 +92,7 @@
       FROM AD_Preference 
       WHERE AD_Client_ID IN ('1') 
       AND AD_Org_ID IN ('2') 
-      AND (AD_User_ID IS NULL OR AD_User_ID=0 OR AD_User_ID=?) 
+      AND (AD_User_ID IS NULL OR AD_User_ID=0 OR AD_User_ID = TO_NUMBER(?)) 
       AND IsActive='Y' 
       AND UPPER(Attribute) = UPPER(?)
       ORDER BY AD_Client_ID, AD_Org_ID, AD_User_ID
@@ -106,7 +106,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
       UPDATE AD_PREFERENCE SET UPDATED=now(), UPDATEDBY=TO_NUMBER(?), VALUE=?
-      WHERE AD_Preference_ID = ?
+      WHERE AD_Preference_ID = TO_NUMBER(?)
     ]]></Sql>
       <Parameter name="adUserId"/>
       <Parameter name="value"/>
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Element_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Element_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
       <![CDATA[
         SELECT AD_WINDOW_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP
         FROM AD_WINDOW
-        WHERE AD_WINDOW_ID = ?
+        WHERE AD_WINDOW_ID = TO_NUMBER(?)
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -44,7 +44,7 @@
         (CASE WHEN AD_WINDOW_TRL.NAME IS NULL THEN '*' || AD_WINDOW.NAME ELSE AD_WINDOW_TRL.NAME END) AS NAME, AD_WINDOW_TRL.HELP
         FROM AD_WINDOW left join AD_WINDOW_TRL on AD_WINDOW.AD_WINDOW_ID = AD_WINDOW_TRL.AD_WINDOW_ID
                                               AND AD_WINDOW_TRL.AD_LANGUAGE = ?
-        WHERE AD_WINDOW.AD_WINDOW_ID = ?
+        WHERE AD_WINDOW.AD_WINDOW_ID = TO_NUMBER(?)
         AND AD_WINDOW.ISACTIVE= 'Y'        
         ]]>
       </Sql>
@@ -57,7 +57,7 @@
       <![CDATA[
         SELECT AD_TAB_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP
         FROM AD_TAB
-        WHERE AD_TAB_ID = ?
+        WHERE AD_TAB_ID = TO_NUMBER(?)
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -71,7 +71,7 @@
         (CASE WHEN AD_TAB_TRL.NAME IS NULL THEN '*' || AD_TAB.NAME ELSE AD_TAB_TRL.NAME END) AS NAME, AD_TAB_TRL.HELP
         FROM AD_TAB left join AD_TAB_TRL on AD_TAB.AD_TAB_ID = AD_TAB_TRL.AD_TAB_ID 
                                         AND AD_TAB_TRL.AD_LANGUAGE =?
-        WHERE AD_TAB.AD_TAB_ID = ?
+        WHERE AD_TAB.AD_TAB_ID = TO_NUMBER(?)
         AND AD_TAB.ISACTIVE = 'Y'
         ]]>
       </Sql>
@@ -84,7 +84,7 @@
       <![CDATA[
         SELECT AD_FIELD_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP
         FROM AD_FIELD
-        WHERE AD_FIELD_ID = ? 
+        WHERE AD_FIELD_ID = TO_NUMBER(?) 
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -98,7 +98,7 @@
         (CASE WHEN AD_FIELD_TRL.NAME IS NULL THEN '*' || AD_FIELD.NAME ELSE AD_FIELD_TRL.NAME END) AS NAME, AD_FIELD_TRL.HELP
         FROM AD_FIELD left join AD_FIELD_TRL on AD_FIELD.AD_FIELD_ID = AD_FIELD_TRL.AD_FIELD_ID 
                                             AND AD_FIELD_TRL.AD_LANGUAGE = ?
-        WHERE AD_FIELD.AD_FIELD_ID = ?
+        WHERE AD_FIELD.AD_FIELD_ID = TO_NUMBER(?)
         AND AD_FIELD.ISACTIVE='Y'
         ]]>
       </Sql>
@@ -111,7 +111,7 @@
       <![CDATA[
         SELECT AD_ELEMENT_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP
         FROM AD_ELEMENT
-        WHERE AD_ELEMENT_ID = ? 
+        WHERE AD_ELEMENT_ID = TO_NUMBER(?) 
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -125,7 +125,7 @@
         (CASE WHEN AD_ELEMENT_TRL.NAME IS NULL THEN '*' || AD_ELEMENT.NAME ELSE AD_ELEMENT_TRL.NAME END) AS NAME, AD_ELEMENT_TRL.HELP
         FROM AD_ELEMENT left join AD_ELEMENT_TRL on AD_ELEMENT.AD_ELEMENT_ID = AD_ELEMENT_TRL.AD_ELEMENT_ID 
                                                 AND AD_ELEMENT_TRL.AD_LANGUAGE = ?
-        WHERE AD_ELEMENT.AD_ELEMENT_ID = ?
+        WHERE AD_ELEMENT.AD_ELEMENT_ID = TO_NUMBER(?)
         AND AD_ELEMENT.ISACTIVE='Y'
         ]]>
       </Sql>
@@ -136,7 +136,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_WINDOW SET NAME=?, HELP=? WHERE AD_WINDOW_ID=?
+        UPDATE AD_WINDOW SET NAME=?, HELP=? WHERE AD_WINDOW_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -147,7 +147,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_WINDOW_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_WINDOW_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_WINDOW_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_WINDOW_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -160,7 +160,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_TAB SET NAME=?, HELP=? WHERE AD_TAB_ID=?
+        UPDATE AD_TAB SET NAME=?, HELP=? WHERE AD_TAB_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -171,7 +171,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_TAB_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_TAB_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_TAB_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_TAB_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -184,7 +184,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_FIELD SET NAME=?, HELP=? WHERE AD_FIELD_ID=?
+        UPDATE AD_FIELD SET NAME=?, HELP=? WHERE AD_FIELD_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -195,7 +195,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_FIELD_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FIELD_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_FIELD_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FIELD_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -209,7 +209,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_ELEMENT SET NAME=?, HELP=? WHERE AD_ELEMENT_ID=?
+        UPDATE AD_ELEMENT SET NAME=?, HELP=? WHERE AD_ELEMENT_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -220,7 +220,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_ELEMENT_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_ELEMENT_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_ELEMENT_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_ELEMENT_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Field_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Field_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
       <![CDATA[
         SELECT AD_WINDOW_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP
         FROM AD_WINDOW
-        WHERE AD_WINDOW_ID = ?
+        WHERE AD_WINDOW_ID = TO_NUMBER(?)
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -44,7 +44,7 @@
         (CASE WHEN AD_WINDOW_TRL.NAME IS NULL THEN '*' || AD_WINDOW.NAME ELSE AD_WINDOW_TRL.NAME END) AS NAME, AD_WINDOW_TRL.HELP
         FROM AD_WINDOW left join AD_WINDOW_TRL on AD_WINDOW.AD_WINDOW_ID = AD_WINDOW_TRL.AD_WINDOW_ID 
                                                AND AD_WINDOW_TRL.AD_LANGUAGE = ?
-        WHERE AD_WINDOW.AD_WINDOW_ID = ?
+        WHERE AD_WINDOW.AD_WINDOW_ID = TO_NUMBER(?)
         AND AD_WINDOW.ISACTIVE= 'Y'        
         ]]>
       </Sql>
@@ -57,7 +57,7 @@
       <![CDATA[
         SELECT AD_TAB_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP
         FROM AD_TAB
-        WHERE AD_TAB_ID = ?
+        WHERE AD_TAB_ID = TO_NUMBER(?)
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -71,7 +71,7 @@
         (CASE WHEN AD_TAB_TRL.NAME IS NULL THEN '*' || AD_TAB.NAME ELSE AD_TAB_TRL.NAME END) AS NAME, AD_TAB_TRL.HELP
         FROM AD_TAB left join AD_TAB_TRL on  AD_TAB.AD_TAB_ID = AD_TAB_TRL.AD_TAB_ID 
                                          AND AD_TAB_TRL.AD_LANGUAGE =?
-        WHERE AD_TAB.AD_TAB_ID = ?
+        WHERE AD_TAB.AD_TAB_ID = TO_NUMBER(?)
         AND AD_TAB.ISACTIVE = 'Y'
         ]]>
       </Sql>
@@ -84,7 +84,7 @@
       <![CDATA[
         SELECT AD_FIELD_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP
         FROM AD_FIELD
-        WHERE AD_FIELD_ID = ? 
+        WHERE AD_FIELD_ID = TO_NUMBER(?) 
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -96,7 +96,7 @@
       <![CDATA[
         SELECT AD_COLUMN.AD_ELEMENT_ID AS ID, AD_FIELD.NAME AS ORIGINALNAME, AD_FIELD.NAME, AD_FIELD.HELP
         FROM AD_COLUMN, AD_FIELD
-        WHERE AD_FIELD.AD_FIELD_ID = ? 
+        WHERE AD_FIELD.AD_FIELD_ID = TO_NUMBER(?) 
         AND AD_FIELD.ISACTIVE='Y'
         AND AD_FIELD.AD_COLUMN_ID = AD_COLUMN.AD_COLUMN_ID
         ]]>
@@ -111,7 +111,7 @@
         (CASE WHEN AD_ELEMENT_TRL.NAME IS NULL THEN '*' || AD_ELEMENT.NAME ELSE AD_ELEMENT_TRL.NAME END) AS NAME, AD_ELEMENT_TRL.HELP
         FROM AD_ELEMENT left join AD_ELEMENT_TRL on AD_ELEMENT.AD_ELEMENT_ID = AD_ELEMENT_TRL.AD_ELEMENT_ID 
                                                 AND AD_ELEMENT_TRL.AD_LANGUAGE = ?
-        WHERE AD_ELEMENT.AD_ELEMENT_ID = ?
+        WHERE AD_ELEMENT.AD_ELEMENT_ID = TO_NUMBER(?)
         AND AD_ELEMENT.ISACTIVE='Y'
         ]]>
       </Sql>
@@ -126,7 +126,7 @@
         (CASE WHEN AD_FIELD_TRL.NAME IS NULL THEN '*' || AD_FIELD.NAME ELSE AD_FIELD_TRL.NAME END) AS NAME, AD_FIELD_TRL.HELP
         FROM AD_FIELD left join AD_FIELD_TRL on AD_FIELD.AD_FIELD_ID = AD_FIELD_TRL.AD_FIELD_ID 
                                             AND AD_FIELD_TRL.AD_LANGUAGE = ?
-        WHERE AD_FIELD.AD_FIELD_ID = ?
+        WHERE AD_FIELD.AD_FIELD_ID = TO_NUMBER(?)
         AND AD_FIELD.ISACTIVE='Y'
         ]]>
       </Sql>
@@ -137,7 +137,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_WINDOW SET NAME=?, HELP=? WHERE AD_WINDOW_ID=?
+        UPDATE AD_WINDOW SET NAME=?, HELP=? WHERE AD_WINDOW_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -148,7 +148,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_WINDOW_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_WINDOW_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_WINDOW_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_WINDOW_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -161,7 +161,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_TAB SET NAME=?, HELP=? WHERE AD_TAB_ID=?
+        UPDATE AD_TAB SET NAME=?, HELP=? WHERE AD_TAB_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -172,7 +172,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_TAB_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_TAB_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_TAB_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_TAB_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -185,7 +185,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_FIELD SET NAME=?, HELP=? WHERE AD_FIELD_ID=?
+        UPDATE AD_FIELD SET NAME=?, HELP=? WHERE AD_FIELD_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -196,7 +196,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_FIELD_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FIELD_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_FIELD_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FIELD_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -30,7 +30,7 @@
       <![CDATA[
         SELECT AD_WINDOW_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP, '' AS iscentrallymaintained
         FROM AD_WINDOW
-        WHERE AD_WINDOW_ID = ?
+        WHERE AD_WINDOW_ID = TO_NUMBER(?)
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -44,7 +44,7 @@
         (CASE WHEN AD_WINDOW_TRL.NAME IS NULL THEN '*' || AD_WINDOW.NAME ELSE AD_WINDOW_TRL.NAME END) AS NAME, AD_WINDOW_TRL.HELP, '' AS iscentrallymaintained
         FROM AD_WINDOW left join AD_WINDOW_TRL on AD_WINDOW.AD_WINDOW_ID = AD_WINDOW_TRL.AD_WINDOW_ID
                                                and AD_WINDOW_TRL.AD_LANGUAGE = ?
-        WHERE AD_WINDOW.AD_WINDOW_ID = ?
+        WHERE AD_WINDOW.AD_WINDOW_ID = TO_NUMBER(?)
         AND AD_WINDOW.ISACTIVE= 'Y'
         ]]>
       </Sql>
@@ -57,7 +57,7 @@
       <![CDATA[
         SELECT AD_TAB_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP, '' AS iscentrallymaintained
         FROM AD_TAB
-        WHERE AD_TAB_ID = ?
+        WHERE AD_TAB_ID = TO_NUMBER(?)
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -71,7 +71,7 @@
         (CASE WHEN AD_TAB_TRL.NAME IS NULL THEN '*' || AD_TAB.NAME ELSE AD_TAB_TRL.NAME END) AS NAME, AD_TAB_TRL.HELP, '' AS iscentrallymaintained
         FROM AD_TAB left join AD_TAB_TRL on AD_TAB.AD_TAB_ID = AD_TAB_TRL.AD_TAB_ID
                                         AND AD_TAB_TRL.AD_LANGUAGE =?
-        WHERE AD_TAB.AD_TAB_ID = ?
+        WHERE AD_TAB.AD_TAB_ID = TO_NUMBER(?)
         AND AD_TAB.ISACTIVE = 'Y'
         ]]>
       </Sql>
@@ -84,7 +84,7 @@
       <![CDATA[
         SELECT AD_FORM_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP, '' AS iscentrallymaintained
         FROM AD_FORM
-        WHERE AD_FORM_ID = ?
+        WHERE AD_FORM_ID = TO_NUMBER(?)
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -98,7 +98,7 @@
         (CASE WHEN AD_FORM_TRL.NAME IS NULL THEN '***' || AD_FORM.NAME ELSE AD_FORM_TRL.NAME END) AS NAME, AD_FORM_TRL.HELP, '' AS iscentrallymaintained
         FROM AD_FORM left join AD_FORM_TRL on AD_FORM.AD_FORM_ID = AD_FORM_TRL.AD_FORM_ID
                                         AND AD_FORM_TRL.AD_LANGUAGE =?
-        WHERE AD_FORM.AD_FORM_ID = ?
+        WHERE AD_FORM.AD_FORM_ID = TO_NUMBER(?)
         AND AD_FORM.ISACTIVE = 'Y'
         ]]>
       </Sql>
@@ -111,7 +111,7 @@
       <![CDATA[
         SELECT AD_PROCESS_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP, '' AS iscentrallymaintained
         FROM AD_PROCESS
-        WHERE AD_PROCESS_ID = ?
+        WHERE AD_PROCESS_ID = TO_NUMBER(?)
         AND ISACTIVE='Y'
         ]]>
       </Sql>
@@ -125,7 +125,7 @@
         (CASE WHEN AD_PROCESS_TRL.NAME IS NULL THEN '***' || AD_PROCESS.NAME ELSE AD_PROCESS_TRL.NAME END) AS NAME, AD_PROCESS_TRL.HELP, '' AS iscentrallymaintained
         FROM AD_PROCESS left join AD_PROCESS_TRL on AD_PROCESS.AD_PROCESS_ID = AD_PROCESS_TRL.AD_PROCESS_ID
                                         AND AD_PROCESS_TRL.AD_LANGUAGE =?
-        WHERE AD_PROCESS.AD_PROCESS_ID = ?
+        WHERE AD_PROCESS.AD_PROCESS_ID = TO_NUMBER(?)
         AND AD_PROCESS.ISACTIVE = 'Y'
         ]]>
       </Sql>
@@ -138,7 +138,7 @@
       <![CDATA[
         SELECT AD_FIELD_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP, iscentrallymaintained AS iscentrallymaintained
         FROM AD_FIELD
-        WHERE AD_FIELD_ID = ? 
+        WHERE AD_FIELD_ID = TO_NUMBER(?) 
         AND ISACTIVE='Y'
         AND ISDISPLAYED = 'Y'
         ]]>
@@ -153,7 +153,7 @@
         (CASE WHEN AD_FIELD_TRL.NAME IS NULL THEN '*' || AD_FIELD.NAME ELSE AD_FIELD_TRL.NAME END) AS NAME, AD_FIELD_TRL.HELP, AD_FIELD.ISCENTRALLYMAINTAINED AS iscentrallymaintained
         FROM AD_FIELD left join AD_FIELD_TRL on AD_FIELD.AD_FIELD_ID = AD_FIELD_TRL.AD_FIELD_ID
                                             AND AD_FIELD_TRL.AD_LANGUAGE = ?
-        WHERE AD_FIELD.AD_FIELD_ID = ?
+        WHERE AD_FIELD.AD_FIELD_ID = TO_NUMBER(?)
         AND AD_FIELD.ISACTIVE='Y'
         AND AD_FIELD.ISDISPLAYED = 'Y'
         ]]>
@@ -167,7 +167,7 @@
       <![CDATA[
         SELECT AD_FIELD_ID AS ID, NAME AS ORIGINALNAME, NAME, HELP, iscentrallymaintained AS iscentrallymaintained
         FROM AD_FIELD
-        WHERE AD_FIELD_ID = ? 
+        WHERE AD_FIELD_ID = TO_NUMBER(?) 
         AND ISACTIVE='Y'
         AND ISDISPLAYED = 'Y'
         ]]>
@@ -180,7 +180,7 @@
       <![CDATA[
         SELECT AD_COLUMN.AD_ELEMENT_ID AS ID, AD_ELEMENT.NAME AS ORIGINALNAME, AD_ELEMENT.NAME, AD_ELEMENT.HELP, '' AS iscentrallymaintained
         FROM AD_COLUMN, AD_FIELD, AD_ELEMENT
-        WHERE AD_FIELD.AD_FIELD_ID = ? 
+        WHERE AD_FIELD.AD_FIELD_ID = TO_NUMBER(?) 
         AND AD_FIELD.ISACTIVE='Y'
         AND AD_FIELD.AD_COLUMN_ID = AD_COLUMN.AD_COLUMN_ID
         AND AD_COLUMN.AD_ELEMENT_ID = AD_ELEMENT.AD_ELEMENT_ID
@@ -198,7 +198,7 @@
         FROM AD_ELEMENT left join AD_ELEMENT_TRL on AD_ELEMENT.AD_ELEMENT_ID = AD_ELEMENT_TRL.AD_ELEMENT_ID
                                                  AND AD_ELEMENT_TRL.AD_LANGUAGE = ? ,     
         AD_COLUMN, AD_FIELD
-        WHERE AD_FIELD.AD_FIELD_ID = ?
+        WHERE AD_FIELD.AD_FIELD_ID = TO_NUMBER(?)
         AND AD_FIELD.AD_COLUMN_ID = AD_COLUMN.AD_COLUMN_ID
         AND AD_COLUMN.AD_ELEMENT_ID = AD_ELEMENT.AD_ELEMENT_ID
         AND AD_ELEMENT.ISACTIVE = 'Y'        
@@ -212,7 +212,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_WINDOW SET NAME=?, HELP=? WHERE AD_WINDOW_ID=?
+        UPDATE AD_WINDOW SET NAME=?, HELP=? WHERE AD_WINDOW_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -223,7 +223,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_WINDOW_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_WINDOW_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_WINDOW_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_WINDOW_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -236,7 +236,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_TAB SET NAME=?, HELP=? WHERE AD_TAB_ID=?
+        UPDATE AD_TAB SET NAME=?, HELP=? WHERE AD_TAB_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -247,7 +247,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_TAB_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_TAB_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_TAB_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_TAB_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -260,7 +260,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_FORM SET NAME=?, HELP=? WHERE AD_FORM_ID=?
+        UPDATE AD_FORM SET NAME=?, HELP=? WHERE AD_FORM_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -271,7 +271,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_FORM_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FORM_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_FORM_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FORM_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -284,7 +284,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_PROCESS SET NAME=?, HELP=? WHERE AD_PROCESS_ID=?
+        UPDATE AD_PROCESS SET NAME=?, HELP=? WHERE AD_PROCESS_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -295,7 +295,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_PROCESS_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_PROCESS_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_PROCESS_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_PROCESS_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -308,7 +308,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_FIELD SET NAME=?, HELP=? , ISCENTRALLYMAINTAINED=? WHERE AD_FIELD_ID=?
+        UPDATE AD_FIELD SET NAME=?, HELP=? , ISCENTRALLYMAINTAINED=? WHERE AD_FIELD_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -320,7 +320,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_FIELD_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FIELD_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_FIELD_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FIELD_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -333,7 +333,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_FIELD SET ISCENTRALLYMAINTAINED=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FIELD_ID=?
+        UPDATE AD_FIELD SET ISCENTRALLYMAINTAINED=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_FIELD_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="centrally"/>
@@ -344,7 +344,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_ELEMENT SET NAME=?, HELP=? WHERE AD_ELEMENT_ID=?
+        UPDATE AD_ELEMENT SET NAME=?, HELP=? WHERE AD_ELEMENT_ID = TO_NUMBER(?)
         ]]>
       </Sql>
         <Parameter name="name"/>
@@ -355,7 +355,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-        UPDATE AD_ELEMENT_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_ELEMENT_ID=? AND AD_LANGUAGE=?
+        UPDATE AD_ELEMENT_TRL SET NAME=?, HELP=?, updated=now(), updatedby=TO_NUMBER(?) WHERE AD_ELEMENT_ID = TO_NUMBER(?) AND AD_LANGUAGE=?
         ]]>
       </Sql>
         <Parameter name="name"/>
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_data.xsql	Tue Feb 12 17:01:08 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_data.xsql	Tue Feb 12 18:53:44 2008 +0000
@@ -37,7 +37,7 @@
           AND AD_TAB.isactive='Y'
           AND AD_FIELD.isactive = 'Y'
           AND AD_FIELD.ISDISPLAYED = 'Y'