details: https://code.openbravo.com/erp/devel/pi/rev/83da9d4045b6 changeset: 16830:83da9d4045b6 user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com> date: Wed Jun 13 13:18:02 2012 +0200 summary: Fixes bug 20746: When coping GL Journal templates you can mix info for different organizations
details: https://code.openbravo.com/erp/devel/pi/rev/527d8e5a6a96 changeset: 16831:527d8e5a6a96 user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com> date: Wed Jun 13 13:18:54 2012 +0200 summary: fixes db-cons postgres. When exporting in postgres it does different diffstat: src-db/database/model/views/FIN_PAYMENT_DETAIL_V.xml | 24 +++------ src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal.java | 2 +- src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal_data.xsql | 4 +- 3 files changed, 13 insertions(+), 17 deletions(-) diffs (65 lines): diff -r 149c7a86161e -r 527d8e5a6a96 src-db/database/model/views/FIN_PAYMENT_DETAIL_V.xml --- a/src-db/database/model/views/FIN_PAYMENT_DETAIL_V.xml Wed Jun 13 12:47:51 2012 +0200 +++ b/src-db/database/model/views/FIN_PAYMENT_DETAIL_V.xml Wed Jun 13 13:18:54 2012 +0200 @@ -1,19 +1,13 @@ <?xml version="1.0"?> <database name="VIEW FIN_PAYMENT_DETAIL_V"> - <view name="FIN_PAYMENT_DETAIL_V"><![CDATA[SELECT psd.fin_payment_scheduledetail_id AS fin_payment_detail_v_id, psd.ad_client_id, psd.ad_org_id, psd.isactive, psd.created, psd.createdby, - psd.updated, psd.updatedby, psi.fin_payment_schedule_id AS fin_payment_sched_inv_v_id, pso.fin_payment_schedule_id AS fin_payment_sched_ord_v_id, i.documentno AS invoiceno, o.documentno AS orderno, - p.documentno AS paymentno, pd.fin_payment_id, coalesce(psi.duedate,pso.duedate) AS duedate, coalesce(i.grandtotal,o.grandtotal) AS invoicedamt, coalesce(psi.amount,pso.amount) AS expected, psd.amount AS paidamt, - p.c_bpartner_id, p.fin_paymentmethod_id, p.fin_financial_account_id, p.c_currency_id, p.paymentdate, gli.name AS glitemname, - pd.writeoffamt, fa.c_currency_id AS finacc_currency_id, p.finacc_txn_convert_rate, psd.amount *p.finacc_txn_convert_rate AS paidconverted, coalesce(psi.amount,pso.amount)*p.finacc_txn_convert_rate AS expectedconverted, psd.iscanceled, - psd.c_bpartner_id AS c_bpartner_id_dim, psd.c_activity_id, psd.m_product_id, psd.c_campaign_id, psd.c_project_id, - psd.c_salesregion_id, p.status -FROM fin_payment p - LEFT JOIN fin_financial_account fa ON p.fin_financial_account_id = fa.fin_financial_account_id,fin_payment_detail pd - JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id - LEFT JOIN fin_payment_schedule psi ON psd.fin_payment_schedule_invoice = psi.fin_payment_schedule_id - LEFT JOIN c_invoice i ON psi.c_invoice_id = i.c_invoice_id - LEFT JOIN fin_payment_schedule pso ON psd.fin_payment_schedule_order = pso.fin_payment_schedule_id - LEFT JOIN c_order o ON pso.c_order_id = o.c_order_id - LEFT JOIN c_glitem gli ON pd.c_glitem_id = gli.c_glitem_id + <view name="FIN_PAYMENT_DETAIL_V"><![CDATA[SELECT psd.fin_payment_scheduledetail_id AS fin_payment_detail_v_id, psd.ad_client_id, psd.ad_org_id, psd.isactive, psd.created, psd.createdby, psd.updated, psd.updatedby, psi.fin_payment_schedule_id AS fin_payment_sched_inv_v_id, pso.fin_payment_schedule_id AS fin_payment_sched_ord_v_id, i.documentno AS invoiceno, o.documentno AS orderno, p.documentno AS paymentno, pd.fin_payment_id, COALESCE(psi.duedate, pso.duedate) AS duedate, COALESCE(i.grandtotal, o.grandtotal) AS invoicedamt, COALESCE(psi.amount, pso.amount) AS expected, psd.amount AS paidamt, p.c_bpartner_id, p.fin_paymentmethod_id, p.fin_financial_account_id, p.c_currency_id, p.paymentdate, gli.name AS glitemname, pd.writeoffamt, fa.c_currency_id AS finacc_currency_id, p.finacc_txn_convert_rate, psd.amount * p.finacc_txn_convert_rate AS paidconverted, COALESCE(psi.amount, pso.amount) * p.finacc_txn_convert_rate AS expectedconverted, psd.iscanceled, psd.c_bpartner_id AS c_bpartner_id_dim, psd.c_activity_id, psd.m_product_id, psd.c_campaign_id, psd.c_project_id, psd.c_salesregion_id, p.status +FROM fin_payment p +LEFT JOIN fin_financial_account fa ON p.fin_financial_account_id = fa.fin_financial_account_id, fin_payment_detail pd +JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id +LEFT JOIN fin_payment_schedule psi ON psd.fin_payment_schedule_invoice = psi.fin_payment_schedule_id +LEFT JOIN c_invoice i ON psi.c_invoice_id = i.c_invoice_id +LEFT JOIN fin_payment_schedule pso ON psd.fin_payment_schedule_order = pso.fin_payment_schedule_id +LEFT JOIN c_order o ON pso.c_order_id = o.c_order_id +LEFT JOIN c_glitem gli ON pd.c_glitem_id = gli.c_glitem_id WHERE p.fin_payment_id = pd.fin_payment_id]]></view> </database> diff -r 149c7a86161e -r 527d8e5a6a96 src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal.java --- a/src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal.java Wed Jun 13 12:47:51 2012 +0200 +++ b/src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal.java Wed Jun 13 13:18:54 2012 +0200 @@ -162,7 +162,7 @@ "org/openbravo/erpCommon/ad_process/CopyFromGLJournal").createXmlDocument(); CopyFromGLJournalData[] data = CopyFromGLJournalData.selectFrom(this, strDescription, strDocumentNo, vars.getClient(), - Utility.getContext(this, vars, "#User_Org", "CopyFromGLJournal")); + Utility.getContext(this, vars, "#User_Org", "CopyFromGLJournal"), strKey); xmlDocument.setData("structure1", data); xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";"); xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n"); diff -r 149c7a86161e -r 527d8e5a6a96 src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal_data.xsql --- a/src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal_data.xsql Wed Jun 13 12:47:51 2012 +0200 +++ b/src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal_data.xsql Wed Jun 13 13:18:54 2012 +0200 @@ -78,6 +78,7 @@ AND 1=1 AND G.AD_CLIENT_ID IN('1') AND G.AD_ORG_ID IN('1') + and ad_isorgincluded(g.ad_org_id,(select ad_org_id from GL_JOURNALBATCH where GL_JOURNALBATCH_id = ?) , g.ad_client_id) <> -1 AND EXISTS (SELECT 1 FROM GL_JOURNAL WHERE GL_JOURNALBATCH_ID = G.GL_JOURNALBATCH_ID) ORDER BY 2 ]]> @@ -86,7 +87,8 @@ <Parameter name="description" optional="true" after="AND 1=1"><![CDATA[ AND UPPER(COALESCE(TO_CHAR(G.DESCRIPTION),' ')) LIKE UPPER(?) ]]></Parameter> <Parameter name="documentNo" ignoreValue="%" optional="true" after="AND 1=1"><![CDATA[ AND UPPER(G.DOCUMENTNO) LIKE UPPER(?) ]]></Parameter> <Parameter name="adUserClient" type="replace" optional="true" after="G.AD_CLIENT_ID IN('" text="1"/> - <Parameter name="adOrgClient" type="replace" optional="true" after="G.AD_ORG_ID IN(" text="'1'"/> + <Parameter name="adUserOrg" type="replace" optional="true" after="G.AD_ORG_ID IN(" text="'1'"/> + <Parameter name="key"/> </SqlMethod> <SqlMethod name="insertGLJournal" type="preparedStatement" connection="true" return="rowCount"> <SqlMethodComment></SqlMethodComment> ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
