details: https://code.openbravo.com/erp/devel/main/rev/9cd004664cde changeset: 18212:9cd004664cde user: Eduardo Argal <eduardo.argal <at> openbravo.com> date: Mon Oct 15 16:58:30 2012 +0200 summary: Related to issue 21931
details: https://code.openbravo.com/erp/devel/main/rev/3544a599e172 changeset: 18213:3544a599e172 user: RM packaging bot <staff.rm <at> openbravo.com> date: Mon Oct 15 21:29:59 2012 +0200 summary: CI: merge back from main details: https://code.openbravo.com/erp/devel/main/rev/c97cb07f8600 changeset: 18214:c97cb07f8600 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Sep 12 11:57:41 2012 +0200 summary: [build time] Skip unneeded 2.50 code generation details: https://code.openbravo.com/erp/devel/main/rev/e0a40d78df47 changeset: 18215:e0a40d78df47 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Sep 12 13:21:22 2012 +0200 summary: [build time] Smartbuild detects changes in 2.50 preference details: https://code.openbravo.com/erp/devel/main/rev/9585dd700f49 changeset: 18216:9585dd700f49 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Sep 12 16:01:45 2012 +0200 summary: [build time] Ask to rebuild in case of setting 2.50 preference through callout details: https://code.openbravo.com/erp/devel/main/rev/a90ccc95e2e0 changeset: 18217:a90ccc95e2e0 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Sep 12 18:11:11 2012 +0200 summary: [build time] Allow to generate all 2.50 windows details: https://code.openbravo.com/erp/devel/main/rev/6e8fd5e25c2b changeset: 18218:6e8fd5e25c2b user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Sep 12 18:12:42 2012 +0200 summary: [build time] Removed incorrect entries in model object and mapping tables These entries were for generated windows which is not needed and caused a test to fail. related to issue 17491, related to issue 18343 details: https://code.openbravo.com/erp/devel/main/rev/d29ca1c8f6da changeset: 18219:d29ca1c8f6da user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Mon Oct 15 08:28:05 2012 +0200 summary: [build time] 2.250 property is not read directly from file, but passed as param details: https://code.openbravo.com/erp/devel/main/rev/805f83eefd43 changeset: 18220:805f83eefd43 user: Ioritz Cia <ioritz.cia <at> openbravo.com> date: Wed Oct 10 18:55:28 2012 +0200 summary: Fixes issue 21884: wrong calculation of ending date for m_costing register under some cirumstancies. details: https://code.openbravo.com/erp/devel/main/rev/482e5d730583 changeset: 18221:482e5d730583 user: Ioritz Cia <ioritz.cia <at> openbravo.com> date: Thu Oct 11 10:02:06 2012 +0200 summary: Fixes issue 21901: Error in Asset Amortization calculation. details: https://code.openbravo.com/erp/devel/main/rev/80f9c2b66fac changeset: 18222:80f9c2b66fac user: Ioritz Cia <ioritz.cia <at> openbravo.com> date: Thu Oct 11 13:36:10 2012 +0200 summary: Fixes issue 21907: When we modify the name of an element of the Account tree, it changes the name of some the account combinations description. details: https://code.openbravo.com/erp/devel/main/rev/4b56827a346b changeset: 18223:4b56827a346b user: Ioritz Cia <ioritz.cia <at> openbravo.com> date: Mon Oct 15 09:41:26 2012 +0200 summary: Fixes issue 21885: Wrong action taken when payment is added to invoice. details: https://code.openbravo.com/erp/devel/main/rev/0381663eaf40 changeset: 18224:0381663eaf40 user: RM packaging bot <staff.rm <at> openbravo.com> date: Tue Oct 16 18:33:18 2012 +0200 summary: CI: update AD_MODULE to version 18223 diffstat: config/Openbravo.properties.template | 5 + modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 4 +- modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.html | 32 + modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java | 109 +++ modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java | 25 +- modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml | 2 +- modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 8 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ElementValueEventHandler.java | 39 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java | 5 +- modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 6 +- modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 4 +- modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 10 +- modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 4 +- modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 12 +- modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 6 +- modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 6 +- modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 24 +- modules/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 18 +- src-db/database/model/functions/A_ASSET_POST.xml | 2 +- src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml | 16 +- src-db/database/model/triggers/C_ELEMENTVALUE_TRG.xml | 6 +- src-db/database/sourcedata/AD_MODEL_OBJECT.xml | 72 -- src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml | 110 --- src-db/database/sourcedata/AD_MODULE.xml | 4 +- src-wad/src/org/openbravo/wad/Tabs_data.xsql | 44 +- src-wad/src/org/openbravo/wad/Wad.java | 343 +++++++-- src-wad/src/org/openbravo/wad/Wad_data.xsql | 13 +- src/build.xml | 4 +- 57 files changed, 607 insertions(+), 384 deletions(-) diffs (truncated from 2143 to 300 lines): diff -r cd08ae6ebfe6 -r 0381663eaf40 config/Openbravo.properties.template --- a/config/Openbravo.properties.template Mon Oct 15 10:37:41 2012 +0200 +++ b/config/Openbravo.properties.template Tue Oct 16 18:33:18 2012 +0200 @@ -199,3 +199,8 @@ # Setting this to true will enable extra (hidden) functionality used # automated test scripts. test.environment=false + +# allows to compile classic 2.50 windows for all available tab +# By default those all not generated anymore for tabs for which they are not needed +#wad.generateAllClassic250Windows=true + diff -r cd08ae6ebfe6 -r 0381663eaf40 modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml --- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml Mon Oct 15 10:37:41 2012 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml Tue Oct 16 18:33:18 2012 +0200 @@ -6,7 +6,7 @@ <!--A918E3331C404B889D69AA9BFAFB23AC--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--A918E3331C404B889D69AA9BFAFB23AC--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--A918E3331C404B889D69AA9BFAFB23AC--> <NAME><![CDATA[Advanced Payables and Receivables Mngmt]]></NAME> -<!--A918E3331C404B889D69AA9BFAFB23AC--> <VERSION><![CDATA[3.0.18206]]></VERSION> +<!--A918E3331C404B889D69AA9BFAFB23AC--> <VERSION><![CDATA[3.0.18223]]></VERSION> <!--A918E3331C404B889D69AA9BFAFB23AC--> <DESCRIPTION><![CDATA[Managing your finances with an ERP does not have to be difficult. Enjoy a radically improved user experience that combines the power of an enterprise grade financial application with the simplicity and ease of a web 2.0 personal accounting service.]]></DESCRIPTION> <!--A918E3331C404B889D69AA9BFAFB23AC--> <HELP><![CDATA[Advanced Payables and Receivables Management simplifies and automates the business processes around the management of financial accounts, from the receipt and issue of payment, to the reconciliation of those events with bank statements. If you would like to help shape this module you are welcome to take part in the forum discussions or register feature requests or issues in the corresponding (Forum and Bug Tracking) sections in the Advanced Payables and Receivable project in the OB Forge.]]></HELP> diff -r cd08ae6ebfe6 -r 0381663eaf40 modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml --- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Mon Oct 15 10:37:41 2012 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Tue Oct 16 18:33:18 2012 +0200 @@ -7,7 +7,7 @@ <!--89326AE95DAD449D85DFAB2C5B1C6683--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <AD_DEPENDENT_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_DEPENDENT_MODULE_ID> -<!--89326AE95DAD449D85DFAB2C5B1C6683--> <STARTVERSION><![CDATA[2.1.18206]]></STARTVERSION> +<!--89326AE95DAD449D85DFAB2C5B1C6683--> <STARTVERSION><![CDATA[2.1.18223]]></STARTVERSION> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <DEPENDANT_MODULE_NAME><![CDATA[User Interface Selector]]></DEPENDANT_MODULE_NAME> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> @@ -21,7 +21,7 @@ <!--B97FC854C6DD41E692161585645A900F--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--B97FC854C6DD41E692161585645A900F--> <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID> <!--B97FC854C6DD41E692161585645A900F--> <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID> -<!--B97FC854C6DD41E692161585645A900F--> <STARTVERSION><![CDATA[3.0.18206]]></STARTVERSION> +<!--B97FC854C6DD41E692161585645A900F--> <STARTVERSION><![CDATA[3.0.18223]]></STARTVERSION> <!--B97FC854C6DD41E692161585645A900F--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--B97FC854C6DD41E692161585645A900F--> <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME> <!--B97FC854C6DD41E692161585645A900F--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> diff -r cd08ae6ebfe6 -r 0381663eaf40 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.html --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.html Mon Oct 15 10:37:41 2012 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.html Tue Oct 16 18:33:18 2012 +0200 @@ -137,6 +137,7 @@ submitThisPage('SAVEANDPROCESS'); return true; } + calculateProperProcessOptions(); document.getElementById('client_top_popup').style.display = 'block'; document.getElementById('client_top').style.display = 'none'; document.getElementById('client_middle').style.display = 'none'; @@ -405,6 +406,16 @@ } } +function calculateProperProcessOptions() { + try { + var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/AddPaymentFromInvoice.html"; + var paramXMLReq = null; + return submitXmlHttpRequest(callBackProperOption, document.frmMain, "PROPERPROCESSOPTIONS", url, false, null, paramXMLReq); + } catch (e) { + alert(e); + } +} + function callBackFinancialAccount(paramXMLParticular, XMLHttpRequestObj) { if (getReadyStateHandler(XMLHttpRequestObj)) { try { @@ -451,6 +462,27 @@ return true; } +function callBackProperOption(paramXMLParticular, XMLHttpRequestObj) { + var strText = ""; + if (getReadyStateHandler(XMLHttpRequestObj)) { + try { + if (XMLHttpRequestObj.responseText) { + strText = XMLHttpRequestObj.responseText; + debugger; + createCombo(document.getElementById('paramActionDocument'), strText); + document.getElementById('client_top_popup').style.display = 'block'; + document.getElementById('client_top').style.display = 'none'; + document.getElementById('client_middle').style.display = 'none'; + document.getElementById('client_bottom').style.display = 'none'; + } else { + document.getElementById('paramActionDocument').innerHTML = ''; + } + } catch (e) { + } + } + return true; +} + </script> <script language="JavaScript" type="text/javascript"> function onLoadDo(){ diff -r cd08ae6ebfe6 -r 0381663eaf40 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java Mon Oct 15 10:37:41 2012 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java Tue Oct 16 18:33:18 2012 +0200 @@ -33,6 +33,7 @@ import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; +import org.hibernate.Query; import org.hibernate.criterion.Restrictions; import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao; import org.openbravo.advpaymentmngt.process.FIN_AddPayment; @@ -264,6 +265,13 @@ vars.setMessage(strTabId, message); printPageClosePopUp(response, vars, strWindowPath); + } else if (vars.commandIn("PROPERPROCESSOPTIONS")) { + String strPaymentMethodId = vars.getRequiredStringParameter("inpPaymentMethod"); + String strFinancialAccountId = vars.getRequiredStringParameter("inpFinancialAccount"); + String strOrgId = vars.getRequiredStringParameter("inpadOrgId"); + boolean isReceipt = vars.getRequiredStringParameter("isReceipt").equals("Y"); + refreshProcessOptions(response, strPaymentMethodId, strFinancialAccountId, strOrgId, + isReceipt); } } @@ -587,6 +595,107 @@ out.close(); } + private void refreshProcessOptions(HttpServletResponse response, String strPaymentMethod, + String strFinancialAccountId, String strOrgId, boolean isReceipt) throws IOException, + ServletException { + log4j.debug("Callout: Financial Account has changed to" + strFinancialAccountId); + + FIN_PaymentMethod paymentMethod = OBDal.getInstance().get(FIN_PaymentMethod.class, + strPaymentMethod); + FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class, + strFinancialAccountId); + FinAccPaymentMethod finAccPaymentMethod = null; + + for (FinAccPaymentMethod finAccPaymentMethodItem : financialAccount + .getFinancialMgmtFinAccPaymentMethodList()) { + if (finAccPaymentMethodItem.getPaymentMethod().getId() + .equalsIgnoreCase(paymentMethod.getId())) { + finAccPaymentMethod = finAccPaymentMethodItem; + } + } + String processOprtionsComboHtml = null; + if (isReceipt) { + if (finAccPaymentMethod.isAutomaticDeposit()) { + // 1 option: Process. + processOprtionsComboHtml = FIN_Utility.getOptionsList( + processActionWithDepositWithdrawn("F903F726B41A49D3860243101CEEBA25", true), null, + true, true); + + } else { + // 2 options: Process or Process and Deposit. + try { + OBContext.setAdminMode(true); + org.openbravo.model.ad.domain.Reference reference = OBDal.getInstance().get( + org.openbravo.model.ad.domain.Reference.class, "F903F726B41A49D3860243101CEEBA25"); + processOprtionsComboHtml = FIN_Utility.getOptionsList(reference.getADListList(), null, + true, true); + } catch (Exception e) { + + } finally { + OBContext.restorePreviousMode(); + } + } + } else { + if (finAccPaymentMethod.isAutomaticWithdrawn()) { + // 1 option: Process. + processOprtionsComboHtml = FIN_Utility.getOptionsList( + processActionWithDepositWithdrawn("F15C13A199A748F1B0B00E985A64C036", false), null, + true, true); + + } else { + // 2 Options: Process or Process and Withdrawn + try { + OBContext.setAdminMode(true); + org.openbravo.model.ad.domain.Reference reference = OBDal.getInstance().get( + org.openbravo.model.ad.domain.Reference.class, "F15C13A199A748F1B0B00E985A64C036"); + processOprtionsComboHtml = FIN_Utility.getOptionsList(reference.getADListList(), null, + true, true); + } catch (Exception e) { + + } finally { + OBContext.restorePreviousMode(); + } + } + } + + response.setContentType("text/html; charset=UTF-8"); + PrintWriter out = response.getWriter(); + out.println(processOprtionsComboHtml.replaceAll("\"", "\\'")); + + out.close(); + } + + /** + * Returns the list of the reference list for payment process + * + * @param refId + * . Indicates the Id of the reference. + * @param deposit + * . Indicates whether the method is being executed for deposit of withdrawn. + * @return. Returns the list of process actions. + */ + private List processActionWithDepositWithdrawn(String refId, boolean deposit) { + try { + OBContext.setAdminMode(true); + StringBuilder hql = new StringBuilder(); + hql.append("select l "); + hql.append("from ADReference r "); + hql.append(" left join r.aDListList l "); + hql.append("where r.id = '").append(refId).append("' "); + hql.append(" and lower(l.name) like '%").append((deposit == true) ? "deposit" : "withdrawn") + .append("%'"); + + final Query query = OBDal.getInstance().getSession().createQuery(hql.toString()); + + return query.list(); + } catch (Exception e) { + return null; + } finally { + OBContext.restorePreviousMode(); + } + + } + private BigDecimal findExchangeRate(VariablesSecureApp vars, Currency paymentCurrency, Currency financialAccountCurrency, Date paymentDate, Organization organization, int conversionRatePrecision) { diff -r cd08ae6ebfe6 -r 0381663eaf40 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Mon Oct 15 10:37:41 2012 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Tue Oct 16 18:33:18 2012 +0200 @@ -505,12 +505,35 @@ */ public static <T extends BaseOBObject> String getOptionsList(List<T> obObjectList, String selectedValue, boolean isMandatory) { + return getOptionsList(obObjectList, selectedValue, isMandatory, false); + } + + /** + * Returns a String containing the html code with the options based on the given List of + * BaseOBObjects + * + * @param <T> + * Class that extends BaseOBObject. + * @param obObjectList + * List containing the values to be included in the options. + * @param selectedValue + * value to set as selected by default. + * @param isMandatory + * boolean to add a blank option in the options list. + * @param isRefList + * boolean to let know if the options belong to a refList. In that case, the value must + * be the search key of the list item instead of it's id. + * @return a String containing the html code with the options. * + */ + public static <T extends BaseOBObject> String getOptionsList(List<T> obObjectList, + String selectedValue, boolean isMandatory, boolean isRefList) { StringBuilder strOptions = new StringBuilder(); if (!isMandatory) strOptions.append("<option value=\"\"></option>"); for (T obObject : obObjectList) { - strOptions.append("<option value=\"").append(obObject.getId()).append("\""); + strOptions.append("<option value=\"") + .append((isRefList) ? obObject.getValue("searchKey") : obObject.getId()).append("\""); if (obObject.getId().equals(selectedValue)) strOptions.append(" selected=\"selected\""); strOptions.append(">"); diff -r cd08ae6ebfe6 -r 0381663eaf40 modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml --- a/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml Mon Oct 15 10:37:41 2012 +0200 +++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml Tue Oct 16 18:33:18 2012 +0200 @@ -6,7 +6,7 @@ <!--C70732EA90A14EC0916078B85CC33D2D--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--C70732EA90A14EC0916078B85CC33D2D--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--C70732EA90A14EC0916078B85CC33D2D--> <NAME><![CDATA[JBoss Weld]]></NAME> -<!--C70732EA90A14EC0916078B85CC33D2D--> <VERSION><![CDATA[1.1.18206]]></VERSION> +<!--C70732EA90A14EC0916078B85CC33D2D--> <VERSION><![CDATA[1.1.18223]]></VERSION> <!--C70732EA90A14EC0916078B85CC33D2D--> <DESCRIPTION><![CDATA[JBoss Weld]]></DESCRIPTION> <!--C70732EA90A14EC0916078B85CC33D2D--> <HELP><![CDATA[Provides the JBoss Weld framework: Java Contexts and Dependency Injection for the Java EE platform (CDI). For more information see http://seamframework.org/Weld]]></HELP> <!--C70732EA90A14EC0916078B85CC33D2D--> <URL><![CDATA[http://forge.openbravo.com/projects/weld]]></URL> diff -r cd08ae6ebfe6 -r 0381663eaf40 modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml --- a/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Mon Oct 15 10:37:41 2012 +0200 +++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Tue Oct 16 18:33:18 2012 +0200 @@ -7,7 +7,7 @@ <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <AD_MODULE_ID><![CDATA[C70732EA90A14EC0916078B85CC33D2D]]></AD_MODULE_ID> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID> -<!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <STARTVERSION><![CDATA[3.0.18206]]></STARTVERSION> +<!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <STARTVERSION><![CDATA[3.0.18223]]></STARTVERSION> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <DEPENDANT_MODULE_NAME><![CDATA[Core]]></DEPENDANT_MODULE_NAME> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> diff -r cd08ae6ebfe6 -r 0381663eaf40 modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml --- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml Mon Oct 15 10:37:41 2012 +0200 ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
