Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0045777
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] A. Platformtrivialalways2021-01-21 11:092021-01-25 09:36
ReportervmromanosView Statuspublic 
Assigned Tocberner 
PrioritynormalResolutionfixedFixed in VersionPR21Q1
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget VersionPR21Q1.1
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0045777: PrintController.java, increase post() visibility

DescriptionUse case: I want to extend the printing process to:
1) Run some validations before printing a record
2) Run some business logic just after printing a record

To achieve that I need to develop a custom class that extends from PrintController and override doPost() to implement my logic and then call the super.doPost().

The problem is that the doPost() runs
final VariablesSecureApp vars = new VariablesSecureApp(request);
at the beginning of the method, which makes the vars.command to be reset to "DEFAULT".

This crashes the "send by email" feature (which expects a vars.command="EMAIL").

To workaround this I could easily override the post() method, which doesn't recalculate the vars variable, and which is called by the doPost().

The problem is that post() has package visibility, so I can't override it outside its package.
Steps To ReproduceCreate a class that extends PrintController in an external module.
Try to override post(). It's not visible outside the package.
Proposed SolutionChange PrintController.post() visibility to public or protected.


In the future, we should add some hooks to the printing process to allow easy extensibility.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0045768 closedcberner PrintController.java, increase post() visibility 

-  Notes
(0125754)
hgbot (developer)
2021-01-25 09:35

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/272 [^]
(0125755)
hgbot (developer)
2021-01-25 09:36

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: e85f0d1e455c3a760d255763217a7df86d77208b
Author: Cristian Berner <cristian.berner@openbravo.com>
Date: 2021-01-25T09:34:46+01:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/e85f0d1e455c3a760d255763217a7df86d77208b [^]

Fixes ISSUE-45777: Allow extending printing process by increasing post method visibility

post method visibility has been set to protected, previously private to
allow overriding it by methods that need to.
One use-case is to handle vars and modification to vars in this method
differently. Those vars are then passed to doPost method.

---
M src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java
---
(0125756)
hgbot (developer)
2021-01-25 09:36

Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/272 [^]

- Issue History
Date Modified Username Field Change
2021-01-25 09:33 cberner Type defect => backport
2021-01-25 09:33 cberner Target Version => PR21Q1.1
2021-01-25 09:35 hgbot Note Added: 0125754
2021-01-25 09:36 hgbot Resolution open => fixed
2021-01-25 09:36 hgbot Status scheduled => closed
2021-01-25 09:36 hgbot Fixed in Version => PR21Q1
2021-01-25 09:36 hgbot Note Added: 0125755
2021-01-25 09:36 hgbot Note Added: 0125756


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker