details: https://code.openbravo.com/erp/devel/main/rev/afec99f5af43 changeset: 26119:afec99f5af43 user: Naroa Iriarte <naroa.iriarte <at> openbravo.com> date: Thu Feb 26 13:45:06 2015 +0100 summary: Fixed issue 28842: There are problems to handle attachments.
There were two problems: First: When storing an attachment in the database (c_file table), the current organization of the user was used instead of the organization of the document where the file is being attached to. The aim of this fix is to take the value of the organization of the attached document instead of the current user organization. Second: When an attachment was created with an organization and after that, the organization of the document was changed, it was not possible to download it, update it nor delete it with a user who does not have access to the organization used to create the attachment. To fix the first part, a new field that stores the document organization has been added to the canvas of the OBAttachmentsSectionItem class in the fillAttachments function. After that the field is sent as a param in the request, and can be used in the TabAttachments.java class to be included to create the new record in c_file. To fix the second part, the way the attachments are retrieved in the TabAttachments and in the AttachmentsAH classes has been modified. Now the automated organization filter is disabled, so the organization of the attachment is not taken into accout. It is needed that the user has at least readable access to the document's organization for downloading, deleting or editing its attachments a new method has been added to the SecurityChecker class for checking this. details: https://code.openbravo.com/erp/devel/main/rev/cc464383f9e1 changeset: 26120:cc464383f9e1 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Wed Mar 04 15:01:42 2015 +0100 summary: Related with issue 28842: Improves javadoc of checkReadableAccess method details: https://code.openbravo.com/erp/devel/main/rev/b8ecd42c2db7 changeset: 26121:b8ecd42c2db7 user: RM packaging bot <staff.rm <at> openbravo.com> date: Wed Mar 04 14:50:57 2015 +0000 summary: CI: merge back from main details: https://code.openbravo.com/erp/devel/main/rev/bce56d638278 changeset: 26122:bce56d638278 user: Jon AlegrÃa <jon.alegria <at> openbravo.com> date: Wed Mar 04 18:06:07 2015 +0100 summary: Fixes issue 0029132: Internal cosumption line can not be saved, because unit is not filled when attribute set in product setup is empty details: https://code.openbravo.com/erp/devel/main/rev/f06d7018a52b changeset: 26123:f06d7018a52b user: Unai Martirena <unai.martirena <at> openbravo.com> date: Tue Mar 03 13:57:53 2015 +0100 summary: Fixes bug 29111: Valued Stock report filter properly by Product Category A new language parameter was added in the issue that has caused the regression, but in wrong order, causing not to be able to filter by Product Category. Also a left join was being done instead of inner join, so the query was displaying an wrong extra line with a sum up of all not necessary m_transaction records. details: https://code.openbravo.com/erp/devel/main/rev/268b0e438f83 changeset: 26124:268b0e438f83 user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Wed Mar 04 18:22:34 2015 +0100 summary: Fixed bug 28729 select the proper credit when a reverse payment is made When reverse payment process is run for a credit payment the credit generated in that specific payment should be consumed details: https://code.openbravo.com/erp/devel/main/rev/86a6b64eb747 changeset: 26125:86a6b64eb747 user: David Baz Fayos <david.baz <at> openbravo.com> date: Wed Mar 04 18:51:22 2015 +0100 summary: Fixed issue 29133: Avoid JS error in 'Add Details' process while moving between fields in new record in 'G/L Items' grid details: https://code.openbravo.com/erp/devel/main/rev/e9d73be9949d changeset: 26126:e9d73be9949d user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Thu Mar 05 10:15:41 2015 +0100 summary: Fixes issue 29113: Use setScale instead of round, and handle properly NaN The BigDecimal.round function did not work as we expected [1]: new BigDecimal('0.145').round(2, BigDecimal.prototype.ROUND_HALF_UP).toString() -> 0.15 (OK) new BigDecimal('1.145').round(2, BigDecimal.prototype.ROUND_HALF_UP).toString() -> 1.1 (WRONG) new BigDecimal('10.145').round(2, BigDecimal.prototype.ROUND_HALF_UP).toString() -> 10 (WRONG) To round the number to a specific amout of decimal digits, the setScale function should be used. new BigDecimal('0.145').setScale(2, BigDecimal.prototype.ROUND_HALF_UP).toString() -> 0.15 (OK) new BigDecimal('1.145').setScale(2, BigDecimal.prototype.ROUND_HALF_UP).toString() -> 1.15 (OK) new BigDecimal('10.145').setScale(2, BigDecimal.prototype.ROUND_HALF_UP).toString() -> 10.15 (OK) Also, when the number provided in the first argument of the OB.Utilities.Number.roundJSNumber is not a number, the function returns NaN, as it used to do it before. [1] http://stackoverflow.com/a/13461270 details: https://code.openbravo.com/erp/devel/main/rev/2369c54c9f14 changeset: 26127:2369c54c9f14 user: RM packaging bot <staff.rm <at> openbravo.com> date: Thu Mar 05 15:36:59 2015 +0000 summary: CI: update AD_MODULE to version 26126 diffstat: 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/process/FIN_PaymentProcess.java | 16 ++- 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_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/window/AttachmentsAH.java | 24 +++- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js | 25 +++- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js | 2 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js | 4 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js | 2 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-number.js | 8 +- 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.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- 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 | 20 +- src-db/database/sourcedata/AD_MODULE.xml | 4 +- src/org/openbravo/dal/security/SecurityChecker.java | 29 ++++- src/org/openbravo/erpCommon/ad_callouts/SL_Internal_Consumption_Product.java | 6 +- src/org/openbravo/erpCommon/ad_reports/ReportValuationStock_data.xsql | 4 +- src/org/openbravo/erpCommon/businessUtility/TabAttachments.java | 65 ++++++++- 54 files changed, 246 insertions(+), 109 deletions(-) diffs (truncated from 1433 to 300 lines): diff -r b5096788cd44 -r 2369c54c9f14 modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml --- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml Thu Mar 05 15:36:59 2015 +0000 @@ -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.26114]]></VERSION> +<!--A918E3331C404B889D69AA9BFAFB23AC--> <VERSION><![CDATA[3.0.26126]]></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 b5096788cd44 -r 2369c54c9f14 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 Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Thu Mar 05 15:36:59 2015 +0000 @@ -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.26114]]></STARTVERSION> +<!--89326AE95DAD449D85DFAB2C5B1C6683--> <STARTVERSION><![CDATA[2.1.26126]]></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.26114]]></STARTVERSION> +<!--B97FC854C6DD41E692161585645A900F--> <STARTVERSION><![CDATA[3.0.26126]]></STARTVERSION> <!--B97FC854C6DD41E692161585645A900F--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--B97FC854C6DD41E692161585645A900F--> <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME> <!--B97FC854C6DD41E692161585645A900F--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> diff -r b5096788cd44 -r 2369c54c9f14 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java Thu Mar 05 15:36:59 2015 +0000 @@ -1154,7 +1154,21 @@ final boolean isReceipt = newPayment.isReceipt(); final Organization Org = newPayment.getOrganization(); - List<FIN_Payment> creditPayments = dao.getCustomerPaymentsWithCredit(Org, bp, isReceipt); + final OBCriteria<FIN_Payment> reversepayment = OBDal.getInstance().createCriteria( + FIN_Payment.class); + reversepayment.add(Restrictions.eq(FIN_Payment.PROPERTY_REVERSEDPAYMENT, newPayment)); + final FIN_Payment reversepaymnt = (FIN_Payment) reversepayment.uniqueResult(); + + List<FIN_Payment> creditPayments; + if (reversepaymnt == null) { + // Normal scenario + creditPayments = dao.getCustomerPaymentsWithCredit(Org, bp, isReceipt); + } else { + // If it is a reverse payment use its original payment + creditPayments = new ArrayList<FIN_Payment>(1); + creditPayments.add(reversepaymnt); + } + BigDecimal pendingToAllocateAmount = usedAmount; for (FIN_Payment creditPayment : creditPayments) { BigDecimal availableAmount = creditPayment.getGeneratedCredit().subtract( diff -r b5096788cd44 -r 2369c54c9f14 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 Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml Thu Mar 05 15:36:59 2015 +0000 @@ -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.26114]]></VERSION> +<!--C70732EA90A14EC0916078B85CC33D2D--> <VERSION><![CDATA[1.1.26126]]></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 b5096788cd44 -r 2369c54c9f14 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 Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Thu Mar 05 15:36:59 2015 +0000 @@ -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.26114]]></STARTVERSION> +<!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <STARTVERSION><![CDATA[3.0.26126]]></STARTVERSION> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <DEPENDANT_MODULE_NAME><![CDATA[Core]]></DEPENDANT_MODULE_NAME> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> diff -r b5096788cd44 -r 2369c54c9f14 modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml --- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml Thu Mar 05 15:36:59 2015 +0000 @@ -6,7 +6,7 @@ <!--9BA0836A3CD74EE4AB48753A47211BCC--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--9BA0836A3CD74EE4AB48753A47211BCC--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--9BA0836A3CD74EE4AB48753A47211BCC--> <NAME><![CDATA[User Interface Application]]></NAME> -<!--9BA0836A3CD74EE4AB48753A47211BCC--> <VERSION><![CDATA[2.1.26114]]></VERSION> +<!--9BA0836A3CD74EE4AB48753A47211BCC--> <VERSION><![CDATA[2.1.26126]]></VERSION> <!--9BA0836A3CD74EE4AB48753A47211BCC--> <DESCRIPTION><![CDATA[Provides the main application components for the openbravo user interface]]></DESCRIPTION> <!--9BA0836A3CD74EE4AB48753A47211BCC--> <HELP><![CDATA[Provides the main application components for the openbravo user interface. The main layout incorporates a navigation bar and a main view area.]]></HELP> <!--9BA0836A3CD74EE4AB48753A47211BCC--> <URL><![CDATA[http://forge.openbravo.com/projects/clientapplication]]></URL> diff -r b5096788cd44 -r 2369c54c9f14 modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml --- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Thu Mar 05 15:36:59 2015 +0000 @@ -7,7 +7,7 @@ <!--15D7CE8D95D043189162DBABA54A1F61--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--15D7CE8D95D043189162DBABA54A1F61--> <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID> <!--15D7CE8D95D043189162DBABA54A1F61--> <AD_DEPENDENT_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_DEPENDENT_MODULE_ID> -<!--15D7CE8D95D043189162DBABA54A1F61--> <STARTVERSION><![CDATA[2.1.26114]]></STARTVERSION> +<!--15D7CE8D95D043189162DBABA54A1F61--> <STARTVERSION><![CDATA[2.1.26126]]></STARTVERSION> <!--15D7CE8D95D043189162DBABA54A1F61--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--15D7CE8D95D043189162DBABA54A1F61--> <DEPENDANT_MODULE_NAME><![CDATA[JSON Datasource]]></DEPENDANT_MODULE_NAME> <!--15D7CE8D95D043189162DBABA54A1F61--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> @@ -21,7 +21,7 @@ <!--60A170212F36499D83B8AD38D01F46B3--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--60A170212F36499D83B8AD38D01F46B3--> <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID> <!--60A170212F36499D83B8AD38D01F46B3--> <AD_DEPENDENT_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_DEPENDENT_MODULE_ID> -<!--60A170212F36499D83B8AD38D01F46B3--> <STARTVERSION><![CDATA[2.1.26114]]></STARTVERSION> +<!--60A170212F36499D83B8AD38D01F46B3--> <STARTVERSION><![CDATA[2.1.26126]]></STARTVERSION> <!--60A170212F36499D83B8AD38D01F46B3--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--60A170212F36499D83B8AD38D01F46B3--> <DEPENDANT_MODULE_NAME><![CDATA[User Interface Client Kernel]]></DEPENDANT_MODULE_NAME> <!--60A170212F36499D83B8AD38D01F46B3--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> @@ -35,7 +35,7 @@ <!--824D60CB352E4099B1D8C903CA139DAE--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--824D60CB352E4099B1D8C903CA139DAE--> <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID> <!--824D60CB352E4099B1D8C903CA139DAE--> <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID> -<!--824D60CB352E4099B1D8C903CA139DAE--> <STARTVERSION><![CDATA[3.0.26114]]></STARTVERSION> +<!--824D60CB352E4099B1D8C903CA139DAE--> <STARTVERSION><![CDATA[3.0.26126]]></STARTVERSION> <!--824D60CB352E4099B1D8C903CA139DAE--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--824D60CB352E4099B1D8C903CA139DAE--> <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME> <!--824D60CB352E4099B1D8C903CA139DAE--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> @@ -49,7 +49,7 @@ <!--E8FD820AFE3D4FE08C02FC47769026AD--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--E8FD820AFE3D4FE08C02FC47769026AD--> <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID> <!--E8FD820AFE3D4FE08C02FC47769026AD--> <AD_DEPENDENT_MODULE_ID><![CDATA[EC356CEE3D46416CA1EBEEB9AB82EDB9]]></AD_DEPENDENT_MODULE_ID> -<!--E8FD820AFE3D4FE08C02FC47769026AD--> <STARTVERSION><![CDATA[8.1.26114]]></STARTVERSION> +<!--E8FD820AFE3D4FE08C02FC47769026AD--> <STARTVERSION><![CDATA[8.1.26126]]></STARTVERSION> <!--E8FD820AFE3D4FE08C02FC47769026AD--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--E8FD820AFE3D4FE08C02FC47769026AD--> <DEPENDANT_MODULE_NAME><![CDATA[Smartclient]]></DEPENDANT_MODULE_NAME> <!--E8FD820AFE3D4FE08C02FC47769026AD--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> diff -r b5096788cd44 -r 2369c54c9f14 modules/org.openbravo.client.application/src/org/openbravo/client/application/window/AttachmentsAH.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/AttachmentsAH.java Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/AttachmentsAH.java Thu Mar 05 15:36:59 2015 +0000 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2011-2013 Openbravo SLU + * All portions are Copyright (C) 2011-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -30,10 +30,14 @@ import org.codehaus.jettison.json.JSONObject; import org.hibernate.criterion.Restrictions; import org.openbravo.base.exception.OBException; +import org.openbravo.base.model.Entity; +import org.openbravo.base.model.ModelProvider; import org.openbravo.base.session.OBPropertiesProvider; +import org.openbravo.base.structure.OrganizationEnabled; import org.openbravo.client.kernel.BaseActionHandler; import org.openbravo.dal.core.DalUtil; import org.openbravo.dal.core.OBContext; +import org.openbravo.dal.security.SecurityChecker; import org.openbravo.dal.service.OBCriteria; import org.openbravo.dal.service.OBDal; import org.openbravo.dal.service.OBDao; @@ -56,8 +60,22 @@ String attachmentId = (String) parameters.get("attachId"); Tab tab = OBDal.getInstance().get(Tab.class, tabId); String tableId = (String) DalUtil.getId(tab.getTable()); + + // Checks if the user has readable access to the record where the file is attached + Entity entity = ModelProvider.getInstance().getEntityByTableId(tableId); + if (entity != null) { + Object object = OBDal.getInstance().get(entity.getMappingClass(), recordIds); + if (object instanceof OrganizationEnabled) { + SecurityChecker.getInstance().checkReadableAccess((OrganizationEnabled) object); + } + } + OBCriteria<Attachment> attachmentFiles = OBDao.getFilteredCriteria(Attachment.class, Restrictions.eq("table.id", tableId), Restrictions.in("record", recordIds.split(","))); + // do not filter by the attachment's organization + // if the user has access to the record where the file its attached, it has access to all + // its attachments + attachmentFiles.setFilterOnReadableOrganization(false); if (attachmentId != null) { attachmentFiles.add(Restrictions.eq(Attachment.PROPERTY_ID, attachmentId)); } @@ -108,6 +126,10 @@ Restrictions.eq("table.id", tableId), Restrictions.in("record", recordIds.split(","))); attachmentFiles.addOrderBy("creationDate", false); List<JSONObject> attachments = new ArrayList<JSONObject>(); + // do not filter by the attachment's organization + // if the user has access to the record where the file its attached, it has access to all its + // attachments + attachmentFiles.setFilterOnReadableOrganization(false); for (Attachment attachment : attachmentFiles.list()) { JSONObject attachmentobj = new JSONObject(); try { diff -r b5096788cd44 -r 2369c54c9f14 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js Thu Mar 05 15:36:59 2015 +0000 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2011-2014 Openbravo SLU + * All portions are Copyright (C) 2011-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -65,8 +65,8 @@ return this.attachmentCanvasItem.canvas; }, - setRecordInfo: function (entity, id, tabId) { - this.getAttachmentPart().setRecordInfo(entity, id, tabId); + setRecordInfo: function (entity, id, tabId, attachmentForm) { + this.getAttachmentPart().setRecordInfo(entity, id, tabId, attachmentForm); }, collapseSection: function () { @@ -168,12 +168,13 @@ return this.canvasItem.form; }, - setRecordInfo: function (entity, id, tabId) { + setRecordInfo: function (entity, id, tabId, attachmentForm) { this.entity = entity; // use recordId instead of id, as id is often used to keep // html ids this.recordId = id; this.tabId = tabId; + this.attachmentForm = attachmentForm; this.isInitialized = false; }, @@ -240,6 +241,7 @@ fillAttachments: function (attachments) { var id, i, length; + var docOrganization; this.savedAttachments = attachments; this.destroyAndRemoveMembers(this.getMembers()); var hLayout = isc.HLayout.create(); @@ -250,6 +252,13 @@ this.addMember(hLayout); var me = this; + //Here we are checking if the entity is 'Organization' because the way of obtaining the + //id of the organization of the form is different depending on the entity + if (this.entity === 'Organization') { + docOrganization = this.recordId; + } else { + docOrganization = this.attachmentForm.values.organization; + } var addButton = isc.OBLinkButtonItem.create({ title: '[ ' + OB.I18N.getLabel('OBUIAPP_AttachmentAdd') + ' ]', width: '30px', @@ -283,6 +292,10 @@ type: 'hidden', value: this.canvas.tabId }, { + name: 'inpDocumentOrg', + type: 'hidden', + value: docOrganization + }, { name: 'inpwindowId', type: 'hidden', value: this.canvas.windowId @@ -495,6 +508,10 @@ type: 'hidden', value: this.canvas.tabId }, { + name: 'inpDocumentOrg', + type: 'hidden', + value: docOrganization + }, { name: 'inpwindowId', type: 'hidden', value: this.canvas.windowId diff -r b5096788cd44 -r 2369c54c9f14 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js Thu Mar 05 15:36:59 2015 +0000 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2011-2012 Openbravo SLU + * All portions are Copyright (C) 2011-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): Valery Lezhebokov. ************************************************************************ diff -r b5096788cd44 -r 2369c54c9f14 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Tue Mar 03 19:14:50 2015 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Thu Mar 05 15:36:59 2015 +0000 @@ -333,7 +333,7 @@ } if (enable) { this.linkedItemSection.collapseSection(true); - this.linkedItemSection.setRecordInfo(this.view.entity, this.getValue(OB.Constants.ID)); + this.linkedItemSection.setRecordInfo(this.view.entity, this.getValue(OB.Constants.ID), this); delete this.linkedItemSection.hiddenInForm; this.linkedItemSection.show(); ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits