120 Commits
Author SHA1 Message Date
Jacques Le Roux 3ba155e910 Improved: put bin in gitignore
I see no reason to have .DS_Store there
2021-11-18 09:27:51 +01:00
Jacques Le Roux 5864e97680 Improved: Fix OFBiz specific Javascript security issues reported by GH CodeQL (OFBIZ-12366)
Revert previous commit, something wrong happened with Eclipse imports order
feature. Anyway it needs to be a frameworkd class or js file for CodeQL to run
2021-11-14 20:15:54 +01:00
Jacques Le Roux f8c85ccb37 Improved: Fix OFBiz specific Javascript security issues reported by GH CodeQL (OFBIZ-12366)
No functional change (imports order) to test CodeQL setting
2021-11-14 19:10:04 +01:00
Jacques Le Roux fc6cf7bf07 Improved: Fix OFBiz specific Javascript security issues reported by GH CodeQL (OFBIZ-12366)
Fixes CmsMultiSiteDemoData.xml by using dompurify

I did not went so far that fixing CmsSiteDemoData.xml. After all it's only demo
data
2021-11-14 17:00:13 +01:00
Nicolas Malin df7ae11c73 Fixed: Add to cart is not working for products with selectable features (OFBIZ-11970)
Two issues were present, first was due to incorrect markup and the second was due to ajax request and response view of the additem request.
In additem request last saved view or the view of the last request is rendered on successful operation and in this case the last request/view is the one which is used to render UOM dropdown.

Thanks: Akash Jain and Ravi Lodhi
2021-09-28 14:12:10 +02:00
Nicolas Malin 6d5aca3d2a Fixed: Incorrect price for selected variant shown (OFBIZ-12236)
When the webshop (ecommerce component) has been set up for retail (B2C), with the tax setting 'Show prices with VAT tax included' set to 'Y' in store 9000 the appropriat Tax Auth Geo and Tax Auth set in store 9000 the flag 'Include Tax In Price' set to 'Y' for the Tax Auth the price for a virtual product is shown including VAT.

However, for a selected variant the price shown is without VAT

Thanks: Pierre Smits to raise this issue and Priya Sharma for solved it
2021-09-27 16:29:18 +02:00
Jacques Le Roux 905e7b0253 Fixed: The Solr version included in OFBiz has an SSRF vulnerability (CVE-2021-27905) (OFBIZ-12316)
Fixes conflicts from cherry pick
2021-09-15 13:44:06 +02:00
Jacques Le Roux cdf6bd69e5 Fixed: The Solr version included in OFBiz has an SSRF vulnerability (CVE-2021-27905) (OFBIZ-12316)
This post-auth security issue was reported to the security team by weinull orz
<weinull@outlook.com> As he suggested the solution is to update Solr to its last
version (8.9.0)

This solution contains a (justified) rant!

Thanks: weinull orz

Conflicts handled by hand (hence the numerous unnecessary automatic changes due to my editor (Scite) config
#	lucene/build.gradle
#	solr/build.gradle
#	solr/home/solrdefault/conf/solrconfig.xml
#	solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java
2021-09-15 10:34:29 +02:00
Jacques Le Roux 18c0c436af Fixed: Add http to https redirect rule for ofbiz.apache.org (OFBIZ-10590)
This prevented to run the stable demo, hence the next
2021-07-20 07:38:46 +02:00
Jacques Le Roux f7f7776514 Improved: removes mention of Birt in plugins LICENSE file
We no longer embed files from Birt project. For years now we use Gradle to load
org.eclipse.birt.runtime:viewservlets:4.5.0 that is only "loaded at runtime"
2021-06-17 18:35:18 +02:00
Jacques Le Roux 485e3b89d7 Fixed: Empty field is reflecting on Contact list section on Profile Page (OFBIZ-10386)
Steps to generate:

Open https://demo-trunk.ofbiz.apache.org/ecomseo/viewprofile

On the profile page, Go down to Contact list
Empty fields are displaying before Verify Subscription button

Expected: The field should have some specifications to be filled up

Thanks: Archana Asthana for report, Devanshu Vyas for suggestion, Praveen Patil
for patch and Thirumurugan for confirming
2021-05-29 15:47:48 +02:00
Jacques Le Roux 340c98b3b0 Improved: Comment out the SOAP and HTTP engines (OFBIZ-12212)
The SOAP and HTTP engines are open doors to security issues.
At https://markmail.org/message/pgtjyh23bazq4s2w I proposed to comment them out
as we did for RMI in the past.
Of cause it must be clearly documented how to use them if needed.

Here is the email content:

    After the recent fix for the CVE-2021-26295[1] we discussed with the security
    team about the opportunity need to comment out the SOAP and HTTP engines
    like we did in the past for RMI[2], this obviously for security reason.

    [1] OFBIZ-12167 "Adds a blacklist (to be
    renamed soon to denylist) in Java serialisation (CVE-2021-26295)"
    [2] OFBIZ-6942 "Comment out RMI related
    code because of the Java deserialization issue [CVE-2016-2170] "

I just put a small comment in webtools and scrumm controllers, it should be
enough.

The tests pass

Conflicts handled by hand
  scrum/servicedef/services.xml
2021-03-29 13:23:43 +02:00
Michael Brohl a356edc9b7 Improved: Switch from jCenter to mavenCentral to handle the jCenter
shutdown (OFBIZ-12171)

See comments in framework build.gradle for details.
2021-02-27 14:42:46 +01:00
Jacques Le Roux d94d5910f7 Fixed: Exception error on ecommerce portal while trying to register new user
(OFBIZ-)

Missing import statement in the groovy script on the new customer registration
page.

Thanks: Pradeep Choudhary
2021-02-27 14:10:31 +01:00
Jacques Le Roux f70aef14a4 Improved: Default ordering of webapps titles in main menu (OFBIZ-12166)
This 1st step sorts the plugins. We need to discuss more...
2021-02-15 12:35:59 +01:00
Deepak Dixit 27baf80c98 Fixed: Fitering on StatusId in FindTask does not work (#56)
(OFBIZ-10914)
2021-02-12 15:42:03 +05:30
Pawan Verma 7afe2b73e5 Fixed: Visit disabling causes NullPointerException on ecomm groovy script(OFBIZ-12173)
Used UtilHttp.getSessionId() instead of visit to get session Id.

Thanks: Giulio, Jacopo and Deepak.
2021-02-12 09:26:36 +05:30
Deepak Dixit e897ffc7ce Updated code as per lucene dependency update (OFBIZ-12100) 2021-01-04 14:42:10 +05:30
Deepak Dixit 0caff3bb10 Fixed: Updated lucene and solr dependecy to fix the test case failure relate…d to tika-parser dependency update
(OFBIZ-12100)
Manually backported cahnges from commit #1c355bb6d89739cb796bc1e17a7ad2a4a4fa8995
2021-01-04 14:40:10 +05:30
Jacques Le Roux 5ab0a6aa2f Fixed: Issue: Displaying company and product information at product backlog, subcomponent of Scrum Application
(OFBIZ-)

Steps to regenerate:
    Navigate to Applications
    Scrum
    Click on '+ Add product'
    Enter: Company and Product Owner
    Product Name
    Description

Issue: the information given in 4, 5, 6 steps are not displayed at the
Product backlog (view product) screen.

Thanks: Dikpal Kanungo for report and Anushi Gupta for the fix
2020-12-28 11:55:14 +01:00
Jacques Le Roux e3adeec062 Fixed: Lucene TopScoreDocCollector::create wrong call the 2 in Search.groovy scripts (OFBIZ-12087)
I guess it's due to an update of Lucene, easy fix

# Conflicts:
#	ecommerce/groovyScripts/content/Search.groovy
2020-12-07 13:21:24 +01:00
Jacques Le Roux 49b96e47cc * Fixed: Secure the uploads (OFBIZ-12080)
2020/08/10 the OFBiz security team received a security report by Harshit Shukla
<harshit.shukz@gmail.com>, roughly it was (quoting part of it to simplify):

<<I have identified a Remote Code Execution (RCE) Vulnerability. The reason
behind this RCE is lack of file extension check at
catalog/control/UploadCategoryImage?productCategoryId=CATALOG1_BEST_SELL&pload_file_type=category>>

Using this post-auth RCE in OFBiz demos, Harshit was able to get some AWS
credentials by uploading a webshell (based on [0]).
By security, it was then decided by the Infra and OFBiz security teams to shut
down the demos.

After discussing the elements reported with Mark J Cox (VP of ASF security team)
we in common decided that no CVE was necessary.

# Conflicts handled by hand:
#	birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java
2020-12-01 09:54:55 +01:00
Saurabh Dixit 3cc8f47135 Fixed: Product summary cards don't have uniform height. (OFBIZ-11910) (#46)
Done following:
1. Used bootstrap card-deck to equalize the height/width of all the product summary cards.

Reference:
https://v4-alpha.getbootstrap.com/components/card/#card-decks

Thanks Guys: Alex Bodnaru for report and suggestion, Saurabh Dixit for the patch, and Daniel Watford for the test
2020-11-30 11:38:26 +01:00
Jacques Le Roux cde1c6ac61 Fixed: Wrong quote marks (OFBIZ-11972)
Thanks: Alex Bodnaru
2020-10-06 16:03:28 +02:00
holivier ccfb388999 Improved: Error messages when generating HTML and PDF file from AsciiDoc files (OFBIZ-11893)
re-encode birt image Report-Master.png to be supported by asciidoctor
2020-10-05 11:32:12 +02:00
Jacques Le Roux b8c43a178a Fixed: Flexible reports use an old noNamespaceSchemaLocation (OFBIZ-12039)
While working on using flexible reports during this discussion
(https://markmail.org/message/qgebmemkqb6ddgzw)
I found this kind of errors in log:

XmlFileLoader: File Internal Content process error. Line: 20. Error message:
TargetNamespace.2: Expecting no namespace, but the schema document has a target
 namespace of 'http://ofbiz.apache.org/Widget-Form'.

Turned out that it was due to an old use of noNamespaceSchemaLocation when
dynamically creating forms.

The fix is to use the same definition than in current forms.

Thanks: Georg Potthast for starting the discussion

# Conflicts:
#	birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
#	birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java
2020-10-04 11:38:14 +02:00
Jacques Le Roux ad04cda8f0 Fixed: Complete Birt Flexible Reports documentation (OFBIZ-9188)
Removes "NOTE: This feature will begin to be officially available with the
R17.12 branch first release"

# Conflicts resolved by hand
#	birt/src/docs/asciidoc/_include/bt-creating reports.adoc
#	birt/src/docs/asciidoc/birt.adoc
2020-10-03 11:07:58 +02:00
Jacques Le Roux 1205ac591c Improved: display/selection of unit of measure is broken/plugins (OFBIZ-11993)
Better code

Thanks: Alex

Conflicts handled by hand ProductDetail.ftl
2020-09-14 08:00:48 +02:00
Akash Jain faf008c152 Fixed: Error on removing scrum members (OFBIZ-7249)
Thanks, Anurag Chandak for report.
2020-09-01 15:18:05 +05:30
Suraj Khurana d4e9a765ff Fixed: Typo in class name.
(OFBIZ-11978)
Thanks Alex Bodnaru for reporting and providing the patch.
2020-09-01 15:11:22 +05:30
Jacques Le Roux ab61110dc5 Fixed: display/selection of unit of measure is broken/plugins (OFBIZ-11993)
Allows selection of uom for multiple products on the same web page

Thanks: Alex
2020-08-31 10:07:56 +02:00
Jacques Le Roux c4a031dcb2 Fixed: multiflex css is linking to wrong location (OFBIZ-11977)
Thanks: Alex
2020-08-30 11:19:10 +02:00
Akash Jain 8c6c0f5834 Fixed: Distorted Final Checkout Review page when Credit card is selected as Payment option (OFBIZ-11920)
Thanks, Rashi Dhagat for reporting.
2020-08-25 21:18:46 +05:30
Akash Jain 05d8e9fa3e Fixed: Product link on Order confirmation page is not responding (OFBIZ-11735)
Thanks, Rashi Dhagat for reporting.
2020-08-03 18:16:29 +05:30
Jacques Le Roux c05bc3af1b Improved: Update markup of Quick Checkout Page according Bootstrap v4.0.0 (OFBIZ-10136)
Fixes a typo
2020-07-25 10:06:52 +02:00
Aditya Sharma 64b0f25e34 Fixed: ui for the product summary in promotion product list (OFBIZ-11906)
The product summary in the row is too slim, leaving 75% of the place unused.
Added CSS that forces to take 100% width
Thanks Alex Bodnaru for reporting and providing the patch
2020-07-24 16:08:07 +05:30
Jacques Le Roux 7a51784e2a Improved: Rename a few map files (OFBIZ-11882)
Renames a few files to suppress warnings in the browser console.

Thanks: Alex Bodnaru
2020-07-23 09:11:48 +02:00
Pawan Verma b93265d798 Fixed: Send me this every month link is not working in order items section(OFBIZ-10891)
Thanks, Ashish for the report, Vivek for lookup and Amit for the patch.
2020-07-11 10:32:17 +05:30
Jacques Le Roux 918d3e8518 Fixed: Error while uploading file in Ecommerce Profile's File Manager (OFBIZ-10746)
This is only fixing the UI where you did not see the file to upload you selected

There is still an issue to upload the file

Thanks: Priya Sharma for testing
2020-06-23 14:36:33 +02:00
Aditya Sharma 2b3252cf37 Improved: Breadcrumbs should be shown on all the pages of eCommerce application
(OFBIZ-2584)
Right now in OOTB eCommerce application breadcrumbs are only shown for catalog pages. It should be available on other pages too.

Added breadcrumb for ContactUs and Anonymous ContactUs page

Thanks Pranay Pandey for reporting the issue and Aishwary Shrivastava for providing the patch
2020-06-02 19:23:36 +05:30
Jacques Le Roux 09c9bab4d0 Improved: adds pull_request_template.md (OFBIZ-11722) 2020-05-31 09:47:17 +02:00
Pawan Verma aa7008407b Fixed: Improve the buttons on edit credit card page
(OFBIZ-10975)

Thanks: Sourabh and Suraj for your contribution.
2020-05-10 14:12:38 +05:30
Jacques Le Roux a64dea4ffe Reverted: Revert "Adds the meta CSRF token for Ajax"
This reverts commit 11250f22d8.

Revert "Improved: POC for CSRF Token"

This reverts commit d52374422e.

I forgot that I committed these changes in ecommerce w/o committing in framework
2020-04-27 18:30:03 +02:00
Jacques Le Roux 11250f22d8 Adds the meta CSRF token for Ajax 2020-04-04 18:36:02 +02:00
Jacques Le Roux d52374422e Improved: POC for CSRF Token
(OFBIZ-11306)

There is no need to change it in common-controller because, apart the ecommerce
application, there are no applications that requires an anonymous flow.
It should be only changed in ecommerce controller.
2020-04-04 18:36:02 +02:00
Pawan Verma fcbb750cf6 Fixed: Product Images not rendering on One Page Checkout
(OFBIZ-11400)

Thanks: Archana Asthana for the report and Devanshu Vyas for the patch.
2020-03-28 12:42:52 +01:00
Jacques Le Roux ba31a241ac Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

As reported by OWASP ZAP:
A cookie has been set without the SameSite attribute, which means that the
cookie can be sent as a result of a 'cross-site' request. The SameSite attribute
is an effective counter measure to cross-site request forgery, cross-site script
inclusion, and timing attacks.

The solution was not obvious in OFBiz for 2 reasons:

1. There is no HttpServletResponse::setHeader. So we need to use a filter
  (SameSiteFilter) and even that is not enough because of 2:
2. To prevent session fixation we force Tomcat to generates a new jsessionId,
ultimately put in cookie, in LoginWorker::login. So we need to add a call to
SameSiteFilter::addSameSiteCookieAttribute in
UtilHttp::setResponseBrowserDefaultSecurityHeaders.
2020-03-20 17:53:57 +01:00
Jacques Le Roux c7c511eda6 Improved: no functional change
Follows the "How to apply the Apache License to your work" section at
https://www.apache.org/licenses/LICENSE-2.0
2020-03-14 12:38:21 +01:00
Jacques Le Roux b0dd29895f Implemented: have a license
(OFBIZ-11451)

Fixes missing sections in LICENCE and adds NOTICE

I have also removed the plugins prefix in "URIs" because we are under plugins

Thanks: Jacopo for spotting missing sections
2020-03-14 08:27:24 +01:00
Pierre Smits 706fc86892 Implemented: have a license
(OFBIZ-11451)
2020-03-13 16:06:45 +01:00
Suraj Khurana c117078a61 Fixed: Unable to remove items from onePageCheckout screen of e-commerce.
(OFBIZ-10800)

Thanks Arpit Mor for reporting and Dhaval Wagela for the patch.
2020-03-02 12:20:33 +05:30
Jacques Le Roux c84b388b85 Fixed: replaceFirst sensible to variable pattern
(OFBIZ-11396)

When using variable pattern with replaceFirst you may cross issues if the
pattern contains specific tokens. For instance on Windows with the path
"C:\projectsASF\Git\ofbiz-framework/" you have inside the token "\p" which has
a special meaning.
2020-02-22 07:42:01 +01:00
Jacques Le Roux bffd5d9d0d Improved: no functional change
This file inadvertently slipped in with a previous commit, it's not needed.
2020-02-19 14:09:44 +01:00
Jacques Le Roux 6d9314e8bf Improved: no functional change
This was added for OFBIZ-9198 but was superfluous since the same is already in
the included ecommerce controller
2020-02-19 14:03:19 +01:00
Jacques Le Roux 90b2d6c9bf Fixed: The "stream" request-map in ecommerce and commonext controllers
requires authentication
(OFBIZ-11349)

Thanks: Michael for reporting a possible issue when only commenting the "stream"
request-map in commonext controller. And Jacopo to suggest to require
authentication (after suggesting to comment out)

It should be also noted that when the CSRF defense implementation will be in
place, all XSS vulnerabilities w/o authentication will not longer be possible.
Because then all requests shall contains a CSRF token.
2020-02-19 14:01:04 +01:00
Jacques Le Roux 8926d686c9 Improved: Temporarily comment out the "stream" request-map in ecommerce
controller for security reason
(OFBIZ-11348)

No functional change, simply amend the comment
2020-02-14 10:25:03 +01:00
Jacques Le Roux bd600a3dd4 Fixed: Temporarily comment out the "stream" request-map in ecommerce controller
for security reason
(OFBIZ-11348)

A vulnerability has been reported to the OFBiz security team. We were able to
quickly and quietly fix it in supported versions, but in the ecommerce component.
To be able to release the 17.12.01 version with this vulnerability fixed we need
to temporarily comment out the "stream" request-map in ecommerce controller.
We will later fix the specific issue in ecommerce to put back the functionnalities
allowed by the "stream" request-map in ecommerce controller.
2020-02-13 06:54:31 +01:00
Aditya Sharma 93f513517f Implemented: Cookie Consent In E-Commerce
(OFBIZ-11333)
Implemented internationalisation by initialising the plugin in header.ftl and using uiLabels for title, message and labels.
Thanks Michael Brohl for your inputs
2020-02-11 14:27:43 +05:30
Aditya Sharma 8b45efaee3 Implemented: Cookie Consent In E-Commerce
(OFBIZ-11333)
The Cookie Law is a piece of privacy legislation that requires websites to get consent from visitors to store or retrieve any information on their computer, smartphone or tablet. It was designed to protect online privacy, by making consumers aware of how information about them is collected and used online, and give them a choice to allow it or not.

The EU Cookie Legislation began as a directive from the European Union. Some variation on the policy has since been adopted by all countries within the EU.

The EU Cookie Legislation requires 4 actions from website owners who use cookies:
1. When someone visits your website, you need to let them know that your site uses cookies.
2. You need to provide detailed information regarding how that cookie data will be utilized.
3. You need to provide visitors with some means of accepting or refusing the use of cookies in your site.
4. If they refuse, you need to ensure that cookies will not be placed on their machine.

Used bsgdprcookies plugin to implement the feature. Thanks Deepak Nigam for initiating and providing initial patch. Thanks Deepak Nigam, Pierre Smits, Michael Brohl, Jacques Le Roux and Swapnil M Mane for inputs.
2020-02-11 14:27:24 +05:30
Aditya Sharma 53e1b6f9a4 Improved: no functional change
Added .gitignore file
2020-02-10 10:48:36 +05:30
Nicolas Malin 6296ab4078 Fixed: Error when initialize billFromParty from groovy context in loadSalesOrderItemFact service
After the conversion from bsh to groovy, the script that resolve
billFromParty need to propage the value on context Map to be available
on minilang context
2020-02-06 13:03:41 +01:00
Pawan Verma ca08d3f8bb Fixed: service 'loadSalesOrderItemFact' has hard coded currencyUomId
(OFBIZ-11033)

Used PartyAccountingPreference.baseCurrencyUomId instead of hard coded USD.

Thanks: Pierre Smits for your contribution.
2020-01-30 18:56:28 +05:30
Jacques Le Roux b6b745a7a1 Fixed: User should not be directed to main page after adding product to cart
from showcart page
(OFBIZ-11223)

    Navigate to URL: https://demo-trunk.ofbiz.apache.org/ecomseo/
    Click on View Cart at top-right of the page (User will be directed to showcart page)
    Enter product number (Eg: GZ-2644)
    Enter quantity
    Click on add to cart

Product is added to the cart but user is directed to main page of ecommerce. 


Thanks: Arpit Mor for report, Sourabh Punyani for the fix
2020-01-26 06:27:33 +01:00
akash 3045557f32 Fixed: User is unable to create return.
(OFBIZ-10850)
Thanks, Ashish and Ankush Upadhyay for your contribution.
2020-01-25 18:37:54 +05:30
Pawan Verma 2d3ca0534e Merge branch 'release18.12' of https://gitbox.apache.org/repos/asf/ofbiz-plugins into release18.12 2020-01-25 11:42:55 +05:30
Pawan Verma af2fde4fd3 Fixed: Corrected file path for ProcessPaymentSettings.groovy
(OFBIZ-11324)
2020-01-25 11:42:34 +05:30
James Yong 4b7a3b3789 Fixed: processorder is submitted as GET instead of POST
(OFBIZ-11319)

During checkout of shopping cart, it is observed that the processorder of the form action is submitted as GET which is incorrect.

Thanks: Jacques for the review
2020-01-19 00:30:13 +08:00
Mathieu Lirzin 20a82a9598 Fixed: Add XML declaration in “web.xml” files (OFBIZ-6993)
These declarations avoid SAXParseException traceback when parsing web.xml
the first time in WebappUtil.parseWebXmlFile

A schema conformance issue has been fixed in ecommerce “web.xml”.

(cherry picked from commit 1158664ba3)

# Conflicts handled by hand
#	msggateway/webapp/msggateway/WEB-INF/web.xml
2019-12-19 06:50:23 +01:00
Jacopo Cappellato ad91ba42c0 Fixed: Add missing view permissions checks to various screens. 2019-11-16 08:16:44 +01:00
Jacques Le Roux 2520f9357e Fixed: Link in verification email for Newsletter gives security error
(OFBIZ-9804)

Changes ContactListEmailTemplate.ftl to also use GET. 
Because we dont' want a form to ask, but only to hide parameters.
See details in Jira.

Handles the emails also in ecomseo after OFBIZ-11278

I have still to see why I get this message at the end of the process:
"Invalid verify code for the New Product Announcements"
ie when using the link in the last (3rd) email:
"Subscribe Contact List New Product Announcements"
This will be another Jira..!
2019-11-10 11:05:30 +01:00
Jacques Le Roux 8a0ae58940 Fixed: double forward slashes in ecommerce emails
(OFBIZ-2618)

I reopened this issue because while working on OFBIZ-9804 I found that
since maybe r1052457 some baseEcommerceSecureUrl in screens like 
ContactListSubscribeEmail are not working anymore.
While at it I remove the commented out lines
2019-11-10 04:40:40 +01:00
Jacques Le Roux c432d0483a "Applied fix from plugins for revision: 1868545"
------------------------------------------------------------------------
r1868545 | jleroux | 2019-10-17 14:19:33 +0200 (jeu. 17 oct. 2019) | 16 lignes

Fixed: EditExample always update status, because current Status not shown
(OFBIZ-11230)

In the EditExample Form, the drop-down is populates with the Valid change status 
only. So current status is not in the list and the status print in the drop-down 
is the next authorized. I want to modify exampleName or exampleType, I go to 
editExample and change what I want and validate. The problem is status is also 
changed!

There are 12 other same or similar cases. For the first of them (in FinAccount) 
there is the same bug: when I change FinAccount Name, status change too. If I 
add current="first-in-list" in the tag drop-down it works 

jleroux: Quote is a peculiar case due to OFBIZ-7337 which was a wrong fix
 
Thanks: Oliver for the analysis and the fix 
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1868547 13f79535-47bb-0310-9956-ffa450edef68
2019-10-17 12:20:10 +00:00
Jacques Le Roux 802adf0385 "Applied fix from plugins for revision: 1867849"
------------------------------------------------------------------------
r1867849 | jleroux | 2019-10-01 19:32:02 +0200 (mar. 01 oct. 2019) | 18 lignes

Fixed: Issue with "User name filed" while creating the new user
(OFBIZ-11226)

Steps to regenerate:

    Open URL https://demo-trunk.ofbiz.apache.org
    2. Click on the "Register" button for creating a new customer
    3. Enter all the mandatory details for the registring a new customer
    4. Enter the user name with a dot (.), for example: "demo.user"
    5. Click on the "Save" button

Actual: Error message "Username can only have letters, digits and the _- 
        characters" is displaying on the screen.

Expected: Dot (.) should be also allowed in validation rules when we enter user 
name manually with a dot (.)

Thanks: Vedansh Tiwari for report
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1867850 13f79535-47bb-0310-9956-ffa450edef68
2019-10-01 17:32:53 +00:00
Jacques Le Roux 4492b0cc55 "Applied fix from plugins for revision: 1867717"
------------------------------------------------------------------------
r1867717 | jleroux | 2019-09-29 11:43:42 +0200 (dim. 29 sept. 2019) | 11 lignes

Fixed: Freemarker error on reviewProduct page on storefront
(OFBIZ-11108)

Steps to regenerate:
1)Navigate to https://demo-trunk.ofbiz.apache.org/ecommerce/control/main
2) User should not be logged in
3) Click on any product
4) Click on Be The First To Review This Product! link
5) FTL error for the null check is occurring

Thanks: Minal Phalak for the patch and Suraj for review
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1867720 13f79535-47bb-0310-9956-ffa450edef68
2019-09-29 11:00:35 +00:00
Jacques Le Roux 3b54c81e1b "Applied fix from plugins for revision: 1867712"
------------------------------------------------------------------------
r1867712 | jleroux | 2019-09-29 11:31:59 +0200 (dim. 29 sept. 2019) | 9 lignes

Improved: UI issue on ecommerce Product page
(OFBIZ-10884)

Navigate to demo-trunk ecom
Click on Product titled as Enchiladas, It redirects to the product page
On the Product page, Multiple horizontal lines are displayed 

Thanks: Garima jain for report, Sourabh Punyani for initial patch and Jayesh 
Agrawal for updated patch
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1867713 13f79535-47bb-0310-9956-ffa450edef68
2019-09-29 09:34:24 +00:00
Nicolas Malin e9bae9a7bd Improved: Any ecommerce user has the ability to reset anothers password (including admin) via "Forget Your Password"
(OFBIZ-4361)

Update ecommerce plugin to use the forget passord process with jwtToken :
  * Add jwtToken managment on update password page
  * Change changepassword to passwordChange on controller for align with common-controller



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1867648 13f79535-47bb-0310-9956-ffa450edef68
2019-09-27 19:26:26 +00:00
Pawan Verma 9a9ba5703d Applied fix from trunk for revision: 1865828
===

Fixed: Scrum parties don't have partyTypeId set
(OFBIZ-11013)
Added missing partyTypeId data for the Scrum Parties.

Thanks: Pierre Smits for your contribution.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1865833 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 09:48:03 +00:00
Jacques Le Roux ff56f6c6b4 "Applied fix from plugins for revision: 1865398"
------------------------------------------------------------------------
r1865398 | jleroux | 2019-08-18 17:16:12 +0200 (dim. 18 août 2019) | 5 lignes

Fixed: <description> of <visual-theme> in Theme.xml does not work
(OFBIZ-9867)

There is no str:label in UelFunctions class but util:label
Missed theses files in previous commit (damn plugins)
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1865399 13f79535-47bb-0310-9956-ffa450edef68
2019-08-18 15:17:30 +00:00
Jacques Le Roux 08f7e7bebe "Applied fix from plugins for revision: 1865347"
------------------------------------------------------------------------
r1865347 | jleroux | 2019-08-17 13:34:01 +0200 (sam. 17 août 2019) | 9 lignes

Fixed: Issue loading solr component (JNDI timeout)
(OFBIZ-11156)

We need to provide a JNDI environment property for Solr to load faster

Fixes previous commit where I hastily harcoded in jndi.properties file

Used a system property which can be used to define a JNDI environment 
property
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1865350 13f79535-47bb-0310-9956-ffa450edef68
2019-08-17 11:39:20 +00:00
Aditya Sharma 840966e2f1 Applied fix from trunk for revision: 1863839
===

Fixed: Check embedded Javascript libs vulnerabilities using retire.js
(OFBIZ-10678)
For solving CVE-2018-14041, Bootstrap upgraded to latest 4.3.1
Thanks Jacques Le Roux for the reviews


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1863852 13f79535-47bb-0310-9956-ffa450edef68
2019-07-27 09:37:36 +00:00
Jacques Le Roux 94f2947278 "Applied fix from plugins for revision: 1862466 "
------------------------------------------------------------------------
r1862466 | jleroux | 2019-07-03 15:30:28 +0200 (mer. 03 juil. 2019) | 20 lignes

Fixed: Error message is displayed when user having space in username logs 
in at ecommerce
(OFBIZ-10671)

Steps to regenerate:
 # Open URL: [https://demo-trunk.ofbiz.apache.org/ecommerce/control/main]
 # Click on register in header section
 # Provide all the mandatory information but provide a user name such that is 
    contains a space (like: Walter White or Jesse Pinkman)
 # Click on save button

Actual: When user clicks on save button then he is redirected to main page of 
ecommerce and an error message is displayed. 
Similarly when user with space in username tries to login, error message is 
displayed. 

Praven: Added standard regex for username allowed alphabets, numbers, and _-
jleroux: actually "-" was  missing in the regepx definition.

Thanks: Arpit Mor for report and Praveen Sharma for the fix
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1862469 13f79535-47bb-0310-9956-ffa450edef68
2019-07-03 13:32:10 +00:00
Jacques Le Roux 14e58e127d "Applied fix from plugins for revision: 1861986"
------------------------------------------------------------------------
r1861986 | jleroux | 2019-06-24 12:31:11 +0200 (lun. 24 juin 2019) | 6 lignes

Fixed: Last Categories section is blank 
(OFBIZ-10858)

Fixes typos in descriptions

Thanks: Priya Sharma
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1861987 13f79535-47bb-0310-9956-ffa450edef68
2019-06-24 10:32:05 +00:00
Jacques Le Roux d241da1275 "Applied fix from plugins for revision: 1861904"
------------------------------------------------------------------------
r1861904 | jleroux | 2019-06-23 11:09:00 +0200 (dim. 23 juin 2019) | 26 lignes

Fixed: Last Categories section is blank 
(OFBIZ-10858)

Issue 1:
1. Open https://demo-trunk.ofbiz.apache.org/ecomseo
2. Click on a category from the Categories section
3. Refresh the page
Actual:
1. Last Categories is blank
2. If we refresh the page then only the search category visible with the last 
row blank with a bullet.

Issue 2:
1. Open https://demo-trunk.ofbiz.apache.org/ecomseo
2. Click on a category from the Categories section
3. Again, open the https://demo-trunk.ofbiz.apache.org/ecomseo in the new tab
Actual: 1st row is blank with searched categories

As per the initial observation, the issue persists for some specific categories 
like Dropship Products, Account Activation and Services.
For all other categories, the last categories section is populated correctly. 
So there could be some issue with the data.

jleroux: on Priya warning I modified the descriptions

Thanks: Rashi Dhagat for reporting, Priya Sharma for the fix
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1861906 13f79535-47bb-0310-9956-ffa450edef68
2019-06-23 09:11:49 +00:00
Swapnil Mane e970e53fb1 Applied fix from trunk for revision: 1861824
===

Fixed: UI issue on the Contact Us page of ecommerce application
(OFBIZ-11061)

Steps to regenerate:

1. Navigate to https://demo-trunk.ofbiz.apache.org/ecomseo/
2. Click on Login
3. Enter valid username and password
4. Click on login button
5. Click on Contact Us

Actual: From, subject and message label are not displayed properly on some resolution.

Note: This issue is resolution specific if you are unable to generate the issue then increase the resolution of your screen or zoom in the page on browser

Thanks:  Arpit Mor for reporting and Sasikant Biswal for providing the patch.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1861826 13f79535-47bb-0310-9956-ffa450edef68
2019-06-22 09:15:26 +00:00
Suraj Khurana caf1a38c8d Applied fix from trunk for revision: 1860801
===

Fixed: Blank page appears after using Tell-A-Friend functionality while adding item to cart.
(OFBIZ-10885)
Thanks Ravi Lodhi for reporting and Nitish Mishra for providing the patch.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1860803 13f79535-47bb-0310-9956-ffa450edef68
2019-06-08 06:47:15 +00:00
Deepak Dixit 5b546b1aba Applied fix from trunk for revision: 1860648
===

Fixed: Wrong page title displayed on contact us page of ecommerce
(OFBIZ-11062)
Thanks Arpit Mor and Ayushi Rathod for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1860649 13f79535-47bb-0310-9956-ffa450edef68
2019-06-05 09:46:02 +00:00
Suraj Khurana 349deceab7 Applied fix from trunk for revision: 1859906
===

Fixed: Unable to find any product in Quick Add functionality.
(OFBIZ-10978)
Thanks Vivek Bisen for providing the patch, Pawan Verma and Jacques Le Roux for review.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1859907 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 05:07:01 +00:00
Jacques Le Roux 49289bc161 "Applied fix from plugins for revision: 1859893"
------------------------------------------------------------------------
r1859893 | jleroux | 2019-05-24 19:15:04 +0200 (ven. 24 mai 2019) | 4 lignes

Fixed: Services allow arbitrary HTML for parameters with allow-html set to "safe"
(OFBIZ-5254)

Once again forgot to commit this changes in plugins :/
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1859894 13f79535-47bb-0310-9956-ffa450edef68
2019-05-24 17:16:44 +00:00
Jacques Le Roux c828fa3735 "Applied fix from plugins for revision: 1859735 "
------------------------------------------------------------------------
r1859735 | jleroux | 2019-05-22 18:41:04 +0200 (mer. 22 mai 2019) | 12 lignes

Fixed: massPrintOrders service does not work
(OFBIZ-11049)

This problem was similar to what was resolved by r1806237 for OFBIZ-9138.

This fixes it by using the same solution than in r1806237. If the visual theme 
is unknown in the the service  context  get the default theme from 
general.properties using ThemeFactory::resolveTheme.

sendPrintFromScreen, createFileFromScreen, sendBirtMail, getXslFo and 
printReportPdf (in example) were concerned

------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1859737 13f79535-47bb-0310-9956-ffa450edef68
2019-05-22 16:41:59 +00:00
Jacques Le Roux 45feca67b3 "Applied fix from plugins for revision: 1859012"
------------------------------------------------------------------------
r1859012 | jleroux | 2019-05-09 16:32:35 +0200 (jeu. 09 mai 2019) | 6 lignes

Fixed: Touch F8 in webpos does not work and generate an error
(OFBIZ-11010)

Adds missing data for POS_SALES_CHANNEL fix this issue, was removed in r1754402.

Thanks: Pawan Verma
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1859013 13f79535-47bb-0310-9956-ffa450edef68
2019-05-09 14:33:36 +00:00
Jacopo Cappellato 40484c0f36 Applied fix from trunk for revision: 1858435
===

Fixed: improved the configuration for the "add forum message" form (the source 
tab is not needed in the ecommerce application).



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1858439 13f79535-47bb-0310-9956-ffa450edef68
2019-04-30 14:58:45 +00:00
Jacques Le Roux 31327e2f59 "Applied fix from plugins for revision: 1858312"
------------------------------------------------------------------------
r1858312 | jleroux | 2019-04-28 12:51:46 +0200 (dim. 28 avr. 2019) | 17 lignes

Fixed: Remove link is not working in shopping list
(OFBIZ-10967)

Steps to reproduce
1. Login with valid username and password.
2. Navigate to ecommerce.
2.1 Adds product/s to the cart
2.2 Add it/them in a shopping list.
4. Navigate to shopping list section.
5. Click on link “Remove"
Expected Result: Product should be removed from shopping list.
Actual Result: Remove link is not working.

jleroux: OFBIZ-7291 broke it. That can be tested on old demo (R13)
Fixed by using a simple submit field

Thanks: Ashish Sharma for report
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1858313 13f79535-47bb-0310-9956-ffa450edef68
2019-04-28 10:52:24 +00:00
Suraj Khurana 9320c40558 Applied fix from trunk for revision: 1858289
===

Fixed: Shortkeys missing on WebPOS.
(OFBIZ-10961)
It was broken after jQuery update on rev #1850712.
Thanks Padmavati Rawat for reporting and Rohit Koushal for providing the patch.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1858290 13f79535-47bb-0310-9956-ffa450edef68
2019-04-27 16:40:08 +00:00
Suraj Khurana 4952ed4713 Applied fix from trunk for revision: 1858285
===

Fixed: FindTask does not allow for all statuses possible to be selected.
(OFBIZ-10913)
Thanks Pierre Smits for repoting, Deepak Dixit for comments/findings and Pawan Verma for providing the patch.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1858286 13f79535-47bb-0310-9956-ffa450edef68
2019-04-27 16:15:02 +00:00
Deepak Dixit 64ff2f81c1 Applied fix from trunk for revision: 1858265
===

Improved: UI issue on ecommerce main page
(OFBIZ-10849)
1. Navigate to demo-trunk ecom
2. Scroll the page and see the last category section in the right column of the screen.
3. The last category section seems to be distorted because of the empty list Screenshot attached for the same.

The patch contains the following:
- Fixed the category section rendering.

- Improved the markup of survey section of the main page.
- Improved the UI/UX of view cart screen 

Thanks  Garima jain  and Nitish Mishra for  your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1858266 13f79535-47bb-0310-9956-ffa450edef68
2019-04-27 11:43:45 +00:00
Suraj Khurana 8be85cc8e8 Applied fix from trunk for revision: 1858244
===

Fixed: Can't set (expected) start and end date of project when creating a project. 
(OFBIZ-10927)
Thanks Pierre Smits for reporting, Pawan Verma for the patch and Jacques for review.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1858245 13f79535-47bb-0310-9956-ffa450edef68
2019-04-27 06:44:36 +00:00
Jacques Le Roux b9ac3ac4d2 "Applied fix from plugins for revision: 1858141 "
------------------------------------------------------------------------
r1858141 | jleroux | 2019-04-25 16:27:36 +0200 (jeu. 25 avr. 2019) | 11 lignes

Fixed: Ensure html verbosity is following general setup
(OFBIZ-10940)

Currently the configuration of the Birt and Scrum component does not follow the 
- de facto - standard of having the html code reference the OFBiz widget and 
templates. 
See [1] vs [2]
[1] view-source:https://demo-trunk.ofbiz.apache.org/birt/control/main
[2] view-source:https://demo-trunk.ofbiz.apache.org/accounting/control/main

Thanks: Pierre Smits
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1858142 13f79535-47bb-0310-9956-ffa450edef68
2019-04-25 14:28:18 +00:00
Jacques Le Roux a2fe68212c Fixed: Update Tomcat to 9.0.18 due to CVE-2019-0232
(OFBIZ-10920)

CVE-2019-0232 Apache Tomcat Remote Code Execution on Windows

Severity: Important

Vendor: The Apache Software Foundation

Versions Affected:
Apache Tomcat 9.0.0.M1 to 9.0.17
Apache Tomcat 8.5.0 to 8.5.39
Apache Tomcat 7.0.0 to 7.0.93

Description:
When running on Windows with enableCmdLineArguments enabled, the CGI
Servlet is vulnerable to Remote Code Execution due to a bug in the way
the JRE passes command line arguments to Windows. The CGI Servlet is
disabled by default. The CGI option enableCmdLineArguments is disabled
by default in Tomcat 9.0.x (and will be disabled by default in all
versions in response to this vulnerability). For a detailed explanation
of the JRE behaviour, see Markus Wulftange's blog [1] and this archived
MSDN blog [2].

Mitigation:
Users of affected versions should apply one of the following mitigations:
- Ensure the CGI Servlet initialisation parameter enableCmdLineArguments
    is set to false
- Upgrade to Apache Tomcat 9.0.18 or later when released
- Upgrade to Apache Tomcat 8.5.40 or later when released
- Upgrade to Apache Tomcat 7.0.93 or later when released
This announcement is being made before the releases are available as the
change to fix this issue is obviously security related.

Credit:
This issue was identified by an external security researcher and
reported to the Apache Tomcat security team via the bug bounty program
sponsored by the EU FOSSA-2 project.


jleroux: actually Tomcat 9.0.19 was released, here it is

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1857587 13f79535-47bb-0310-9956-ffa450edef68
2019-04-15 14:42:28 +00:00
Jacques Le Roux 7d6fbeebb9 "Applied fix from plugins for revision: 1857173 "
------------------------------------------------------------------------
r1857173 | jleroux | 2019-04-09 13:49:10 +0200 (mar. 09 avr. 2019) | 8 lignes

Fixed: Error message is displayed while click on create new quotes.
(OFBIZ-10882)

This feature has been removed with OFBIZ-10882, 

This removes the "Create New Quote" link, the redundant "Save" link (there is a 
Save button) and the OrderCreateQuoteFromShoppingList label which was only used 
there
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1857175 13f79535-47bb-0310-9956-ffa450edef68
2019-04-09 11:51:06 +00:00
Deepak Dixit 9d0e6c2528 Applied fix from trunk for revision: 1857120
===

Improved: Amount field is editable at Product Detail Page 
(OFBIZ-10663)
Added mising css and js code to show/hide the amount field based on Product.requireAmount field.
Thanks  Dikpal Kanungo for reporting the issue.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1857121 13f79535-47bb-0310-9956-ffa450edef68
2019-04-08 16:53:30 +00:00
Jacques Le Roux 15480125b8 "Applied fix from plugins for revision: 1856917 "
------------------------------------------------------------------------
r1856917 | jleroux | 2019-04-04 14:17:35 +0200 (jeu. 04 avr. 2019) | 12 lignes

Fixed: Unable to create new quote from cart at eCommerce store
(OFBIZ-10886)

Actually we decided that an external user should not be able to create quotes
but only requests for quote.

This disables creating quotes from the ecommerce. An authorised user can still
do the same from the backedn (order manager)

Thanks: Sanjay Yadav for initial report, Sasikant Biswal for trying, Pierre for
mentioning that this should not be open to external users and Pawan Verma for 
the fix
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1856918 13f79535-47bb-0310-9956-ffa450edef68
2019-04-04 12:19:18 +00:00
Jacques Le Roux 5a4dcd611d "Applied fix from plugins for revision: 1856802"
------------------------------------------------------------------------
r1856802 | jleroux | 2019-04-02 09:52:53 +0200 (mar. 02 avr. 2019) | 17 lignes

Fixed: Error message is displayed in shopping cart when click on recalculate 
cart link
(OFBIZ-10852)

Login with valid username and password.
Navigate to ecommerce.
Add multiple product in shopping cart.
Select one product and click on remove selected.
Product should be removed.
Select another product and click on recalculate cart.

Expected result: Product should be recalculate.
Actual result: Error message is displayed as 404. Screen print attached

jleroux: I did not see the error message but the fix makes sense anyway

Thanks: Ashish Sharma for report Sasikant Biswal for the fix
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1856803 13f79535-47bb-0310-9956-ffa450edef68
2019-04-02 07:57:15 +00:00
Jacques Le Roux a4cee4a745 "Applied fix from plugins for revision: 1856212 "
------------------------------------------------------------------------
r1856212 | jleroux | 2019-03-25 18:47:52 +0100 (lun. 25 mars 2019) | 9 lignes

Fixed: Update Tomcat to 9.0.16 due to CVE-2019-0199
(OFBIZ-10873)

The HTTP/2 implementation accepted streams with excessive numbers of
SETTINGS frames and also permitted clients to keep streams open without
reading/writing request/response data. By keeping streams open for
requests that utilised the Servlet API's blocking I/O, clients were able
to cause server-side threads to block eventually leading to thread
exhaustion and a DoS.
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1856214 13f79535-47bb-0310-9956-ffa450edef68
2019-03-25 17:50:29 +00:00
Aditya Sharma 3a73856173 Applied fix from trunk for revision: 1855084
===

Improved: Replace document.write() occurrences with some legitimate code
(OFBIZ-10759)
Removed document.write.lastFocusedName as code works without it


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1855092 13f79535-47bb-0310-9956-ffa450edef68
2019-03-09 06:51:09 +00:00
Suraj Khurana 6d0cc93ee9 Applied fix from trunk for revision: 1855082
===

Fixed: Product image is not displayed on showcart page of ecommerce.
(OFBIZ-10738)
Thanks Arpit Mor for reporting the issue and Praveen Sharma for providing the patch.
It was occuring due to incorrect encoder type used and so URL was not creating properly to render the image.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1855089 13f79535-47bb-0310-9956-ffa450edef68
2019-03-09 06:39:33 +00:00
Deepak Dixit aefe7895ac Applied fix from trunk for revision: 1853904
===

Improved: Updated plugin code to fix console warning related to deprecated method. Removed Double constructor call as its depracated since jdk 9. Also replace the CellType::getCellTypeEnum method call with CellTyoe::getCellType
(OFBIZ-10757)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1854692 13f79535-47bb-0310-9956-ffa450edef68
2019-03-03 10:52:01 +00:00
Deepak Dixit c5a05c83ff Applied fix from trunk for revision: 1854684
===

Preparation for JDK11 update, Updated following code to fix warning with respect to JDK11
- Replaced Class::newInstance occurrences
(OFBIZ-10757)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1854690 13f79535-47bb-0310-9956-ffa450edef68
2019-03-03 10:46:27 +00:00
Jacques Le Roux a331d3dee8 Improved: no functional change
Copies Solr doc from trunk

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1854518 13f79535-47bb-0310-9956-ffa450edef68
2019-02-28 10:31:29 +00:00
Swapnil Mane 96fc00f7d0 Applied fix from trunk for revision: 1852988
===

Fixed: 404 error while creating/updating contact information from the checkout page
(OFBIZ-10827)

Thanks: Ravi Lodhi for reporting the issue and Pawan Verma for providing the patch.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1852990 13f79535-47bb-0310-9956-ffa450edef68
2019-02-05 11:56:38 +00:00
Jacques Le Roux a67d054c35 "Applied fix from plugins for revision: 1851885 "
------------------------------------------------------------------------
r1851885 | jleroux | 2019-01-23 08:14:21 +0100 (mer. 23 janv. 2019) | 10 lignes

Fixed: Implemented: Navigate from a domain to another with automated signed in 
authentication
(OFBIZ-10307)

Non functional change

Removes now useless "webappName" var after I put in the SecuredUserLoginId 
cookies.

Thanks: Michael for spotting it in OFBIZ-10814
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1851887 13f79535-47bb-0310-9956-ffa450edef68
2019-01-23 07:17:11 +00:00
Aditya Sharma c62accc95c Applied fix from trunk for revision: 1851316
===

Improved: Replace Inline js with External js in renderDateFindField macro
(OFBIZ-9850)
Added an example in FormWidgetExamples for the field.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1851318 13f79535-47bb-0310-9956-ffa450edef68
2019-01-15 04:59:33 +00:00
Deepak Dixit 7ffe31bed9 Applied fix from trunk for revision: 1851185
===

Improved: Convert Promotion Screen of e-commerce as per Bootstrap Styling
(OFBIZ-10793)
Thanks  Nitish Mishra for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1851186 13f79535-47bb-0310-9956-ffa450edef68
2019-01-12 19:16:59 +00:00
Deepak Dixit 249ed1b30f Applied fix from trunk for revision: 1851140
===

Fixed:List Request page seems distorted of ecommerce component
(OFBIZ-10621)
Thanks  Garima jain for reporting the issue.
Set the col class based on right/left screen inclusion


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1851142 13f79535-47bb-0310-9956-ffa450edef68
2019-01-12 06:50:54 +00:00
Deepak Dixit 7bf63fad20 Applied fix from trunk for revision: 1851139
===

Only formatting , No function chages
(OFBIZ-10790)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1851141 13f79535-47bb-0310-9956-ffa450edef68
2019-01-12 06:48:31 +00:00
Deepak Dixit dc87292455 Applied fix from trunk for revision: 1851135
===

Improved: Improve ecommerce main-decorator 
(OFBIZ-10790)
Added two new section in ecommerce main-decorator, now we don't need to pass right/left bar screen name, instead we can include it directly in decoratot-section.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1851136 13f79535-47bb-0310-9956-ffa450edef68
2019-01-12 06:16:36 +00:00
Jacques Le Roux 684a5a1220 "Applied fix from plugins for revision: 1851068 "
------------------------------------------------------------------------
r1851068 | jleroux | 2019-01-11 17:12:01 +0100 (ven. 11 janv. 2019) | 12 lignes

Fixed: Add session tracking mode and make cookie secure
(OFBIZ-6655)

Following "Session timeout for webapps" discussion on dev ML 
https://markmail.org/message/p6fbiojjrwb2ybxd

We decided to put back the session-timeout value in web.xml files and to remove
the line
    session.setMaxInactiveInterval(60*60); //in seconds
from ControlEventListener.java

Thanks: Deepak Nigam for report and Girish Vasmatkar for discussion
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1851073 13f79535-47bb-0310-9956-ffa450edef68
2019-01-11 16:15:16 +00:00
Deepak Dixit 2ded55743a Applied fix from trunk for revision: 1851009
===

Improved: Update multifex theme as per new markup 
(OFBIZ-10118)
Thanks Ayushi Rathod, Parakh Maheshwari and Nitish Mishra for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1851010 13f79535-47bb-0310-9956-ffa450edef68
2019-01-11 06:23:45 +00:00
Deepak Dixit b7949d22a8 Applied fix from trunk for revision: 1851002
===

Fixed: Page dropdown list on categorydetail page broken
(OFBIZ-10787)
Thanks Sebastian Wachinger for reporting the issue.
Corrected the condition to display pagination options


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1851004 13f79535-47bb-0310-9956-ffa450edef68
2019-01-11 06:04:35 +00:00
Aditya Sharma f2c26f9d97 Applied fix from trunk for revision: 1850712
===

Improved: Replace jQuery.bind() with jQuery.on()
(OFBIZ-10758)
As of jQuery 3.0, .bind() has been deprecated. It was superseded by the .on() method for attaching event handlers to a document.
Additional change:
Improved boolean returns with single statement, replacing if blocks with explicit boolean return.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1850714 13f79535-47bb-0310-9956-ffa450edef68
2019-01-08 05:25:10 +00:00
Nicolas Malin e029947649 Created feature branch 18.12 for the ofbiz-plugins.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release18.12@1849862 13f79535-47bb-0310-9956-ffa450edef68
2018-12-28 14:37:05 +00:00
2255 changed files with 524957 additions and 18312 deletions
-34
View File
@@ -1,34 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
github:
description: "Apache OFBiz is an open source product for the automation of enterprise processes. It includes framework components and business applications for ERP, CRM, E-Business/E-Commerce, Supply Chain Management and Manufacturing Resource Planning. OFBiz provides a foundation and starting point for reliable, secure and scalable enterprise solutions."
homepage: https://ofbiz.apache.org/
labels:
- ofbiz
- plugins
- xml
- java
- groovy
- javascript
- web-framework
- database
- network-server
- https
- content
- geospatial
notifications:
jobs: notifications@ofbiz.apache.org
+1 -2
View File
@@ -1,2 +1 @@
.DS_Store
bin/
/bin/
-2
View File
@@ -1,2 +0,0 @@
+1 -6
View File
@@ -1,4 +1,4 @@
Apache License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@@ -225,8 +225,3 @@ For details, see:
ecommerce/webapp/ecommerce/js
ecommerce/webapp/ecommerce/css
=========================================================================
This product bundles "swagger-ui", which is available under the
"Apache License Version 2.0".
For details, see rest-api/webapp/docs
+15 -9
View File
@@ -1,14 +1,20 @@
<img src="https://camo.githubusercontent.com/b313d4ec52b77b5024e2988aaf76720258233e69/68747470733a2f2f6f6662697a2e6170616368652e6f72672f696d616765732f6f6662697a5f6c6f676f2e706e67" alt="Apache OFBiz" />
<img src="http://ofbiz.apache.org/images/OFBiz-logo.png" alt="Apache OFBiz" />
# Assetmaint component
The asset management and maintenance application enables organisations to maintain a register of all kinds of assets. It enables them to plan maintenance and keep track of allocations and use. Integrates with the accounting module regarding depreciation bookings.
The asset management and maintenance application enables organisations to
maintain a register of all kinds of assets. It enables them to plan maintenance
and keep track of allocations and use. Integrates with the accounting module
regarding depreciation bookings.
## more information
For more information about this component visit the product page in the OFBiz
WIKI, which can be found at
https://cwiki.apache.org/confluence/display/OFBIZ/Asset+Management
## Features
Asset registration
Maintenance planning
Depreciation calculation and registration
Meter registrations
Allocation registration
## issues
JIRA issues related to this component can be found at
https://issues.apache.org/jira/browse/OFBIZ/component/12311644
## commits
Committed revisions can be viewed at
http://svn.apache.org/viewvc/ofbiz/trunk/plugins/assetmaint/
+20
View File
@@ -155,6 +155,16 @@
<value xml:lang="zh">添加交付明细</value>
<value xml:lang="zh-TW">增加交付細項</value>
</property>
<property key="PageTitleChildWorkEfforts">
<value xml:lang="en">Task Breakdown</value>
<value xml:lang="fr">Décomposition de tâche</value>
<value xml:lang="it">Scoposizione compito</value>
<value xml:lang="ja">タスクブレークダウン</value>
<value xml:lang="th">งานหยุด</value>
<value xml:lang="vi">Phân nhỏ Tác vụ</value>
<value xml:lang="zh">任务分解</value>
<value xml:lang="zh-TW">任務分解</value>
</property>
<property key="PageTitleFindFixedAssetMaints">
<value xml:lang="de">Verwaltungen finden</value>
<value xml:lang="en">Find Maintenances</value>
@@ -166,6 +176,16 @@
<value xml:lang="zh">查找维修保养</value>
<value xml:lang="zh-TW">尋找維修保養</value>
</property>
<property key="PageTitleFindFixedAssets">
<value xml:lang="en">Find Equipments</value>
<value xml:lang="fr">Chercher des équipements</value>
<value xml:lang="it">Ricerca cespite</value>
<value xml:lang="ja">設備を検索</value>
<value xml:lang="th">ค้นหาเครื่องมือ</value>
<value xml:lang="vi">Tìm Thiết bị</value>
<value xml:lang="zh">查找设备</value>
<value xml:lang="zh-TW">尋找設備</value>
</property>
<property key="PageTitleListItemIssuance">
<value xml:lang="en">Parts List</value>
<value xml:lang="fr">Liste des pièces</value>
@@ -28,5 +28,4 @@ under the License.
<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="ASSETMAINTTECH" permissionId="ASSETMAINT_UPDATE"/>
<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="FULLADMIN" permissionId="ASSETMAINT_ADMIN"/>
<SecurityGroupPermission fromDate="2001-01-01 00:00:00.0" groupId="VIEWADMIN" permissionId="ASSETMAINT_VIEW"/>
</entity-engine-xml>
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
<simple-method method-name="testCreateFixedAssetMaintUpdateWorkEffortWithProductMaint" short-description="Test case for service createFixedAssetMaintUpdateWorkEffort with a product Maintenance" login-required="false">
<set field="fixedAssetId" value="DEMO_VEHICLE_01"/>
<set field="serviceCtx.fixedAssetId" from-field="fixedAssetId"/>
<set field="serviceCtx.statusId" value="FAM_CREATED"/>
<set field="serviceCtx.productMaintSeqId" value="seq03"/><!-- Product Maintenance -->
<set field="serviceCtx.intervalMeterTypeId" value="ODOMETER"/>
<set field="serviceCtx.estimatedStartDate" value="2009-12-18 00:00:00.000" type="Timestamp"/>
<set field="serviceCtx.estimatedCompletionDate" value="2009-12-18 01:00:00.000" type="Timestamp"/>
<set field="serviceCtx.actualStartDate" value="2009-12-20 00:00:00.000" type="Timestamp"/>
<entity-one entity-name="UserLogin" value-field="userLogin">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<set field="serviceCtx.userLogin" from-field="userLogin"/>
<call-service service-name="createFixedAssetMaintUpdateWorkEffort" in-map-name="serviceCtx">
<result-to-field result-name="maintHistSeqId"/>
</call-service>
<entity-one entity-name="FixedAssetMaint" value-field="fixedAssetMaint"/>
<get-related-one relation-name="ScheduleWorkEffort" value-field="fixedAssetMaint" to-value-field="workEffort"/>
<assert>
<not><if-empty field="fixedAssetMaint"/></not>
<not><if-empty field="fixedAssetMaint.scheduleWorkEffortId"/></not>
<not><if-empty field="workEffort"/></not>
<if-compare-field field="workEffort.estimatedStartDate" operator="equals" to-field="serviceCtx.estimatedStartDate"/>
<if-compare-field field="workEffort.estimatedCompletionDate" operator="equals" to-field="serviceCtx.estimatedCompletionDate"/>
<if-compare-field field="workEffort.actualStartDate" operator="equals" to-field="serviceCtx.actualStartDate"/>
</assert>
<check-errors/>
</simple-method>
<simple-method method-name="testCreateFixedAssetMaintUpdateWorkEffortWithoutProductMaint" short-description="Test case for service createFixedAssetMaintUpdateWorkEffort without a product maintenance" login-required="false">
<set field="fixedAssetId" value="DEMO_VEHICLE_01"/>
<set field="serviceCtx.fixedAssetId" from-field="fixedAssetId"/>
<set field="serviceCtx.statusId" value="FAM_CREATED"/>
<set field="serviceCtx.productMaintTypeId" value="OIL_CHANGE"/>
<set field="serviceCtx.intervalMeterTypeId" value="ODOMETER"/>
<set field="serviceCtx.estimatedStartDate" value="2009-12-18 00:00:00.000" type="Timestamp"/>
<set field="serviceCtx.estimatedCompletionDate" value="2009-12-18 01:00:00.000" type="Timestamp"/>
<set field="serviceCtx.actualStartDate" value="2009-12-20 00:00:00.000" type="Timestamp"/>
<entity-one entity-name="UserLogin" value-field="userLogin">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<set field="serviceCtx.userLogin" from-field="userLogin"/>
<call-service service-name="createFixedAssetMaintUpdateWorkEffort" in-map-name="serviceCtx">
<result-to-field result-name="maintHistSeqId"/>
</call-service>
<entity-one entity-name="FixedAssetMaint" value-field="fixedAssetMaint">
<field-map field-name="fixedAssetId"/>
<field-map field-name="maintHistSeqId"/>
</entity-one>
<get-related-one relation-name="ScheduleWorkEffort" value-field="fixedAssetMaint" to-value-field="workEffort"/>
<assert>
<not><if-empty field="fixedAssetMaint"/></not>
<not><if-empty field="fixedAssetMaint.scheduleWorkEffortId"/></not>
<not><if-empty field="workEffort"/></not>
<if-compare-field field="workEffort.estimatedStartDate" operator="equals" to-field="serviceCtx.estimatedStartDate"/>
<if-compare-field field="workEffort.estimatedCompletionDate" operator="equals" to-field="serviceCtx.estimatedCompletionDate"/>
<if-compare-field field="workEffort.actualStartDate" operator="equals" to-field="serviceCtx.actualStartDate"/>
</assert>
<check-errors/>
</simple-method>
<simple-method method-name="testUpdateFixedAssetMaintAndWorkEffort" short-description="Test case for service updateFixedAssetMaintAndWorkEffort" login-required="false">
<set field="fixedAssetId" value="DEMO_VEHICLE_01"/>
<set field="maintHistSeqId" value="00001"/><!-- Sequence created by testCreateFixedAssetMaintUpdateWorkEffortWithProductMaint -->
<set field="serviceCtx.fixedAssetId" from-field="fixedAssetId"/>
<set field="serviceCtx.maintHistSeqId" from-field="maintHistSeqId"/>
<set field="serviceCtx.estimatedCompletionDate" value="2009-12-22 01:00:00.000" type="Timestamp"/><!-- Changed estimatedCompletionDate to test update service -->
<entity-one entity-name="FixedAssetMaint" value-field="fixedAssetMaint"/>
<set field="serviceCtx.workEffortId" from-field="fixedAssetMaint.scheduleWorkEffortId"/>
<entity-one entity-name="UserLogin" value-field="userLogin">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<set field="serviceCtx.userLogin" from-field="userLogin"/>
<call-service service-name="updateFixedAssetMaintAndWorkEffort" in-map-name="serviceCtx"/>
<clear-field field="fixedAssetMaint"/>
<entity-one entity-name="FixedAssetMaint" value-field="fixedAssetMaint"/>
<get-related-one relation-name="ScheduleWorkEffort" value-field="fixedAssetMaint" to-value-field="workEffort"/>
<assert>
<not><if-empty field="fixedAssetMaint"/></not>
<not><if-empty field="fixedAssetMaint.scheduleWorkEffortId"/></not>
<not><if-empty field="workEffort"/></not>
<if-compare-field field="workEffort.estimatedCompletionDate" operator="equals" to-field="serviceCtx.estimatedCompletionDate"/>
</assert>
<check-errors/>
</simple-method>
<simple-method method-name="testUpdateFixedAssetMaintAndWorkEffortComplete" short-description="Test case for service updateFixedAssetMaintAndWorkEffort" login-required="false">
<entity-one entity-name="FixedAssetMaint" value-field="fixedAssetMaint">
<field-map field-name="fixedAssetId" value="DEMO_VEHICLE_01"/>
<field-map field-name="maintHistSeqId" value="00001"/>
</entity-one>
<set field="serviceInMap.fixedAssetId" from-field="fixedAssetMaint.fixedAssetId"/>
<set field="serviceInMap.maintHistSeqId" from-field="fixedAssetMaint.maintHistSeqId"/>
<set field="serviceInMap.scheduleWorkEffortId" from-field="fixedAssetMaint.scheduleWorkEffortId"/>
<set field="serviceInMap.statusId" value="FAM_COMPLETED"/>
<now-timestamp field="nowTimestamp"/>
<set field="serviceInMap.actualCompletionDate" from-field="nowTimestamp"/>
<entity-one entity-name="UserLogin" value-field="userLogin">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<set field="serviceInMap.userLogin" from-field="userLogin"/>
<call-service service-name="updateFixedAssetMaintAndWorkEffort" in-map-name="serviceInMap"/>
<entity-one entity-name="FixedAssetMaint" value-field="newFixedAssetMaint">
<field-map field-name="fixedAssetId" value="DEMO_VEHICLE_01"/>
<field-map field-name="maintHistSeqId" value="00001"/>
</entity-one>
<assert>
<if-compare field="newFixedAssetMaint.statusId" operator="equals" value="FAM_COMPLETED"/>
</assert>
<check-errors/>
<entity-one entity-name="WorkEffort" value-field="workEffort">
<field-map field-name="workEffortId" from-field="fixedAssetMaint.scheduleWorkEffortId"/>
</entity-one>
<assert>
<if-compare field="workEffort.currentStatusId" operator="equals" value="CAL_COMPLETED"/>
<if-compare-field field="workEffort.actualCompletionDate" operator="equals" to-field="nowTimestamp" type="Timestamp"/>
</assert>
<check-errors/>
</simple-method>
</simple-methods>
+4 -4
View File
@@ -44,7 +44,7 @@
position="19"
server="default-server"
location="webapp/assetmaint"
base-permission="OFBTOOLS,ASSETMAINT"
base-permission="ASSETMAINT"
mount-point="/assetmaint"
app-bar-display="true"/>
@@ -52,9 +52,9 @@
title="IS Mgr"
position="20"
server="default-server"
app-bar-display="false"
location="webapp/ismgr"
base-permission="OFBTOOLS,ASSETMAINT"
mount-point="/ismgr"
app-bar-display="true"/>
base-permission="ASSETMAINT"
mount-point="/ismgr"/>
</ofbiz-component>
-23
View File
@@ -1,23 +0,0 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
= Asset Maintenance plugin
Assets are items of value that are owned by the business.
The Asset Maintenance application is used to schedule and trace all maintenance activities on assets.
@@ -1,147 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ofbiz.assetmaint.test
import java.sql.Timestamp
import java.text.SimpleDateFormat
import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.service.testtools.OFBizTestCase
class FixedAssetMaintTests extends OFBizTestCase {
public FixedAssetMaintTests(String name) {
super(name)
}
void testCreateFixedAssetMaintUpdateWorkEffortWithProductMaint() {
// Test case for service createFixedAssetMaintUpdateWorkEffort with a product Maintenance
String fixedAssetId = "DEMO_VEHICLE_01"
Map serviceCtx = [:]
serviceCtx.fixedAssetId = fixedAssetId
serviceCtx.statusId = "FAM_CREATED"
serviceCtx.productMaintSeqId = "seq03" // product maintenance
serviceCtx.intervalMeterTypeId = "ODOMETER"
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
String estimatedStartDate = "2009-12-18 00:00:00.000"
serviceCtx.estimatedStartDate = new Timestamp(sdf.parse(estimatedStartDate).getTime())
String estimatedCompletionDate = "2009-12-18 01:00:00.000"
serviceCtx.estimatedCompletionDate = new Timestamp(sdf.parse(estimatedCompletionDate).getTime())
String actualStartDate = "2009-12-20 00:00:00.000"
serviceCtx.actualStartDate = new Timestamp(sdf.parse(actualStartDate).getTime())
serviceCtx.userLogin = userLogin
Map serviceResult = dispatcher.runSync('createFixedAssetMaintUpdateWorkEffort', serviceCtx)
String maintHistSeqId = serviceResult.maintHistSeqId
GenericValue fixedAssetMaint = from("FixedAssetMaint").where("fixedAssetId", fixedAssetId).queryFirst()
GenericValue workEffort = from("WorkEffort").where("workEffortId", fixedAssetMaint.scheduleWorkEffortId).queryOne()
assert fixedAssetMaint
assert fixedAssetMaint.scheduleWorkEffortId
assert workEffort
assert workEffort.estimatedStartDate == serviceCtx.estimatedStartDate
assert workEffort.estimatedCompletionDate == serviceCtx.estimatedCompletionDate
assert workEffort.actualStartDate == serviceCtx.actualStartDate
}
void testCreateFixedAssetMaintUpdateWorkEffortWithoutProductMaint() {
// Test case for service createFixedAssetMaintUpdateWorkEffort without a product maintenance
String fixedAssetId = "DEMO_VEHICLE_01"
Map serviceCtx = [:]
serviceCtx.fixedAssetId = fixedAssetId
serviceCtx.statusId = "FAM_CREATED"
serviceCtx.productMaintTypeId = "OIL_CHANGE"
serviceCtx.intervalMeterTypeId = "ODOMETER"
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
String estimatedStartDate = "2009-12-18 00:00:00.000"
serviceCtx.estimatedStartDate = new Timestamp(sdf.parse(estimatedStartDate).getTime())
String estimatedCompletionDate = "2009-12-18 01:00:00.000"
serviceCtx.estimatedCompletionDate = new Timestamp(sdf.parse(estimatedCompletionDate).getTime())
String actualStartDate = "2009-12-20 00:00:00.000"
serviceCtx.actualStartDate = new Timestamp(sdf.parse(actualStartDate).getTime())
serviceCtx.userLogin = userLogin
Map serviceResult = dispatcher.runSync('createFixedAssetMaintUpdateWorkEffort', serviceCtx)
String maintHistSeqId = serviceResult.maintHistSeqId
GenericValue fixedAssetMaint = from("FixedAssetMaint").where("fixedAssetId", fixedAssetId, "maintHistSeqId", maintHistSeqId).queryOne()
GenericValue workEffort = from("WorkEffort").where("workEffortId", fixedAssetMaint.scheduleWorkEffortId).queryOne()
assert fixedAssetMaint
assert fixedAssetMaint.scheduleWorkEffortId
assert workEffort
assert workEffort.estimatedStartDate == serviceCtx.estimatedStartDate
assert workEffort.estimatedCompletionDate == serviceCtx.estimatedCompletionDate
assert workEffort.actualStartDate == serviceCtx.actualStartDate
}
void testUpdateFixedAssetMaintAndWorkEffort() {
// Test case for service updateFixedAssetMaintAndWorkEffort
String fixedAssetId = "DEMO_VEHICLE_01"
String maintHistSeqId = "00001" // Sequence created by testCreateFixedAssetMaintUpdateWorkEffortWithProductMaint
Map serviceCtx = [:]
serviceCtx.fixedAssetId = fixedAssetId
serviceCtx.maintHistSeqId = maintHistSeqId
serviceCtx.statusId = "FAM_CREATED"
serviceCtx.productMaintTypeId = "OIL_CHANGE"
serviceCtx.intervalMeterTypeId = "ODOMETER"
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
String estimatedCompletionDate = "2009-12-22 01:00:00.000" // Changed estimatedCompletionDate to test update service
serviceCtx.estimatedCompletionDate = new Timestamp(sdf.parse(estimatedCompletionDate).getTime())
GenericValue fixedAssetMaint = from("FixedAssetMaint").where("fixedAssetId", fixedAssetId).queryFirst()
serviceCtx.workEffortId = fixedAssetMaint.scheduleWorkEffortId
serviceCtx.userLogin = userLogin
Map serviceResult = dispatcher.runSync('updateFixedAssetMaintAndWorkEffort', serviceCtx)
GenericValue workEffort = from("WorkEffort").where("workEffortId", fixedAssetMaint.scheduleWorkEffortId).queryOne()
assert fixedAssetMaint
assert fixedAssetMaint.scheduleWorkEffortId
assert workEffort
assert workEffort.estimatedCompletionDate == serviceCtx.estimatedCompletionDate
}
void testUpdateFixedAssetMaintAndWorkEffortComplete() {
// Test case for service updateFixedAssetMaintAndWorkEffort
GenericValue fixedAssetMaint = from("FixedAssetMaint").where("fixedAssetId", "DEMO_VEHICLE_01", "maintHistSeqId", "00001").queryOne()
Map serviceCtx = [:]
serviceCtx.fixedAssetId = fixedAssetMaint.fixedAssetId
serviceCtx.maintHistSeqId = fixedAssetMaint.maintHistSeqId
serviceCtx.scheduleWorkEffortId = fixedAssetMaint.scheduleWorkEffortId
serviceCtx.statusId = "FAM_COMPLETED"
serviceCtx.actualCompletionDate = UtilDateTime.nowTimestamp()
serviceCtx.userLogin = userLogin
Map serviceResult = dispatcher.runSync('updateFixedAssetMaintAndWorkEffort', serviceCtx)
GenericValue newFixedAssetMaint = from("FixedAssetMaint").where("fixedAssetId", "DEMO_VEHICLE_01", "maintHistSeqId", "00001").queryOne()
assert newFixedAssetMaint.statusId == "FAM_COMPLETED"
GenericValue workEffort = from("WorkEffort").where("workEffortId", fixedAssetMaint.scheduleWorkEffortId).queryOne()
assert workEffort.currentStatusId == "CAL_COMPLETED"
assert workEffort.actualCompletionDate == serviceCtx.actualCompletionDate
}
}
@@ -43,33 +43,31 @@ import org.apache.ofbiz.service.ServiceUtil;
public class FixedAssetMaintServices {
private static final String MODULE = FixedAssetMaintServices.class.getName();
private static final String RESOURCE = "AssetMaintUiLabels";
public static final String module = FixedAssetMaintServices.class.getName();
public static final String resource = "AssetMaintUiLabels";
public static Map<String, Object> addPartFixedAssetMaint(DispatchContext ctx, Map<String, Object> context) {
LocalDispatcher dispatcher = ctx.getDispatcher();
Delegator delegator = ctx.getDelegator();
Locale locale = (Locale) context.get("locale");
String fixedAssetId = (String) context.get("fixedAssetId");
String maintHistSeqId = (String) context.get("maintHistSeqId");
String productId = (String) context.get("productId");
String facilityId = (String) context.get("facilityId");
Double quantity = (Double) context.get("quantity");
String fixedAssetId = (String)context.get("fixedAssetId");
String maintHistSeqId = (String)context.get("maintHistSeqId");
String productId = (String)context.get("productId");
String facilityId = (String)context.get("facilityId");
Double quantity = (Double)context.get("quantity");
double requestedQty = quantity;
try {
GenericValue product = ProductWorker.findProduct(delegator, productId);
if (product == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AssetMaintInvalidPartProductIdError", UtilMisc.toMap(
"productId", productId), locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AssetMaintInvalidPartProductIdError", UtilMisc.toMap("productId", productId), locale));
}
Map<String, ? extends Object> findCurrInventoryParams = UtilMisc.toMap("productId", productId, "facilityId", facilityId);
Map<String, ? extends Object> findCurrInventoryParams = UtilMisc.toMap("productId", productId, "facilityId", facilityId);
GenericValue userLogin = (GenericValue) context.get("userLogin");
// Call issuance service
Map<String, Object> result = dispatcher.runSync("getInventoryAvailableByFacility", findCurrInventoryParams);
if (ServiceUtil.isError(result)) {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AssetMaintProblemGettingInventoryLevel", locale) + productId,
null, null, result);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AssetMaintProblemGettingInventoryLevel", locale) + productId , null, null, result);
}
Object atpObj = result.get("availableToPromiseTotal");
double atp = 0.0;
@@ -77,16 +75,14 @@ public class FixedAssetMaintServices {
atp = Double.parseDouble(atpObj.toString());
}
if (requestedQty > atp) {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AssetMaintLowPartInventoryError", UtilMisc.toMap("productId",
productId, "quantity", Double.toString(atp)), locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AssetMaintLowPartInventoryError", UtilMisc.toMap("productId", productId , "quantity", Double.toString(atp)), locale));
}
EntityConditionList<EntityExpr> ecl = EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId),
EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.GREATER_THAN, "0")),
EntityOperator.AND);
List<GenericValue> inventoryItems = EntityQuery.use(delegator).from("InventoryItem").where(ecl).queryList(); //&& inventoryItems.size
// () > 0
List<GenericValue> inventoryItems = EntityQuery.use(delegator).from("InventoryItem").where(ecl).queryList(); //&& inventoryItems.size() > 0
Iterator<GenericValue> itr = inventoryItems.iterator();
while (requestedQty > 0 && itr.hasNext()) {
GenericValue inventoryItem = itr.next();
@@ -99,25 +95,24 @@ public class FixedAssetMaintServices {
} else {
issueQuantity = requestedQty;
}
Map<String, Object> itemIssuanceCtx = new HashMap<>();
Map<String, Object> itemIssuanceCtx = new HashMap<String, Object>();
itemIssuanceCtx.put("userLogin", userLogin);
itemIssuanceCtx.put("inventoryItemId", inventoryItemId);
itemIssuanceCtx.put("fixedAssetId", fixedAssetId);
itemIssuanceCtx.put("maintHistSeqId", maintHistSeqId);
itemIssuanceCtx.put("quantity", issueQuantity);
// Call issuance service
result = dispatcher.runSync("issueInventoryItemToFixedAssetMaint", itemIssuanceCtx);
result = dispatcher.runSync("issueInventoryItemToFixedAssetMaint",itemIssuanceCtx);
if (ServiceUtil.isError(result)) {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AssetMaintProblemCallingService", locale), null, null,
result);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AssetMaintProblemCallingService", locale), null, null, result);
}
requestedQty = requestedQty - issueQuantity;
}
} catch (GenericEntityException e) {
Debug.logError("Problem in retriving data from database", MODULE);
Debug.logError("Problem in retriving data from database", module);
} catch (GenericServiceException e) {
Debug.logError("Problem in calling service issueInventoryItemToFixedAssetMaint", MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AssetMaintProblemCallingService", locale));
Debug.logError("Problem in calling service issueInventoryItemToFixedAssetMaint", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AssetMaintProblemCallingService", locale));
}
return ServiceUtil.returnSuccess();
}
@@ -222,7 +222,8 @@ under the License.
<#list notes as note>
<fo:table-row>
<fo:table-cell>
<fo:block>Author : ${Static["org.apache.ofbiz.party.party.PartyHelper"].getPartyName(delegator, note.noteParty, true)}</fo:block>
<fo:block>Author : ${Static[
"org.apache.ofbiz.party.party.PartyHelper"].getPartyName(delegator, note.noteParty, true)}</fo:block>
<fo:block>Date : ${note.noteDateTime?string.short}</fo:block>
<#escape x as x?html>
<fo:block>${note.noteInfo!}</fo:block>
+2 -1
View File
@@ -23,6 +23,7 @@
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
<test-case case-name="assetmaint-tests">
<junit-test-suite class-name="org.apache.ofbiz.assetmaint.test.FixedAssetMaintTests"/>
<simple-method-test location="component://assetmaint/minilang/test/FixedAssetMaintTests.xml"/>
</test-case>
</test-suite>
@@ -112,6 +112,10 @@
<url-pattern>/control/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
@@ -0,0 +1,53 @@
<%--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--%>
<%@ page import="org.apache.ofbiz.base.util.*" %>
<html>
<head>
<title>OFBiz Message</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
<body bgcolor="#FFFFFF">
<div align="center">
<br/>
<table width="100%" border="1" height="200">
<tr>
<td>
<table width="100%" border="0" height="200">
<tr bgcolor="#CC6666">
<td height="45">
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
</td>
</tr>
<tr>
<td>
<div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div align="center"></div>
</body>
</html>
@@ -0,0 +1,27 @@
<%--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--%>
<html>
<head>
<title>ERROR!</title>
</head>
<body>
<h3>An Error 403 Happened: Access to resource Forbidden</h3>
</body>
</html>
@@ -17,4 +17,11 @@ specific language governing permissions and limitations
under the License.
--%>
<%response.sendRedirect("control/main");%>
<html>
<head>
<title>ERROR!</title>
</head>
<body>
<h3>An Error 404 Happened: Request resource Not Found</h3>
</body>
</html>
+4
View File
@@ -107,6 +107,10 @@
<url-pattern>/control/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
+53
View File
@@ -0,0 +1,53 @@
<%--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--%>
<%@ page import="org.apache.ofbiz.base.util.*" %>
<html>
<head>
<title>OFBiz Message</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
<body bgcolor="#FFFFFF">
<div align="center">
<br/>
<table width="100%" border="1" height="200">
<tr>
<td>
<table width="100%" border="0" height="200">
<tr bgcolor="#CC6666">
<td height="45">
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
</td>
</tr>
<tr>
<td>
<div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div align="center"></div>
</body>
</html>
@@ -0,0 +1,27 @@
<%--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--%>
<html>
<head>
<title>ERROR!</title>
</head>
<body>
<h3>An Error 403 Happened: Access to resource Forbidden</h3>
</body>
</html>
@@ -1,4 +1,4 @@
<#--
<%--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -15,11 +15,13 @@ software distributed under the License is distributed on an
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
{
"requestType": "ReturnTransaction",
"transactionAmount": {
"total": "${amount}",
"currency": "${currency}"
}
}
--%>
<html>
<head>
<title>ERROR!</title>
</head>
<body>
<h3>An Error 404 Happened: Request resource Not Found</h3>
</body>
</html>
+1 -2
View File
@@ -39,7 +39,6 @@ under the License.
<set field="applicationMenuName" value="AssetMaintAppBar" global="true"/>
<set field="applicationMenuLocation" value="component://assetmaint/widget/AssetmaintMenus.xml" global="true"/>
<set field="applicationTitle" from-field="uiLabelMap.AssetMaintApplication"/>
<set field="helpAnchor" from-field="helpAnchor" default-value="_asset_maintenance_plugin"/>
</actions>
<widgets>
<include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/>
@@ -139,6 +138,6 @@ under the License.
</widgets>
</section>
</screen>
</screens>
+2 -2
View File
@@ -60,8 +60,8 @@
<!--<link target="ViewFacilityInventoryByProductSimple" text="${uiLabelMap.CommonPrint}" style="buttontext">
<parameter param-name="facilityId" from-field="facilityId"/>
</link>-->
<link target="ViewFacilityInventoryByProductReport?${searchParameterString}" text="${uiLabelMap.CommonPrint}2" style="buttontext" target-window="_blank"/>
<link target="ViewFacilityInventoryByProductExport?${searchParameterString}" text="${uiLabelMap.CommonExport}2" style="buttontext" target-window="_blank"/>
<link target="ViewFacilityInventoryByProductReport?${searchParameterString}" text="${uiLabelMap.CommonPrint}" style="buttontext"/>
<link target="ViewFacilityInventoryByProductExport?${searchParameterString}" text="${uiLabelMap.CommonExport}" style="buttontext"/>
</container>
<include-form name="FindFacilityInventoryByProduct" location="component://product/widget/facility/FacilityForms.xml"/>
@@ -34,7 +34,6 @@ under the License.
<set field="activeApp" value="ismgr" global="true"/>
<set field="applicationMenuName" value="IsMgrAppBar" global="true"/>
<set field="applicationMenuLocation" value="component://assetmaint/widget/ismgr/Menus.xml" global="true"/>
<set field="helpAnchor" from-field="helpAnchor" default-value="_apache_ofbiz_plugins"/>
<set field="layoutSettings.companyName" from-field="uiLabelMap.IsMgrCompanyName" global="true"/>
<set field="layoutSettings.companySubtitle" from-field="uiLabelMap.IsMgrCompanySubtitle" global="true"/>
<!-- layoutSettings.headerImageUrl can be used to specify an application specific logo; if not set,
-1
View File
@@ -24,7 +24,6 @@ under the License.
<!-- ========================================================= -->
<!-- Dimensions -->
<!-- ========================================================= -->
<entity-group group="org.apache.ofbiz.olap" entity="CountryDimension"/>
<entity-group group="org.apache.ofbiz.olap" entity="CurrencyDimension"/>
<entity-group group="org.apache.ofbiz.olap" entity="DateDimension"/>
<entity-group group="org.apache.ofbiz.olap" entity="ProductDimension"/>
-25
View File
@@ -29,31 +29,6 @@ under the License.
<!-- ========================================================= -->
<!-- Dimensions -->
<!-- ========================================================= -->
<entity entity-name="CountryDimension" package-name="org.apache.ofbiz.bi.dimension" title="Country Dimension">
<description>Country dimension. Based on ISO 3166-1. The natural key is [geoId]</description>
<field name="dimensionId" type="id">
<description>Unique identifier of the Date dimension record</description>
</field>
<field name="geoId" type="id">
<description>The natural key, based on ISO 3166-1 alpha-3</description>
</field>
<field name="geoName" type="name">
<description>The name of the country, based on ISO 3166</description>
</field>
<field name="geoCode" type="short-varchar">
<description>The ISO 3166-1 alpha-2 code of the country</description>
</field>
<field name="abbreviation" type="short-varchar">
<description>Based on the ISO 3166-1 alpha-3 code of the country</description>
</field>
<field name="telCountryCode" type="short-varchar">
<description>The telephone country code. Based on ITU.E123 and ITU.164</description>
</field>
<field name="ccTld" type="short-varchar">
<description>The country code top-level domain for the country. Base on IANA rfc1591</description>
</field>
<prim-key field="dimensionId"/>
</entity>
<entity entity-name="DateDimension" package-name="org.apache.ofbiz.bi.dimension" title="Date Dimension">
<description>Date (days) dimension. The natural key is [dateValue]</description>
<field name="dimensionId" type="id">
-136
View File
@@ -1,136 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityListIterator
import org.apache.ofbiz.service.ModelService
import org.apache.ofbiz.service.ServiceUtil
def quickInitDataWarehouse() {
Map inMap = dispatcher.getDispatchContext().makeValidContext("loadDateDimension", ModelService.IN_PARAM, parameters)
serviceResult = run service: "loadDateDimension", with: inMap
if (!ServiceUtil.isSuccess(serviceResult)) return error(serviceResult.errorMessage)
inMap.clear()
serviceResult = run service: "loadCurrencyDimension", with: inMap
if (!ServiceUtil.isSuccess(serviceResult)) return error(serviceResult.errorMessage)
// loads all products in the ProductDimension
serviceResult = run service: "loadAllProductsInProductDimension", with: inMap
if (!ServiceUtil.isSuccess(serviceResult)) return error(serviceResult.errorMessage)
// loads the invoice items in the SalesInvoiceItemFact fact entity
entryExprs = EntityCondition.makeCondition([
EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, "SALES_INVOICE"),
EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, parameters.fromDate),
EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN_EQUAL_TO, parameters.thruDate)
], EntityOperator.AND)
EntityListIterator listIterator = from("Invoice").where(entryExprs).queryIterator()
GenericValue iterator
while (iterator = listIterator.next()) {
inMap.invoiceId = iterator.invoiceId
serviceResult = run service: "loadSalesInvoiceFact", with: inMap
if (!ServiceUtil.isSuccess(serviceResult)) return error(serviceResult.errorMessage)
}
// loads the order items in the SalesOrderItemFact fact entity
entryExprs = EntityCondition.makeCondition([
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"),
EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, parameters.fromDate),
EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, parameters.thruDate)
], EntityOperator.AND)
listIterator = from("OrderHeader").where(entryExprs).queryIterator()
inMap.clear()
while (iterator = listIterator.next()) {
inMap.orderId = iterator.orderId
serviceResult = run service: "loadSalesOrderFact", with: inMap
if (!ServiceUtil.isSuccess(serviceResult)) return error(serviceResult.errorMessage)
}
// loads the inventory items in the InventoryItemFact fact entity
listIterator = from("InventoryItem").where("inventoryItemTypeId", "NON_SERIAL_INV_ITEM").queryIterator()
inMap.clear()
while (iterator = listIterator.next()) {
inMap.inventoryItemId = iterator.inventoryItemId
serviceResult = run service: "loadInventoryFact", with: inMap
if (!ServiceUtil.isSuccess(serviceResult)) return error(serviceResult.errorMessage)
}
}
def loadCurrencyDimension() {
// Initialize the CurrencyDimension using the update strategy of 'type 1
EntityListIterator listIterator = from("Uom").where("uomTypeId", "CURRENCY_MEASURE").queryIterator()
GenericValue currency
while (currency = listIterator.next()) {
currencyDims = from("CurrencyDimension").where("currencyId", currency.uomId).queryList()
if (currencyDims) {
for (GenericValue currencyDim: currencyDims) {
currencyDim.description = currency.description
currencyDim.store()
}
} else {
currencyDim = makeValue("CurrencyDimension", [dimensionId: currency.uomId])
currencyDim.currencyId = currency.uomId
currencyDim.description = currency.description
currencyDim.create()
}
}
}
def prepareProductDimensionData() {
GenericValue product = from("Product").where("productId", parameters.productId).queryOne()
if (product == null) {
return error(UtilProperties.getMessage('ProductUiLabels', 'ProductProductNotFoundWithProduct', locale))
}
productDimension = makeValue("ProductDimension")
productDimension.setNonPKFields(product)
GenericValue productType = select("description").from("ProductType")
.where("productTypeId", product.productTypeId).cache().queryOne()
productDimension.productType = productType.description
Map result = success()
result.productDimension = productDimension
return result
}
def loadProductInProductDimension() {
Map inMap = dispatcher.getDispatchContext().makeValidContext("prepareProductDimensionData", ModelService.IN_PARAM, parameters)
serviceResult = run service: "prepareProductDimensionData", with: inMap
GenericValue productDimension
if (ServiceUtil.isSuccess(serviceResult)) {
productDimension = serviceResult.productDimension
}
inMap.clear()
inMap = dispatcher.getDispatchContext().makeValidContext("storeGenericDimension", ModelService.IN_PARAM, parameters)
inMap.naturalKeyFields = "productId"
inMap.dimensionValue = productDimension
run service: "storeGenericDimension", with: inMap
}
def loadAllProductsInProductDimension() {
EntityListIterator listIterator = from("Product").queryIterator()
GenericValue product
Map inMap
while (product = listIterator.next()) {
inMap = dispatcher.getDispatchContext().makeValidContext("loadProductInProductDimension", ModelService.IN_PARAM, parameters)
inMap.productId = product.productId
run service: "loadProductInProductDimension", with: inMap
}
}
-664
View File
@@ -1,664 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.sql.Timestamp
import java.text.SimpleDateFormat
import java.sql.Date
import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.base.util.UtilValidate
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.order.order.OrderReadHelper
import org.apache.ofbiz.service.ServiceUtil
def loadSalesInvoiceFact() {
GenericValue invoice = from("Invoice").where(parameters).queryOne()
if (!invoice) {
String errorMessage = UtilProperties.getMessage("AccountingUiLabels", "AccountingInvoiceDoesNotExists", parameters.locale)
logError(errorMessage)
return error(errorMessage)
}
if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) {
Map andConditions = ["invoiceItemTypeId": "INV_FPROD_ITEM"]
List invoiceItems = delegator.getRelated("InvoiceItem", null, null, invoice, false)
for (GenericValue invoiceItem : invoiceItems) {
Map inMap = [invoice: invoice, invoiceItem: invoiceItem]
run service: "loadSalesInvoiceItemFact", with: inMap
}
}
return success()
}
def loadSalesInvoiceItemFact() {
GenericValue invoice = parameters.invoice
GenericValue invoiceItem = parameters.invoiceItem
if (!invoice) {
invoice = from("Invoice").where(parameters).queryOne()
}
if (UtilValidate.isEmpty(invoiceItem)) {
invoiceItem = from("InvoiceItem").where(parameters).queryOne()
}
if (!invoice) {
String errorMessage = UtilProperties.getMessage("AccountingUiLabels", "AccountingInvoiceDoesNotExists", parameters.locale)
logError(errorMessage)
return error(errorMessage)
}
if (!invoiceItem) {
String errorMessage = UtilProperties.getMessage("AccountingUiLabels", "AccountingInvoiceItemDoesNotExists", parameters.locale)
logError(errorMessage)
return error(errorMessage)
}
if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) {
GenericValue fact = from("SalesInvoiceItemFact").where(invoiceId: invoiceItem.invoiceId, invoiceItemSeqId: invoiceItem.invoiceItemSeqId).queryOne()
// key handling
if (!fact) {
Map inMap
Map naturalKeyFields
Map serviceResult
String dimensionId
fact = makeValue("SalesInvoiceItemFact")
fact.invoiceId = invoice.invoiceId
fact.invoiceItemSeqId = invoiceItem.invoiceItemSeqId
// conversion of the invoice date
if (invoice.invoiceDate) {
inMap = [:]
naturalKeyFields = [:]
inMap.dimensionEntityName = "DateDimension"
Date invoiceDate = new Date(invoice.invoiceDate.getTime())
naturalKeyFields.dateValue = invoiceDate
inMap.naturalKeyFields = naturalKeyFields
serviceResult = run service: "getDimensionIdFromNaturalKey", with: inMap
fact.invoiceDateDimId = serviceResult.dimensionId
if (!fact.invoiceDateDimId) {
fact.invoiceDateDimId = "_NF_"
}
} else {
fact.invoiceDateDimId = "_NA_"
}
// conversion of the product id
if (invoiceItem.productId) {
inMap = [:]
naturalKeyFields = [:]
inMap.dimensionEntityName = "ProductDimension"
naturalKeyFields.productId = invoiceItem.productId
inMap.naturalKeyFields = naturalKeyFields
serviceResult = run service: "getDimensionIdFromNaturalKey", with: inMap
fact.productDimId = serviceResult.dimensionId
if (!fact.productDimId) {
fact.productDimId = "_NF_"
}
} else {
fact.productDimId = "_NA_"
}
// conversion of the invoice currency
if (invoice.currencyUomId) {
inMap = [:]
naturalKeyFields = [:]
inMap.dimensionEntityName = "CurrencyDimension"
naturalKeyFields.currencyId = invoice.currencyUomId
inMap.naturalKeyFields = naturalKeyFields
serviceResult = run service: "getDimensionIdFromNaturalKey", with: inMap
fact.origCurrencyDimId = serviceResult.dimensionId
if (!fact.origCurrencyDimId) {
fact.origCurrencyDimId = "_NF_"
}
} else {
fact.origCurrencyDimId = "_NA_"
}
// TODO
fact.orderId = "_NA_"
fact.billToCustomerDimId = "_NA_"
fact.create()
}
/*
* facts handling
*/
fact.quantity = invoiceItem.quantity as BigDecimal
fact.extGrossAmount = 0 as BigDecimal
fact.extDiscountAmount = 0 as BigDecimal
fact.extTaxAmount = 0 as BigDecimal
fact.extNetAmount = 0 as BigDecimal
if (invoiceItem.quantity && invoiceItem.amount) {
fact.extGrossAmount = invoiceItem.quantity * invoiceItem.amount
}
Map andConditions
// taxes
andConditions = [invoiceItemTypeId: "ITM_SALES_TAX"]
List taxes = delegator.getRelated("ChildrenInvoiceItem", null, null, invoiceItem, false)
for (GenericValue tax : taxes) {
if (tax.amount) {
fact.extTaxAmount = fact.extTaxAmount + tax.amount
}
}
// discounts
andConditions = [invoiceItemTypeId: "ITM_PROMOTION_ADJ"]
List discounts = delegator.getRelated("ChildrenInvoiceItem", null, null, invoiceItem, false)
for (GenericValue discount : discounts) {
if (discount.amount) {
fact.extDiscountAmount = fact.extDiscountAmount - discount.amount
}
}
fact.extNetAmount = fact.extGrossAmount - fact.extDiscountAmount
// TODO: prorate invoice header discounts and shipping charges
// TODO: costs
fact.extManFixedCost = 0 as BigDecimal
fact.extManVarCost = 0 as BigDecimal
fact.extStorageCost = 0 as BigDecimal
fact.extDistributionCost = 0 as BigDecimal
BigDecimal costs = fact.extManFixedCost + fact.extManVarCost + fact.extStorageCost + fact.extDistributionCost
fact.contributionAmount = fact.extNetAmount - costs
fact.store()
}
return success()
}
def loadSalesOrderFact() {
GenericValue orderHeader = from("OrderHeader").where(parameters).queryOne()
if (!orderHeader) {
String errorMessage = UtilProperties.getMessage("OrderErrorUiLabels", "OrderOrderIdDoesNotExists", parameters.locale)
logError(errorMessage)
return error(errorMessage)
}
if ("SALES_ORDER".equals(orderHeader.orderTypeId)) {
if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
List orderItems = from("OrderItem")
.where("orderId", orderHeader.orderId, "orderItemTypeId", "PRODUCT_ORDER_ITEM")
.queryList()
for (GenericValue orderItem : orderItems) {
Map inMap = [:]
inMap.orderHeader = orderHeader
inMap.orderItem = orderItem
inMap.orderAdjustment = null
run service: "loadSalesOrderItemFact", with: inMap
}
}
}
return success()
}
def loadSalesOrderItemFact() {
Map inMap
Map naturalKeyFields
Map serviceResult
GenericValue orderHeader = parameters.orderHeader
GenericValue orderItem = parameters.orderItem
GenericValue orderAdjustment = parameters.orderAdjustment
List orderAdjustments
GenericValue orderStatus
if (!orderHeader) {
orderHeader = from("OrderHeader").where(parameters).queryOne()
}
if (!orderItem) {
orderItem = from("OrderItem").where(parameters).queryOne()
}
if (!orderAdjustment) {
orderAdjustments = from("OrderAdjustment").where("orderId": orderItem.orderId).queryList()
}
if (!orderHeader) {
String errorMessage = UtilProperties.getMessage("OrderErrorUiLabels", "OrderOrderIdDoesNotExists", parameters.locale)
logError(errorMessage)
return error(errorMessage)
}
if (!orderItem) {
String errorMessage = UtilProperties.getMessage("OrderErrorUiLabels", "OrderOrderItemIdDoesNotExists", parameters.locale)
logError(errorMessage)
return error(errorMessage)
}
if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
GenericValue fact = from("SalesOrderItemFact").where(orderId: orderItem.orderId, orderItemSeqId: orderItem.orderItemSeqId).queryOne()
// key handling
if (!fact) {
fact = makeValue("SalesOrderItemFact")
fact.orderId = orderHeader.orderId
fact.orderItemSeqId = orderItem.orderItemSeqId
fact.productStoreId = orderHeader.productStoreId
fact.salesChannelEnumId = orderHeader.salesChannelEnumId
fact.statusId = orderItem.statusId
// account
if (orderHeader.productStoreId) {
GenericValue account = from("ProductStore").where(productStoreId: orderHeader.productStoreId).queryOne()
fact.account = account.storeName
}
// pod
if ("EUR".equals(orderHeader.currencyUom)) {
fact.pod = "Latin"
} else {
fact.pod = "Engish"
}
// brand
if (orderHeader.salesChannelEnumId) {
GenericValue brand = from("Enumeration").where(enumId: orderHeader.salesChannelEnumId).queryOne()
fact.brand = brand.description
}
// conversion of the order date
orderStatus = from("OrderStatus")
.where(orderId: orderHeader.orderId, statusId: "ORDER_APPROVED")
.orderBy("-statusDatetime")
.queryFirst()
if (orderStatus.statusDatetime) {
inMap = [:]
naturalKeyFields = [:]
inMap.dimensionEntityName = "DateDimension"
Date statusDatetime = new Date(orderStatus.statusDatetime.getTime())
naturalKeyFields.dateValue = statusDatetime
inMap.naturalKeyFields = naturalKeyFields
serviceResult = run service: "getDimensionIdFromNaturalKey", with: inMap
fact.orderDateDimId = serviceResult.dimensionId
if (!fact.orderDateDimId) {
fact.orderDateDimId = "_NF_"
}
} else {
fact.orderDateDimId = "_NA_"
}
// conversion of the product id
if (UtilValidate.isNotEmpty(orderItem.productId)) {
inMap = [:]
naturalKeyFields = [:]
inMap.dimensionEntityName = "ProductDimension"
naturalKeyFields.productId = orderItem.productId
inMap.naturalKeyFields = naturalKeyFields
serviceResult = run service: "getDimensionIdFromNaturalKey", with: inMap
fact.productDimId = serviceResult.dimensionId
if (!fact.productDimId) {
fact.productDimId = "_NF_"
}
} else {
fact.productDimId = "_NA_"
}
// conversion of the order currency
if (orderHeader.currencyUom) {
inMap = [:]
naturalKeyFields = [:]
inMap.dimensionEntityName = "CurrencyDimension"
naturalKeyFields.currencyId = orderHeader.currencyUom
inMap.naturalKeyFields = naturalKeyFields
serviceResult = run service: "getDimensionIdFromNaturalKey", with: inMap
fact.origCurrencyDimId = serviceResult.dimensionId
if (!fact.origCurrencyDimId) {
fact.origCurrencyDimId = "_NF_"
}
} else {
fact.origCurrencyDimId = "_NA_"
}
// productCategoryId
GenericValue productCategoryMember = from("ProductCategoryMember").where(productId: orderItem.productId, thruDate: null).queryFirst()
if (productCategoryMember) {
fact.productCategoryId = productCategoryMember.productCategoryId
}
// TODO
fact.billToCustomerDimId = "_NA_"
fact.create()
}
/*
* facts handling
*/
Map partyAccountingPreferencesCallMap = [:]
OrderReadHelper orderReadHelper = new OrderReadHelper(orderHeader)
Map billFromParty = orderReadHelper.getBillFromParty()
partyAccountingPreferencesCallMap.organizationPartyId = billFromParty.partyId
Map accountResult = run service:"getPartyAccountingPreferences", with: partyAccountingPreferencesCallMap
GenericValue accPref = accountResult.partyAccountingPreference
fact.quantity = orderItem.quantity as BigDecimal
fact.extGrossAmount = 0 as BigDecimal
fact.extGrossCost = 0 as BigDecimal
fact.extDiscountAmount = 0 as BigDecimal
fact.extNetAmount = 0 as BigDecimal
fact.extShippingAmount = 0 as BigDecimal
fact.extTaxAmount = 0 as BigDecimal
fact.GS = 0 as BigDecimal
fact.GMS = 0 as BigDecimal
fact.GMP = 0 as BigDecimal
fact.GSS = 0 as BigDecimal
fact.GSC = 0 as BigDecimal
fact.GSP = 0 as BigDecimal
fact.GP = 0 as BigDecimal
fact.countOrder = 0 as BigDecimal
// extGrossAmount
Map convertUomCurrencyMap = [:]
convertUomCurrencyMap.uomId = orderHeader.currencyUom
convertUomCurrencyMap.uomIdTo = accPref.baseCurrencyUomId
if (UtilValidate.isNotEmpty(orderStatus)) {
convertUomCurrencyMap.nowDate = orderStatus.statusDatetime
}
Map convertResult = run service: "convertUomCurrency", with: convertUomCurrencyMap
BigDecimal exchangeRate = convertResult.conversionFactor
if (exchangeRate) {
BigDecimal unitPrice = orderItem.unitPrice * exchangeRate
fact.extGrossAmount = fact.quantity * unitPrice
}
// extGrossCost
GenericValue cost = from("SupplierProduct")
.where(productId: orderItem.productId, availableThruDate: null, minimumOrderQuantity: 0 as BigDecimal)
.queryFirst()
if (cost) {
convertUomCurrencyMap.uomId = cost.currencyUomId
convertUomCurrencyMap.uomIdTo = accPref.baseCurrencyUomId
if (orderStatus) {
convertUomCurrencyMap.nowDate = orderStatus.statusDatetime
}
Map grossCostResult = run service: "convertUomCurrency", with: convertUomCurrencyMap
exchangeRate = grossCostResult.conversionFactor
if (exchangeRate) {
BigDecimal costPrice = cost.lastPrice * exchangeRate
fact.extGrossCost = fact.quantity * costPrice
}
}
// extShippingAmount
for (GenericValue shipping : orderAdjustments) {
if ("SHIPPING_CHARGES".equals(shipping.orderAdjustmentTypeId)) {
fact.extShippingAmount = fact.extShippingAmount + shipping.amount
}
}
// extTaxAmount
for (GenericValue tax : orderAdjustments) {
if ("SALES_TAX".equals(tax.orderAdjustmentTypeId)) {
fact.extTaxAmount = fact.extTaxAmount + tax.amount
}
}
// extDiscountAmount
for (GenericValue discount : orderAdjustments) {
if ("PROMOTION_ADJUSTMENT".equals(discount.orderAdjustmentTypeId)) {
fact.extDiscountAmount = fact.extDiscountAmount + discount.amount
// product promo code
GenericValue productPromoCode = from("ProductPromoCode").where(productPromoId: discount.productPromoId).queryFirst()
if (productPromoCode) {
fact.productPromoCode = productPromoCode.productPromoCodeId
} else {
fact.productPromoCode = "Not require code"
}
}
}
// extNetAmount
fact.extNetAmount = fact.extGrossAmount - fact.extDiscountAmount
// GS
BigDecimal countGS = 0 as BigDecimal
List checkGSList = from("SalesOrderItemFact").where(orderId: orderHeader.orderId).queryList()
for (GenericValue checkGS : checkGSList) {
if (checkGS.GS) {
if (0 != checkGS.GS) {
countGS = 1
}
}
}
if (countGS == 0) {
convertUomCurrencyMap.uomId = orderHeader.currencyUom
convertUomCurrencyMap.uomIdTo = accPref.baseCurrencyUomId
if (orderStatus) {
convertUomCurrencyMap.nowDate = orderStatus.statusDatetime
}
Map GSResult = run service: "convertUomCurrency", with: convertUomCurrencyMap
exchangeRate = GSResult.conversionFactor
if (exchangeRate) {
fact.GS = orderHeader.grandTotal * exchangeRate
}
}
// GMS
fact.GMS = fact.GMS + fact.extGrossAmount
// GMP
fact.GMP = fact.GMS - fact.extGrossCost
// GSP
BigDecimal countGSP = 0 as BigDecimal
List checkGSPList = from("SalesOrderItemFact").where(orderId: orderHeader.orderId).queryList()
for (GenericValue checkGSP : checkGSPList) {
if (checkGSP.GSP) {
if (checkGSP.GSP != 0) {
countGSP = 1
}
}
}
if (countGSP == 0) {
List orderItemList = from("OrderItem").where(orderId: orderHeader.orderId).queryList()
BigDecimal warrantyPrice = 0 as BigDecimal
for (GenericValue warranty : orderAdjustments) {
if ("WARRANTY_ADJUSTMENT".equals(warranty.orderAdjustmentTypeId)) {
warrantyPrice = warrantyPrice + warranty.amount
}
}
BigDecimal GSS = fact.extShippingAmount + warrantyPrice
convertUomCurrencyMap.uomId = orderHeader.currencyUom
convertUomCurrencyMap.uomIdTo = accPref.baseCurrencyUomId
if (orderStatus) {
convertUomCurrencyMap.nowDate = orderStatus.statusDatetime
}
Map GSPResult = run service: "convertUomCurrency", with: convertUomCurrencyMap
exchangeRate = GSPResult.conversionFactor
if (exchangeRate) {
GSS = GSS * exchangeRate
}
fact.GSS = GSS
fact.GSP = GSS as BigDecimal
}
// GP
fact.GP = fact.GMP + fact.GSP
// countOrder
BigDecimal countOrder = 0 as BigDecimal
List checkCountOrderList = from("SalesOrderItemFact").where(orderId: orderHeader.orderId).queryList()
for (GenericValue checkCountOrder : checkCountOrderList) {
if (checkCountOrder.countOrder) {
if (checkCountOrder.countOrder != 0) {
countOrder = 1
}
}
}
if (countOrder == 0) {
fact.countOrder = 1 as BigDecimal
}
fact.store()
}
return success()
}
/**
* Load Sales Order Data Daily
*/
def loadSalesOrderDataDaily() {
Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
Date nowDate = new Date(nowTimestamp.getTime())
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 07:00:00.000")
def today = sdf.format(nowDate)
Date yesterdayDate = new Date(nowTimestamp.getTime()-86400000)
def yesterday = sdf.format(yesterdayDate)
Map inMap = [:]
inMap.fromDate = yesterday
inMap.thruDate = today
run service: "importSalesOrderData", with: inMap
return success()
}
/**
* Import Sales Order Data
*/
def importSalesOrderData() {
Map inMap = [fromDate: parameters.fromDate, thruDate: parameters.thruDate]
Map res = run service:"loadDateDimension", with: inMap
if (!ServiceUtil.isSuccess(res)) {
return res
}
EntityCondition condition = EntityCondition.makeCondition(
EntityCondition.makeCondition("statusId", "ORDER_APPROVED"),
EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, parameters.fromDate),
EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN, parameters.thruDate)
)
List orderStatusList = from("OrderStatus").where(condition).queryList()
for (GenericValue orderHeader : orderStatusList) {
inMap =[:]
inMap.orderId = orderHeader.orderId
res = run service:"loadSalesOrderFact", with: inMap
if (!ServiceUtil.isSuccess(res)) {
return res
}
}
return success()
}
/**
* Convert Uom Currency from UomConversionDated entity
*/
def convertUomCurrency() {
if (!parameters.nowDate) {
Timestamp now = UtilDateTime.nowTimestamp()
parameters.nowDate = now
}
Map result = success()
EntityCondition condition = EntityCondition.makeCondition(
EntityCondition.makeCondition("uomId", parameters.uomId),
EntityCondition.makeCondition("uomIdTo", parameters.uomIdTo),
EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, parameters.nowDate),
EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, parameters.nowDate)
)
GenericValue UomConversion = from("UomConversionDated").where(condition).orderBy("-fromDate").queryFirst()
if (UomConversion) {
result.conversionFactor = UomConversion.conversionFactor
} else {
GenericValue UomConversionLastest = from("UomConversionDated")
.where(uomId: parameters.uomId, uomIdTo: parameters.uomIdTo, thruDate: null)
.queryFirst()
if (UomConversionLastest) {
result.conversionFactor = UomConversionLastest.conversionFactor
}
}
return result
}
def loadInventoryFact() {
GenericValue inventory = from("InventoryItem").where(inventoryItemId: parameters.inventoryItemId).queryOne()
GenericValue fact = from("InventoryItemFact").where(inventoryItemId: parameters.inventoryItemId).queryOne()
Map inMap = [:]
Map naturalKeyFields = [:]
Map serviceResult
if (!fact) {
fact = makeValue("InventoryItemFact")
fact.inventoryItemId = inventory.inventoryItemId
// conversion of the inventory date
if (inventory?.createdStamp) {
inMap = [:]
naturalKeyFields = [:]
inMap.dimensionEntityName = "DateDimension"
Date createdStampDatetime = new Date(inventory.createdStamp.getTime())
naturalKeyFields.dateValue = createdStampDatetime
inMap.naturalKeyFields = naturalKeyFields
serviceResult = run service:"getDimensionIdFromNaturalKey", with: inMap
fact.inventoryDateDimId = serviceResult.dimensionId
if (!fact.inventoryDateDimId) {
fact.inventoryDateDimId = "_NF_"
}
} else {
fact.inventoryDateDimId = "_NA_"
}
// conversion of the productId
if (inventory?.productId) {
inMap = [:]
naturalKeyFields = [:]
inMap.dimensionEntityName = "ProductDimension"
naturalKeyFields.productId = inventory.productId
inMap.naturalKeyFields = naturalKeyFields
serviceResult = run service:"getDimensionIdFromNaturalKey", with: inMap
fact.productDimId = serviceResult.dimensionId
if (!fact.productDimId) {
fact.productDimId = "_NF_"
}
} else {
fact.productDimId = "_NA_"
}
// conversion of the order currency
if (inventory?.currencyUomId) {
inMap =[:]
naturalKeyFields = [:]
inMap.dimensionEntityName = "CurrencyDimension"
naturalKeyFields.currencyId = inventory.currencyUomId
inMap.naturalKeyFields = naturalKeyFields
serviceResult = run service:"getDimensionIdFromNaturalKey", with: inMap
fact.origCurrencyDimId = serviceResult.dimensionId
if (!fact.origCurrencyDimId) {
fact.origCurrencyDimId = "_NF_"
}
} else {
fact.origCurrencyDimId = "_NA_"
}
fact.create()
}
fact.facilityId = inventory.facilityId
fact.inventoryItemId = inventory.inventoryItemId
fact.quantityOnHandTotal = inventory.quantityOnHandTotal
fact.availableToPromiseTotal = inventory.availableToPromiseTotal
fact.unitCost = inventory.unitCost
// calculate sold out amount
fact.soldoutAmount = inventory.quantityOnHandTotal - inventory.availableToPromiseTotal
fact.store()
return success()
}
+142
View File
@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
<simple-method method-name="quickInitDataWarehouse" short-description="">
<set-service-fields service-name="loadDateDimension" map="parameters" to-map="inMap"/>
<call-service service-name="loadDateDimension" in-map-name="inMap"/>
<check-errors/>
<clear-field field="inMap"/>
<call-service service-name="loadCurrencyDimension" in-map-name="inMap"/>
<check-errors/>
<!-- loads all products in the ProductDimension -->
<clear-field field="inMap"/>
<call-service service-name="loadAllProductsInProductDimension" in-map-name="inMap"/>
<check-errors/>
<!-- loads the invoice items in the SalesInvoiceItemFact fact entity -->
<entity-condition entity-name="Invoice" list="invoices">
<condition-list>
<condition-expr field-name="invoiceTypeId" value="SALES_INVOICE"/>
<condition-expr field-name="invoiceDate" operator="greater-equals" from-field="parameters.fromDate"/>
<condition-expr field-name="invoiceDate" operator="less-equals" from-field="parameters.thruDate"/>
</condition-list>
</entity-condition>
<iterate list="invoices" entry="invoice">
<clear-field field="inMap"/>
<set field="inMap.invoiceId" from-field="invoice.invoiceId"/>
<call-service service-name="loadSalesInvoiceFact" in-map-name="inMap"/>
<check-errors/>
</iterate>
<!-- loads the order items in the SalesOrderItemFact fact entity -->
<entity-condition entity-name="OrderHeader" list="orderHeaders">
<condition-list>
<condition-expr field-name="orderTypeId" value="SALES_ORDER"/>
<condition-expr field-name="orderDate" operator="greater-equals" from-field="parameters.fromDate"/>
<condition-expr field-name="orderDate" operator="less-equals" from-field="parameters.thruDate"/>
</condition-list>
</entity-condition>
<iterate list="orderHeaders" entry="orderHeader">
<clear-field field="inMap"/>
<set field="inMap.orderId" from-field="orderHeader.orderId"/>
<call-service service-name="loadSalesOrderFact" in-map-name="inMap"></call-service>
<check-errors/>
</iterate>
<!-- loads the inventory items in the InventoryItemFact fact entity -->
<entity-condition entity-name="InventoryItem" list="inventoryItems">
<condition-expr field-name="inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM"/>
</entity-condition>
<iterate list="inventoryItems" entry="inventoryItem">
<clear-field field="inventMap"/>
<set field="inventMap.inventoryItemId" from-field="inventoryItem.inventoryItemId"/>
<call-service service-name="loadInventoryFact" in-map-name="inventMap"></call-service>
<check-errors/>
</iterate>
</simple-method>
<simple-method method-name="loadCurrencyDimension" short-description="Initialize the CurrencyDimension using the update strategy of 'type 1'">
<entity-and entity-name="Uom" list="currencies">
<field-map field-name="uomTypeId" value="CURRENCY_MEASURE"/>
</entity-and>
<iterate list="currencies" entry="currency">
<entity-and entity-name="CurrencyDimension" list="currencyDims">
<field-map field-name="currencyId" from-field="currency.uomId"/>
</entity-and>
<if-not-empty field="currencyDims">
<iterate list="currencyDims" entry="currencyDim">
<set field="currencyDim.description" from-field="currency.description"/>
<store-value value-field="currencyDim"/>
</iterate>
<else>
<make-value entity-name="CurrencyDimension" value-field="currencyDim"/>
<sequenced-id sequence-name="CurrencyDimension" field="currencyDim.dimensionId"/>
<set field="currencyDim.currencyId" from-field="currency.uomId"/>
<set field="currencyDim.description" from-field="currency.description"/>
<create-value value-field="currencyDim"/>
</else>
</if-not-empty>
</iterate>
</simple-method>
<simple-method method-name="prepareProductDimensionData" short-description="">
<entity-one entity-name="Product" value-field="product"/>
<if-empty field="product">
<add-error>
<fail-property resource="ProductUiLabels" property="ProductProductNotFoundWithProduct"/>
</add-error>
</if-empty>
<check-errors/>
<make-value entity-name="ProductDimension" value-field="productDimension"/>
<set-nonpk-fields map="product" value-field="productDimension"/>
<get-related-one value-field="product" relation-name="ProductType" to-value-field="productType"/>
<set field="productDimension.productType" from-field="productType.description"/>
<field-to-result field="productDimension"/>
</simple-method>
<simple-method method-name="loadProductInProductDimension" short-description="">
<set-service-fields service-name="prepareProductDimensionData" map="parameters" to-map="inMap"/>
<call-service service-name="prepareProductDimensionData" in-map-name="inMap">
<result-to-field result-name="productDimension"/>
</call-service>
<clear-field field="inMap"/>
<set-service-fields service-name="storeGenericDimension" map="parameters" to-map="inMap"/>
<set field="inMap.naturalKeyFields[]" value="productId"/>
<set field="inMap.dimensionValue" from-field="productDimension"/>
<call-service service-name="storeGenericDimension" in-map-name="inMap"/>
</simple-method>
<simple-method method-name="loadAllProductsInProductDimension" short-description="">
<entity-condition entity-name="Product" list="products"/>
<iterate list="products" entry="product">
<set-service-fields service-name="loadProductInProductDimension" map="parameters" to-map="inMap"/>
<set field="inMap.productId" from-field="product.productId"/>
<call-service service-name="loadProductInProductDimension" in-map-name="inMap"/>
<clear-field field="inMap"/>
</iterate>
</simple-method>
</simple-methods>
+761
View File
@@ -0,0 +1,761 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
<simple-method method-name="loadSalesInvoiceFact" short-description="">
<entity-one entity-name="Invoice" value-field="invoice"/>
<if-empty field="invoice">
<add-error>
<fail-property resource="AccountingUiLabels" property="AccountingInvoiceDoesNotExists"/>
</add-error>
</if-empty>
<check-errors/>
<if-compare field="invoice.invoiceTypeId" operator="equals" value="SALES_INVOICE">
<set field="andConditions.invoiceItemTypeId" value="INV_FPROD_ITEM"/>
<get-related relation-name="InvoiceItem" value-field="invoice" list="invoiceItems" map="andConditions"/>
<iterate list="invoiceItems" entry="invoiceItem">
<clear-field field="inMap"/>
<set field="inMap.invoice" from-field="invoice"/>
<set field="inMap.invoiceItem" from-field="invoiceItem"/>
<call-service service-name="loadSalesInvoiceItemFact" in-map-name="inMap"/>
</iterate>
</if-compare>
</simple-method>
<simple-method method-name="loadSalesInvoiceItemFact" short-description="">
<set field="invoice" from-field="parameters.invoice"/>
<set field="invoiceItem" from-field="parameters.invoiceItem"/>
<if-empty field="invoice">
<entity-one entity-name="Invoice" value-field="invoice"/>
</if-empty>
<if-empty field="invoiceItem">
<entity-one entity-name="InvoiceItem" value-field="invoiceItem"/>
</if-empty>
<if-empty field="invoice">
<add-error>
<fail-property resource="AccountingUiLabels" property="AccountingInvoiceDoesNotExists"/>
</add-error>
</if-empty>
<if-empty field="invoiceItem">
<add-error>
<fail-property resource="AccountingUiLabels" property="AccountingInvoiceItemDoesNotExists"/>
</add-error>
</if-empty>
<check-errors/>
<if-compare field="invoice.invoiceTypeId" operator="equals" value="SALES_INVOICE">
<entity-one entity-name="SalesInvoiceItemFact" value-field="fact" auto-field-map="false">
<field-map field-name="invoiceId" from-field="invoiceItem.invoiceId"/>
<field-map field-name="invoiceItemSeqId" from-field="invoiceItem.invoiceItemSeqId"/>
</entity-one>
<!-- key handling -->
<if-empty field="fact">
<make-value entity-name="SalesInvoiceItemFact" value-field="fact"/>
<set field="fact.invoiceId" from-field="invoice.invoiceId"/>
<set field="fact.invoiceItemSeqId" from-field="invoiceItem.invoiceItemSeqId"/>
<!-- conversion of the invoice date -->
<if-not-empty field="invoice.invoiceDate">
<clear-field field="inMap"/>
<set field="inMap.dimensionEntityName" value="DateDimension"/>
<set field="inMap.naturalKeyFields.dateValue" from-field="invoice.invoiceDate" type="Date"/>
<call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
<result-to-field result-name="dimensionId" field="fact.invoiceDateDimId"/>
</call-service>
<if-empty field="fact.invoiceDateDimId">
<set field="fact.invoiceDateDimId" value="_NF_"/>
</if-empty>
<else>
<set field="fact.invoiceDateDimId" value="_NA_"/>
</else>
</if-not-empty>
<!-- conversion of the product id -->
<if-not-empty field="invoiceItem.productId">
<clear-field field="inMap"/>
<set field="inMap.dimensionEntityName" value="ProductDimension"/>
<set field="inMap.naturalKeyFields.productId" from-field="invoiceItem.productId"/>
<call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
<result-to-field result-name="dimensionId" field="fact.productDimId"/>
</call-service>
<if-empty field="fact.productDimId">
<set field="fact.productDimId" value="_NF_"/>
</if-empty>
<else>
<set field="fact.productDimId" value="_NA_"/>
</else>
</if-not-empty>
<!-- conversion of the invoice currency -->
<if-not-empty field="invoice.currencyUomId">
<clear-field field="inMap"/>
<set field="inMap.dimensionEntityName" value="CurrencyDimension"/>
<set field="inMap.naturalKeyFields.currencyId" from-field="invoice.currencyUomId"/>
<call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
<result-to-field result-name="dimensionId" field="fact.origCurrencyDimId"/>
</call-service>
<if-empty field="fact.origCurrencyDimId">
<set field="fact.origCurrencyDimId" value="_NF_"/>
</if-empty>
<else>
<set field="fact.origCurrencyDimId" value="_NA_"/>
</else>
</if-not-empty>
<!-- TODO -->
<set field="fact.orderId" value="_NA_"/>
<set field="fact.billToCustomerDimId" value="_NA_"/>
<create-value value-field="fact"/>
</if-empty>
<!-- =============== -->
<!-- facts handling -->
<!-- =============== -->
<set field="fact.quantity" from-field="invoiceItem.quantity" type="BigDecimal"/>
<set field="fact.extGrossAmount" value="0.0" type="BigDecimal"/>
<set field="fact.extDiscountAmount" value="0.0" type="BigDecimal"/>
<set field="fact.extTaxAmount" value="0.0" type="BigDecimal"/>
<set field="fact.extNetAmount" value="0.0" type="BigDecimal"/>
<calculate field="fact.extGrossAmount">
<calcop field="invoiceItem.quantity" operator="multiply">
<calcop field="invoiceItem.amount" operator="get"/>
</calcop>
</calculate>
<!-- taxes -->
<clear-field field="andConditions"/>
<set field="andConditions.invoiceItemTypeId" value="ITM_SALES_TAX"/>
<get-related relation-name="ChildrenInvoiceItem" value-field="invoiceItem" list="taxes" map="andConditions"/>
<iterate list="taxes" entry="tax">
<calculate field="fact.extTaxAmount">
<calcop field="fact.extTaxAmount" operator="add">
<calcop field="tax.amount" operator="get"/>
</calcop>
</calculate>
</iterate>
<!-- discounts -->
<clear-field field="andConditions"/>
<set field="andConditions.invoiceItemTypeId" value="ITM_PROMOTION_ADJ"/>
<get-related relation-name="ChildrenInvoiceItem" value-field="invoiceItem" list="discounts" map="andConditions"/>
<iterate list="discounts" entry="discount">
<calculate field="fact.extDiscountAmount" type="BigDecimal">
<calcop field="fact.extDiscountAmount" operator="add">
<calcop field="discount.amount" operator="negative"/>
</calcop>
</calculate>
</iterate>
<calculate field="fact.extNetAmount">
<calcop field="fact.extGrossAmount" operator="subtract">
<calcop field="fact.extDiscountAmount" operator="get"/>
</calcop>
</calculate>
<!-- TODO: prorate invoice header discounts and shipping charges -->
<!-- TODO: costs -->
<set field="fact.extManFixedCost" value="0.0" type="BigDecimal"/>
<set field="fact.extManVarCost" value="0.0" type="BigDecimal"/>
<set field="fact.extStorageCost" value="0.0" type="BigDecimal"/>
<set field="fact.extDistributionCost" value="0.0" type="BigDecimal"/>
<calculate field="fact.contributionAmount">
<calcop field="fact.extNetAmount" operator="subtract">
<calcop field="fact.extManFixedCost" operator="get"/>
<calcop field="fact.extManVarCost" operator="get"/>
<calcop field="fact.extStorageCost" operator="get"/>
<calcop field="fact.extDistributionCost" operator="get"/>
</calcop>
</calculate>
<store-value value-field="fact"/>
</if-compare>
</simple-method>
<simple-method method-name="loadSalesOrderFact" short-description="">
<entity-one entity-name="OrderHeader" value-field="orderHeader"/>
<if-empty field="orderHeader">
<add-error>
<fail-property resource="OrderErrorUiLabels" property="OrderOrderIdDoesNotExists"/>
</add-error>
</if-empty>
<check-errors/>
<if-compare field="orderHeader.orderTypeId" operator="equals" value="SALES_ORDER">
<if-compare field="orderHeader.statusId" operator="equals" value="ORDER_APPROVED">
<entity-condition entity-name="OrderItem" list="orderItems">
<condition-list combine="and">
<condition-expr field-name="orderId" operator="equals" from-field="orderHeader.orderId"/>
<!--<condition-expr field-name="productId" operator="not-like" value="M00%"/>-->
<condition-expr field-name="orderItemTypeId" operator="equals" value="PRODUCT_ORDER_ITEM"/>
<!--<condition-expr field-name="statusId" operator="equals" value="ITEM_APPROVED"/>-->
</condition-list>
</entity-condition>
<!--<set field="andConditions.orderItemTypeId" value="PRODUCT_ORDER_ITEM"/>
<get-related relation-name="OrderItem" value-field="orderHeader" list="orderItems" map="andConditions"/>-->
<iterate list="orderItems" entry="orderItem">
<clear-field field="inMap"/>
<set field="inMap.orderHeader" from-field="orderHeader"/>
<set field="inMap.orderItem" from-field="orderItem"/>
<set field="inMap.orderAdjustment" from-field="orderAdjustment"/>
<call-service service-name="loadSalesOrderItemFact" in-map-name="inMap"/>
</iterate>
</if-compare>
</if-compare>
</simple-method>
<simple-method method-name="loadSalesOrderItemFact" short-description="">
<set field="orderHeader" from-field="parameters.orderHeader"/>
<set field="orderItem" from-field="parameters.orderItem"/>
<set field="orderAdjustment" from-field="parameters.orderAdjustment"/>
<if-empty field="orderHeader">
<entity-one entity-name="OrderHeader" value-field="orderHeader"/>
</if-empty>
<if-empty field="orderItem">
<entity-one entity-name="OrderItem" value-field="orderItem"/>
</if-empty>
<if-empty field="orderAdjustment">
<entity-and entity-name="OrderAdjustment" list="orderAdjustments">
<field-map field-name="orderId" from-field="orderItem.orderId"/>
</entity-and>
</if-empty>
<if-empty field="orderHeader">
<add-error>
<fail-property resource="OrderErrorUiLabels" property="OrderOrderIdDoesNotExists"/>
</add-error>
</if-empty>
<if-empty field="orderItem">
<add-error>
<fail-property resource="OrderErrorUiLabels" property="OrderOrderItemIdDoesNotExists"/>
</add-error>
</if-empty>
<check-errors/>
<if-compare field="orderHeader.statusId" operator="equals" value="ORDER_APPROVED">
<entity-one entity-name="SalesOrderItemFact" value-field="fact" auto-field-map="false">
<field-map field-name="orderId" from-field="orderItem.orderId"/>
<field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
</entity-one>
<!-- key handling -->
<if-empty field="fact">
<make-value entity-name="SalesOrderItemFact" value-field="fact"/>
<set field="fact.orderId" from-field="orderHeader.orderId"/>
<set field="fact.orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
<set field="fact.productStoreId" from-field="orderHeader.productStoreId"/>
<set field="fact.salesChannelEnumId" from-field="orderHeader.salesChannelEnumId"/>
<set field="fact.statusId" from-field="orderItem.statusId"/>
<!-- account -->
<if-not-empty field="orderHeader.productStoreId">
<entity-one entity-name="ProductStore" value-field="account">
<field-map field-name="productStoreId" from-field="orderHeader.productStoreId"/>
</entity-one>
<set field="fact.account" from-field="account.storeName"/>
</if-not-empty>
<!-- pod -->
<if-compare field="orderHeader.currencyUom" operator="equals" value="EUR">
<set field="fact.pod" value="Latin"/>
<else>
<set field="fact.pod" value="English"/>
</else>
</if-compare>
<!-- brand -->
<if-not-empty field="orderHeader.salesChannelEnumId">
<entity-one entity-name="Enumeration" value-field="brand">
<field-map field-name="enumId" from-field="orderHeader.salesChannelEnumId"/>
</entity-one>
<set field="fact.brand" from-field="brand.description"/>
</if-not-empty>
<!-- conversion of the order date -->
<entity-condition entity-name="OrderStatus" list="orderStatusList">
<condition-list combine="and">
<condition-expr field-name="orderId" from-field="orderHeader.orderId"/>
<condition-expr field-name="statusId" value="ORDER_APPROVED"/>
</condition-list>
<order-by field-name="-statusDatetime"/>
</entity-condition>
<first-from-list list="orderStatusList" entry="orderStatus"/>
<if-not-empty field="orderStatus.statusDatetime">
<clear-field field="inMap"/>
<set field="inMap.dimensionEntityName" value="DateDimension"/>
<set field="inMap.naturalKeyFields.dateValue" from-field="orderStatus.statusDatetime" type="Date"/>
<call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
<result-to-field result-name="dimensionId" field="fact.orderDateDimId"/>
</call-service>
<if-empty field="fact.orderDateDimId">
<set field="fact.orderDateDimId" value="_NF_"/>
</if-empty>
<else>
<set field="fact.orderDateDimId" value="_NA_"/>
</else>
</if-not-empty>
<!-- conversion of the product id -->
<if-not-empty field="orderItem.productId">
<clear-field field="inMap"/>
<set field="inMap.dimensionEntityName" value="ProductDimension"/>
<set field="inMap.naturalKeyFields.productId" from-field="orderItem.productId"/>
<call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
<result-to-field result-name="dimensionId" field="fact.productDimId"/>
</call-service>
<if-empty field="fact.productDimId">
<set field="fact.productDimId" value="_NF_"/>
</if-empty>
<else>
<set field="fact.productDimId" value="_NA_"/>
</else>
</if-not-empty>
<!-- conversion of the order currency -->
<if-not-empty field="orderHeader.currencyUom">
<clear-field field="inMap"/>
<set field="inMap.dimensionEntityName" value="CurrencyDimension"/>
<set field="inMap.naturalKeyFields.currencyId" from-field="orderHeader.currencyUom"/>
<call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
<result-to-field result-name="dimensionId" field="fact.origCurrencyDimId"/>
</call-service>
<if-empty field="fact.origCurrencyDimId">
<set field="fact.origCurrencyDimId" value="_NF_"/>
</if-empty>
<else>
<set field="fact.origCurrencyDimId" value="_NA_"/>
</else>
</if-not-empty>
<!-- productCategoryId -->
<entity-and entity-name="ProductCategoryMember" list="productCategoryMembers">
<field-map field-name="productId" from-field="orderItem.productId"/>
<field-map field-name="thruDate" from-field="nullField"/>
</entity-and>
<if-not-empty field="productCategoryMembers">
<first-from-list list="productCategoryMembers" entry="productCategoryMember"/>
<set field="fact.productCategoryId" from-field="productCategoryMember.productCategoryId"/>
</if-not-empty>
<!-- TODO -->
<set field="fact.billToCustomerDimId" value="_NA_"/>
<create-value value-field="fact"/>
</if-empty>
<!-- =============== -->
<!-- facts handling -->
<!-- =============== -->
<script>groovy:
import org.apache.ofbiz.order.order.OrderReadHelper
orderReadHelper = new OrderReadHelper(orderHeader)
context.billFromParty = orderReadHelper.getBillFromParty()
</script>
<set field="partyAccountingPreferencesCallMap.organizationPartyId" from-field="billFromParty.partyId"/>
<call-service service-name="getPartyAccountingPreferences" in-map-name="partyAccountingPreferencesCallMap">
<result-to-field result-name="partyAccountingPreference" field="accPref"/>
</call-service>
<set field="fact.quantity" from-field="orderItem.quantity" type="BigDecimal"/>
<set field="fact.extGrossAmount" value="0" type="BigDecimal"/>
<set field="fact.extGrossCost" value="0" type="BigDecimal"/>
<set field="fact.extDiscountAmount" value="0" type="BigDecimal"/>
<set field="fact.extNetAmount" value="0" type="BigDecimal"/>
<set field="fact.extShippingAmount" value="0" type="BigDecimal"/>
<set field="fact.extTaxAmount" value="0" type="BigDecimal"/>
<set field="fact.GS" value="0" type="BigDecimal"/>
<set field="fact.GMS" value="0" type="BigDecimal"/>
<set field="fact.GMP" value="0" type="BigDecimal"/>
<set field="fact.GSS" value="0" type="BigDecimal"/>
<set field="fact.GSC" value="0" type="BigDecimal"/>
<set field="fact.GSP" value="0" type="BigDecimal"/>
<set field="fact.GP" value="0" type="BigDecimal"/>
<set field="fact.countOrder" value="0" type="BigDecimal"/>
<!-- extGrossAmount -->
<set field="convertUomCurrencyMap.uomId" from-field="orderHeader.currencyUom"/>
<set field="convertUomCurrencyMap.uomIdTo" from-field="accPref.baseCurrencyUomId"/>
<set field="convertUomCurrencyMap.nowDate" from-field="orderStatus.statusDatetime"/>
<call-service service-name="convertUomCurrency" in-map-name="convertUomCurrencyMap">
<result-to-field result-name="conversionFactor" field="exchangeRate"/>
</call-service>
<if-not-empty field="exchangeRate">
<calculate field="unitPrice">
<calcop field="orderItem.unitPrice" operator="multiply">
<calcop field="exchangeRate" operator="get"/>
</calcop>
</calculate>
<calculate field="fact.extGrossAmount">
<calcop field="fact.quantity" operator="multiply">
<calcop field="unitPrice" operator="get"/>
</calcop>
</calculate>
</if-not-empty>
<!-- extGrossCost -->
<entity-condition entity-name="SupplierProduct" list="costs">
<condition-list combine="and">
<condition-expr field-name="productId" operator="equals" from-field="orderItem.productId"/>
<condition-expr field-name="availableThruDate" operator="equals" from-field="nullField"/>
<condition-expr field-name="minimumOrderQuantity" operator="equals" value="0"/>
</condition-list>
</entity-condition>
<if-not-empty field="costs">
<first-from-list list="costs" entry="cost"/>
<set field="convertUomCurrencyMap.uomId" from-field="cost.currencyUomId"/>
<set field="convertUomCurrencyMap.uomIdTo" from-field="accPref.baseCurrencyUomId"/>
<set field="convertUomCurrencyMap.nowDate" from-field="orderStatus.statusDatetime"/>
<call-service service-name="convertUomCurrency" in-map-name="convertUomCurrencyMap">
<result-to-field result-name="conversionFactor" field="exchangeRate"/>
</call-service>
<if-not-empty field="exchangeRate">
<calculate field="costPrice">
<calcop field="cost.lastPrice" operator="multiply">
<calcop field="exchangeRate" operator="get"/>
</calcop>
</calculate>
<calculate field="fact.extGrossCost">
<calcop field="fact.quantity" operator="multiply">
<calcop field="costPrice" operator="get"/>
</calcop>
</calculate>
</if-not-empty>
</if-not-empty>
<!-- extShippingAmount -->
<iterate list="orderAdjustments" entry="shipping">
<if-compare field="shipping.orderAdjustmentTypeId" operator="equals" value="SHIPPING_CHARGES">
<calculate field="fact.extShippingAmount">
<calcop field="fact.extShippingAmount" operator="add">
<calcop field="shipping.amount" operator="get"/>
</calcop>
</calculate>
</if-compare>
</iterate>
<!-- extTaxAmount -->
<iterate list="orderAdjustments" entry="tax">
<if-compare field="tax.orderAdjustmentTypeId" operator="equals" value="SALES_TAX">
<calculate field="fact.extTaxAmount">
<calcop field="fact.extTaxAmount" operator="add">
<calcop field="tax.amount" operator="get"/>
</calcop>
</calculate>
</if-compare>
</iterate>
<!-- extDiscountAmount -->
<iterate list="orderAdjustments" entry="discount">
<if-compare field="discount.orderAdjustmentTypeId" operator="equals" value="PROMOTION_ADJUSTMENT">
<calculate field="fact.extDiscountAmount">
<calcop field="fact.extDiscountAmount" operator="add">
<calcop field="discount.amount" operator="get"/>
</calcop>
</calculate>
<!-- product promo code -->
<entity-and entity-name="ProductPromoCode" list="productPromo">
<field-map field-name="productPromoId" from-field="discount.productPromoId"/>
</entity-and>
<first-from-list list="productPromo" entry="productPromoCode"/>
<if-not-empty field="productPromoCode">
<set field="fact.productPromoCode" from-field="productPromoCode.productPromoCodeId"/>
<else>
<set field="fact.productPromoCode" value="Not require code"/>
</else>
</if-not-empty>
</if-compare>
</iterate>
<!-- extNetAmount -->
<calculate field="fact.extNetAmount">
<calcop field="fact.extGrossAmount" operator="subtract">
<calcop field="fact.extDiscountAmount" operator="get"/>
</calcop>
</calculate>
<!-- GS -->
<set field="countGS" value="0"/>
<entity-and entity-name="SalesOrderItemFact" list="checkGSList">
<field-map field-name="orderId" from-field="orderHeader.orderId"/>
</entity-and>
<iterate list="checkGSList" entry="checkGS">
<if-not-empty field="checkGS.GS">
<if-compare field="checkGS.GS" operator="not-equals" value="0">
<set field="countGS" value="1"/>
</if-compare>
</if-not-empty>
</iterate>
<if-compare field="countGS" operator="equals" value="0">
<set field="convertUomCurrencyMap.uomId" from-field="orderHeader.currencyUom"/>
<set field="convertUomCurrencyMap.uomIdTo" from-field="accPref.baseCurrencyUomId"/>
<set field="convertUomCurrencyMap.nowDate" from-field="orderStatus.statusDatetime"/>
<call-service service-name="convertUomCurrency" in-map-name="convertUomCurrencyMap">
<result-to-field result-name="conversionFactor" field="exchangeRate"/>
</call-service>
<if-not-empty field="exchangeRate">
<calculate field="fact.GS">
<calcop field="orderHeader.grandTotal" operator="multiply">
<calcop field="exchangeRate" operator="get"/>
</calcop>
</calculate>
</if-not-empty>
</if-compare>
<!-- GMS -->
<calculate field="fact.GMS">
<calcop field="fact.GMS" operator="add">
<calcop field="fact.extGrossAmount" operator="get"/>
</calcop>
</calculate>
<!-- GMP -->
<calculate field="fact.GMP">
<calcop field="fact.GMS" operator="subtract">
<calcop field="fact.extGrossCost" operator="get"/>
</calcop>
</calculate>
<!-- GSP -->
<set field="countGSP" value="0"/>
<entity-and entity-name="SalesOrderItemFact" list="checkGSPList">
<field-map field-name="orderId" from-field="orderHeader.orderId"/>
</entity-and>
<iterate list="checkGSPList" entry="checkGSP">
<if-not-empty field="checkGSP.GSP">
<if-compare field="checkGSP.GSP" operator="not-equals" value="0">
<set field="countGSP" value="1"/>
</if-compare>
</if-not-empty>
</iterate>
<if-compare field="countGSP" operator="equals" value="0">
<entity-and entity-name="OrderItem" list="orderItemList">
<field-map field-name="orderId" from-field="orderHeader.orderId"/>
</entity-and>
<set field="warrantyPrice" value="0" type="BigDecimal"/>
<iterate list="orderAdjustments" entry="warranty">
<if-compare field="warranty.orderAdjustmentTypeId" operator="equals" value="WARRANTY_ADJUSTMENT">
<calculate field="warrantyPrice">
<calcop field="warrantyPrice" operator="add">
<calcop field="warranty.amount" operator="get"/>
</calcop>
</calculate>
</if-compare>
</iterate>
<calculate field="GSS">
<calcop field="fact.extShippingAmount" operator="add">
<calcop field="warrantyPrice" operator="get"/>
</calcop>
</calculate>
<set field="convertUomCurrencyMap.uomId" from-field="orderHeader.currencyUom"/>
<set field="convertUomCurrencyMap.uomIdTo" from-field="accPref.baseCurrencyUomId"/>
<set field="convertUomCurrencyMap.nowDate" from-field="orderStatus.statusDatetime"/>
<call-service service-name="convertUomCurrency" in-map-name="convertUomCurrencyMap">
<result-to-field result-name="conversionFactor" field="exchangeRate"/>
</call-service>
<if-not-empty field="exchangeRate">
<calculate field="GSS">
<calcop field="GSS" operator="multiply">
<calcop field="exchangeRate" operator="get"/>
</calcop>
</calculate>
</if-not-empty>
<set field="fact.GSS" from-field="GSS"/>
<set field="fact.GSP" from-field="GSS" type="BigDecimal"/>
</if-compare>
<!-- GP -->
<calculate field="fact.GP">
<calcop field="fact.GMP" operator="add">
<calcop field="fact.GSP" operator="get"/>
</calcop>
</calculate>
<!-- countOrder -->
<set field="countOrder" value="0"/>
<entity-and entity-name="SalesOrderItemFact" list="checkCountOrderList">
<field-map field-name="orderId" from-field="orderHeader.orderId"/>
</entity-and>
<iterate list="checkCountOrderList" entry="checkCountOrder">
<if-not-empty field="checkCountOrder.countOrder">
<if-compare field="checkCountOrder.countOrder" operator="not-equals" value="0">
<set field="countOrder" value="1"/>
</if-compare>
</if-not-empty>
</iterate>
<if-compare field="countOrder" operator="equals" value="0">
<set field="fact.countOrder" value="1" type="BigDecimal"/>
</if-compare>
<store-value value-field="fact"/>
</if-compare>
</simple-method>
<simple-method method-name="loadSalesOrderDataDaily" short-description="Load Sales Order Data Daily">
<now-date-to-env field="nowDate"/>
<set field="yesterday" value="${groovy:
import java.text.SimpleDateFormat;
def sdf = new SimpleDateFormat(&quot;yyyy-MM-dd 07:00:00.000&quot;);
def yesterday = sdf.format(nowDate-1);
return yesterday;
}" type="Timestamp"/>
<set field="today" value="${groovy:
import java.text.SimpleDateFormat;
def sdf = new SimpleDateFormat(&quot;yyyy-MM-dd 07:00:00.000&quot;);
def today = sdf.format(nowDate);
return today;
}" type="Timestamp"/>
<set field="inMap.fromDate" from-field="yesterday"/>
<set field="inMap.thruDate" from-field="today"/>
<call-service service-name="importSalesOrderData" in-map-name="inMap"></call-service>
</simple-method>
<simple-method method-name="importSalesOrderData" short-description="Import Sales Order Data">
<set-service-fields service-name="loadDateDimension" map="parameters" to-map="inMap"/>
<set field="inMap.fromDate" from-field="parameters.fromDate"/>
<set field="inMap.thruDate" from-field="parameters.thruDate"/>
<call-service service-name="loadDateDimension" in-map-name="inMap"/>
<check-errors/>
<entity-condition entity-name="OrderStatus" list="orderStatusList">
<condition-list combine="and">
<condition-expr field-name="statusId" value="ORDER_APPROVED"/>
<condition-expr field-name="statusDatetime" operator="greater-equals" from-field="parameters.fromDate"/>
<condition-expr field-name="statusDatetime" operator="less" from-field="parameters.thruDate"/>
</condition-list>
</entity-condition>
<iterate list="orderStatusList" entry="orderHeader">
<clear-field field="inMap"/>
<set field="inMap.orderId" from-field="orderHeader.orderId"/>
<call-service service-name="loadSalesOrderFact" in-map-name="inMap"></call-service>
<check-errors/>
</iterate>
</simple-method>
<simple-method method-name="convertUomCurrency" short-description="Convert Uom Currency from UomConversionDated entity">
<if-empty field="parameters.nowDate">
<now field="now"/>
<set field="parameters.nowDate" from-field="now"/>
</if-empty>
<entity-condition entity-name="UomConversionDated" list="UomConversionDatedList">
<condition-list combine="and">
<condition-expr field-name="uomId" operator="equals" from-field="parameters.uomId"/>
<condition-expr field-name="uomIdTo" operator="equals" from-field="parameters.uomIdTo"/>
<condition-expr field-name="fromDate" operator="less-equals" from-field="parameters.nowDate"/>
<condition-expr field-name="thruDate" operator="greater" from-field="parameters.nowDate"/>
</condition-list>
<order-by field-name="-fromDate"/>
</entity-condition>
<if-not-empty field="UomConversionDatedList">
<first-from-list list="UomConversionDatedList" entry="UomConversion"/>
<field-to-result field="UomConversion.conversionFactor" result-name="conversionFactor"/>
<else>
<entity-condition entity-name="UomConversionDated" list="UomConversionDatedLastestList">
<condition-list combine="and">
<condition-expr field-name="uomId" operator="equals" from-field="parameters.uomId"/>
<condition-expr field-name="uomIdTo" operator="equals" from-field="parameters.uomIdTo"/>
<condition-expr field-name="thruDate" operator="equals" from-field="nullField"/>
</condition-list>
</entity-condition>
<if-not-empty field="UomConversionDatedLastestList">
<first-from-list list="UomConversionDatedLastestList" entry="UomConversionLastest"/>
<field-to-result field="UomConversionLastest.conversionFactor" result-name="conversionFactor"/>
</if-not-empty>
</else>
</if-not-empty>
</simple-method>
<simple-method method-name="loadInventoryFact" short-description="">
<entity-one entity-name="InventoryItem" value-field="inventory">
<field-map field-name="inventoryItemId" from-field="parameters.inventoryItemId"/>
</entity-one>
<entity-one entity-name="InventoryItemFact" value-field="fact">
<field-map field-name="inventoryItemId" from-field="parameters.inventoryItemId"/>
</entity-one>
<if-empty field="fact">
<make-value entity-name="InventoryItemFact" value-field="fact"/>
<set field="fact.inventoryItemId" from-field="inventory.inventoryItemId"/>
<!-- conversion of the inventory date -->
<if-not-empty field="inventory.createdStamp">
<clear-field field="inMap"/>
<set field="inMap.dimensionEntityName" value="DateDimension"/>
<set field="inMap.naturalKeyFields.dateValue" from-field="inventory.createdStamp" type="Date"/>
<call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
<result-to-field result-name="dimensionId" field="fact.inventoryDateDimId"/>
</call-service>
<if-empty field="fact.inventoryDateDimId">
<set field="fact.inventoryDateDimId" value="_NF_"/>
</if-empty>
<else>
<set field="fact.inventoryDateDimId" value="_NA_"/>
</else>
</if-not-empty>
<!-- conversion of the product id -->
<if-not-empty field="inventory.productId">
<clear-field field="inMap"/>
<set field="inMap.dimensionEntityName" value="ProductDimension"/>
<set field="inMap.naturalKeyFields.productId" from-field="inventory.productId"/>
<call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
<result-to-field result-name="dimensionId" field="fact.productDimId"/>
</call-service>
<if-empty field="fact.productDimId">
<set field="fact.productDimId" value="_NF_"/>
</if-empty>
<else>
<set field="fact.productDimId" value="_NA_"/>
</else>
</if-not-empty>
<!-- conversion of the order currency -->
<if-not-empty field="inventory.currencyUomId">
<clear-field field="inMap"/>
<set field="inMap.dimensionEntityName" value="CurrencyDimension"/>
<set field="inMap.naturalKeyFields.currencyId" from-field="inventory.currencyUomId"/>
<call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
<result-to-field result-name="dimensionId" field="fact.origCurrencyDimId"/>
</call-service>
<if-empty field="fact.origCurrencyDimId">
<set field="fact.origCurrencyDimId" value="_NF_"/>
</if-empty>
<else>
<set field="fact.origCurrencyDimId" value="_NA_"/>
</else>
</if-not-empty>
<create-value value-field="fact"/>
</if-empty>
<set field="fact.facilityId" from-field="inventory.facilityId"/>
<set field="fact.inventoryItemId" from-field="inventory.inventoryItemId"/>
<set field="fact.quantityOnHandTotal" from-field="inventory.quantityOnHandTotal"/>
<set field="fact.availableToPromiseTotal" from-field="inventory.availableToPromiseTotal"/>
<set field="fact.unitCost" from-field="inventory.unitCost"/>
<!-- calculate sold out amount -->
<calculate field="fact.soldoutAmount">
<calcop operator="get" field="inventory.quantityOnHandTotal">
<calcop operator="negative" field="inventory.availableToPromiseTotal"/>
</calcop>
</calculate>
<store-value value-field="fact"/>
</simple-method>
</simple-methods>
+30 -30
View File
@@ -35,8 +35,8 @@ under the License.
<attribute name="naturalKeyFields" type="Map" mode="IN" optional="false"/> <!-- the names/values pairs of the fields that compose the natural key of the dimension -->
<attribute name="dimensionId" type="String" mode="OUT" optional="true"/>
</service>
<service name="quickInitDataWarehouse" auth="true" engine="groovy"
location="component://bi/groovyScripts/DimensionServices.groovy" invoke="quickInitDataWarehouse">
<service name="quickInitDataWarehouse" auth="true" engine="simple"
location="component://bi/minilang/DimensionServices.xml" invoke="quickInitDataWarehouse">
<description>Quickly initialize the dimensions (Currency, Date, Product) and facts (SalesInvoiceItem): useful to quickly initialize the datawarehouse.</description>
<attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/>
<attribute name="thruDate" type="Timestamp" mode="IN" optional="false"/>
@@ -49,44 +49,44 @@ under the License.
<attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/>
<attribute name="thruDate" type="Timestamp" mode="IN" optional="false"/>
</service>
<service name="loadCurrencyDimension" auth="true" engine="groovy"
location="component://bi/groovyScripts/DimensionServices.groovy" invoke="loadCurrencyDimension">
<service name="loadCurrencyDimension" auth="true" engine="simple"
location="component://bi/minilang/DimensionServices.xml" invoke="loadCurrencyDimension">
<description>Loads data in the CurrencyDimension entity (olap entity) using the update strategy of 'type 1': overwrite the values of the attributes</description>
</service>
<!-- Product Dimension -->
<service name="prepareProductDimensionData" auth="true" engine="groovy"
location="component://bi/groovyScripts/DimensionServices.groovy" invoke="prepareProductDimensionData">
<service name="prepareProductDimensionData" auth="true" engine="simple"
location="component://bi/minilang/DimensionServices.xml" invoke="prepareProductDimensionData">
<description>Pulls information from the Product* entities (oltp entities) and prepares data for the ProductDimension entity (olap entity)</description>
<attribute name="productId" type="String" mode="IN" optional="false"/>
<attribute name="productDimension" type="GenericEntity" mode="OUT" optional="false"/>
</service>
<service name="loadProductInProductDimension" auth="true" engine="groovy"
location="component://bi/groovyScripts/DimensionServices.groovy" invoke="loadProductInProductDimension">
<service name="loadProductInProductDimension" auth="true" engine="simple"
location="component://bi/minilang/DimensionServices.xml" invoke="loadProductInProductDimension">
<description>Pulls information from the Product* entities and stores them in the ProductDimension entity (olap entity)</description>
<attribute name="productId" type="String" mode="IN" optional="false"/>
<attribute name="updateMode" type="String" mode="IN" optional="false"/> <!-- TYPE1, TYPE2, TYPE3 -->
</service>
<service name="loadType1ProductInProductDimension" auth="true" engine="groovy"
location="component://bi/groovyScripts/DimensionServices.groovy" invoke="loadProductInProductDimension">
<service name="loadType1ProductInProductDimension" auth="true" engine="simple"
location="component://bi/minilang/DimensionServices.xml" invoke="loadProductInProductDimension">
<description>Same as loadProductInProductDimension; the update strategy is 'type 1': overwrite the values of the attributes</description>
<attribute name="productId" type="String" mode="IN" optional="false"/>
<attribute name="updateMode" type="String" mode="IN" optional="true" default-value="TYPE1"/>
</service>
<service name="loadType2ProductInProductDimension" auth="true" engine="groovy"
location="component://bi/groovyScripts/DimensionServices.groovy" invoke="loadProductInProductDimension">
<service name="loadType2ProductInProductDimension" auth="true" engine="simple"
location="component://bi/minilang/DimensionServices.xml" invoke="loadProductInProductDimension">
<description>Same as loadProductInProductDimension; the update strategy is 'type 2': add a dimension row</description>
<attribute name="productId" type="String" mode="IN" optional="false"/>
<attribute name="updateMode" type="String" mode="IN" optional="true" default-value="TYPE2"/>
</service>
<service name="loadAllProductsInProductDimension" auth="true" engine="groovy"
location="component://bi/groovyScripts/DimensionServices.groovy" invoke="loadAllProductsInProductDimension">
<service name="loadAllProductsInProductDimension" auth="true" engine="simple"
location="component://bi/minilang/DimensionServices.xml" invoke="loadAllProductsInProductDimension">
<description>Calls the loadProductInProductDimension service for all the products.</description>
<attribute name="updateMode" type="String" mode="IN" optional="true" default-value="TYPE1"/>
</service>
<!-- Accounting Facts -->
<service name="loadSalesInvoiceItemFact" auth="true" engine="groovy"
location="component://bi/groovyScripts/FactServices.groovy" invoke="loadSalesInvoiceItemFact">
<service name="loadSalesInvoiceItemFact" auth="true" engine="simple"
location="component://bi/minilang/FactServices.xml" invoke="loadSalesInvoiceItemFact">
<description>
Pulls information from the Invoice* entities and stores them in the SalesInvoiceItem entity (olap entity).
One of invoiceId/invoiceItemSeqId or invoice/invoiceItem must be passed or an error is returned.
@@ -96,15 +96,15 @@ under the License.
<attribute name="invoice" type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
<attribute name="invoiceItem" type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
</service>
<service name="loadSalesInvoiceFact" auth="true" engine="groovy"
location="component://bi/groovyScripts/FactServices.groovy" invoke="loadSalesInvoiceFact">
<service name="loadSalesInvoiceFact" auth="true" engine="simple"
location="component://bi/minilang/FactServices.xml" invoke="loadSalesInvoiceFact">
<description>Calls the loadSalesInvoiceItemFact service for all the invoice items.</description>
<attribute name="invoiceId" type="String" mode="IN" optional="false"/>
</service>
<!-- Order Facts -->
<service name="loadSalesOrderItemFact" auth="true" engine="groovy"
location="component://bi/groovyScripts/FactServices.groovy" invoke="loadSalesOrderItemFact">
<service name="loadSalesOrderItemFact" auth="true" engine="simple"
location="component://bi/minilang/FactServices.xml" invoke="loadSalesOrderItemFact">
<description>
Pulls information from the OrderItem* entities and stores them in the SalesOrderItem entity (olap entity).
One of orderId/orderItemSeqId or order/orderItem must be passed or an error is returned.
@@ -115,23 +115,23 @@ under the License.
<attribute name="orderItem" type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
<attribute name="orderAdjustment " type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
</service>
<service name="loadSalesOrderFact" auth="true" engine="groovy"
location="component://bi/groovyScripts/FactServices.groovy" invoke="loadSalesOrderFact">
<service name="loadSalesOrderFact" auth="true" engine="simple"
location="component://bi/minilang/FactServices.xml" invoke="loadSalesOrderFact">
<description>Calls the loadSalesOrderItemFact service for all the order items.</description>
<attribute name="orderId" type="String" mode="IN" optional="false"/>
</service>
<service name="loadSalesOrderDataDaily" auth="true" engine="groovy"
location="component://bi/groovyScripts/FactServices.groovy" invoke="loadSalesOrderDataDaily" transaction-timeout="10000000">
<service name="loadSalesOrderDataDaily" auth="true" engine="simple"
location="component://bi/minilang/FactServices.xml" invoke="loadSalesOrderDataDaily" transaction-timeout="10000000">
<description>Load Sales Order Data Daily.</description>
</service>
<service name="importSalesOrderData" auth="true" engine="groovy"
location="component://bi/groovyScripts/FactServices.groovy" invoke="importSalesOrderData" transaction-timeout="10000000">
<service name="importSalesOrderData" auth="true" engine="simple"
location="component://bi/minilang/FactServices.xml" invoke="importSalesOrderData" transaction-timeout="10000000">
<description>Import Sales Order Data.</description>
<attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/>
<attribute name="thruDate" type="Timestamp" mode="IN" optional="false"/>
</service>
<service name="convertUomCurrency" auth="true" engine="groovy"
location="component://bi/groovyScripts/FactServices.groovy" invoke="convertUomCurrency">
<service name="convertUomCurrency" auth="true" engine="simple"
location="component://bi/minilang/FactServices.xml" invoke="convertUomCurrency">
<description>Import Sales Order Data.</description>
<attribute name="uomId" type="String" mode="IN"/>
<attribute name="uomIdTo" type="String" mode="IN"/>
@@ -140,8 +140,8 @@ under the License.
</service>
<!-- Inventory Facts -->
<service name="loadInventoryFact" auth="true" engine="groovy"
location="component://bi/groovyScripts/FactServices.groovy" invoke="loadInventoryFact">
<service name="loadInventoryFact" auth="true" engine="simple"
location="component://bi/minilang/FactServices.xml" invoke="loadInventoryFact">
<attribute name="inventoryItemId" type="String" mode="IN" optional="true"/>
</service>
@@ -18,6 +18,8 @@ under the License.
*/
package org.apache.ofbiz.bi.util;
import java.lang.Object;
import java.lang.String;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -39,8 +41,8 @@ import org.apache.ofbiz.service.ServiceUtil;
public class DimensionServices {
private static final String MODULE = DimensionServices.class.getName();
private static final String RESOURCE = "BiUiLabels";
public static final String module = DimensionServices.class.getName();
public static final String resource = "BiUiLabels";
public static Map<String, Object> getDimensionIdFromNaturalKey(DispatchContext ctx, Map<String, ? extends Object> context) {
Map<String, Object> resultMap = ServiceUtil.returnSuccess();
@@ -63,7 +65,7 @@ public class DimensionServices {
public static Map<String, Object> storeGenericDimension(DispatchContext ctx, Map<String, ? extends Object> context) {
Delegator delegator = ctx.getDelegator();
GenericValue dimensionValue = (GenericValue) context.get("dimensionValue");
List<String> naturalKeyFields = UtilGenerics.checkCollection(context.get("naturalKeyFields"), String.class);
List<String> naturalKeyFields = UtilGenerics.checkList(context.get("naturalKeyFields"), String.class);
String updateMode = (String) context.get("updateMode");
Locale locale = (Locale) context.get("locale");
@@ -73,8 +75,7 @@ public class DimensionServices {
andCondition.put(naturalKeyField, dimensionValue.get(naturalKeyField));
}
if (andCondition.isEmpty()) {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "BusinessIntelligenceNaturalKeyWithourDimension",
UtilMisc.toMap("naturalKeyFields", naturalKeyFields, "dimensionValue", dimensionValue), locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "BusinessIntelligenceNaturalKeyWithourDimension", UtilMisc.toMap("naturalKeyFields", naturalKeyFields, "dimensionValue", dimensionValue), locale));
}
List<GenericValue> existingDimensionValues = null;
try {
@@ -98,8 +99,7 @@ public class DimensionServices {
dimensionValue.set("dimensionId", delegator.getNextSeqId(dimensionValue.getEntityName()));
dimensionValue.create();
} else {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "BusinessIntelligenceUpdateModeStillNotSupported",
UtilMisc.toMap("updateMode", updateMode), locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "BusinessIntelligenceUpdateModeStillNotSupported", UtilMisc.toMap("updateMode", updateMode), locale));
}
}
} catch (GenericEntityException gee) {
@@ -157,7 +157,7 @@ public class DimensionServices {
dateValue.set("yearName", Long.valueOf(calendar.get(Calendar.YEAR)));
dateValue.set("weekOfMonth", Long.valueOf(calendar.get(Calendar.WEEK_OF_MONTH)));
dateValue.set("weekOfYear", Long.valueOf(calendar.get(Calendar.WEEK_OF_YEAR)));
dateValue.set("weekdayType", (dayOfWeek == 1 || dayOfWeek == 7 ? "Weekend" : "Weekday"));
dateValue.set("weekdayType", (dayOfWeek == 1 || dayOfWeek == 7? "Weekend": "Weekday"));
dateValue.set("yearMonthDay", yearMonthDayFormat.format(currentDate));
dateValue.set("yearAndMonth", yearMonthFormat.format(currentDate));
+4
View File
@@ -92,6 +92,10 @@
<url-pattern>/control/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
-1
View File
@@ -33,7 +33,6 @@ under the License.
<set field="applicationMenuName" value="BiAppBar" global="true"/>
<set field="applicationMenuLocation" value="component://bi/widget/BiMenus.xml" global="true"/>
<set field="applicationTitle" from-field="uiLabelMap.BusinessIntelligenceApplication" global="true"/>
<set field="helpAnchor" from-field="helpAnchor" default-value="_apache_ofbiz_plugins"/>
</actions>
<widgets>
<include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/>
+5 -1
View File
@@ -1,8 +1,12 @@
![Apache OFBiz® logo](https://camo.githubusercontent.com/b313d4ec52b77b5024e2988aaf76720258233e69/68747470733a2f2f6f6662697a2e6170616368652e6f72672f696d616765732f6f6662697a5f6c6f676f2e706e67)
![Apache OFBiz® logo](http://ofbiz.apache.org/images/OFBiz-logo.png) And
![Birt Logo](http://www.eclipse.org/birt/img/logo/Birt-logo.png)
# Birt component
For more information about this component visit the [https://cwiki.apache.org/confluence/display/OFBIZ/Using+BIRT+with+OFBiz](https://cwiki.apache.org/confluence/display/OFBIZ/Using+BIRT+with+OFBiz) page in the OFBiz wiki
Information about the birt product can be found at: [http://www.eclipse.org/birt/](http://www.eclipse.org/birt/)
JIRA issues related to this component can be found at [https://issues.apache.org/jira/browse/OFBIZ/component/12321022](https://issues.apache.org/jira/browse/OFBIZ/component/12321022 "Jira")
Committed revisions can be viewed at [http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/](http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/ "Svn")
Information on the OFBiz Flexible Birt Reports are at [https://cwiki.apache.org/confluence/display/OFBIZ/Birt+Flexible+Reports](https://cwiki.apache.org/confluence/display/OFBIZ/Birt+Flexible+Reports)
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<entity-engine-xml>
<DataResource dataResourceId="HELP_BIRT" localeString="en" dataResourceTypeId="OFBIZ_FILE"
objectInfo="plugins/birt/data/helpdata/HELP_BIRT.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS"
dataResourceName="BIRT" mimeTypeId="text/xml" isPublic="Y" />
<Content contentId="HELP_BIRT" contentTypeId="DOCUMENT" contentName="BIRT Overview" templateDataResourceId="HELP_TEMPL"
dataResourceId="HELP_BIRT" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
<ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_BIRT" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" mapKey="BIRT_main"/>
</entity-engine-xml>
+6
View File
@@ -18,6 +18,12 @@
under the License.
-->
<entity-engine-xml>
<SecurityPermission permissionId="BIRT_ADMIN" description="ALL Birt component operations"/>
<SecurityPermission permissionId="BIRT_CREATE" description="Create report from master"/>
<SecurityPermission permissionId="BIRT_UPDATE" description="Update operations for reports"/>
<SecurityPermission permissionId="BIRT_DELETE" description="Delete reports"/>
<SecurityPermission permissionId="BIRT_VIEW" description="View and use all birt reports"/>
<SecurityGroup groupId="BIRTADMIN" description="Birt - admin"/>
<SecurityGroup groupId="BIRTUSER" description="Birt - user"/>
+48
View File
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<entity-engine-xml>
<DataResource dataResourceId="HELP_EXAMPLE" localeString="en" dataResourceTypeId="OFBIZ_FILE"
objectInfo="plugins/example/data/helpdata/HELP_EXAMPLE.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS"
dataResourceName="Framework Example" mimeTypeId="text/xml" isPublic="Y" />
<Content contentId="HELP_EXAMPLE" contentTypeId="DOCUMENT" contentName="Framework Example" templateDataResourceId="HELP_TEMPL"
dataResourceId="HELP_EXAMPLE" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
<ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_EXAMPLE" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000"/>
<DataResource dataResourceId="HELP_EXAMPLE_FR" localeString="fr" dataResourceTypeId="OFBIZ_FILE"
objectInfo="plugins/example/data/helpdata/HELP_EXAMPLE_FR.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS"
dataResourceName="Exemple pour le développement" mimeTypeId="text/xml" isPublic="Y" />
<Content contentId="HELP_EXAMPLE_FR" contentTypeId="DOCUMENT" contentName="Exemple pour le développement" templateDataResourceId="HELP_TEMPL"
dataResourceId="HELP_EXAMPLE_FR" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html" localeString="fr" />
<ContentAssoc contentId="HELP_EXAMPLE" contentIdTo="HELP_EXAMPLE_FR" contentAssocTypeId="ALTERNATE_LOCALE" fromDate="2006-01-12 01:01:01"/>
<DataResource dataResourceId="EXAMPLE_main" localeString="en" dataResourceTypeId="OFBIZ_FILE"
objectInfo="plugins/example/data/helpdata/HELP_EXAMPLE_main.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Example help main page" mimeTypeId="text/xml" isPublic="Y" />
<Content contentId="EXAMPLE_main" contentTypeId="DOCUMENT" contentName="Example main menu." templateDataResourceId="HELP_TEMPL" dataResourceId="EXAMPLE_main" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
<ContentAssoc contentId="HELP_EXAMPLE" contentIdTo="EXAMPLE_main" mapKey="EXAMPLE_main" fromDate="2006-01-12 01:01:01" contentAssocTypeId="TREE_CHILD" sequenceNum="000"/>
<ContentAssoc contentId="HELP_EXAMPLE" contentIdTo="EXAMPLE_main" mapKey="EXAMPLE_FindExample" fromDate="2006-01-12 01:01:02" sequenceNum="000" contentAssocTypeId="INSTANCE"/>
<DataResource dataResourceId="EXAMPLE_docbook" localeString="en" dataResourceTypeId="OFBIZ_FILE"
objectInfo="plugins/example/data/helpdata/HELP_EXAMPLE_docbook.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Example docBook usage" mimeTypeId="text/xml" isPublic="Y" />
<Content contentId="EXAMPLE_docbook" contentTypeId="DOCUMENT" contentName="Example Docbook usage" templateDataResourceId="HELP_TEMPL" dataResourceId="EXAMPLE_docbook" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
<ContentAssoc contentId="HELP_EXAMPLE" contentIdTo="EXAMPLE_docbook" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EXAMPLE_docbook"/>
</entity-engine-xml>
+87
View File
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<section xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd"
xmlns="http://docbook.org/ns/docbook">
<title>OFBiz BIRT Overview</title>
<para>
Welcome to OFBiz BIRT. The part installed within OFBiz allows you to run the reports which are prepared using Eclipse with the BIRT plugin installed.
</para>
<para>
This is a short document to help you get started using BIRT to make a report.
</para>
<para>
As a demo we have prepared a an example report.
Look at the <link xl:href="http://eclipse.org/birt/phoenix/">Eclipse BIRT web site</link> for more information.
</para>
<para>
-
</para>
<para>
There is also a new feature (2017) which allows you to dynamically create Birt reports, and allow your users to customise them: the OFBiz Flexible Reports.
</para>
<para>
Look at the <link xl:href="https://cwiki.apache.org/confluence/display/OFBIZ/Birt+Flexible+Reports">the official documentation</link> for more information.
</para>
<section>
<title>1. PDF tab</title>
<para>When you click on this tab. It will render the example report in a PDF format</para>
</section>
<section>
<title>2. Send any format through Mail tab</title>
<para>When you click on this tab. It will show a form that can send the report per email.</para>
</section>
<section>
<title>3. Chart tab</title>
<para>When you click on this tab. An example chart will render in a PDF format</para>
</section>
<section>
<title>Examine the Example Report</title>
<para>
The example report that run in OFBiz is in the file component://birt/webapp/birt/report/example.rptdesign. When you have started Eclipse BIRT, open this document.
This report show how a report receives data from OFBiz through Scripted Data Source using the OFBiz delegator.
This report has the scripted data source name "OFBiz" and the data set that use the script data source name is called "Product".
Open the script editor for Product data set, it uses the delegator object query data from the Product entity.
A report that runs on the OFBiz platform can use the delegator object, dispatcher object, security object and classpath of OFBiz environment in the script.</para>
</section>
<section>
<title>How do I send parameter to report?</title>
<para>If a report is to be rendered through a view map, you can send a parameter through attribute of the request object, the attribute's name is "birtParameters" which is a map.</para>
<para>If a report is to be rendered through an e-mail, you can send the parameter through the service's parameter name called birtParameters.</para>
</section>
<section>
<title>Which are the supported content types?</title>
<para>Excel (.xls)</para>
<para>Excel (.xlsx)</para>
<para>LibreOffice Calc (.ods)</para>
<para>LibreOffice Impress (.odp)</para>
<para>LibreOffice Writer (.odt)</para>
<para>Pdf (.pdf)</para>
<para>Postscript (.ps)</para>
<para>Powerpoint (.ppt)</para>
<para>Powerpoint (.pptx)</para>
<para>Text (.html)</para>
<para>Word (.doc)</para>
<para>Word (.docx)</para>
</section>
</section>
+29
View File
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<chapter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0"
xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://docbook.org/ns/docbook ../../applications/content/dtd/docbook.xsd"
xmlns="http://docbook.org/ns/docbook">
<title>BIRT report generator.</title>
<para> An example report sales can be found in the example component. </para>
<para>
<xi:include href="../../../plugins/birt/data/helpdata/HELP_BIRT.xml"/>
</para>
</chapter>
@@ -17,6 +17,8 @@
* under the License.
*/
def module = "AcctgTransEntriesSearchResultsParameters.groovy"
try {
def birtParameters = [:]
birtParameters.organizationPartyId = parameters.organizationPartyId
@@ -41,6 +43,6 @@ try {
birtParameters.userLoginId = userLogin.userLoginId
request.setAttribute("birtParameters", birtParameters)
} catch (e) {
logError(e)
Debug.logError(e, module)
}
return "success";
@@ -18,6 +18,9 @@
*/
import java.sql.Timestamp
import org.apache.ofbiz.base.util.Debug
def module = "BalanceSheetParameters.groovy"
try {
def birtParameters = [:]
@@ -33,6 +36,6 @@ try {
birtParameters.locale = locale
request.setAttribute("birtParameters", birtParameters)
} catch (e) {
logError(e)
Debug.logError(e, module)
}
return "success";
@@ -18,6 +18,9 @@
*/
import java.sql.Timestamp
import org.apache.ofbiz.base.util.Debug
def module = "IncomeStatementParameters.groovy"
try {
def birtParameters = [:]
@@ -32,6 +35,6 @@ try {
birtParameters.userLoginId = userLogin.userLoginId
request.setAttribute("birtParameters", birtParameters)
} catch (e) {
logError(e)
Debug.logError(e, module)
}
return "success";
@@ -17,12 +17,14 @@
* under the License.
*/
def module = "InvoiceAcctgTransEntryParameters.groovy"
try {
birtParameters = [:]
birtParameters.invoiceId = parameters.invoiceId
birtParameters.userLoginId = userLogin.userLoginId
request.setAttribute("birtParameters", birtParameters)
} catch (e) {
logError(e)
Debug.logError(e, module)
}
return "success";
@@ -17,12 +17,14 @@
* under the License.
*/
def module = "PaymentAcctgTransEntryParameters.groovy"
try {
birtParameters = [:]
birtParameters.paymentId = parameters.paymentId
birtParameters.userLoginId = userLogin.userLoginId
request.setAttribute("birtParameters", birtParameters)
} catch (e) {
logError(e)
Debug.logError(e, module)
}
return "success";
@@ -17,6 +17,8 @@
* under the License.
*/
def module = "TrialBalanceParameters.groovy"
try {
def birtParameters = [:]
birtParameters.organizationPartyId = parameters.organizationPartyId
@@ -24,6 +26,6 @@ try {
birtParameters.userLoginId = userLogin.userLoginId
request.setAttribute("birtParameters", birtParameters)
} catch (e) {
logError(e)
Debug.logError(e, module)
}
return "success";
+13 -13
View File
@@ -22,17 +22,17 @@ import org.apache.ofbiz.base.util.UtilValidate
reportBy = parameters.reportBy
exportType = parameters.exportType
if (!parameters.fromDate) {
if (UtilValidate.isEmpty(parameters.fromDate)) {
request.setAttribute("_ERROR_MESSAGE_", "Please select From Date.")
return "error"
}
if ("pdf" == exportType) {
if ("day" == reportBy) {
if (exportType == "pdf") {
if (reportBy == "day") {
return "dayPDF"
} else if ("week" == reportBy) {
} else if (reportBy == "week") {
return "weekPDF"
} else if ("month" == reportBy) {
} else if (reportBy == "month") {
return "monthPDF"
} else {
request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.")
@@ -40,12 +40,12 @@ if ("pdf" == exportType) {
}
}
if ("excel" == exportType) {
if ("day" == reportBy) {
if (exportType == "excel") {
if (reportBy == "day") {
return "dayExcel"
} else if ("week" == reportBy) {
} else if (reportBy == "week") {
return "weekExcel"
} else if ("month" == reportBy) {
} else if (reportBy == "month") {
return "monthExcel"
} else {
request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.")
@@ -53,12 +53,12 @@ if ("excel" == exportType) {
}
}
if ("html" == exportType) {
if ("day" == reportBy) {
if (exportType == "html") {
if (reportBy == "day") {
return "dayHTML"
} else if ("week" == reportBy) {
} else if (reportBy == "week") {
return "weekHTML"
} else if ("month"== reportBy) {
} else if (reportBy == "month") {
return "monthHTML"
} else {
request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.")
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.ofbiz.base.util.Debug
import org.apache.ofbiz.base.util.UtilDatetime
import java.sql.*
@@ -26,11 +27,11 @@ DateDay = DateStr.substring(0,10)
DateMonth = DateStr.substring(5,7)
DateYear = DateStr.substring(0,4)
if ("01" == DateMonth||"03" == DateMonth||"05" == DateMonth||"07" == DateMonth||"08" == DateMonth||"10" == DateMonth||"12" == DateMonth)
if (DateMonth == "01"||DateMonth == "03"||DateMonth == "05"||DateMonth == "07"||DateMonth == "08"||DateMonth == "10"||DateMonth == "12")
{
NunberDate = 31
}
else if ("02" == DateMonth)
else if (DateMonth == "02")
{
NunberDate = 29
}
@@ -47,7 +48,7 @@ try {
birtParameters.DateYear = DateYear
birtParameters.NunberDate = NunberDate
} catch (e) {
logError(e)
Debug.logError(e, "")
}
request.setAttribute("birtParameters", birtParameters)
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.ofbiz.base.util.Debug
import org.apache.ofbiz.base.util.UtilDateTime
import java.sql.*
import com.ibm.icu.util.Calendar
@@ -32,7 +33,7 @@ try
birtParameters.Week = Week
birtParameters.Year = Year
} catch (e) {
logError(e)
Debug.logError(e, "")
}
request.setAttribute("birtParameters", birtParameters)
+2 -1
View File
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.ofbiz.base.util.Debug
import java.sql.*
fromDateStr = parameters.fromDate
@@ -35,7 +36,7 @@ try {
birtParameters.thruMonth = month
birtParameters.thisYear = year
} catch (e) {
logError(e)
Debug.logError(e, "")
}
request.setAttribute("birtParameters", birtParameters)
+2
View File
@@ -25,6 +25,7 @@ under the License.
<classpath type="dir" location="config"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/BirtHelpData.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/BirtTypeData.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/OrderPortletData.xml"/>
<entity-resource type="data" reader-name="demo" loader="main" location="data/BirtSecurityGroupDemoData.xml"/>
@@ -35,6 +36,7 @@ under the License.
<entity-resource type="data" reader-name="demo" loader="main" location="data/example/ExampleSecurityGroupDemoData.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/example/ExamplePortletData.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/example/ExamplePortalSeedData.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/example/ExampleHelpData.xml"/>
<entity-resource type="data" reader-name="demo" loader="main" location="data/example/ExampleDemoData.xml"/>
<entity-resource type="model" reader-name="main" loader="main" location="entitydef/ServiceReportsView.xml"/>
@@ -1,37 +1,21 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
=== Report creation
http://www.apache.org/licenses/LICENSE-2.0
==== Introduction
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
=== Report creation
A flexible report is an OFBiz content of FLEXIBLE_REPORT type that allows a final user to make use of the reporting
module to obtain flexible reports, ie reports which are created from an entity or view definition and even from a
service. A flexible report is created from a Report Master (content REPORT_MASTER), and an optional XML override of the
parent form.
==== Introduction
==== Pre-requisite
A flexible report is an OFBiz content of FLEXIBLE_REPORT type that allows a final user to make use of the reporting
module to obtain flexible reports, ie reports which are created from an entity or view definition and even from a
service. A flexible report is created from a Report Master (content REPORT_MASTER), and an optional XML override of the
parent form.
* OFBiz framework
* The Birt plugin
* The BIRT Report Designer: <<#_using_the_birt_report_designer,Using the Birt Report Designer>>
==== Pre-requisite
* OFBiz framework
* The Birt plugin
* The BIRT Report Designer: <<#_using_the_birt_report_designer,Using the Birt Report Designer>>
'''
==== How to do
. Get to Birt component in OFBiz image:Birt-Menus.png[Birt menus]
. Get to Birt component in OFBiz image:Birt-Menus.png[Birt menus]
. Click on the "Flexible Report" menu (varies depending on themes)
. Click on the "Generate report" button, you get to this screen:
. Fill the form: image:Example-Report.png[Example Report]
@@ -40,54 +24,54 @@ parent form.
** The description is a short description which will allow you to recognise the report and its topic.
** The box "Generate filters in design" will add in the design the visualisation of the filters filled in the filtering form.
Once the form is validated, OFBiz will show you the "Edit Report" screen.
Once the form is validated, OFBiz will show you the "Edit Report" screen.
image::Edit-Report-screen.png[Edit Report screen]
image::Edit-Report-screen.png[Edit Report screen]
==== Report information
==== Report information
This first panel allows you to change the report description and status. Actually it does not make sense changing the
status to published before having downloaded the .rptdesign file (Birt Report Designer file) from the server (in
database), edited and uploaded it back to the server. This is explained in the section below. Changing the status allows
users to use your reports. But if you publish without any change the report will render as empty.
This first panel allows you to change the report description and status. Actually it does not make sense changing the
status to published before having downloaded the .rptdesign file (Birt Report Designer file) from the server (in
database), edited and uploaded it back to the server. This is explained in the section below. Changing the status allows
users to use your reports. But if you publish without any change the report will render as empty.
==== The .rptdesign report file: download, edit, upload and publish it
==== The .rptdesign report file: download, edit, upload and publish it
To really use the report you need to download the .rptdesign file from the server in a location from where you can edit
it with the BIRT Report Designer. So you need to install first the BIRT Report Designer. Then you can edit the
.rptdesign file in the BIRT Report Designer. For that refer to <<#_using_the_birt_report_designer,Using the Birt Report
Designer>>.
To really use the report you need to download the .rptdesign file from the server in a location from where you can edit
it with the BIRT Report Designer. So you need to install first the BIRT Report Designer. Then you can edit the
.rptdesign file in the BIRT Report Designer. For that refer to <<#_using_the_birt_report_designer,Using the Birt Report
Designer>>.
===== Editing the downloaded file
===== Editing the downloaded file
Once you installed the BIRT Report Designer and have downloaded the .rptdesign file, you can edit it with the Birt
Report Designer. When you have edited it suiting your needs you must upload it to the server for your changes to be
taken into account by OFBiz.
Once you installed the BIRT Report Designer and have downloaded the .rptdesign file, you can edit it with the Birt
Report Designer. When you have edited it suiting your needs you must upload it to the server for your changes to be
taken into account by OFBiz.
*This is when things begin to be really interesting*. You can then test your report using the "Preview" panel. There you
can temporarily filter the result, and use the export format you prefer, once done click "Send". You can then decide to
change the report content in the Birt Report Designer again or keep your changes. Once done in the Birt Report Designer,
simply select the changed file to upload, and upload it again. You can re-test your changes and continue until you
really get what you want! You can then publish the report to allow users to select and use it. There are 2 ways to
publish a report from the "Manage reports" screen or directly in the "Report information" panel. We will see the "Manage
reports" screen below.
*This is when things begin to be really interesting*. You can then test your report using the "Preview" panel. There you
can temporarily filter the result, and use the export format you prefer, once done click "Send". You can then decide to
change the report content in the Birt Report Designer again or keep your changes. Once done in the Birt Report Designer,
simply select the changed file to upload, and upload it again. You can re-test your changes and continue until you
really get what you want! You can then publish the report to allow users to select and use it. There are 2 ways to
publish a report from the "Manage reports" screen or directly in the "Report information" panel. We will see the "Manage
reports" screen below.
==== Filters Overriding
==== Filters Overriding
You may want to overide the default filters. You can then use the Xml "Override filters" panel to override and
personnalize the form, once done click "Save". If you ignore that step, it will *NOT* prevent the report creation, *it
is already done*, it will just be with the generic filtering form inherited from the master from.
You may want to overide the default filters. You can then use the Xml "Override filters" panel to override and
personnalize the form, once done click "Save". If you ignore that step, it will *NOT* prevent the report creation, *it
is already done*, it will just be with the generic filtering form inherited from the master from.
NOTE: if no preview is available, it is usually due to a mistake in the master form code. You can edit it in the
database.
NOTE: if no preview is available, it is usually due to a mistake in the master form code. You can edit it in the
database.
==== Manage reports
==== Manage reports
The "Manage reports" button get you to a screen which allows to edit (get back to current page), publish or delete a
report.
The "Manage reports" button get you to a screen which allows to edit (get back to current page), publish or delete a
report.
==== Use a report
==== Use a report
Users can select and use any published report from that screen. When they select a report they then get the same
"Preview" Panel and can do the same things than in the "Edit Report" screen. Refer users to
Users can select and use any published report from that screen. When they select a report they then get the same
"Preview" Panel and can do the same things than in the "Edit Report" screen. Refer users to
@@ -1,75 +0,0 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
= BIRT in OFbiz User Interface
Welcome to OFBiz BIRT component. +
The part installed within OFBiz allows you to run the reports which are prepared using Eclipse with the BIRT plugin installed.
This is a short document to help you get started using BIRT to make a report.
As a demo we have prepared a an example report. +
Look at the http://eclipse.org/birt/phoenix/[Eclipse BIRT web site] for more information.
There is also a new feature (2017) which allows you to dynamically create Birt reports, and allow your users to customise them:
the <<_ofbiz_flexible_reports>>.
== PDF tab
When you click on this tab.
It will render the example report in a PDF format
== Send any format through Mail tab
When you click on this tab.
It will show a form that can send the report per email.
== Chart tab
When you click on this tab.
An example chart will render in a PDF format
== Examine the Example Report
The example report design that run in OFBiz is in the file component://birt/webapp/birt/report/example.rptdesign.
When you have started Eclipse BIRT, open this document.
This report show how a report receives data from OFBiz through Scripted Data Source using the OFBiz delegator. +
This report has the scripted data source name "OFBiz" and the data set that use the script data source name is called "Product".
Open the script editor for Product data set, it uses the delegator object query data from the Product entity.
A report that runs on the OFBiz platform can use the delegator object, dispatcher object, security object and classpath of
OFBiz environment in the script.
== How do I send parameter to report?
If a report is to be rendered through a view map, you can send a parameter through attribute of the request object,
the attribute's name is "birtParameters" which is a map.
If a report is to be rendered through an e-mail, you can send the parameter through the service's parameter name called
birtParameters.
== Which are the supported content types?
* Excel (.xls)
* Excel (.xlsx)
* LibreOffice Calc (.ods)
* LibreOffice Impress (.odp)
* LibreOffice Writer (.odt)
* Pdf (.pdf)
* Postscript (.ps)
* Powerpoint (.ppt)
* Powerpoint (.pptx)
* Text (.html)
* Word (.doc)
* Word (.docx)
@@ -1,37 +1,21 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
=== Using a flexible report
http://www.apache.org/licenses/LICENSE-2.0
==== Introduction
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
=== Using a flexible report
NOTE: this feature will be officially available with the R17.12 branch first release
==== Introduction
A flexible report is an OFBiz content of FLEXIBLE_REPORT type which allows the final user to obtain reports using the
Birt reporting module. It will be produced at a specific time of your choosing, with your chosen output format,
filtering the data with a few parameters defined during report design creation.
NOTE: this feature will be officially available with the R17.12 branch first release
==== Pre-requisite
A flexible report is an OFBiz content of FLEXIBLE_REPORT type which allows the final user to obtain reports using the
Birt reporting module. It will be produced at a specific time of your choosing, with your chosen output format,
filtering the data with a few parameters defined during report design creation.
==== Pre-requisite
* OFBiz
* The Birt plugin
* Pre-published reports created from report masters
==== Using the report
==== Using the report
. go to the Birt component or to another page harboring reports.
. In the Birt component, click "Use a report".
. Select your report and hit "Send".
@@ -1,30 +1,12 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
=== Report master creation
==== Introduction
NOTE: this feature will be officially available with the R17.12 branch first release
A report master is an OFBiz content which allows a user to generate data reports.
It defines data connexion, and a general filtering form for data.
It can be based on an entity, a dedicated service, or in a wider sense on any shape
A report master is an OFBiz content which allows a user to generate data reports.
It defines data connexion, and a general filtering form for data.
It can be based on an entity, a dedicated service, or in a wider sense on any shape
a data connexion can take and return back a map.
==== Pre-requisite
@@ -33,19 +15,19 @@ a data connexion can take and return back a map.
* Birt plugin
==== Report Master based on an entity/view
. Create or choice a database entity or view
. Create the general filtering form within the file plugins/birt/widget/birt/BirtMasterForms.xml. The only informations to be changed are entity-name and form name.
+
[source,xml]
----
<form name="CTNT_MASTER_EXAMPLE" type="single" extends="AbstractFlexibleReportSearchForm">
<auto-fields-entity entity-name="Example" default-field-type="find"/>
</form>
----
. Add the informations about this Master in the database using the file
[start=3]
. Add the informations about this Master in the database using the file
plugins/birt/data/BirtMasterData.xml
+
[source,xml]
----
<DataResource dataResourceId="DR_MASTER_EXAMPLE" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="FORM_COMBINED" />
@@ -60,13 +42,13 @@ plugins/birt/data/BirtMasterData.xml
<ContentAttribute contentId="CTNT_MASTER_EXAMPLE" attrName="Entity" attrValue="Example"/>
----
+
The form in the database is the form that will allow users to change form parameters.
You can add any field you desire. Some field names are though reserved: reportContentId, overrideFilters,
The form in the database is the form that will allow users to change form parameters.
You can add any field you desire. Some field names are though reserved: reportContentId, overrideFilters,
entityViewName, birtContentType.
. Add in the file content/config/contentEntityLabels.xml the Property that will allow translation
[start=4]
. Add in the file content/config/contentEntityLabels.xml the Property that will allow translation
for your report master description.
+
[source,xml]
----
<property key="Content.description.CTNT_MASTER_EXAMPLE">
@@ -78,48 +60,41 @@ for your report master description.
Your Report Master is created ! You can now create reports using it.
==== Report Master based on a service
In plugins/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java there is 2 sets of dedicated services (see examples there)
. In each set the first service, will return 4 items:
** an object of type Map<String, String> called *dataMap*.
*** *Keys*: data field names.
*** *Values*: data types (OFBiz types).
** an object of type Map<String, String> called *fieldDisplayLabels*.
*** *Keys*: data field names.
*** *Values*: the names displayed to the user.
+
This output is optional, should it be missing, the keys will be displayed.
** an object of type Map<String, String> called *filterMap*.
*** *Keys*: data filtering field names (exact names used for the form fields).
*** *Values*: data type (OFBiz type).
+
This output is optional, if missing, filters can not be displayed on the report.
** an object of type Map<String, String> called *filterDisplayLabels*.
*** *Keys*: data filtering field names (exact names used for the form fields).
*** *Values*: names to be displayed to the user.
+
This output is optional, should it be missing, the keys will be displayed.
. The second service will actually get the data. It receives an object (Object type) called reportContext. +
From this object, you can obtain the map parameters using the following code:
+
** an object of type Map<String, String> called dataMap.
*Keys*: data field names. *Values*: data types (OFBiz types).
** an object of type Map<String, String> called fieldDisplayLabels.
*Keys*: data field names. *Values*: the names displayed to the user.
This output is optional, should it be missing, the keys will be displayed.
** an object of type Map<String, String> called filterMap.
*Keys*: data filtering field names (exact names used for the form fields).
*Values*: data type (OFBiz type).
This output is optional, if missing, filters can not be displayed on the report.
** an object of type Map<String, String> called filterDisplayLabels.
*Keys*: data filtering field names (exact names used for the form fields).
*Values*: names to be displayed to the user.
This output is optional, should it be missing, the keys will be displayed.
. The second service will actually get the data. It receives an object (Object type) called reportContext.
From this object, you can obtain the map parameters using the following code:
[source,java]
----
Map<String, Object> parameters = UtilGenerics.checkMap(reportContext.getParameterValue("parameters"));
----
+
This Map will give access fields of the filtering form. +
This service will return a list of type List<GenericValue>, containing the data. +
This Map will give access fields of the filtering form.
This service will return a list of type List<GenericValue>, containing the data.
A Map<String, Object> would also do.
Then,
. create the parent form in the file plugins/birt/widget/birt/BirtMasterForms.xml.
Field names created here must be the names used on the Map parameters of the previous service,
Field names created here must be the names used on the Map parameters of the previous service,
and also corresponding to the map filterMap.
+
[source,xml]
----
<form name="CTNT_MASTER_TURNOVER" type="single" extends="AbstractFlexibleReportSearchForm">
@@ -129,9 +104,9 @@ and also corresponding to the map filterMap.
<field name="productStoreId"><lookup target-form-name="LookupProductStore"/></field>
</form>
----
[start=2]
. Create the master in database following.
+
[source,xml]
----
<CustomMethod customMethodId="CM_FB_TURNOVER" customMethodTypeId="FLEXIBLE_BIRT" customMethodName="flexibleReportTurnOver" description="service to resolve invoice for turnover report domain"/>
@@ -150,10 +125,10 @@ and also corresponding to the map filterMap.
<ContentAttribute contentId="CTNT_MASTER_TURNOVER" attrName="Service" attrValue="default"/>
----
+
The form in the database is the form that will allow users to change form parameters.
You can add any field you desire. Some field names are reserved: reportContentId, overrideFilters,
The form in the database is the form that will allow users to change form parameters.
You can add any field you desire. Some field names are reserved: reportContentId, overrideFilters,
entityViewName, birtContentType.
[start=3]
. Import these data in the base using Webtools XML import (or the longer "gradlew 'ofbiz -l readers=seed,ext' command).
. Add in the file content/config/contentEntityLabels.xml the Property which will translate your report Master description.
@@ -1,89 +1,71 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
=== Using the Birt Report Designer
http://www.apache.org/licenses/LICENSE-2.0
==== Introduction
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
=== Using the Birt Report Designer
NOTE: this feature will be officially available with the R17.12 branch first release
==== Introduction
The creation of a flexible report goes through a design step of the initial flexible report output under the Birt Report
Designer.
NOTE: this feature will be officially available with the R17.12 branch first release
This document describes the simplest designs to connect to the data. It is not exhaustive, and simply attempts to cover
basic needs. You will find much more documentation online. In our approach, the connection to the data is generated
automatically by OFBiz, only the design part of the report will be discussed.
The creation of a flexible report goes through a design step of the initial flexible report output under the Birt Report
Designer.
==== Installing the BIRT Report Designer
This document describes the simplest designs to connect to the data. It is not exhaustive, and simply attempts to cover
basic needs. You will find much more documentation online. In our approach, the connection to the data is generated
automatically by OFBiz, only the design part of the report will be discussed.
Installing the BIRT Report Designer is easy. If you use Eclipse, you can include it as a plugin. You can also install
the whole BIRT Report Designer. I use Eclipse but I prefer the second way, to not mix things. So simply download and
install the whole all-in-one thing. Or install the plugin if you prefer and use its "Report Design" view which allows to
edit .rptdesign files.
==== Installing the BIRT Report Designer
NOTE: if you installed the BIRT Report Designer under say, a Birt directory, then by default the reports will be
accessed from the Birt\workspace\Report Builder directly and this is where you should put the .rptdesign files when
downloading them. Your mileage may wary...
Installing the BIRT Report Designer is easy. If you use Eclipse, you can include it as a plugin. You can also install
the whole BIRT Report Designer. I use Eclipse but I prefer the second way, to not mix things. So simply download and
install the whole all-in-one thing. Or install the plugin if you prefer and use its "Report Design" view which allows to
edit .rptdesign files.
==== Different areas of the screen and their role
NOTE: if you installed the BIRT Report Designer under say, a Birt directory, then by default the reports will be
accessed from the Birt\workspace\Report Builder directly and this is where you should put the .rptdesign files when
downloading them. Your mileage may wary...
===== Navigator - Report Builder
==== Different areas of the screen and their role
This is where you should find the .rptdesign files you downloaded.
===== Navigator - Report Builder
image::Report-Builder.png[Report Builder]
This is where you should find the .rptdesign files you downloaded.
===== Data Explorer
image::Report-Builder.png[Report Builder]
The Data Explorer defaults to the right of your screen. It gives you access to two things. The data fields available for
the report, and the filter fields that can be used for this report.
===== Data Explorer
image::Data-Explorer.png[Data Explorer]
The Data Explorer defaults to the right of your screen. It gives you access to two things. The data fields available for
the report, and the filter fields that can be used for this report.
===== Palette
image::Data-Explorer.png[Data Explorer]
The palette provides the various tools you can insert in the report. Simple text, image, table of data, layout table,
graph, aggregation, etc. All objects are added to the report by drag & drop.
===== Palette
image::Palette.png[Palette]
The palette provides the various tools you can insert in the report. Simple text, image, table of data, layout table,
graph, aggregation, etc. All objects are added to the report by drag & drop.
===== Tabs
image::Palette.png[Palette]
At the right bottom of the window is a series of five tabs.
===== Tabs
At the right bottom of the window is a series of five tabs.
We will use two:
We will use two:
* Layout, which will allow most of the design.
* Master Page, which will give access by its owners to standard parameters such as the orientation or size of the report.
The preview is not accessible because it can not be executed outside of OFBiz. Any changes to the scripts will be erased
during the upload in OFBiz.
The preview is not accessible because it can not be executed outside of OFBiz. Any changes to the scripts will be erased
during the upload in OFBiz.
===== Simple design without break
===== Simple design without break
The simplest possible design is to insert in a table (table in the palette), a part or all of the data set data fields.
To do this, right-click on Data Set in the Data Explorer \-> Insert in Layout, and then select the fields you want to
see appear.
The simplest possible design is to insert in a table (table in the palette), a part or all of the data set data fields.
To do this, right-click on Data Set in the Data Explorer \-> Insert in Layout, and then select the fields you want to
see appear.
===== Simple design with break
===== Simple design with break
A break is a collection of data made by Birt from the data. It permits to classify according to a field, and to give
details for each category, then to aggregate certain fields, etc.
A break is a collection of data made by Birt from the data. It permits to classify according to a field, and to give
details for each category, then to aggregate certain fields, etc.
. Insert a table (Table) in the report \-> OK
. Right-click on the table \-> Edit Data Binding, select all fields
@@ -95,40 +77,40 @@ details for each category, then to aggregate certain fields, etc.
** A group detail line
** A footer of the group
** A global footer line
. Then insert some elements in the design: in the global header, everything that does not depend on the group, for example the title of the report. In the header of the group, everything that is common to the whole group and that you want to see in its title. In the details, the fields that may appear for each group line. As in the image below, the fields might be inserted by Copy/Paste from the Data Set, and titles via a text element of the palette. You can add lines and columns by right clicking on the end of the line (gray rectangle when the table is selected), etc.
. Then insert some elements in the design: in the global header, everything that does not depend on the group, for example the title of the report. In the header of the group, everything that is common to the whole group and that you want to see in its title. In the details, the fields that may appear for each group line. As in the image below, the fields might be inserted by Copy/Paste from the Data Set, and titles via a text element of the palette. You can add lines and columns by right clicking on the end of the line (gray rectangle when the table is selected), etc.
image::Design-with-break.png[Design with break]
====== Construction of aggregation
image::Design-with-break.png[Design with break]
====== Construction of aggregation
The aggregations may be on the whole table, or only on a group. They are characterized by an expression to aggregate
(made up of different data fields), a possible filter on the data lines, and an aggregation function, eg:
The aggregations may be on the whole table, or only on a group. They are characterized by an expression to aggregate
(made up of different data fields), a possible filter on the data lines, and an aggregation function, eg:
image::Aggregation-builder.png[Aggregation builder]
image::Aggregation-builder.png[Aggregation builder]
====== Expression builder
====== Expression builder
The _fx_ (for expression and filter) buttons are used to open a complex expression construction window. It is possible
to use predefined functions, Javascript, data fields, already built aggregations, and so on. This window can also be
used by including a data element, which allows to construct non-aggregated data expressions.
The _fx_ (for expression and filter) buttons are used to open a complex expression construction window. It is possible
to use predefined functions, Javascript, data fields, already built aggregations, and so on. This window can also be
used by including a data element, which allows to construct non-aggregated data expressions.
image::Expression-builder.png[Expression builder]
image::Expression-builder.png[Expression builder]
Footer lines often allow you to place aggregations, such as sums on the group or table rows, eg
Footer lines often allow you to place aggregations, such as sums on the group or table rows, eg
image::Design-with-break-complete.png[Design with break complete]
image::Design-with-break-complete.png[Design with break complete]
WARNING: any unused line must be deleted, otherwise it generates white spaces on the report.
WARNING: any unused line must be deleted, otherwise it generates white spaces on the report.
==== Layout Management
==== Layout Management
===== General settings
===== General settings
Right button leads to Properties Editor tab at bottom. Then click on the Master Page tab, just above. In the Property
Editor you will see a series of general properties that will allow you to modify the general form of the report.
Right button leads to Properties Editor tab at bottom. Then click on the Master Page tab, just above. In the Property
Editor you will see a series of general properties that will allow you to modify the general form of the report.
===== Styles
===== Styles
By right-clicking on any item in the table, you have access to the menu of styles. From there they can be edited,
applied, created. A style can be applied to the whole picture, to a row or column, to a cell, or to an element in that
cell (text, data, ...).
By right-clicking on any item in the table, you have access to the menu of styles. From there they can be edited,
applied, created. A style can be applied to the whole picture, to a row or column, to a cell, or to an element in that
cell (text, data, ...).
+12 -21
View File
@@ -16,36 +16,27 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
= Birt OFBiz® plugin
= Birt Apache OFBiz® plugin
The Apache OFBiz Project
Release 17.12
:imagesdir: ./images
ifdef::backend-pdf[]
:title-logo-image: image::images/OFBiz-Logo.svg[Apache OFBiz Logo, pdfwidth=4.25in, align=center]
:title-logo-image: image::OFBiz-Logo.svg[Apache OFBiz Logo, pdfwidth=4.25in, align=center]
:source-highlighter: rouge
endif::[]
:imagesdir: ./images/birt
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[link="http://www.apache.org/licenses/LICENSE-2.0"]
The birt plugin is one of the OFBiz plugins.
== OFBiz Flexible Reports
One of the functionalities of the birt plugin are the "OFBiz Flexible Reports"
There is an announce with some history in the OFBiz blog:
https://blogs.apache.org/ofbiz/entry/the-birt-flexible-reports-a[Reporting in Apache OFBiz® and the OFBiz Flexible Reports]
== Technical Documentation
include::_include/bt-creating reports.adoc[leveloffset=+0]
include::_include/bt-using the birt report designer.adoc[leveloffset=+0]
include::_include/bt-report master creation.adoc[leveloffset=+0]
== User documentation
include::_include/bt-how to use flexible reports.adoc[leveloffset=+0]
include::_include/bt-help.adoc[leveloffset=+1]
There is an anounce with some history in the OFBiz blog:
https://blogs.apache.org/ofbiz/entry/the-birt-flexible-reports-a[Reporting in Apache OFBiz® and the OFBiz Flexible Reports]
=== Technical Documentation
include::_include/bt-creating reports.adoc[leveloffset=+1]
include::_include/bt-using the birt report designer.adoc[leveloffset=+1]
include::_include/bt-report master creation.adoc[leveloffset=+1]
=== User documentation
include::_include/bt-how to use flexible reports.adoc[leveloffset=+1]

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 196 KiB

@@ -37,7 +37,7 @@ import org.xml.sax.SAXException;
*/
public class BirtFactory {
private static final String MODULE = BirtFactory.class.getName();
public final static String module = BirtFactory.class.getName();
private static IReportEngine engine;
@@ -66,7 +66,7 @@ public class BirtFactory {
* @throws ParserConfigurationException
*/
public static InputStream getReportInputStreamFromLocation(String resourceName)
throws IOException, SAXException, ParserConfigurationException {
throws IOException, SAXException, ParserConfigurationException{
InputStream reportInputStream = null;
synchronized (BirtFactory.class) {
@@ -81,8 +81,8 @@ public class BirtFactory {
throw new IllegalArgumentException("Could not resolve location to URL: " + resourceName);
}
reportInputStream = reportFileUrl.openStream();
double totalSeconds = (System.currentTimeMillis() - startTime) / 1000.0;
Debug.logInfo("Got report in " + totalSeconds + "s from: " + reportFileUrl.toExternalForm(), MODULE);
double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0;
Debug.logInfo("Got report in " + totalSeconds + "s from: " + reportFileUrl.toExternalForm(), module);
}
if (reportInputStream == null) {
@@ -61,29 +61,29 @@ import org.eclipse.birt.report.engine.api.RenderOption;
public final class BirtWorker {
private static final String MODULE = BirtWorker.class.getName();
public final static String module = BirtWorker.class.getName();
private static final String BIRT_PARAMETERS = "birtParameters";
private static final String BIRT_LOCALE = "birtLocale";
private static final String BIRT_IMAGE_DIRECTORY = "birtImageDirectory";
private static final String BIRT_CONTENT_TYPE = "birtContentType";
private static final String BIRT_OUTPUT_FILE_NAME = "birtOutputFileName";
private static final String RES_ERROR = "BirtErrorUiLabels";
private final static String BIRT_PARAMETERS = "birtParameters";
private final static String BIRT_LOCALE = "birtLocale";
private final static String BIRT_IMAGE_DIRECTORY = "birtImageDirectory";
private final static String BIRT_CONTENT_TYPE = "birtContentType";
private final static String BIRT_OUTPUT_FILE_NAME = "birtOutputFileName";
private static final String resourceError = "BirtErrorUiLabels";
private static final HTMLServerImageHandler IMAGE_HANDLER = new HTMLServerImageHandler();
private final static HTMLServerImageHandler imageHandler = new HTMLServerImageHandler();
private BirtWorker() { }
private BirtWorker() {}
private static final Map<Integer, Level> LEVEL_INT_MAP = new HashMap<>();
private static final Map<Integer, Level> levelIntMap = new HashMap<>();
static {
LEVEL_INT_MAP.put(Debug.ERROR, Level.SEVERE);
LEVEL_INT_MAP.put(Debug.TIMING, Level.FINE);
LEVEL_INT_MAP.put(Debug.INFO, Level.INFO);
LEVEL_INT_MAP.put(Debug.IMPORTANT, Level.INFO);
LEVEL_INT_MAP.put(Debug.WARNING, Level.WARNING);
LEVEL_INT_MAP.put(Debug.ERROR, Level.SEVERE);
LEVEL_INT_MAP.put(Debug.FATAL, Level.ALL);
LEVEL_INT_MAP.put(Debug.ALWAYS, Level.ALL);
levelIntMap.put(Debug.ERROR, Level.SEVERE);
levelIntMap.put(Debug.TIMING, Level.FINE);
levelIntMap.put(Debug.INFO, Level.INFO);
levelIntMap.put(Debug.IMPORTANT, Level.INFO);
levelIntMap.put(Debug.WARNING, Level.WARNING);
levelIntMap.put(Debug.ERROR, Level.SEVERE);
levelIntMap.put(Debug.FATAL, Level.ALL);
levelIntMap.put(Debug.ALWAYS, Level.ALL);
}
/**
@@ -110,19 +110,19 @@ public final class BirtWorker {
if (birtImageDirectory == null) {
birtImageDirectory = "/";
}
Debug.logInfo("Get report engine", MODULE);
Debug.logInfo("Get report engine", module);
IReportEngine engine = BirtFactory.getReportEngine();
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
if (birtLocale != null) {
Debug.logInfo("Set BIRT locale:" + birtLocale, MODULE);
Debug.logInfo("Set BIRT locale:" + birtLocale, module);
task.setLocale(birtLocale);
}
// set parameters if exists
Map<String, Object> parameters = UtilGenerics.cast(context.get(BirtWorker.getBirtParameters()));
if (parameters != null) {
//Debug.logInfo("Set BIRT parameters:" + parameters, MODULE);
//Debug.logInfo("Set BIRT parameters:" + parameters, module);
task.setParameterValues(parameters);
}
@@ -138,7 +138,7 @@ public final class BirtWorker {
HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
htmlOptions.setImageDirectory(birtImageDirectory);
htmlOptions.setBaseImageURL(birtImageDirectory);
options.setImageHandler(IMAGE_HANDLER);
options.setImageHandler(imageHandler);
} else if ("application/pdf".equals(contentType)) { // PDF
PDFRenderOption pdfOptions = new PDFRenderOption(options);
pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, Boolean.TRUE);
@@ -151,8 +151,8 @@ public final class BirtWorker {
// run report
if (Debug.infoOn()) {
Debug.logInfo("BIRT's locale is: " + task.getLocale(), MODULE);
Debug.logInfo("Run report's task", MODULE);
Debug.logInfo("BIRT's locale is: " + task.getLocale(), module);
Debug.logInfo("Run report's task", module);
}
task.run();
task.close();
@@ -165,7 +165,7 @@ public final class BirtWorker {
* @param response
*/
public static void setWebContextObjects(Map<String, Object> appContext, HttpServletRequest request, HttpServletResponse response)
throws GeneralException {
throws GeneralException {
HttpSession session = request.getSession();
ServletContext servletContext = session.getServletContext();
@@ -181,23 +181,23 @@ public final class BirtWorker {
appContext.put("dispatcher", WebAppUtil.getDispatcher(servletContext));
}
public static String getBirtParameters() {
public static String getBirtParameters () {
return BIRT_PARAMETERS;
}
public static String getBirtLocale() {
public static String getBirtLocale () {
return BIRT_LOCALE;
}
public static String getBirtImageDirectory() {
public static String getBirtImageDirectory () {
return BIRT_IMAGE_DIRECTORY;
}
public static String getBirtContentType() {
public static String getBirtContentType () {
return BIRT_CONTENT_TYPE;
}
public static String getBirtOutputFileName() {
public static String getBirtOutputFileName () {
return BIRT_OUTPUT_FILE_NAME;
}
@@ -231,12 +231,12 @@ public final class BirtWorker {
EntityCondition entityConditionRpt = EntityCondition.makeCondition("contentTypeId", "RPTDESIGN");
String templatePathLocation = BirtUtil.resolveTemplatePathLocation();
File templatePathLocationDir = new File(templatePathLocation);
if (!templatePathLocationDir.exists()) {
boolean created = templatePathLocationDir.mkdirs();
if (!created) {
throw new GeneralException(UtilProperties.getMessage(RES_ERROR, "BirtErrorCannotLocateReportFolder", locale));
if (!templatePathLocationDir.exists()) {
boolean created = templatePathLocationDir.mkdirs();
if (!created) {
throw new GeneralException(UtilProperties.getMessage(resourceError, "BirtErrorCannotLocateReportFolder", locale));
}
}
}
int i = 0;
String templateFileLocation = null;
EntityCondition ecl = null;
@@ -252,8 +252,7 @@ public final class BirtWorker {
} while (EntityQuery.use(delegator).from("ContentDataResourceView").where(ecl).queryCount() > 0);
//resolve the initial form structure from master content
Map<String, Object> resultElectronicText = dispatcher.runSync("getElectronicText", UtilMisc.toMap("contentId", masterContentId, "locale",
locale, "userLogin", userLogin));
Map<String, Object> resultElectronicText = dispatcher.runSync("getElectronicText", UtilMisc.toMap("contentId", masterContentId, "locale", locale, "userLogin", userLogin));
if (ServiceUtil.isError(resultElectronicText)) {
throw new GeneralException(ServiceUtil.getErrorMessage(resultElectronicText));
}
@@ -273,18 +272,15 @@ public final class BirtWorker {
//create content and dataressource strucutre
Map<String, Object> result = null;
result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceId, "dataResourceTypeId", "ELECTRONIC_TEXT",
"dataTemplateTypeId", "FORM_COMBINED", "userLogin", userLogin));
result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceId, "dataResourceTypeId", "ELECTRONIC_TEXT", "dataTemplateTypeId", "FORM_COMBINED", "userLogin", userLogin));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
result = dispatcher.runSync("createElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", reportForm, "userLogin",
userLogin));
result = dispatcher.runSync("createElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", reportForm, "userLogin", userLogin));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentId, "contentTypeId", "FLEXIBLE_REPORT", "dataResourceId",
dataResourceId, "statusId", "CTNT_IN_PROGRESS", "contentName", reportName, "description", description, "userLogin", userLogin));
result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentId, "contentTypeId", "FLEXIBLE_REPORT", "dataResourceId", dataResourceId, "statusId", "CTNT_IN_PROGRESS", "contentName", reportName, "description", description, "userLogin", userLogin));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
@@ -294,29 +290,23 @@ public final class BirtWorker {
if (!rptDesignName.endsWith(".rptdesign")) {
rptDesignName = rptDesignName.concat(".rptdesign");
}
result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceIdRpt, "dataResourceTypeId", "LOCAL_FILE",
"mimeTypeId", "text/rptdesign", "dataResourceName", rptDesignName, "objectInfo", templateFileLocation, "userLogin", userLogin));
result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceIdRpt, "dataResourceTypeId", "LOCAL_FILE", "mimeTypeId", "text/rptdesign", "dataResourceName", rptDesignName, "objectInfo", templateFileLocation, "userLogin", userLogin));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentIdRpt, "contentTypeId", "RPTDESIGN", "dataResourceId",
dataResourceIdRpt, "statusId", "CTNT_PUBLISHED", "contentName", reportName, "description", description + " (.rptDesign file)",
"userLogin", userLogin));
result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentIdRpt, "contentTypeId", "RPTDESIGN", "dataResourceId", dataResourceIdRpt, "statusId", "CTNT_PUBLISHED", "contentName", reportName, "description", description + " (.rptDesign file)", "userLogin", userLogin));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", masterContentId, "contentIdTo", contentId,
"contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", masterContentId, "contentIdTo", contentId, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", contentId, "contentIdTo", contentIdRpt, "contentAssocTypeId",
"SUB_CONTENT", "userLogin", userLogin));
result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", contentId, "contentIdTo", contentIdRpt, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
result = dispatcher.runSync("createContentAttribute", UtilMisc.toMap("contentId", contentId, "attrName", workflowType, "attrValue",
modelElementName, "userLogin", userLogin));
result = dispatcher.runSync("createContentAttribute", UtilMisc.toMap("contentId", contentId, "attrName", workflowType, "attrValue", modelElementName, "userLogin", userLogin));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
@@ -337,7 +327,6 @@ public final class BirtWorker {
break;
}
}
config.setLogConfig(UtilProperties.getPropertyValue("debug", "log4j.appender.css.dir", ofbizHome + "/runtime/logs/"),
LEVEL_INT_MAP.get(lowerLevel));
config.setLogConfig(UtilProperties.getPropertyValue("debug", "log4j.appender.css.dir", ofbizHome + "/runtime/logs/"), levelIntMap.get(lowerLevel));
}
}
@@ -36,9 +36,10 @@ import org.apache.ofbiz.birt.BirtWorker;
public class BirtContainer implements Container {
private static final String MODULE = BirtContainer.class.getName();
public static final String module = BirtContainer.class.getName();
protected String configFile;
private String configFile;
private String name;
@Override
@@ -52,7 +53,7 @@ public class BirtContainer implements Container {
*/
@Override
public boolean start() throws ContainerException {
Debug.logInfo("Start BIRT container", MODULE);
Debug.logInfo("Start BIRT container", module);
// make sure the subclass sets the config name
if (getName() == null) {
@@ -72,20 +73,20 @@ public class BirtContainer implements Container {
// startup platform
try {
Debug.logInfo("Startup BIRT platform", MODULE);
Debug.logInfo("Startup BIRT platform", module);
Platform.startup(config);
} catch (BirtException e) {
throw new ContainerException(e);
}
// create report engine
Debug.logInfo("Create factory object", MODULE);
Debug.logInfo("Create factory object", module);
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
if (factory == null) {
throw new ContainerException("can not create birt engine factory");
}
Debug.logInfo("Create report engine", MODULE);
Debug.logInfo("Create report engine", module);
IReportEngine engine = factory.createReportEngine(config);
BirtFactory.setReportEngine(engine);
@@ -99,7 +100,7 @@ public class BirtContainer implements Container {
formatList = supportedFormat;
}
}
Debug.logInfo("BIRT supported formats: " + formatList, MODULE);
Debug.logInfo("BIRT supported formats: " + formatList, module);
return false;
}
@@ -63,10 +63,11 @@ import freemarker.template.TemplateException;
public class BirtEmailServices {
private static final String MODULE = BirtEmailServices.class.getName();
private static final String RESOURCE = "BirtUiLabels";
public static final String module = BirtEmailServices.class.getName();
public static final String resource = "BirtUiLabels";
/**
* send birt mail
*
* @param ctx the dispatch context
* @param context the context
* @return returns the result of the service execution
@@ -76,6 +77,7 @@ public class BirtEmailServices {
Delegator delegator = ctx.getDelegator();
LocalDispatcher dispatcher = ctx.getDispatcher();
Security security = ctx.getSecurity();
String webSiteId = (String) serviceContext.remove("webSiteId");
String bodyText = (String) serviceContext.remove("bodyText");
String bodyScreenUri = (String) serviceContext.remove("bodyScreenUri");
@@ -90,7 +92,7 @@ public class BirtEmailServices {
VisualTheme visualTheme = (VisualTheme) context.get("visualTheme");
if (visualTheme == null) {
visualTheme = ThemeFactory.resolveVisualTheme(null);
}
}
if (visualTheme == null) visualTheme = ThemeFactory.resolveVisualTheme(null);
if (bodyParameters == null) {
bodyParameters = MapStack.create();
@@ -117,14 +119,12 @@ public class BirtEmailServices {
try {
screenStringRenderer = new MacroScreenRenderer("screen", visualTheme.getModelTheme().getScreenRendererLocation("screen"));
} catch (TemplateException e) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorRenderingScreenForEmail", UtilMisc.toMap("errorString", e.toString()),
locale);
Debug.logError(e, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorRenderingScreenForEmail", UtilMisc.toMap("errorString", e.toString()), locale);
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (IOException e) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorRenderingScreenForEmail", UtilMisc.toMap("errorString", e.toString()),
locale);
Debug.logError(e, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorRenderingScreenForEmail", UtilMisc.toMap("errorString", e.toString()), locale);
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
}
ScreenRenderer screens = new ScreenRenderer(bodyWriter, screenContext, screenStringRenderer);
@@ -135,24 +135,20 @@ public class BirtEmailServices {
try {
screens.render(bodyScreenUri);
} catch (GeneralException e) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorRenderingScreenForEmail", UtilMisc.toMap("errorString",
e.toString()), locale);
Debug.logError(e, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorRenderingScreenForEmail", UtilMisc.toMap("errorString", e.toString()), locale);
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (IOException e) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorIORenderingScreenForEmail", UtilMisc.toMap("errorString",
e.toString()), locale);
Debug.logError(e, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorIORenderingScreenForEmail", UtilMisc.toMap("errorString", e.toString()), locale);
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (SAXException e) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorSAXRenderingScreenForEmail", UtilMisc.toMap("errorString",
e.toString()), locale);
Debug.logError(e, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorSAXRenderingScreenForEmail", UtilMisc.toMap("errorString", e.toString()), locale);
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (ParserConfigurationException e) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorParserConfigRenderingScreenForEmail", UtilMisc.toMap("errorString",
e.toString()), locale);
Debug.logError(e, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorParserConfigRenderingScreenForEmail", UtilMisc.toMap("errorString", e.toString()), locale);
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
}
}
@@ -167,7 +163,7 @@ public class BirtEmailServices {
// create the output stream for the generation
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Map<String, Object> birtContext = new HashMap<>();
Map<String, Object> birtContext = new HashMap<String, Object>();
if (birtLocale == null) {
birtLocale = locale;
}
@@ -186,17 +182,18 @@ public class BirtEmailServices {
appContext.put("delegator", delegator);
appContext.put("dispatcher", dispatcher);
appContext.put("security", security);
InputStream reportInputStream = BirtFactory.getReportInputStreamFromLocation(birtReportLocation);
IReportRunnable design = engine.openReportDesign(reportInputStream);
Debug.logInfo("Export report as content type:" + birtContentType, MODULE);
Debug.logInfo("Export report as content type:" + birtContentType, module);
BirtWorker.exportReport(design, context, birtContentType, baos);
baos.flush();
baos.close();
// store in the list of maps for sendmail....
List<Map<String, ? extends Object>> bodyParts = new LinkedList<>();
List<Map<String, ? extends Object>> bodyParts = new LinkedList<Map<String,? extends Object>>();
if (bodyText != null) {
bodyText = FlexibleStringExpander.expandString(bodyText, screenContext, locale);
bodyText = FlexibleStringExpander.expandString(bodyText, screenContext, locale);
bodyParts.add(UtilMisc.toMap("content", bodyText, "type", "text/html"));
} else {
bodyParts.add(UtilMisc.toMap("content", bodyWriter.toString(), "type", "text/html"));
@@ -204,46 +201,39 @@ public class BirtEmailServices {
bodyParts.add(UtilMisc.toMap("content", baos.toByteArray(), "type", "application/pdf", "filename", attachmentName));
serviceContext.put("bodyParts", bodyParts);
} catch (GeneralException ge) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType",
birtContentType, "errorString", ge.toString()), locale);
Debug.logError(ge, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType", birtContentType, "errorString", ge.toString()), locale);
Debug.logError(ge, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (IOException ie) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorIORenderingAttachmentForEmail", UtilMisc.toMap("birtContentType",
birtContentType, "errorString", ie.toString()), locale);
Debug.logError(ie, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorIORenderingAttachmentForEmail", UtilMisc.toMap("birtContentType", birtContentType, "errorString", ie.toString()), locale);
Debug.logError(ie, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (FOPException fe) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorFOPRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType",
birtContentType, "errorString", fe.toString()), locale);
Debug.logError(fe, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorFOPRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType", birtContentType, "errorString", fe.toString()), locale);
Debug.logError(fe, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (SAXException se) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorSAXRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType",
birtContentType, "errorString", se.toString()), locale);
Debug.logError(se, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorSAXRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType", birtContentType, "errorString", se.toString()), locale);
Debug.logError(se, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (ParserConfigurationException pe) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorParserRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType",
birtContentType, "errorString", pe.toString()), locale);
Debug.logError(pe, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorParserRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType", birtContentType, "errorString", pe.toString()), locale);
Debug.logError(pe, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (EngineException ee) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType",
birtContentType, "errorString", ee.toString()), locale);
Debug.logError(ee, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType", birtContentType, "errorString", ee.toString()), locale);
Debug.logError(ee, errMsg, module);
return ServiceUtil.returnError(errMsg);
} catch (SQLException se) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorSQLRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType",
birtContentType, "errorString", se.toString()), locale);
Debug.logError(se, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorSQLRenderingAttachmentForEmail", UtilMisc.toMap("birtContentType", birtContentType, "errorString", se.toString()), locale);
Debug.logError(se, errMsg, module);
return ServiceUtil.returnError(errMsg);
}
} else {
isMultiPart = false;
// store body and type for single part message in the context.
if (bodyText != null) {
bodyText = FlexibleStringExpander.expandString(bodyText, screenContext, locale);
bodyText = FlexibleStringExpander.expandString(bodyText, screenContext, locale);
serviceContext.put("body", bodyText);
} else {
serviceContext.put("body", bodyWriter.toString());
@@ -264,9 +254,7 @@ public class BirtEmailServices {
serviceContext.put("subject", subject);
serviceContext.put("partyId", partyId);
if (Debug.verboseOn()) {
Debug.logVerbose("sendMailFromScreen sendMail context: " + serviceContext, MODULE);
}
if (Debug.verboseOn()) Debug.logVerbose("sendMailFromScreen sendMail context: " + serviceContext, module);
Map<String, Object> result = ServiceUtil.returnSuccess();
try {
@@ -282,8 +270,8 @@ public class BirtEmailServices {
}
}
} catch (GenericServiceException e) {
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorInSendingEmail", UtilMisc.toMap("errorString", e.toString()), locale);
Debug.logError(e, errMsg, MODULE);
String errMsg = UtilProperties.getMessage(resource, "BirtErrorInSendingEmail", UtilMisc.toMap("errorString", e.toString()), locale);
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
}
result.put("body", bodyWriter.toString());
@@ -50,29 +50,30 @@ import org.eclipse.birt.report.engine.api.script.IReportContext;
public class BirtMasterReportServices {
private static final String MODULE = BirtServices.class.getName();
private static final String RESOURCE = "BirtUiLabels";
public static final String module = BirtServices.class.getName();
public static final String resource = "BirtUiLabels";
public static final String resource_error = "BirtErrorUiLabels";
// The following methods are flexible report services as examples for reporting
public static Map<String, Object> workEffortPerPersonPrepareDate(DispatchContext dctx, Map<String, Object> context) {
Map<String, String> dataMap = UtilMisc.toMap(
"lastName", "name",
"firstName", "name",
"hours", "floating-point",
"fromDate", "date-time",
"lastName", "name",
"firstName", "name",
"hours", "floating-point",
"fromDate", "date-time",
"thruDate", "date-time");
LinkedHashMap<String, String> filterMap = new LinkedHashMap<>();
LinkedHashMap<String, String> filterMap = new LinkedHashMap<String, String>();
filterMap.put("firstName", "name");
filterMap.put("lastName", "name");
filterMap.put("fromDate", "date-time");
filterMap.put("thruDate", "date-time");
Map<String, String> fieldDisplayLabels = UtilMisc.toMap(
"lastName", "Last name",
"firstName", "First name",
"hours", "Hours",
"fromDate", "From date",
"lastName", "Last name",
"firstName", "First name",
"hours", "Hours",
"fromDate", "From date",
"thruDate", "Thru date");
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<>();
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<String, String>();
filterDisplayLabels.put("firstName", "First name");
filterDisplayLabels.put("lastName", "Last name");
filterDisplayLabels.put("fromDate", "From date");
@@ -88,7 +89,7 @@ public class BirtMasterReportServices {
public static Map<String, Object> workEffortPerPerson(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
IReportContext reportContext = (IReportContext) context.get("reportContext");
Map<String, Object> parameters = UtilGenerics.cast(reportContext.getParameterValue("parameters"));
Map<String, Object> parameters = UtilGenerics.checkMap(reportContext.getParameterValue("parameters"));
List<GenericValue> listWorkEffortTime = null;
if (UtilValidate.isEmpty(parameters.get("firstName")) && UtilValidate.isEmpty(parameters.get("lastName"))) {
@@ -97,7 +98,7 @@ public class BirtMasterReportServices {
List<GenericValue> listPersons = null;
try {
// TODO: translate labels
List<EntityExpr> listConditions = new ArrayList<>();
List<EntityExpr> listConditions = new ArrayList<EntityExpr>();
if (UtilValidate.isNotEmpty(parameters.get("firstName"))) {
EntityExpr conditionFirstName = EntityCondition.makeCondition("firstName", parameters.get("firstName"));
listConditions.add(conditionFirstName);
@@ -118,7 +119,7 @@ public class BirtMasterReportServices {
}
String partyId = person.getString("partyId");
List<EntityExpr> listConditionsWorkEffort = new ArrayList<>();
List<EntityExpr> listConditionsWorkEffort = new ArrayList<EntityExpr>();
Timestamp thruDate = null;
Timestamp fromDate = null;
if (UtilValidate.isEmpty(parameters.get("fromDate"))) {
@@ -143,10 +144,10 @@ public class BirtMasterReportServices {
.where(ecl).select("hours", "fromDate", "thruDate")
.queryList();
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
ServiceUtil.returnError("Error getting party from person name.");
}
List<GenericValue> listCompiled = new ArrayList<>();
List<GenericValue> listCompiled = new ArrayList<GenericValue>();
if (UtilValidate.isNotEmpty(listWorkEffortTime)) listCompiled.addAll(listWorkEffortTime);
if (UtilValidate.isNotEmpty(listPersons)) listCompiled.addAll(listPersons);
Map<String, Object> result = ServiceUtil.returnSuccess();
@@ -156,43 +157,43 @@ public class BirtMasterReportServices {
public static Map<String, Object> turnOverPrepareFields(DispatchContext dctx, Map<String, Object> context) {
Map<String, String> dataMap = UtilMisc.toMap(
"invoiceTypeId", "short-varchar",
"invoicePartyId", "short-varchar",
"statusId", "short-varchar",
"invoiceDate", "date",
"dueDate", "date",
"currencyUomId", "short-varchar",
"invoiceItemTypeId", "short-varchar",
"invoiceItemSeqId", "short-varchar",
"productId", "short-varchar",
"partyId", "short-varchar",
"primaryProductCategoryId", "short-varchar",
"quantity", "numeric",
"amount", "currency-amount",
"productStoreId", "short-varchar",
"invoiceTypeId", "short-varchar",
"invoicePartyId", "short-varchar",
"statusId", "short-varchar",
"invoiceDate", "date",
"dueDate", "date",
"currencyUomId", "short-varchar",
"invoiceItemTypeId", "short-varchar",
"invoiceItemSeqId", "short-varchar",
"productId", "short-varchar",
"partyId", "short-varchar",
"primaryProductCategoryId", "short-varchar",
"quantity", "numeric",
"amount", "currency-amount",
"productStoreId", "short-varchar",
"storeName", "short-varchar");
Map<String, String> fieldDisplayLabels = UtilMisc.toMap(
"invoiceTypeId", "invoice Type",
"invoicePartyId", "Invoice",
"statusId", "Status",
"invoiceDate", "Date",
"dueDate", "Due date",
"currencyUomId", "Currency",
"invoiceItemTypeId", "Invoice type line",
"invoiceItemSeqId", "Invoice line",
"productId", "Product",
"partyId", "Customer",
"primaryProductCategoryId", "Product category",
"quantity", "Qty",
"amount", "Amount",
"productStoreId", "Product Store",
"invoiceTypeId", "invoice Type",
"invoicePartyId", "Invoice",
"statusId", "Status",
"invoiceDate", "Date",
"dueDate", "Due date ",
"currencyUomId", "Currency",
"invoiceItemTypeId", "Invoice type line",
"invoiceItemSeqId", "Invoice line",
"productId", "Product",
"partyId", "Customer",
"primaryProductCategoryId", "Product category",
"quantity", "Qty",
"amount", "Amount",
"productStoreId", "Product Store",
"storeName", "Product store name");
LinkedHashMap<String, String> filterMap = new LinkedHashMap<>();
LinkedHashMap<String, String> filterMap = new LinkedHashMap<String, String>();
filterMap.put("productCategoryId", "short-varchar");
filterMap.put("productStoreId", "short-varchar");
filterMap.put("fromDate", "date");
filterMap.put("thruDate", "date");
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<>();
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<String, String>();
//it's better to use Label Map, maybe an improvement point !
filterDisplayLabels.put("productCategoryId", "product Category");
filterDisplayLabels.put("productStoreId", "product Store");
@@ -210,11 +211,11 @@ public class BirtMasterReportServices {
Delegator delegator = dctx.getDelegator();
Locale locale = (Locale) context.get("locale");
IReportContext reportContext = (IReportContext) context.get("reportContext");
Map<String, Object> parameters = UtilGenerics.cast(reportContext.getParameterValue("parameters"));
Map<String, Object> parameters = UtilGenerics.checkMap(reportContext.getParameterValue("parameters"));
List<GenericValue> listTurnOver = null;
List<Map<String, Object>> listInvoiceEditable = new ArrayList<>();
List<EntityCondition> listAllConditions = new ArrayList<>();
List<Map<String, Object>> listInvoiceEditable = new ArrayList<Map<String, Object>>();
List<EntityCondition> listAllConditions = new ArrayList<EntityCondition>();
try {
// treating fromDate field condition
if (UtilValidate.isNotEmpty(parameters.get("fromDate"))) {
@@ -236,23 +237,19 @@ public class BirtMasterReportServices {
// product category field condition
if (UtilValidate.isNotEmpty(parameters.get("productCategoryId"))) {
List<String> productCategoryList = new ArrayList<>();
List<String> productCategoryList = new ArrayList<String>();
if (parameters.get("productCategoryId") instanceof String) {
String productCategoryId = (String) parameters.get("productCategoryId");
productCategoryList.add(productCategoryId);
} else if (parameters.get("productStoreId") instanceof String) {
productCategoryList = UtilGenerics.cast(parameters.get("productCategoryId"));
productCategoryList = UtilGenerics.checkList(parameters.get("productCategoryId"));
}
// getting productIds in these categories
EntityExpr conditionProductCategory = EntityCondition.makeCondition("primaryProductCategoryId", EntityOperator.IN,
productCategoryList);
EntityExpr conditionFromDate = EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO,
UtilDateTime.nowTimestamp());
EntityExpr conditionBeforeDate = EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN_EQUAL_TO,
UtilDateTime.nowTimestamp());
EntityExpr conditionProductCategory = EntityCondition.makeCondition("primaryProductCategoryId", EntityOperator.IN, productCategoryList);
EntityExpr conditionFromDate = EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.nowTimestamp());
EntityExpr conditionBeforeDate = EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.nowTimestamp());
EntityExpr conditionNull = EntityCondition.makeCondition("thruDate", null);
EntityCondition conditionThroughDate = EntityCondition.makeCondition(EntityOperator.OR, UtilMisc.toList(conditionBeforeDate,
conditionNull));
EntityCondition conditionThroughDate = EntityCondition.makeCondition(EntityOperator.OR, UtilMisc.toList(conditionBeforeDate, conditionNull));
List<GenericValue> listProductIds = EntityQuery.use(delegator)
.from("ProductCategoryMember")
.where(EntityCondition.makeCondition(UtilMisc.toList(conditionProductCategory, conditionFromDate, conditionThroughDate)))
@@ -263,22 +260,20 @@ public class BirtMasterReportServices {
}
// productStoreId condition
List<String> productStoreList = new ArrayList<>();
List<String> productStoreList = new ArrayList<String>();
if (UtilValidate.isNotEmpty(parameters.get("productStoreId"))) {
if (parameters.get("productStoreId") instanceof String) {
String productStoreId = (String) parameters.get("productStoreId");
productStoreList.add(productStoreId);
} else if (parameters.get("productStoreId") instanceof List) {
productStoreList = UtilGenerics.cast(parameters.get("productStoreId"));
productStoreList = UtilGenerics.checkList(parameters.get("productStoreId"));
}
// getting list of invoice Ids linked to these productStore
EntityExpr conditionProductStoreId = EntityCondition.makeCondition("productStoreId", EntityOperator.IN, productStoreList);
List<GenericValue> listOrderAndProductStores =
EntityQuery.use(delegator).from("OrderAndProductStore").where(conditionProductStoreId).select("orderId").queryList();
List<GenericValue> listOrderAndProductStores = EntityQuery.use(delegator).from("OrderAndProductStore").where(conditionProductStoreId).select("orderId").queryList();
List<String> listOrderIds = EntityUtil.getFieldListFromEntityList(listOrderAndProductStores, "orderId", true);
EntityExpr conditionOrderId = EntityCondition.makeCondition("orderId", EntityOperator.IN, listOrderIds);
List<GenericValue> listInvoices =
EntityQuery.use(delegator).from("OrderItemBilling").where(conditionOrderId).select("invoiceId").queryList();
List<GenericValue> listInvoices = EntityQuery.use(delegator).from("OrderItemBilling").where(conditionOrderId).select("invoiceId").queryList();
List<String> listInvoiceString = EntityUtil.getFieldListFromEntityList(listInvoices, "invoiceId", true);
EntityExpr conditionInvoiceIdProductStore = EntityCondition.makeCondition("invoiceId", EntityOperator.IN, listInvoiceString);
@@ -287,8 +282,7 @@ public class BirtMasterReportServices {
// adding mandatory conditions
// condition on invoice item type
List<String> listInvoiceItemType = UtilMisc.toList("ITM_PROMOTION_ADJ", "INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM",
"INV_FDPROD_ITEM", "INV_PROD_FEATR_ITEM");
List<String> listInvoiceItemType = UtilMisc.toList("ITM_PROMOTION_ADJ", "INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM", "INV_FDPROD_ITEM", "INV_PROD_FEATR_ITEM");
listInvoiceItemType.add("ITM_DISCOUNT_ADJ");
listInvoiceItemType.add("CRT_FPROD_ITEM");
listInvoiceItemType.add("CRT_DPROD_ITEM");
@@ -304,13 +298,11 @@ public class BirtMasterReportServices {
// condition on invoice ((not cancelled) or null)
EntityExpr conditionStatusNotCancelled = EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "INVOICE_CANCELLED");
EntityExpr conditionStatusNull = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null);
EntityCondition conditionStatus = EntityCondition.makeCondition(UtilMisc.toList(conditionStatusNotCancelled, conditionStatusNull),
EntityOperator.OR);
EntityCondition conditionStatus = EntityCondition.makeCondition(UtilMisc.toList(conditionStatusNotCancelled, conditionStatusNull), EntityOperator.OR);
listAllConditions.add(conditionStatus);
// condition sales invoice or customer return invoice
EntityExpr conditionSalesInvoice = EntityCondition.makeCondition("invoiceTypeId", EntityOperator.IN, UtilMisc.toList("SALES_INVOICE",
"CUST_RTN_INVOICE"));
EntityExpr conditionSalesInvoice = EntityCondition.makeCondition("invoiceTypeId", EntityOperator.IN, UtilMisc.toList("SALES_INVOICE", "CUST_RTN_INVOICE"));
listAllConditions.add(conditionSalesInvoice);
// retrieving all invoices
@@ -336,18 +328,16 @@ public class BirtMasterReportServices {
// adding missing fields
for (GenericValue invoice : listTurnOver) {
Map<String, Object> invoiceEditableTemp = UtilGenerics.cast(invoice.clone());
Map<String, Object> invoiceEditableTemp = UtilGenerics.checkMap(invoice.clone());
invoiceEditableTemp.remove("GenericEntity");
Map<String, Object> invoiceEditable = new HashMap<>();
Map<String, Object> invoiceEditable = new HashMap<String, Object>();
invoiceEditable.putAll(invoiceEditableTemp);
invoiceEditable.put("partyName", PartyHelper.getPartyName(delegator, invoice.getString("partyId"), false));
// adding productStoreId and productStoreName
EntityExpr conditionInvoiceId = EntityCondition.makeCondition("invoiceId", invoice.getString("invoiceId"));
// EntityExpr conditionInvoiceItemSeqId = EntityCondition.makeCondition("invoiceItemSeqId", invoice.getString
// ("invoiceItemSeqId"));
// List<GenericValue> listOrderBilling = delegator.findList("OrderItemBilling", EntityCondition.makeCondition
// (UtilMisc.toList(conditionInvoiceId, conditionInvoiceItemSeqId)), UtilMisc.toSet("orderId"), null, null, false);
// EntityExpr conditionInvoiceItemSeqId = EntityCondition.makeCondition("invoiceItemSeqId", invoice.getString("invoiceItemSeqId"));
// List<GenericValue> listOrderBilling = delegator.findList("OrderItemBilling", EntityCondition.makeCondition(UtilMisc.toList(conditionInvoiceId, conditionInvoiceItemSeqId)), UtilMisc.toSet("orderId"), null, null, false);
GenericValue orderBilling = EntityQuery.use(delegator)
.from("OrderItemBilling")
.where(conditionInvoiceId)
@@ -360,9 +350,8 @@ public class BirtMasterReportServices {
.where(conditionOrderId)
.cache()
.queryFirst();
if (UtilValidate.isNotEmpty(productStoreList) && !productStoreList.contains(productStore.getString("productStoreId"))) {
continue; // FIXME pretty ugly... but had problems with the rare case where an invoice matches with several orders with
// more than one productStore
if (UtilValidate.isNotEmpty(productStoreList) && ! productStoreList.contains(productStore.getString("productStoreId"))) {
continue; // FIXME pretty ugly... but had problems with the rare case where an invoice matches with several orders with more than one productStore
}
invoiceEditable.put("productStoreId", productStore.getString("productStoreId"));
invoiceEditable.put("storeName", productStore.getString("storeName"));
@@ -373,8 +362,8 @@ public class BirtMasterReportServices {
listInvoiceEditable.add(invoiceEditable);
}
} catch (Exception e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "BirtErrorRetrievingTurnOver", locale));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "BirtErrorRetrievingTurnOver", locale));
}
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("records", listInvoiceEditable);
@@ -88,9 +88,10 @@ import com.ibm.icu.util.ULocale;
public class BirtServices {
private static final String MODULE = BirtServices.class.getName();
private static final String RESOURCE = "BirtUiLabels";
private static final String RES_ERROR = "BirtErrorUiLabels";
public static final String module = BirtServices.class.getName();
public static final String resource = "BirtUiLabels";
public static final String resource_error = "BirtErrorUiLabels";
public static final String resourceProduct = "BirtUiLabels";
/**
* Instantiate a new Flexible report, using the data given in parameters and <code>ReportDesignGenerator</code> class.
@@ -100,13 +101,13 @@ public class BirtServices {
try {
rptGenerator = new ReportDesignGenerator(context, dctx);
} catch (Exception e1) {
Debug.logError(e1, MODULE);
Debug.logError(e1, module);
return ServiceUtil.returnError(e1.getMessage());
}
try {
rptGenerator.buildReport();
} catch (Exception e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
return ServiceUtil.returnSuccess();
@@ -114,15 +115,14 @@ public class BirtServices {
@Deprecated
// TODO lack documentation about the reason of deprecation
// Seems to need to be simply removed since not used at all.
// But not sure it's not still useful in certain situations, else why not already removed?
// Seems to need to be simply removed since not used at all. But not sure it's not still useful in certain situations, else why not already removed?
public static Map<String, Object> prepareFlexibleReportOptionFieldsFromEntity(DispatchContext dctx, Map<String, Object> context) {
String entityViewName = (String) context.get("entityViewName");
GenericValue userLogin = (GenericValue) context.get("userLogin");
List<String> listMultiFields = new ArrayList<>();
List<String> listMultiFields = new ArrayList<String>();
Delegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<String, Object>();
Locale locale = (Locale) context.get("locale");
ModelEntity modelEntity = delegator.getModelEntity(entityViewName);
@@ -134,19 +134,18 @@ public class BirtServices {
String fieldType = mField.getType();
String birtType = null;
try {
Map<String, Object> convertRes = dispatcher.runSync("convertFieldTypeToBirtType", UtilMisc.toMap("fieldType", fieldType,
"userLogin", userLogin));
Map<String, Object> convertRes = dispatcher.runSync("convertFieldTypeToBirtType", UtilMisc.toMap("fieldType", fieldType, "userLogin", userLogin));
if (ServiceUtil.isError(convertRes)) {
String errMsg = UtilProperties.getMessage(RES_ERROR, "BirtErrorConversionFieldToBirtFailed", locale);
String errMsg = UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale);
return ServiceUtil.returnError(errMsg + ServiceUtil.getErrorMessage(convertRes));
}
birtType = (String) convertRes.get("birtType");
if (UtilValidate.isEmpty(birtType)) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorConversionFieldToBirtFailed", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale));
}
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorConversionFieldToBirtFailed", locale));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale));
}
// make more general when report forms have been made so too.
if ("date-time".equalsIgnoreCase(birtType) || "date".equalsIgnoreCase(birtType) || "time".equalsIgnoreCase(birtType)) {
@@ -163,6 +162,7 @@ public class BirtServices {
/**
* Perform find data on given view/entity and return these into Birt compatible format.
* This service is meant to be used as default for View/entity report design
*
*/
public static Map<String, Object> callPerformFindFromBirt(DispatchContext dctx, Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
@@ -170,38 +170,38 @@ public class BirtServices {
Locale locale = (Locale) context.get("locale");
GenericValue userLogin = (GenericValue) context.get("userLogin");
String entityViewName = (String) reportContext.getParameterValue("modelElementName");
Map<String, Object> inputFields = UtilGenerics.cast(reportContext.getParameterValue("parameters"));
Map<String, Object> resultPerformFind = new HashMap<>();
Map<String, Object> inputFields = UtilGenerics.checkMap(reportContext.getParameterValue("parameters"));
Map<String, Object> resultPerformFind = new HashMap<String, Object>();
Map<String, Object> resultToBirt = null;
List<GenericValue> list = null;
if (UtilValidate.isEmpty(entityViewName)) {
entityViewName = (String) inputFields.get("modelElementName");
if (UtilValidate.isEmpty(entityViewName)) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorEntityViewNotFound", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorEntityViewNotFound", locale));
}
}
try {
resultPerformFind = dispatcher.runSync("performFind", UtilMisc.<String, Object>toMap("entityName", entityViewName,
resultPerformFind = dispatcher.runSync("performFind", UtilMisc.<String, Object>toMap("entityName", entityViewName,
"inputFields", inputFields, "userLogin", userLogin, "noConditionFind", "Y", "locale", locale));
if (ServiceUtil.isError(resultPerformFind)) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorRunningPerformFind", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorRunningPerformFind", locale));
}
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorRunningPerformFind", locale));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorRunningPerformFind", locale));
}
try (EntityListIterator listIt = (EntityListIterator) resultPerformFind.get("listIt")) {
if (UtilValidate.isNotEmpty(listIt)) {
list = listIt.getCompleteList();
} else {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorRunningPerformFind", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorRunningPerformFind", locale));
}
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorRunningPerformFind", locale));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorRunningPerformFind", locale));
}
resultToBirt = ServiceUtil.returnSuccess();
resultToBirt.put("records", list);
@@ -212,8 +212,8 @@ public class BirtServices {
* Analyse given master and create report design from its data
* Two cases are implemented :
* <ul>
* <li>Entity : data retieval is based on a simple view/entity</li>
* <li>Service : data retrieval is based on service</li>
* <li>Entity : data retieval is based on a simple view/entity</li>
* <li>Service : data retrieval is based on service</li>
* </ul>
*/
public static Map<String, Object> createFlexibleReportFromMaster(DispatchContext dctx, Map<String, Object> context) {
@@ -232,12 +232,12 @@ public class BirtServices {
EntityCondition entityCondition = EntityCondition.makeCondition("contentId", masterContentId);
masterContentAttribute = EntityQuery.use(delegator).from("ContentAttribute").where(entityCondition).queryFirst();
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorNoAttributeFound", locale));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorNoAttributeFound", locale));
}
if (masterContentAttribute == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorNoAttributeFound", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorNoAttributeFound", locale));
}
String attrName = masterContentAttribute.getString("attrName");
String reportContentId;
@@ -245,66 +245,58 @@ public class BirtServices {
String entityViewName = masterContentAttribute.getString("attrValue");
ModelEntity modelEntity = delegator.getModelEntity(entityViewName);
if (modelEntity == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorEntityViewNotExist", locale) + " " + entityViewName);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorEntityViewNotExist", locale) + " " + entityViewName);
}
try {
Map<String, Object> resultContent = dispatcher.runSync("createFlexibleReportFromMasterEntityWorkflow", UtilMisc.toMap(
"entityViewName", entityViewName,
"reportName", reportName, "description", description, "writeFilters", writeFilters, "masterContentId", masterContentId,
"userLogin", userLogin, "locale", locale));
if (ServiceUtil.isError(resultContent)) {
Map<String, Object> resultContent = dispatcher.runSync("createFlexibleReportFromMasterEntityWorkflow", UtilMisc.toMap("entityViewName", entityViewName,
"reportName", reportName, "description", description, "writeFilters", writeFilters, "masterContentId", masterContentId, "userLogin", userLogin, "locale", locale));
if(ServiceUtil.isError(resultContent)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultContent));
}
reportContentId = (String) resultContent.get("contentId");
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCannotDetermineDataSource", locale));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCannotDetermineDataSource", locale));
}
} else if ("Service".equalsIgnoreCase(attrName)) {
String serviceName = masterContentAttribute.getString("attrValue");
try {
Map<String, Object> resultContent = dispatcher.runSync("createFlexibleReportFromMasterServiceWorkflow", UtilMisc.toMap(
"serviceName", serviceName, "reportName", reportName, "description", description, "writeFilters", writeFilters,
"masterContentId", masterContentId, "userLogin", userLogin, "locale", locale));
Map<String, Object> resultContent = dispatcher.runSync("createFlexibleReportFromMasterServiceWorkflow", UtilMisc.toMap("serviceName", serviceName,
"reportName", reportName, "description", description, "writeFilters", writeFilters, "masterContentId", masterContentId, "userLogin", userLogin, "locale", locale));
if (ServiceUtil.isError(resultContent)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultContent));
}
reportContentId = (String) resultContent.get("contentId");
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCannotDetermineDataSource", locale));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCannotDetermineDataSource", locale));
}
} else {
// TODO check: could create other workflows. WebService? Does it need to be independent from Service workflow?
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCannotDetermineDataSource", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCannotDetermineDataSource", locale));
}
// prepare report form to display to allow override
String textForm;
Map<String, Object> resultFormDisplay;
try {
resultFormDisplay = dispatcher.runSync("prepareFlexibleReportSearchFormToEdit", UtilMisc.toMap("reportContentId", reportContentId,
"userLogin", userLogin, "locale", locale));
resultFormDisplay = dispatcher.runSync("prepareFlexibleReportSearchFormToEdit", UtilMisc.toMap("reportContentId", reportContentId, "userLogin", userLogin, "locale", locale));
if (ServiceUtil.isError(resultFormDisplay)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultFormDisplay));
}
textForm = (String) resultFormDisplay.get("textForm");
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
"BirtErrorCreatingDefaultSearchForm", locale).concat(": ").concat(e.getMessage()));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCreatingDefaultSearchForm", locale).concat(": ").concat(e.getMessage()));
}
Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "BirtFlexibleReportSuccessfullyGenerated",
locale).concat(" ").concat(reportName));
Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "BirtFlexibleReportSuccessfullyGenerated", locale).concat(" ").concat(reportName));
result.put("textForm", textForm);
result.put("reportContentId", reportContentId);
return result;
}
// TODO check: I'm not a big fan of how I did the createFormForDisplay / overrideReportForm. Could probably be improved using a proper
// formForReport object or something similar.
// TODO check: I'm not a big fan of how I did the createFormForDisplay / overrideReportForm. Could probably be improved using a proper formForReport object or something similar.
/**
* Update search form of a report design
*/
@@ -318,9 +310,8 @@ public class BirtServices {
// safety check : do not accept "${groovy", "${bsh" and "javascript"
String overideFiltersNoWhiteSpace = overrideFilters.replaceAll("\\s", "");
if (overideFiltersNoWhiteSpace.contains("${groovy:") || overideFiltersNoWhiteSpace.contains("${bsh:")
|| overideFiltersNoWhiteSpace.contains("javascript:")) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorUnauthorisedCharacter", locale));
if (overideFiltersNoWhiteSpace.contains("${groovy:") || overideFiltersNoWhiteSpace.contains("${bsh:") || overideFiltersNoWhiteSpace.contains("javascript:")) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorUnauthorisedCharacter", locale));
}
try {
@@ -334,17 +325,16 @@ public class BirtServices {
newForm.append(overrideFilters);
newForm.append("</forms>");
Document xmlForm = UtilXml.readXmlDocument(newForm.toString());
Map<String, Object> result = dispatcher.runSync("updateElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId,
"textData", UtilXml.writeXmlDocument(xmlForm),
Map<String, Object> result = dispatcher.runSync("updateElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", UtilXml.writeXmlDocument(xmlForm),
"userLogin", userLogin, "locale", locale));
if (ServiceUtil.isError(result)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
}
} catch (GeneralException | SAXException | ParserConfigurationException | IOException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in overrideReportForm service."); //TODO labelise
}
return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "BirtSearchFormSuccessfullyOverridde", locale));
return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "BirtSearchFormSuccessfullyOverridde", locale));
}
/**
@@ -362,24 +352,23 @@ public class BirtServices {
String contentId = null;
Map<String, Object> result = ServiceUtil.returnSuccess();
try {
Map<String, Object> resultMapsForGeneration = dispatcher.runSync("prepareFlexibleReportFieldsFromEntity", UtilMisc.toMap("modelEntity",
modelEntity,
Map<String, Object> resultMapsForGeneration = dispatcher.runSync("prepareFlexibleReportFieldsFromEntity", UtilMisc.toMap("modelEntity", modelEntity,
"userLogin", userLogin, "locale", locale));
if (ServiceUtil.isError(resultMapsForGeneration)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultMapsForGeneration));
}
Map<String, String> dataMap = UtilGenerics.cast(resultMapsForGeneration.get("dataMap"));
Map<String, String> dataMap = UtilGenerics.checkMap(resultMapsForGeneration.get("dataMap"));
Map<String, String> fieldDisplayLabels = null;
if (UtilValidate.isNotEmpty(resultMapsForGeneration.get("fieldDisplayLabels"))) {
fieldDisplayLabels = UtilGenerics.cast(resultMapsForGeneration.get("fieldDisplayLabels"));
fieldDisplayLabels = UtilGenerics.checkMap(resultMapsForGeneration.get("fieldDisplayLabels"));
}
Map<String, String> filterMap = null;
if (UtilValidate.isNotEmpty(resultMapsForGeneration.get("filterMap"))) {
filterMap = UtilGenerics.cast(resultMapsForGeneration.get("filterMap"));
filterMap = UtilGenerics.checkMap(resultMapsForGeneration.get("filterMap"));
}
Map<String, String> filterDisplayLabels = null;
if (UtilValidate.isNotEmpty(resultMapsForGeneration.get("filterDisplayLabels"))) {
filterDisplayLabels = UtilGenerics.cast(resultMapsForGeneration.get("filterDisplayLabels"));
filterDisplayLabels = UtilGenerics.checkMap(resultMapsForGeneration.get("filterDisplayLabels"));
}
contentId = BirtWorker.recordReportContent(delegator, dispatcher, context);
// callPerformFindFromBirt is the customMethod for Entity workflow
@@ -405,7 +394,7 @@ public class BirtServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
}
} catch (GeneralException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in createFlexibleReportFromMasterEntityWorkflow service"); //TODO labelise
}
result.put("contentId", contentId);
@@ -442,9 +431,9 @@ public class BirtServices {
}
try {
@SuppressWarnings("unused") // Used only to passively check
ModelService modelService = dctx.getModelService(serviceName);
ModelService modelService = dctx.getModelService(serviceName);
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("No service define with name " + serviceName); //TODO labelise
}
contentId = BirtWorker.recordReportContent(delegator, dispatcher, context);
@@ -453,10 +442,10 @@ public class BirtServices {
if (ServiceUtil.isError(serviceResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
}
Map<String, String> dataMap = UtilGenerics.cast(serviceResult.get("dataMap"));
Map<String, String> filterMap = UtilGenerics.cast(serviceResult.get("filterMap"));
Map<String, String> fieldDisplayLabels = UtilGenerics.cast(serviceResult.get("fieldDisplayLabels"));
Map<String, String> filterDisplayLabels = UtilGenerics.cast(serviceResult.get("filterDisplayLabels"));
Map<String, String> dataMap = UtilGenerics.checkMap(serviceResult.get("dataMap"));
Map<String, String> filterMap = UtilGenerics.checkMap(serviceResult.get("filterMap"));
Map<String, String> fieldDisplayLabels = UtilGenerics.checkMap(serviceResult.get("fieldDisplayLabels"));
Map<String, String> filterDisplayLabels = UtilGenerics.checkMap(serviceResult.get("filterDisplayLabels"));
Map<String, Object> resultGeneration = dispatcher.runSync("createFlexibleReport", UtilMisc.toMap(
"locale", locale,
"dataMap", dataMap,
@@ -468,11 +457,11 @@ public class BirtServices {
"fieldDisplayLabels", fieldDisplayLabels,
"filterDisplayLabels", filterDisplayLabels));
if (ServiceUtil.isError(resultGeneration)) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCreatingFlexibleReport", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCreatingFlexibleReport", locale));
}
} catch (GeneralException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCreatingFlexibleReport", locale));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCreatingFlexibleReport", locale));
}
result.put("contentId", contentId);
return result;
@@ -485,15 +474,14 @@ public class BirtServices {
Locale locale = (Locale) context.get("locale");
ModelEntity modelEntity = (ModelEntity) context.get("modelEntity");
Map<String, String> dataMap = new HashMap<>();
Map<String, String> fieldDisplayLabels = new HashMap<>();
LinkedHashMap<String, String> filterMap = new LinkedHashMap<>();
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<>();
Map<String, String> dataMap = new HashMap<String, String>();
Map<String, String> fieldDisplayLabels = new HashMap<String, String>();
LinkedHashMap<String, String> filterMap = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<String, String>();
List<String> listEntityFields = modelEntity.getAllFieldNames();
Map<Object, Object> uiLabelMap = new HashMap<>();
final String[] resourceGlob = {"OrderUiLabels", "ProductUiLabels", "PartyUiLabels", "ContentUiLabels", "AccountingUiLabels",
"CommonUiLabels", "BirtUiLabels"};
Map<Object, Object> uiLabelMap = new HashMap<Object, Object>();
final String[] resourceGlob = {"OrderUiLabels", "ProductUiLabels", "PartyUiLabels", "ContentUiLabels", "AccountingUiLabels", "CommonUiLabels", "BirtUiLabels"};
for (String res : resourceGlob) {
uiLabelMap.putAll(UtilProperties.getProperties(res, locale));
}
@@ -523,20 +511,15 @@ public class BirtServices {
filterMap.put(field.concat("_fld0_op"), "short-varchar");
filterMap.put(field.concat("_fld1_value"), mField.getType());
filterMap.put(field.concat("_fld1_op"), "short-varchar");
filterDisplayLabels.put(field.concat("_fld0_value"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(RESOURCE,
"BirtFindFieldOptionValue0", locale)));
filterDisplayLabels.put(field.concat("_fld0_op"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(RESOURCE,
"BirtFindFieldOptionValue0", locale).concat(UtilProperties.getMessage(RESOURCE, "BirtFindCompareOperator", locale))));
filterDisplayLabels.put(field.concat("_fld1_value"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(RESOURCE,
"BirtFindFieldOptionValue1", locale)));
filterDisplayLabels.put(field.concat("_fld1_op"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(RESOURCE,
"BirtFindFieldOptionValue1", locale).concat(UtilProperties.getMessage(RESOURCE, "BirtFindCompareOperator", locale))));
filterDisplayLabels.put(field.concat("_fld0_value"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(resource, "BirtFindFieldOptionValue0", locale)));
filterDisplayLabels.put(field.concat("_fld0_op"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(resource, "BirtFindFieldOptionValue0", locale).concat(UtilProperties.getMessage(resource, "BirtFindCompareOperator", locale))));
filterDisplayLabels.put(field.concat("_fld1_value"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(resource, "BirtFindFieldOptionValue1", locale)));
filterDisplayLabels.put(field.concat("_fld1_op"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(resource, "BirtFindFieldOptionValue1", locale).concat(UtilProperties.getMessage(resource, "BirtFindCompareOperator", locale))));
} else { // remaining types need 4 fields (fld0-1_op-value)
filterMap.put(field, mField.getType());
filterMap.put(field.concat("_op"), "short-varchar");
filterDisplayLabels.put(field, fieldDisplayLabels.get(field));
filterDisplayLabels.put(field.concat("_op"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(RESOURCE,
"BirtFindCompareOperator", locale)));
filterDisplayLabels.put(field.concat("_op"), fieldDisplayLabels.get(field).concat(UtilProperties.getMessage(resource, "BirtFindCompareOperator", locale)));
}
}
Map<String, Object> result = ServiceUtil.returnSuccess();
@@ -565,17 +548,14 @@ public class BirtServices {
try {
GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", reportContentId).cache().queryOne();
String dataResourceId = content.getString("dataResourceId");
GenericValue electronicText =
EntityQuery.use(delegator).from("ElectronicText").where("dataResourceId", dataResourceId).cache().queryOne();
GenericValue electronicText = EntityQuery.use(delegator).from("ElectronicText").where("dataResourceId", dataResourceId).cache().queryOne();
textData = electronicText.getString("textData");
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in createFormForDisplay service."); //TODO labelise
}
if (Debug.infoOn()) {
Debug.logInfo(textData, MODULE);
}
if (Debug.infoOn()) Debug.logInfo(textData, module);
textData = textData.substring(textData.indexOf("<form "), textData.length());
if (textData.contains("</form>")) {
textData = textData.substring(0, textData.indexOf("</form>") + 7);
@@ -602,27 +582,26 @@ public class BirtServices {
try {
listContent = EntityQuery.use(delegator).from("Content").where(entityConditionContent).select("contentId").queryList();
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in deleteAllReports service."); //TODO labelise
}
if (UtilValidate.isEmpty(listContent)) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorNoFlexibleReportToDelete", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorNoFlexibleReportToDelete", locale));
}
listContentId = EntityUtil.getFieldListFromEntityList(listContent, "contentId", true);
try {
for (String contentId : listContentId) {
Map<String, Object> returnMap = dispatcher.runSync("deleteFlexibleReport", UtilMisc.toMap("contentId", contentId, "userLogin",
userLogin, "locale", locale));
Map<String, Object> returnMap = dispatcher.runSync("deleteFlexibleReport", UtilMisc.toMap("contentId", contentId, "userLogin", userLogin, "locale", locale));
if (ServiceUtil.isError(returnMap)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(returnMap));
}
}
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in deleteAllReports service."); //TODO labelise
}
return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "BirtFlexibleReportsSuccessfullyDeleted", locale));
return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "BirtFlexibleReportsSuccessfullyDeleted", locale));
}
/**
@@ -650,40 +629,38 @@ public class BirtServices {
.select("drObjectInfo")
.queryList();
} catch (GenericEntityException e1) {
Debug.logError(e1, MODULE);
Debug.logError(e1, module);
return ServiceUtil.returnError("Error in deleteFlexibleReport service."); //TODO labelise
}
if (listRptDesignFileGV.size() > 1) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorUnexpectedNumberReportToDelete", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorUnexpectedNumberReportToDelete", locale));
}
List<String> listRptDesignFile = EntityUtil.getFieldListFromEntityList(listRptDesignFileGV, "drObjectInfo", false);
String rptfileName = listRptDesignFile.get(0);
Path path = Paths.get(rptfileName);
try {
if (!Files.deleteIfExists(path)) {
ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCannotLocateReportFile", locale));
ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCannotLocateReportFile", locale));
}
} catch (IOException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in deleteFlexibleReport service."); //TODO labelise
}
try {
delegator.removeByAnd("ContentAttribute", UtilMisc.toMap("contentId", contentId));
Map<String, Object> result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentId, "userLogin",
userLogin, "locale", locale));
Map<String, Object> result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentId, "userLogin", userLogin, "locale", locale));
if (ServiceUtil.isError(result)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
}
result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentIdRpt, "userLogin", userLogin, "locale",
locale));
result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentIdRpt, "userLogin", userLogin, "locale", locale));
if (ServiceUtil.isError(result)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
}
} catch (GenericServiceException | GenericEntityException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in deleteFlexibleReport service."); //TODO labelise
}
return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "BirtFlexibleReportSuccessfullyDeleted", locale));
return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "BirtFlexibleReportSuccessfullyDeleted", locale));
}
/**
@@ -695,7 +672,7 @@ public class BirtServices {
Locale locale = (Locale) context.get("locale");
Delegator delegator = dctx.getDelegator();
Map<String, Object> result = null;
List<String> listSuccessMessage = new ArrayList<>();
List<String> listSuccessMessage = new ArrayList<String>();
// the idea is to allow only design to be uploaded. We use the stored file and add the new design from the uploaded file within.
DesignConfig config = new DesignConfig();
@@ -705,7 +682,7 @@ public class BirtServices {
IDesignEngineFactory factory = (IDesignEngineFactory) Platform.createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY);
engine = factory.createDesignEngine(config);
} catch (Exception e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
SessionHandle session = engine.newSessionHandle(ULocale.forLocale(locale));
@@ -713,14 +690,14 @@ public class BirtServices {
// get old file to restore dataset and datasource
ByteBuffer newRptDesignBytes = (ByteBuffer) context.get("uploadRptDesign");
if (newRptDesignBytes == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCannotFindUploadedFile", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCannotFindUploadedFile", locale));
}
GenericValue dataResource = null;
try {
dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne();
} catch (GenericEntityException e1) {
Debug.logError(e1, MODULE);
Debug.logError(e1, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
String rptDesignName = dataResource.getString("objectInfo");
@@ -728,7 +705,7 @@ public class BirtServices {
try {
Platform.startup();
} catch (BirtException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Cannot start Birt platform");
}
@@ -737,7 +714,7 @@ public class BirtServices {
try {
designStored = session.openDesign(rptDesignName);
} catch (DesignFileException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
@@ -751,7 +728,7 @@ public class BirtServices {
try {
iter.remove();
} catch (Exception e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
}
@@ -773,8 +750,8 @@ public class BirtServices {
Path path = Paths.get(nameTempRpt);
Files.deleteIfExists(path);
} catch (DesignFileException | IOException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorInuploadRptDesignNoFile", locale));
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorInuploadRptDesignNoFile", locale));
}
//copy cube
@@ -788,7 +765,7 @@ public class BirtServices {
try {
designStored.getCubes().add(copy);
} catch (Exception e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
}
@@ -804,7 +781,7 @@ public class BirtServices {
try {
designStored.getBody().add(copy);
} catch (Exception e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
}
@@ -819,8 +796,7 @@ public class BirtServices {
}
}
// FXIME ? adding simple master page => All these casts and other occurrences ... It's ugly, but it's so hard that when I find a
// solution that works ...
// FXIME ? adding simple master page => All these casts and other occurrences ... It's ugly, but it's so hard that when I find a solution that works ...
@SuppressWarnings("unchecked")
List<DesignElementHandle> listMasterPages = designFromUser.getMasterPages().getContents();
for (DesignElementHandle masterPage : listMasterPages) {
@@ -830,7 +806,7 @@ public class BirtServices {
}
}
} catch (Exception e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
@@ -840,7 +816,7 @@ public class BirtServices {
try {
designStored.setPageVariable(pageVariable.getName(), pageVariable.getPropertyBindingExpression(pageVariable.getName()));
} catch (SemanticException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
}
@@ -850,7 +826,7 @@ public class BirtServices {
SlotHandle stylesStored = designStored.getStyles();
// getting style names from stored report
List<String> listStyleNames = new ArrayList<>();
List<String> listStyleNames = new ArrayList<String>();
@SuppressWarnings("unchecked")
Iterator<DesignElementHandle> iterStored = stylesStored.iterator();
while (iterStored.hasNext()) {
@@ -869,7 +845,7 @@ public class BirtServices {
try {
designStored.getStyles().add(copy);
} catch (Exception e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
}
@@ -878,18 +854,17 @@ public class BirtServices {
try {
designStored.saveAs(rptDesignName);
} catch (IOException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
designFromUser.close();
designStored.close();
if (Debug.infoOn()) {
Debug.logInfo("####### Design uploaded: ".concat(rptDesignName), MODULE);
}
if (Debug.infoOn()) Debug.logInfo("####### Design uploaded: ".concat(rptDesignName), module);
// TODO check: should we, as a secondary safety precaution, delete any file finishing with _TEMP_.rptdesign?
listSuccessMessage.add(UtilProperties.getMessage(RESOURCE, "BirtFlexibleRptDesignSuccessfullyUploaded", locale));
listSuccessMessage.add(UtilProperties.getMessage(resource, "BirtFlexibleRptDesignSuccessfullyUploaded", locale));
result = ServiceUtil.returnSuccess(listSuccessMessage);
return result;
}
}
}
@@ -39,16 +39,16 @@ import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
public final class BirtUtil {
private static final String MODULE = BirtUtil.class.getName();
public final static String module = BirtUtil.class.getName();
private static final Map<String, String> ENTITY_FIELD_TYPE_BIRT_TYPE_MAP = MapUtils.unmodifiableMap(UtilMisc.toMap(
private final static Map<String, String> entityFieldTypeBirtTypeMap = MapUtils.unmodifiableMap(UtilMisc.toMap(
"id", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"url", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"name", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"value", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"email", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"comment", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"id-long", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"id-long",DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"id-vlong", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"very-long", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
"indicator", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
@@ -70,14 +70,14 @@ public final class BirtUtil {
"object", DesignChoiceConstants.COLUMN_DATA_TYPE_JAVA_OBJECT,
"blob", DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB));
private static final Map<String, String> ENTITY_FIELD_TYPE_BIRT_PARAM_TYPE_MAP = MapUtils.unmodifiableMap(UtilMisc.toMap(
private final static Map<String, String> entityFieldTypeBirtParameterTypeMap = MapUtils.unmodifiableMap(UtilMisc.toMap(
"id", DesignChoiceConstants.PARAM_TYPE_STRING,
"url", DesignChoiceConstants.PARAM_TYPE_STRING,
"name", DesignChoiceConstants.PARAM_TYPE_STRING,
"value", DesignChoiceConstants.PARAM_TYPE_STRING,
"email", DesignChoiceConstants.PARAM_TYPE_STRING,
"comment", DesignChoiceConstants.PARAM_TYPE_STRING,
"id-long", DesignChoiceConstants.PARAM_TYPE_STRING,
"id-long",DesignChoiceConstants.PARAM_TYPE_STRING,
"id-vlong", DesignChoiceConstants.PARAM_TYPE_STRING,
"very-long", DesignChoiceConstants.PARAM_TYPE_STRING,
"indicator", DesignChoiceConstants.PARAM_TYPE_STRING,
@@ -99,7 +99,7 @@ public final class BirtUtil {
"object", DesignChoiceConstants.PARAM_TYPE_JAVA_OBJECT,
"blob", DesignChoiceConstants.PARAM_TYPE_JAVA_OBJECT));
private static final Map<String, String> MIME_TYPE_OUTPUT_FORMAT_MAP = UtilMisc.toMap(
private final static Map<String, String> mimeTypeOutputFormatMap = UtilMisc.toMap(
"text/html", RenderOption.OUTPUT_FORMAT_HTML,
"application/pdf", RenderOption.OUTPUT_FORMAT_PDF,
"application/postscript", "postscript",
@@ -113,7 +113,7 @@ public final class BirtUtil {
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx",
"application/vnd.openxmlformats-officedocument.presentationml.presentation", "pptx");
private BirtUtil() { }
private BirtUtil() {}
/**
* Return birt field type corresponding to given entity field type
@@ -124,11 +124,11 @@ public final class BirtUtil {
if (UtilValidate.isEmpty(entityFieldType)) {
return null;
}
return ENTITY_FIELD_TYPE_BIRT_TYPE_MAP.get(entityFieldType.toLowerCase());
return entityFieldTypeBirtTypeMap.get(entityFieldType.toLowerCase());
}
/**
* Return birt parameter type corresponding to given entity field type
* Return birt parameter type corresponding to given entity field type
* @param entityFieldType
* @return birt parameter type corresponding to given entity field type
*/
@@ -136,7 +136,7 @@ public final class BirtUtil {
if (UtilValidate.isEmpty(entityFieldType)) {
return null;
}
return ENTITY_FIELD_TYPE_BIRT_PARAM_TYPE_MAP.get(entityFieldType.toLowerCase());
return entityFieldTypeBirtParameterTypeMap.get(entityFieldType.toLowerCase());
}
/**
@@ -145,7 +145,7 @@ public final class BirtUtil {
* @return true if mime type related to a contentType is supported by Birt
*/
public static boolean isSupportedMimeType(String contentType) {
return MIME_TYPE_OUTPUT_FORMAT_MAP.containsKey(contentType);
return mimeTypeOutputFormatMap.containsKey(contentType);
}
/**
@@ -156,7 +156,7 @@ public final class BirtUtil {
*/
public static String getMimeTypeOutputFormat(String contentType) throws GeneralException {
if (isSupportedMimeType(contentType)) {
return MIME_TYPE_OUTPUT_FORMAT_MAP.get(contentType);
return mimeTypeOutputFormatMap.get(contentType);
}
throw new GeneralException("Unknown content type : " + contentType);
}
@@ -237,4 +237,4 @@ public final class BirtUtil {
if (UtilValidate.isEmpty(reportName)) return "";
return StringUtil.replaceString(StringUtil.removeRegex(reportName.trim(), "[^\\p{L}\\s]"), " ", "_");
}
}
}
@@ -66,34 +66,29 @@ import com.ibm.icu.util.ULocale;
public class ReportDesignGenerator {
private static final String MODULE = ReportDesignGenerator.class.getName();
private static final String RES_ERROR = "BirtErrorUiLabels";
private static final String module = ReportDesignGenerator.class.getName();
private Locale locale;
private ElementFactory factory;
/**
* The generated design
*/
/** The generated design */
private ReportDesignHandle design;
private Map<String, String> dataMap;
/**
* Map of all filter supported by the report design
*/
/** Map of all filter supported by the report design */
private Map<String, String> filterMap;
/**
* Service name to populate dataset of the report design
*/
/** Service name to populate dataset of the report design*/
private String serviceName;
private Map<String, String> fieldDisplayLabels;
private Map<String, String> filterDisplayLabels;
private String rptDesignName;
private boolean generateFilters = false;
public static final String resource_error = "BirtErrorUiLabels";
public ReportDesignGenerator(Map<String, Object> context, DispatchContext dctx) throws GeneralException, SemanticException {
locale = (Locale) context.get("locale");
dataMap = UtilGenerics.cast(context.get("dataMap"));
dataMap = UtilGenerics.checkMap(context.get("dataMap"));
filterMap = UtilGenerics.cast(context.get("filterMap"));
serviceName = (String) context.get("serviceName");
fieldDisplayLabels = UtilGenerics.cast(context.get("fieldDisplayLabels"));
fieldDisplayLabels = UtilGenerics.checkMap(context.get("fieldDisplayLabels"));
filterDisplayLabels = UtilGenerics.cast(context.get("filterDisplayLabels"));
rptDesignName = (String) context.get("rptDesignName");
String writeFilters = (String) context.get("writeFilters");
@@ -109,14 +104,13 @@ public class ReportDesignGenerator {
* Generate report design (rtdesign file).
* @throws IOException
* @throws GeneralException
* @throws BirtException
* @throws BirtException
*/
public void buildReport() throws IOException, GeneralException, BirtException {
DesignConfig config = new DesignConfig();
Platform.startup();
IDesignEngine engine = ((IDesignEngineFactory) Platform.createFactoryObject(
IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY)).createDesignEngine(config);
IDesignEngine engine = ((IDesignEngineFactory) Platform.createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY)).createDesignEngine(config);
// creating main design elements
SessionHandle session = engine.newSessionHandle(ULocale.forLocale(locale));
design = session.createDesign();
@@ -152,7 +146,7 @@ public class ReportDesignGenerator {
for (String filter : filterMap.keySet()) {
String birtType = BirtUtil.convertFieldTypeToBirtParameterType(filterMap.get(filter));
if (birtType == null) {
throw new GeneralException(UtilProperties.getMessage(RES_ERROR, "BirtErrorConversionFieldToBirtFailed", locale));
throw new GeneralException(UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale));
}
// get label
String displayFilterName;
@@ -162,13 +156,10 @@ public class ReportDesignGenerator {
displayFilterName = filter;
}
ScalarParameterHandle scalParam = factory.newScalarParameter(filter);
// scalParam.setDisplayName(displayFilterName); // TODO has no incidence at all right now, is only displayed when using birt's
// report parameter system. Not our case. I leave it here if any idea arise of how to translate these.
// scalParam.setDisplayName(displayFilterName); // TODO has no incidence at all right now, is only displayed when using birt's report parameter system. Not our case. I leave it here if any idea arise of how to translate these.
scalParam.setPromptText(displayFilterName);
if ("javaObject".equals(birtType)) { //Fields of type='blob' are rejected by Birt: org.eclipse.birt.report.model.api.metadata
// .PropertyValueException: The choice value "javaObject" is not allowed.
throw new GeneralException("Fields of type='blob' are rejected by Birt. Create a view entity, based on the requested entity, "
+ "where you exclude the field of type='blob'");
if ("javaObject".equals(birtType)) { //Fields of type='blob' are rejected by Birt: org.eclipse.birt.report.model.api.metadata.PropertyValueException: The choice value "javaObject" is not allowed.
throw new GeneralException("Fields of type='blob' are rejected by Birt. Create a view entity, based on the requested entity, where you exclude the field of type='blob'");
} else {
scalParam.setDataType(birtType);
}
@@ -222,18 +213,16 @@ public class ReportDesignGenerator {
ImageHandle image = factory.newImage(null);
CellHandle cell = (CellHandle) row.getCells().get(0);
cell.getContent().add(image);
image.setURL("https://ofbiz.apache.org/images/ofbiz_logo.png");
image.setURL("http://ofbiz.apache.org/images/ofbiz_logo.png");
LabelHandle label = factory.newLabel(null);
cell = (CellHandle) row.getCells().get(1);
cell.getContent().add(label);
label.setText("Dat is dat test !");
// ################ CODE HERE IF YOU WANT TO ADD GENERATED DESIGN / MAY BE WORTH USING RPTTEMPLATE AND-OR RPTLIBRARY ################### */
design.saveAs(rptDesignName);
design.close();
if (Debug.infoOn()) {
Debug.logInfo("####### Design generated: " + rptDesignName, MODULE);
}
if (Debug.infoOn())Debug.logInfo("####### Design generated: " + rptDesignName, module);
session.closeAll(false);
Platform.shutdown();
}
@@ -243,7 +232,7 @@ public class ReportDesignGenerator {
* <p>This script is used to populate Birt design parameters from input</p>
*/
private void createScriptedBeforeFactory() {
StringBuffer beforeFactoryScript = new StringBuffer("Debug.logInfo(\"###### In beforeFactory\", MODULE);\n");
StringBuffer beforeFactoryScript = new StringBuffer("Debug.logInfo(\"###### In beforeFactory\", module);\n");
beforeFactoryScript.append("var inputFields = reportContext.getParameterValue(\"parameters\");\n");
beforeFactoryScript.append("//get a list of all report parameters\n");
beforeFactoryScript.append("var parameters = reportContext.getDesignHandle().getAllParameters();\n");
@@ -273,22 +262,20 @@ public class ReportDesignGenerator {
dataSetInitializeScript.append("importPackage(Packages.org.apache.ofbiz.service);\n");
dataSetInitializeScript.append("importPackage(Packages.org.apache.ofbiz.base.util);\n");
dataSetInitializeScript.append("importPackage(java.util);\n");
dataSetInitializeScript.append("MODULE = \"" + rptDesignName + "\";");
dataSetInitializeScript.append("Debug.logInfo(\"###### In initialize \", MODULE);");
dataSetInitializeScript.append("module = \"" + rptDesignName + "\";");
dataSetInitializeScript.append("Debug.logInfo(\"###### In initialize \", module);");
design.setInitialize(dataSetInitializeScript.toString());
// set open Birt script
StringBuffer dataSetOpenScript = new StringBuffer("importPackage(Packages.org.apache.ofbiz.birt);\n");
dataSetOpenScript.append("Debug.logInfo(\"#### In open\", MODULE)\n");
dataSetOpenScript.append("Debug.logInfo(\"#### In open\", module)\n");
dataSetOpenScript.append("try {\n");
dataSetOpenScript.append(" listRes = dispatcher.runSync(\"" + serviceName + "\", UtilMisc.toMap(\"userLogin\", reportContext"
+ ".getParameterValue(\"userLogin\"), \"locale\", reportContext.getParameterValue(\"locale\"), "
+ "\"reportContext\", reportContext));\n");
dataSetOpenScript.append(" listRes = dispatcher.runSync(\"" + serviceName + "\", UtilMisc.toMap(\"userLogin\", reportContext.getParameterValue(\"userLogin\"), \"locale\", reportContext.getParameterValue(\"locale\"), \"reportContext\", reportContext));\n");
dataSetOpenScript.append(" if (ServiceUtil.isError(listRes)) {\n");
dataSetOpenScript.append(" Debug.logError(ServiceUtil.getErrorMessage(listRes));\n");
dataSetOpenScript.append(" }\n");
dataSetOpenScript.append("}\n");
dataSetOpenScript.append("catch (e) { Debug.logError(e, MODULE); }\n");
dataSetOpenScript.append("catch (e) { Debug.logError(e, module); }\n");
dataSetOpenScript.append("records = listRes.get(\"records\");\n");
dataSetOpenScript.append("countOfRow = 0;\n");
dataSetOpenScript.append("totalRow = records.size();\n");
@@ -323,7 +310,7 @@ public class ReportDesignGenerator {
resultSetCol.setColumnName(field);
String birtType = BirtUtil.convertFieldTypeToBirtType(dataMap.get(field));
if (birtType == null) {
throw new GeneralException(UtilProperties.getMessage(RES_ERROR, "BirtErrorConversionFieldToBirtFailed", locale));
throw new GeneralException(UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale));
}
resultSetCol.setPosition(i);
resultSetCol.setDataType(birtType);
@@ -347,9 +334,7 @@ public class ReportDesignGenerator {
design.getDataSets().add(dataSetHandle);
}
/**
* Create new dataSource named OFBiz
*/
/** Create new dataSource named OFBiz */
private void createScriptedDataSource() throws SemanticException {
ScriptDataSourceHandle dataSource = factory.newScriptDataSource("OFBiz");
design.getDataSources().add(dataSource);
@@ -24,22 +24,24 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.ofbiz.base.util.GeneralException;
import org.apache.ofbiz.base.util.UtilGenerics;
import org.apache.ofbiz.birt.BirtWorker;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.report.context.BirtContext;
import org.eclipse.birt.report.context.IContext;
import org.eclipse.birt.report.service.BirtReportServiceFactory;
import org.eclipse.birt.report.service.ReportEngineService;
import org.eclipse.birt.report.utility.ParameterAccessor;
import org.apache.ofbiz.base.util.UtilGenerics;
import org.apache.ofbiz.birt.BirtWorker;
@SuppressWarnings("serial")
public class OfbizBirtEngineServlet extends org.eclipse.birt.report.servlet.BirtEngineServlet {
public class BirtEngineServlet extends org.eclipse.birt.report.servlet.BirtEngineServlet {
public final static String module = BirtEngineServlet.class.getName();
@Override
protected IContext __getContext(HttpServletRequest request, HttpServletResponse response) throws BirtException {
BirtReportServiceFactory.getReportService().setContext(getServletContext(), null);
// set app context
Map<String, Object> appContext = UtilGenerics.cast(ReportEngineService.getInstance().getEngineConfig().getAppContext());
try {
@@ -47,6 +49,7 @@ public class OfbizBirtEngineServlet extends org.eclipse.birt.report.servlet.Birt
} catch (GeneralException e) {
throw new BirtException(e.getMessage());
}
return new BirtContext(new ViewerServletRequest(ParameterAccessor.getParameter(request, ParameterAccessor.PARAM_REPORT), request), response);
return new BirtContext(new ViewerServletRequest(ParameterAccessor.getParameter(request, ParameterAccessor.PARAM_REPORT)
, request), response);
}
}
@@ -37,12 +37,12 @@ import org.apache.ofbiz.birt.BirtWorker;
@SuppressWarnings("serial")
public class BirtViewerServlet extends ViewerServlet {
private static final String MODULE = BirtViewerServlet.class.getName();
public final static String module = BirtViewerServlet.class.getName();
@Override
protected IContext __getContext(HttpServletRequest request, HttpServletResponse response) throws BirtException {
BirtReportServiceFactory.getReportService().setContext(getServletContext(), null);
// set app context
Map<String, Object> appContext = UtilGenerics.cast(ReportEngineService.getInstance().getEngineConfig().getAppContext());
try {
@@ -50,6 +50,8 @@ public class BirtViewerServlet extends ViewerServlet {
} catch (GeneralException e) {
throw new BirtException(e.getMessage());
}
return new BirtContext(new ViewerServletRequest(ParameterAccessor.getParameter(request, ParameterAccessor.PARAM_REPORT), request), response);
return new BirtContext(new ViewerServletRequest(ParameterAccessor.getParameter(request, ParameterAccessor.PARAM_REPORT)
, request), response);
}
}
@@ -30,13 +30,16 @@ import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.Debug;
public class ViewerServletRequest extends HttpServletRequestWrapper {
private static final String MODULE = ViewerServletRequest.class.getName();
private String originalReportParam = null;
public final static String module = ViewerServletRequest.class.getName();
protected String originalReportParam = null;
public ViewerServletRequest(String originalReportParam, HttpServletRequest request) {
super(request);
this.originalReportParam = originalReportParam;
}
@Override
public String getParameter(String name) {
if (ParameterAccessor.PARAM_REPORT.equals(name)) {
@@ -50,7 +53,7 @@ public class ViewerServletRequest extends HttpServletRequestWrapper {
try {
reportFileUrl = FlexibleLocation.resolveLocation(reportParam, loader);
} catch (MalformedURLException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
}
if (reportFileUrl == null) {
throw new IllegalArgumentException("Could not resolve location to URL: " + reportParam);
@@ -51,32 +51,29 @@ import org.xml.sax.SAXException;
public class BirtViewHandler implements ViewHandler {
private static final String MODULE = BirtViewHandler.class.getName();
private static final String RES_ERROR = "BirtErrorUiLabels";
private ServletContext servletContext = null;
public static final String module = BirtViewHandler.class.getName();
public static final String resource_error = "BirtErrorUiLabels";
protected ServletContext servletContext = null;
private String name = "birt";
@Override
public void init(ServletContext context) throws ViewHandlerException {
this.servletContext = context;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public void render(String name, String page, String info,
String contentType, String encoding, HttpServletRequest request,
HttpServletResponse response) throws ViewHandlerException {
try {
IReportEngine engine = org.apache.ofbiz.birt.BirtFactory.getReportEngine();
// open report design
@@ -88,7 +85,7 @@ public class BirtViewHandler implements ViewHandler {
}
if (UtilValidate.isEmpty(page)) {
Locale locale = request.getLocale();
throw new ViewHandlerException(UtilProperties.getMessage(RES_ERROR, "BirtErrorNotPublishedReport", locale));
throw new ViewHandlerException(UtilProperties.getMessage(resource_error, "BirtErrorNotPublishedReport", locale));
}
if (page.startsWith("component://")) {
InputStream reportInputStream = BirtFactory.getReportInputStreamFromLocation(page);
@@ -96,13 +93,13 @@ public class BirtViewHandler implements ViewHandler {
} else {
design = engine.openReportDesign(page);
}
Map<String, Object> appContext = UtilGenerics.cast(engine.getConfig().getAppContext());
BirtWorker.setWebContextObjects(appContext, request, response);
Map<String, Object> context = new HashMap<>();
Map<String, Object> context = new HashMap<String, Object>();
// set parameters from request
Map<String, Object> parameters = UtilGenerics.cast(request.getAttribute(BirtWorker.getBirtParameters()));
Map<String, Object> parameters = UtilGenerics.cast(request.getAttribute(BirtWorker.getBirtParameters()));
if (parameters != null) {
context.put(BirtWorker.getBirtParameters(), parameters);
} else {
@@ -113,13 +110,13 @@ public class BirtViewHandler implements ViewHandler {
if (locale == null) {
locale = UtilHttp.getLocale(request);
}
// set override content type
String overrideContentType = request.getParameter(BirtWorker.getBirtContentType());
if (UtilValidate.isNotEmpty(overrideContentType)) {
contentType = overrideContentType;
}
// set output file name to get also file extension
String outputFileName = request.getParameter(BirtWorker.getBirtOutputFileName());
if (UtilValidate.isNotEmpty(outputFileName)) {
@@ -154,11 +151,11 @@ public class BirtViewHandler implements ViewHandler {
throw new ViewHandlerException("general error: " + e.toString(), e);
} catch (SAXException se) {
String errMsg = "Error SAX rendering " + page + " view handler: " + se.toString();
Debug.logError(se, errMsg, MODULE);
Debug.logError(se, errMsg, module);
throw new ViewHandlerException(errMsg, se);
} catch (ParserConfigurationException pe) {
String errMsg = "Error parser rendering " + page + " view handler: " + pe.toString();
Debug.logError(pe, errMsg, MODULE);
Debug.logError(pe, errMsg, module);
throw new ViewHandlerException(errMsg, pe);
}
}
+4
View File
@@ -98,6 +98,10 @@ under the License.
<url-pattern>/control/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
+4
View File
@@ -141,6 +141,10 @@ under the License.
<url-pattern>/extract</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
+52
View File
@@ -0,0 +1,52 @@
<%--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--%>
<%@ page import="org.apache.ofbiz.base.util.*" %>
<html>
<head>
<title>OFBiz Message</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
<body bgcolor="#FFFFFF">
<div align="center">
<br/>
<table width="100%" border="1" height="200">
<tr>
<td>
<table width="100%" border="0" height="200">
<tr bgcolor="#CC6666">
<td height="45">
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
</td>
</tr>
<tr>
<td>
<div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div align="center"></div>
</body>
</html>
+4
View File
@@ -109,6 +109,10 @@ under the License.
<url-pattern>/ShippingAPI.dll</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
+4
View File
@@ -105,6 +105,10 @@ under the License.
<url-pattern>/products/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
+2 -3
View File
@@ -43,7 +43,6 @@ under the License.
<set field="applicationMenuName" value="BirtAppBar" global="true"/>
<set field="applicationMenuLocation" value="component://birt/widget/birt/BirtMenus.xml" global="true"/>
<set field="applicationTitle" from-field="uiLabelMap.BirtExampleApplication" global="true"/>
<set field="helpAnchor" from-field="helpAnchor" default-value="_birt_ofbiz_plugin"/>
</actions>
<widgets>
<include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/>
@@ -226,12 +225,12 @@ under the License.
<field-map field-name="mainAction" value="CREATE"/>
</service>
<set field="hasCreatePermission" from-field="permCreateResult.hasPermission"/>
<service service-name="genericBirtPermission" result-map="permDeleteResult">
<field-map field-name="mainAction" value="DELETE"/>
</service>
<set field="hasDeletePermission" from-field="permDeleteResult.hasPermission"/>
<service service-name="genericBirtPermission" result-map="permUpdateResult">
<field-map field-name="mainAction" value="UPDATE"/>
</service>
+4 -4
View File
@@ -55,8 +55,8 @@ under the License.
<label style="h1" text="${uiLabelMap.ProductInventoryByProduct} ${uiLabelMap.CommonFor} ${facility.facilityName}"/>
</container>
<container>
<link target="ViewFacilityInventoryByProductReport?${searchParameterString}" text="${uiLabelMap.CommonPrint}" style="buttontext" target-window="_blank"/>
<link target="ViewFacilityInventoryByProductExport?${searchParameterString}" text="${uiLabelMap.CommonExport}" style="buttontext" target-window="_blank"/>
<link target="ViewFacilityInventoryByProductReport?${searchParameterString}" text="${uiLabelMap.CommonPrint}" style="buttontext"/>
<link target="ViewFacilityInventoryByProductExport?${searchParameterString}" text="${uiLabelMap.CommonExport}" style="buttontext"/>
<link target="ViewFacilityInventoryHistoryReport?${searchParameterString}" text="${uiLabelMap.BirtFacilityReportInventoryHistoryReport}" style="buttontext"/>
</container>
<screenlet title="${uiLabelMap.PageTitleFindFacilityInventoryItemsByProduct}">
@@ -86,8 +86,8 @@ under the License.
<label style="h1" text="${uiLabelMap.ProductInventoryByProduct} ${uiLabelMap.CommonFor} ${facility.facilityName}"/>
</container>
<container>
<link target="ViewFacilityInventoryByProductReport?facilityId=${parameters.facilityId}" text="${uiLabelMap.CommonPrint}" style="buttontext" target-window="_blank"/>
<link target="ViewFacilityInventoryByProductExport?facilityId=${parameters.facilityId}" text="${uiLabelMap.CommonExport}" style="buttontext" target-window="_blank"/>
<link target="ViewFacilityInventoryByProductReport?facilityId=${parameters.facilityId}" text="${uiLabelMap.CommonPrint}" style="buttontext"/>
<link target="ViewFacilityInventoryByProductExport?facilityId=${parameters.facilityId}" text="${uiLabelMap.CommonExport}" style="buttontext"/>
<link target="ViewFacilityInventoryHistoryReport?facilityId=${parameters.facilityId}" text="${uiLabelMap.BirtFacilityReportInventoryHistoryReport}" style="buttontext"/>
</container>
<screenlet title="${uiLabelMap.BirtFacilityReportInventoryHistoryReport}">
+1 -2
View File
@@ -57,8 +57,7 @@ under the License.
<form name="SaleOrdersByChannel" type="single" target="OrdersByChannel.pdf" target-window="_BLANK">
<field name="SalesChannel" title="${uiLabelMap.OrderSalesChannel}">
<drop-down allow-empty="false">
<option key="" description="${uiLabelMap.CommonAll}"/>
<drop-down allow-empty="true">
<entity-options entity-name="Enumeration" key-field-name="enumId" description="${description}">
<entity-constraint name="enumTypeId" operator="equals" value="ORDER_SALES_CHANNEL"/>
</entity-options>
+2
View File
@@ -44,6 +44,7 @@ under the License.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>${(decoratedContent.subcontent.title.render)!"WebSite 1 Generic Title (Set subcontent 'title' on your content!)"}</title>
<link rel="shortcut icon" href="/images/ofbiz.ico" />
<script src="/common/js/util/dompurify/dist/purify.min.js" type="application/javascript"></script>
<script src="/common/js/util/fieldlookup.js" type="application/javascript"></script>
<script src="/common/js/util/OfbizUtil.js" type="application/javascript"></script>
<link rel="stylesheet" href="/ecommerce/images/ecommain.css" type="text/css"/>
@@ -125,6 +126,7 @@ under the License.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>${(decoratedContent.subcontent.title.render)!"WebSite 2 Generic Title (Set subcontent 'title' on your content!)"}</title>
<link rel="shortcut icon" href="/images/ofbiz.ico" />
<script src="/common/js/util/dompurify/dist/purify.min.js" type="application/javascript"></script>
<script src="/common/js/util/fieldlookup.js" type="application/javascript"></script>
<script src="/common/js/util/OfbizUtil.js" type="application/javascript"></script>
<link rel="stylesheet" href="/ecommerce/images/ecommain.css" type="text/css"/>
+22
View File
@@ -114,6 +114,7 @@ under the License.
<li><a href="${thisContent.content.CMSS_DEMO_SCREEN.link}">Demo Page with screen widget and screen decorator</a></li>
<li><a href="${thisContent.content.CMSS_DEMO_BLOG.link}">Demo Page with blog using screen decorator</a></li>
<li><a href="${thisContent.content.CMSS_DEMO_TPL_DATA.link}">Demo Page with an xml resource formatted with a template ftl resource</a></li>
<li><a href="${thisContent.content.PUBLIC_DOCS.link}">The ofbiz public documents</a></li>
<li><a href="/cmssite/website-1">WebSite 1</a></li>
<li><a href="/cmssite/website-2">WebSite 2</a></li>
</ul>
@@ -228,5 +229,26 @@ under the License.
<DataResource dataResourceId="DOCBOOK_HTML_TEMPL" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/template/docbook/html/docbook.xsl" dataTemplateTypeId="XSLT" statusId="CTNT_IN_PROGRESS" dataResourceName="Help template file" mimeTypeId="text/html" isPublic="Y"/>
<DataResource dataResourceId="DOCBOOK_PDF_TEMPL" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/template/docbook/fo/docbook.xsl" dataTemplateTypeId="XSLT" statusId="CTNT_IN_PROGRESS" dataResourceName="Help template file" mimeTypeId="text/html" isPublic="Y"/>
<DataResource dataResourceId="PUBLIC_DOCS" dataResourceTypeId="URL_RESOURCE" dataTemplateTypeId="SCREEN_COMBINED" objectInfo="component://cmssite/widget/CmssiteScreens.xml#publicDocs"/>
<Content contentId="PUBLIC_DOCS" contentTypeId="DOCUMENT" contentName="OFBIz public documents" dataResourceId="PUBLIC_DOCS"/>
<DataResource dataResourceId="APACHE_OFBIZ" localeString="en" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/documents/ApacheOfbiz.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Apache OFBiz document" mimeTypeId="text/xml" isPublic="Y" />
<Content contentId="APACHE_OFBIZ_HTML" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_HTML_TEMPL" dataResourceId="APACHE_OFBIZ" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The User &amp; Technical Apache OFBiz document in one page HTML" mimeTypeId="text/html"/>
<ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01"/>/>
<Content contentId="APACHE_OFBIZ_PDF" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_PDF_TEMPL" dataResourceId="APACHE_OFBIZ" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The general Apache document in PDF format" mimeTypeId="application/pdf"/>
<ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_PDF" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01"/>/>
<DataResource dataResourceId="APACHE_OFBIZ_TECH" localeString="en" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/documents/ApacheOfbizTechnical.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Apache OFBiz document" mimeTypeId="text/xml" isPublic="Y" />
<Content contentId="APACHE_OFBIZ_T_HTML" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_HTML_TEMPL" dataResourceId="APACHE_OFBIZ_TECH" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The Apache OFBiz Technical Guide in one page HTML" mimeTypeId="text/html"/>
<ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_T_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01"/>/>
<DataResource dataResourceId="APACHE_OFBIZ_USER" localeString="en" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/documents/ApacheOfbizUser.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Apache OFBiz User document" mimeTypeId="text/xml" isPublic="Y" />
<Content contentId="APACHE_OFBIZ_U_HTML" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_HTML_TEMPL" dataResourceId="APACHE_OFBIZ_USER" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The Apache OFBizUser Guide in one page HTML" mimeTypeId="text/html"/>
<ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_U_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01"/>/>
<ContentAssoc contentId="CMSS_PPOINT" contentIdTo="PUBLIC_DOCS" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/>
<ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="documents"/>
<ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_PDF" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="documents"/>
<WebSiteContent webSiteId="CmsSite" contentId="MAINTENANCE_PAGE" webSiteContentTypeId="MAINTENANCE_PAGE" fromDate="2016-05-21 00:00:00"/>
</entity-engine-xml>
+62
View File
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://docbook.org/ns/docbook ../../content/dtd/docbook.xsd"
xmlns="http://docbook.org/ns/docbook">
<info>
<title>Apache OFBiz official documentation.</title>
<abstract>
<para>
This Book is currently in an experimental stage. It will be the start of moving the OFBiz documentation from the current
<link xl:href="https://cwiki.apache.org/confluence/display/OFBIZ/Home">OFBiz documentation site</link> and the old ofbiz website (Entity documents) to the OFBiz content component.
The layout is currently open for discussion by the OFBiz community.
</para>
<para>
The advantages of using it within OFBiz are:
<orderedlist>
<listitem><para>No external system required for documentation</para></listitem>
<listitem><para>The content of the internal help files can be used within the documentation</para></listitem>
<listitem><para>The documentation always has the same version as the system (It is part of it)</para></listitem>
<listitem><para>The content is stored in a internationally accepted <link xl:href="http://docbook.org">'DocBook'</link> format</para></listitem>
<listitem><para>The content can be easily presented in the selected visual schemas (To be implemented)</para></listitem>
</orderedlist>
</para>
<para>
If you want to contribute to this document, you are very welcome.
Several possibilities exist:
<orderedlist>
<listitem><para>Convert existing OFBiz documents on the <link xl:href="https://cwiki.apache.org/confluence/display/OFBIZ/Documentation">OFBiz documentation site</link> to the <link xl:href="http://docbook.org">docbookformat</link></para></listitem>
<listitem><para>Write new document chapters for an OFBiz component</para></listitem>
<listitem><para>Write new Help screens which can be inserted as sections in the document.</para></listitem>
</orderedlist>
How to contribute? It depends if you have a local OFBiz system or not. If you have, check the appendix for an explanation how the document text is stored within the OFBiz system.
If you do not have a local OFBiz system write your text in an xml editor using the DocBook V5.0 schema's.
If you have text to contribute create a Jira issue and upload your text to the issue.
</para>
</abstract>
</info>
<xi:include href="ApacheOfbizUser.xml"/>
<xi:include href="ApacheOfbizTechnical.xml"/>
</set>
+219
View File
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://docbook.org/ns/docbook ../../content/dtd/docbook.xsd"
xmlns="http://docbook.org/ns/docbook">
<info>
<title>Apache OFBiz Technical documentation.</title>
</info>
<dedication>
<para>
I was reading the book in development from Norman Walsh called <link xl:href="http://www.docbook.org/tdg5/en/html/docbook.html">DocBook 5.0: The Definitive Guide
</link> and found that a book can have a dedication. My first thought was there is only one man to whom this book can be dedicated. Without him I would not have been writing it.
Sometimes i talk to other people about my dinners with David Jones in Pucket, Thailand which were very revealing to me. At a relative young age David designed and developed with Andy Zenesky
the cornerstones of the OFBiz system called entity engine and recognized that in 2001 SOA (System Oriented Architecture) would be the future.
So, David, thank you very much spending your efforts creating this excellent system.
</para>
</dedication>
<chapter>
<title>Introduction.</title>
<para>
Welcome to Apache OFBiz, the ready to use open source ERP system. Let me first say if you downloaded
the system for the first time it will be very overwhelming because the system is pretty big what is actually pretty normal for an ERP system
because of its size.
</para>
<para>
This document is describing the technical aspects of the system. How to install it, how to load the data and how to make the system available to the Internet.
This is described pretty well in the 'production setup guide' in the next section. If you looking how to setup the system from a user point of view then better
have a look at the Apache OFBiz user guide.
</para>
<section>
<title>The production setup guide.</title>
<para>
An excellent guide to configure the system in a production environment, read the document at the <link xl:href="http://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+Production+Setup+Guide">OFBiz documentation site</link>
</para>
</section>
<section>
<title>The quick setup of an Ubuntu/Debian Linux with Postgresql Apache OFBiz server</title>
<para>
Ubuntu/Debian is certainly not the only distribution which is suitable for OFBiz. In general all Linux distributions can be used.
The OFBiz system will also run on Windows, however this is not preferred and much less experience is available in the OFBiz communiy.
The preferred data base is Postgresql although most databases will do.
</para>
<orderedlist>
<listitem>
<para>Upgrade Linux to Ubuntu/Debian remotely using Grub menu</para>
<para>
If you have a version of Linux running already on your server which using the GRUB menu, it is possible to upgrade to Debian/Ubuntu
without even touching the server physically. With the method below the Debian installer is loaded into a Ram disk from where it can
reformat and re-partition the harddisk and install the system.
Practice this first on a local server, because if after the reboot the server is unreachable you have to ask somebody at the datacenter to manually reboot the system.
</para>
<para>
If you have a proper Linux installed go to the Postgres installation.
</para>
<orderedlist>
<listitem>
<para>Get the OS kernel and the related initrd.gz</para>
<para>
Make sure you server can handle 64bit if you take that version, if not sure take the 32bit version.
Example url for 64bit Ubuntu: http://us.archive.ubuntu.com/ubuntu/dists/hardy/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux for the kernel and
http://us.archive.ubuntu.com/ubuntu/dists/jaunty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz for the initrd.gz file
</para>
<para>
If not sure take the 32bit version:
Example url for 32bit Ubuntu: http://us.archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/ubuntu-installer/amd64/linux for the kernel and
http://us.archive.ubuntu.com/ubuntu/dists/jaunty/main/installer-i386/current/images/netboot/ubuntu-installer/i386/initrd.gz for the initrd.gz file
</para>
</listitem>
<listitem>
<para>Uncompress the initrd.gz: gzip -dc ../initrd.gz | cpio -id</para>
</listitem>
<listitem>
<para>Edit the preseed.cfg file inside the initrd.gz file</para>
<para>
The file I used had the following content:
<programlisting>
d-i debconf/priority select critical
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i auto-install/enabled boolean true
d-i netcfg/choose_interface select eth0
d-i netcfg/disable_dhcp boolean true
d-i netcfg/get_nameservers string x.x.x.x &lt;--- EDIT! (max 3)
d-i netcfg/get_ipaddress string x.x.x.x &lt;--- EDIT!
d-i netcfg/get_netmask string 255.255.255.0 &lt;--- EDIT!
d-i netcfg/get_gateway string x.x.x.x &lt;--- EDIT!
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string servername &lt;--- EDIT!
d-i netcfg/get_domain string yourdomain.com &lt;--- EDIT!
d-i network-console/password password password &lt;--- EDIT!
d-i network-console/password-again password password &lt;--- EDIT!
d-i preseed/early_command string anna-install network-console
</programlisting>
You can find the ip addresses in the current Linux normally in the /etc/network/interfaces file.
</para>
</listitem>
<listitem>
<para>Create the new Archive:
<programlisting>
find ./ | cpio -H newc -o > initrd-preseed
gzip initrd-preseed
</programlisting>
</para>
</listitem>
<listitem>
<para>Copy the Kernel and the new initrd.gz to the server</para>
<para>
Copy these to files to the /boot/ directory on the server.
</para>
<para>If using LiLo</para>
<para>
You have to download the vmlinuz image and put that in the /boot directory under the name vmlinuzNew
</para>
</listitem>
<listitem>
<para>If Grub is used: Edit the /boot/grub/menu.lst file on the server:
<programlisting>
# menu entry before the first:(for root, look at the other menu items)
title Ubuntu Install
root xxxxx
kernel /linux
initrd /initrd-preseed.gz
savedefault 1
</programlisting>
</para>
<para>If Lilo is used edit the /etc/lilo.conf file on the server:
<programlisting>
image=/boot/vmlinuzNew
label="newUbuntu"
initrd=/boot/init-preseed.gz
</programlisting>
</para>
</listitem>
<listitem>
<para>Reboot the server</para>
<para>and hopfully after some time you can login with SSH and using the username &quot;installer&quot; and the password you specified in the preseed file</para>
<para>From that point you can configure the server and repartition the harddisk</para>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>Install Subversion</para>
<para>use the command (as root) apt-get install subversion</para>
</listitem>
<listitem>
<para>Install Apache using proxy AJP to talk to OFBiz</para>
<para>Use the command (as root): apt-get install apache2</para>
<para>Make symbolic links from mods-available to mods-enabled for ssl.config, ssl.load, proxy.load, proxy_ajp.load and proxy.config. Modify proxy.config and replace &quot;Deny from all&quot; with &quot;Allow from all&quot;</para>
</listitem>
<listitem>
<para>Install Java SDK</para>
<para>Use the command (as root): apt-get install sun-java6-jdk</para>
</listitem>
<listitem>
<para>Install PostGresql</para>
<para>Use the command (as root): apt-get install postgresql</para>
<para>
Then logon as root, and su to the user &quot;postgres&quot; and issue the command: createuser &quot;ofbiz&quot;
</para>
</listitem>
<listitem>
<para>Install Ofbiz</para>
</listitem>
<listitem>
<para>Start ofbiz.....and look for he result in your browser.....</para>
</listitem>
</orderedlist>
</section>
</chapter>
<xi:include href="../../../framework/documents/Framework.xml"/>
<xi:include href="../../../framework/base/documents/FrameworkBase.xml" />
<xi:include href="../../../framework/common/documents/FrameworkCommon.xml" />
<xi:include href="../../../framework/entity/documents/EntityEngine.xml" />
<xi:include href="../../../framework/service/documents/ServiceEngine.xml" />
<xi:include href="../../../framework/webtools/documents/Webtools.xml" />
<xi:include href="../../../framework/documents/UnitTest.xml" />
<xi:include href="../../../framework/documents/SingleSignOn.xml" />
<xi:include href="../../../framework/documents/DataFiles.xml"/>
<appendix>
<xi:include href="../../../applications/commonext/data/helpdata/HELP_OFBizDocumentationSystem.xml"/>
</appendix>
<appendix>
<section>
<title>Revisions Requiring Data Migration.</title>
<para>
A List of migration actions you need to perform can be found at the <link xl:href="http://cwiki.apache.org/confluence/display/OFBTECH/Revisions+Requiring+Data+Migration">OFBiz documentation site</link>
</para>
</section>
</appendix>
</book>
+64
View File
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://docbook.org/ns/docbook ../../content/dtd/docbook.xsd"
xmlns="http://docbook.org/ns/docbook">
<info>
<title>Apache OFBiz User documentation</title>
</info>
<chapter>
<title>Introduction</title>
<para>
Welcome to Apache OFBiz the ready to use open source ERP system.
</para>
<para>
A project introduction can be found at the <link xl:href="http://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Project+Overview">OFBiz documentation site</link>
</para>
<para>
A general Business setup guide can be found at <link xl:href="http://cwiki.apache.org/confluence/display/OFBENDUSER/Apache+OFBiz+Business+Setup+Guide">OFBiz documentation site</link>
For a quick setup check the <link xl:href="#componentSetup">Setup component.</link>
</para>
</chapter>
<xi:include href="../../../applications/commonext/documents/Setup.xml"/>
<xi:include href="../../../applications/accounting/documents/Accounting.xml"/>
<xi:include href="../../../applications/party/documents/Party.xml"/>
<xi:include href="../../../applications/product/documents/Product.xml"/>
<xi:include href="../../../applications/order/documents/Order.xml"/>
<xi:include href="../../../applications/content/documents/Content.xml"/>
<xi:include href="../../../applications/marketing/documents/Marketing.xml"/>
<xi:include href="../../../applications/humanres/documents/Humanres.xml"/>
<xi:include href="../../myportal/documents/MyPortal.xml"/>
<xi:include href="../../projectmgr/documents/ProjectMgr.xml"/>
<xi:include href="../../ebay/documents/Ebay.xml"/>
<xi:include href="../../ebaystore/documents/EbayStore.xml"/>
<appendix>
<title>New features recently added</title>
<para>
A description of the new features recently added can be found at the <link xl:href="http://cwiki.apache.org/confluence/display/OFBIZ/Main+New+Features">OFBiz documentation site</link>
</para>
</appendix>
</book>
@@ -54,9 +54,7 @@ public class MultiSiteRequestWrapper implements HttpServletRequest {
}
@Override
public String changeSessionId() {
return request.changeSessionId();
}
public String changeSessionId() { return request.changeSessionId(); }
@Override
public String getAuthType() {
@@ -116,9 +114,9 @@ public class MultiSiteRequestWrapper implements HttpServletRequest {
}
}
return pathInfo.substring(nextPathSegmentStart);
} else {
return pathInfo;
}
} else {
return pathInfo;
}
}
@Override
@@ -215,7 +213,7 @@ public class MultiSiteRequestWrapper implements HttpServletRequest {
public int getContentLength() {
return request.getContentLength();
}
@Override
public long getContentLengthLong() {
return request.getContentLengthLong();
@@ -280,134 +278,134 @@ public class MultiSiteRequestWrapper implements HttpServletRequest {
public String getProtocol() {
return request.getProtocol();
}
/** get reader */
@Override
public BufferedReader getReader() throws IOException {
return request.getReader();
}
/** get real path */
@Override @Deprecated
public String getRealPath(String arg0) {
return request.getServletContext().getRealPath(arg0);
}
/** get remote addr */
@Override
public String getRemoteAddr() {
return request.getRemoteAddr();
}
/** get remote host */
@Override
public String getRemoteHost() {
return request.getRemoteHost();
}
/** get remote port */
@Override
public int getRemotePort() {
return request.getRemotePort();
}
/** get request dispatcher */
@Override
public RequestDispatcher getRequestDispatcher(String arg0) {
return request.getRequestDispatcher(arg0);
}
/** get scheme */
@Override
public String getScheme() {
return request.getScheme();
}
/** get server name */
@Override
public String getServerName() {
return request.getServerName();
}
/** get server port */
@Override
public int getServerPort() {
return request.getServerPort();
}
/** is secure */
@Override
public boolean isSecure() {
return request.isSecure();
}
/** remove attribute */
@Override
public void removeAttribute(String arg0) {
request.removeAttribute(arg0);
}
/** set attribute */
@Override
public void setAttribute(String arg0, Object arg1) {
request.setAttribute(arg0, arg1);
}
/** set character encoding */
@Override
public void setCharacterEncoding(String arg0) throws UnsupportedEncodingException {
request.setCharacterEncoding(arg0);
}
/** authenticate */
@Override
public boolean authenticate(HttpServletResponse arg0) throws IOException, ServletException {
return request.authenticate(arg0);
}
/** get part */
@Override
public Part getPart(String arg0) throws IOException, IllegalStateException, ServletException {
return request.getPart(arg0);
}
/** get parts */
@Override
public Collection<Part> getParts() throws IOException, IllegalStateException, ServletException {
return request.getParts();
}
/** login */
@Override
public void login(String arg0, String arg1) throws ServletException {
request.login(arg0, arg1);
}
/** logout */
@Override
public void logout() throws ServletException {
request.logout();
}
/** get async context */
@Override
public AsyncContext getAsyncContext() {
return request.getAsyncContext();
}
/** get dispatcher type */
@Override
public DispatcherType getDispatcherType() {
return request.getDispatcherType();
}
/** get servlet context */
@Override
public ServletContext getServletContext() {
return request.getServletContext();
}
/** is async started */
@Override
public boolean isAsyncStarted() {
return request.isAsyncStarted();
}
/** is async supported */
@Override
public boolean isAsyncSupported() {
return request.isAsyncSupported();
}
/** start async */
@Override
public AsyncContext startAsync() {
return request.startAsync();
}
/** start async */
@Override
public AsyncContext startAsync(ServletRequest arg0, ServletResponse arg1) {
return request.startAsync(arg0, arg1);
}
/** upgrade */
@Override
public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException {
public <T extends HttpUpgradeHandler> T upgrade (Class<T> handlerClass) throws IOException, ServletException {
return request.upgrade(handlerClass);
}
}
}
@@ -51,14 +51,14 @@ import org.apache.ofbiz.webapp.stats.VisitHandler;
// Used to filter website on the basis of hosted pathAlias.
public class WebSiteFilter implements Filter {
private static final String MODULE = WebSiteFilter.class.getName();
public static final String module = WebSiteFilter.class.getName();
private FilterConfig mConfig = null;
protected FilterConfig m_config = null;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
mConfig = filterConfig;
mConfig.getServletContext().setAttribute("MULTI_SITE_ENABLED", true);
m_config = filterConfig;
m_config.getServletContext().setAttribute("MULTI_SITE_ENABLED", true);
}
@Override
@@ -67,7 +67,7 @@ public class WebSiteFilter implements Filter {
HttpServletResponse httpResponse = (HttpServletResponse) response;
HttpSession session = httpRequest.getSession();
String webSiteId = (String) mConfig.getServletContext().getAttribute("webSiteId");
String webSiteId = (String) m_config.getServletContext().getAttribute("webSiteId");
String pathInfo = httpRequest.getPathInfo();
// get the WebSite id segment, cheat here and use existing logic
String webSiteAlias = RequestHandler.getRequestUri(pathInfo);
@@ -85,7 +85,7 @@ public class WebSiteFilter implements Filter {
webSite = EntityQuery.use(delegator).from("WebSite").where("isDefault", "Y").cache().queryFirst();
}
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
}
if (webSite != null) {
webSiteId = webSite.getString("webSiteId");
@@ -93,7 +93,7 @@ public class WebSiteFilter implements Filter {
try {
productStore = webSite.getRelatedOne("ProductStore", false);
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
}
String newLocale = request.getParameter("newLocale");
@@ -103,14 +103,13 @@ public class WebSiteFilter implements Filter {
newLocale = session.getAttribute("locale").toString();
}
if (newLocale == null) {
if (newLocale == null)
newLocale = UtilHttp.getLocale(httpRequest).toString();
}
// If the webSiteId has changed then invalidate the existing session
if (!webSiteId.equals(session.getAttribute("webSiteId"))) {
ShoppingCart cart = (ShoppingCart) session.getAttribute("shoppingCart");
if (cart != null && !(webSite.getString("productStoreId").equals(cart.getProductStoreId()))) {
// clearing cart items from previous store
if (cart != null && !(webSite.getString("productStoreId").equals(cart.getProductStoreId())) ) {
// clearing cart items from previous store
cart.clear();
// Put product Store for this webSite in cart
cart.setProductStoreId(webSite.getString("productStoreId"));
@@ -121,7 +120,7 @@ public class WebSiteFilter implements Filter {
try {
cart.setCurrency(dispatcher, productStore.getString("defaultCurrencyUomId"));
} catch (CartItemModifyException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
}
}
session.removeAttribute("webSiteId");
@@ -130,7 +129,7 @@ public class WebSiteFilter implements Filter {
}
request.setAttribute("webSiteId", webSiteId);
session.setAttribute("displayMaintenancePage", webSite.getString("displayMaintenancePage"));
if (UtilValidate.isEmpty(webSite.getString("hostedPathAlias"))) {
if(UtilValidate.isEmpty(webSite.getString("hostedPathAlias"))) {
request.setAttribute("removePathAlias", false);
} else {
request.setAttribute("removePathAlias", true);
@@ -144,14 +143,13 @@ public class WebSiteFilter implements Filter {
chain.doFilter(httpRequest, response);
}
private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator,
LocalDispatcher dispatcher) {
private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher) {
HttpSession session = request.getSession();
Security security = null;
try {
security = SecurityFactory.getInstance(delegator);
} catch (SecurityConfigurationException e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
}
request.setAttribute("delegator", delegator);
request.setAttribute("dispatcher", dispatcher);
@@ -162,6 +160,7 @@ public class WebSiteFilter implements Filter {
session.setAttribute("dispatcher", dispatcher);
session.setAttribute("security", security);
session.setAttribute("_WEBAPP_NAME_", UtilHttp.getApplicationName(request));
// get rid of the visit info since it was pointing to the previous database, and get a new one
session.removeAttribute("visitor");
session.removeAttribute("visit");
@@ -171,4 +170,4 @@ public class WebSiteFilter implements Filter {
@Override
public void destroy() {
}
}
}
+4
View File
@@ -0,0 +1,4 @@
The DocBook XSL stylesheets are maintained by Norman Walsh,
<ndw@nwalsh.com>, and members of the DocBook Project,
<docbook-developers@sf.net>
+21
View File
@@ -0,0 +1,21 @@
To view a list of all open DocBook Project XSL stylesheet bugs:
http://docbook.sf.net/tracker/xsl/bugs
To submit a bug report against the stylesheets:
http://docbook.sf.net/tracker/submit/bug
To do a full-text search of all DocBook Project issues:
http://docbook.sf.net/tracker/search
Discussion about the DocBook Project XSL stylesheets takes place
on the docbook-apps mailing list:
http://wiki.docbook.org/topic/DocBookAppsMailingList
Real-time discussion takes place on IRC:
http://wiki.docbook.org/topic/DocBookIrcChannel
irc://irc.freenode.net/docbook
+48
View File
@@ -0,0 +1,48 @@
Copyright
---------
Copyright (C) 1999-2007 Norman Walsh
Copyright (C) 2003 Jiří Kosek
Copyright (C) 2004-2007 Steve Ball
Copyright (C) 2005-2008 The DocBook Project
Copyright (C) 2011-2012 O'Reilly Media
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the ``Software''), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Except as contained in this notice, the names of individuals
credited with contribution to this software shall not be used in
advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization
from the individuals in question.
Any stylesheet derived from this Software that is publically
distributed will be identified with a different name and the
version strings in any derived Software will be changed so that
no possibility of confusion between the derived package and this
Software will exist.
Warranty
--------
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL NORMAN WALSH OR ANY OTHER
CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Contacting the Author
---------------------
The DocBook XSL stylesheets are maintained by Norman Walsh,
<ndw@nwalsh.com>, and members of the DocBook Project,
<docbook-developers@sf.net>

Some files were not shown because too many files have changed in this diff Show More