148 Commits
Author SHA1 Message Date
Jacques Le Roux 32a310ca14 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:24:08 +02:00
Michael Brohl 63df767bee Improved: Switch from jCenter to mavenCentral to handle the jCenter
shutdown (OFBIZ-12171)
2021-02-27 14:43:06 +01:00
Jacques Le Roux e7f198427b 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:59 +01:00
Pawan Verma 38419ef257 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:27:36 +05:30
Deepak Dixit 4bef6dd715 Updated code as per lucene dependency update (OFBIZ-12100) 2021-01-04 14:43:07 +05:30
Deepak Dixit 1c355bb6d8 Updated lucene and solr dependecy to fix the test case failure related to tika-parser dependency update(OFBIZ-12100) (#48) 2021-01-04 12:45:22 +05:30
Jacques Le Roux 581c68f3c6 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:31 +01:00
Jacques Le Roux 96e2deea3b 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:22:12 +01:00
Jacques Le Roux aff4aa19ff * 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:55:46 +01:00
Saurabh Dixit 819be88570 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
# Conflicts:
#	ecommerce/template/catalog/ProductSummary.ftl
2020-11-30 11:39:18 +01:00
Jacques Le Roux feef385e7e Fixed: Wrong quote marks (OFBIZ-11972)
Thanks: Alex Bodnaru
2020-10-06 16:03:44 +02:00
Jacques Le Roux 128c252942 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 handled by hand
#	birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
#	birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java
2020-10-04 12:04:07 +02:00
holivier eadffa215b 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-02 18:34:40 +02:00
Akash Jain 39494e6a57 Fixed: Error on removing scrum members (OFBIZ-7249)
Thanks, Anurag Chandak for report.
2020-09-01 15:21:14 +05:30
Suraj Khurana b52a5e85e2 Fixed: Typo in class name.
(OFBIZ-11978)
Thanks Alex Bodnaru for reporting and providing the patch.
2020-09-01 15:12:55 +05:30
Jacques Le Roux 1ada36d74d 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:08:15 +02:00
Jacques Le Roux c903c71aa8 Fixed: multiflex css is linking to wrong location (OFBIZ-11977)
Thanks: Alex
2020-08-30 11:19:34 +02:00
Akash Jain e6e7351309 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:24:49 +05:30
Akash Jain 2386d02960 Fixed: Product link on Order confirmation page is not responding (OFBIZ-11735)
Thanks, Rashi Dhagat for reporting.
2020-08-03 18:36:58 +05:30
Aditya Sharma 486f1d8a59 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:46 +05:30
Jacques Le Roux d335f7890f 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:12:13 +02:00
Pawan Verma 1a8410f98b 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:51 +05:30
Jacques Le Roux 6d87d52388 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

Changes done by hand, impossible to cherry-pick

Thanks: Priya Sharma for testing
2020-06-23 14:56:32 +02:00
Jacques Le Roux 76775e4a7c Improved: adds pull_request_template.md (OFBIZ-11722) 2020-05-31 09:48:15 +02:00
Pawan Verma 369088d732 Fixed: Improve the buttons on edit credit card page
(OFBIZ-10975)

Thanks: Sourabh and Suraj for your contribution.
2020-05-10 14:14:04 +05:30
Pawan Verma 3e312acc68 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:43:20 +01:00
Jacques Le Roux 62f9b45dcf 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:54:26 +01:00
Jacques Le Roux c8ed017afe 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:53 +01:00
Jacques Le Roux 88ca87d106 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:28:00 +01:00
Pierre Smits 1ad6d34683 Implemented: have a license
(OFBIZ-11451)
2020-03-13 16:07:12 +01:00
Suraj Khurana 0d05685ad4 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:21:34 +05:30
Deepak Dixit 227ecf8023 Upgrade Tomcat from 9.0.29 to 9.0.31 (CVE-2020-1938)
(OFBIZ-11407)

tomcat-embed-websocket dependencies not updated
2020-02-27 19:57:54 +05:30
Jacques Le Roux 3d37294014 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:32 +01:00
Jacques Le Roux 6f944d762e Improved: no functional change
This file inadvertently slipped in with a previous commit, it's not needed.
2020-02-19 14:10:13 +01:00
Jacques Le Roux a4d6d422e2 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:04:00 +01:00
Jacques Le Roux 17d5c1a1e7 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:35 +01:00
Jacques Le Roux 6e7f6a4495 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:53 +01:00
Jacques Le Roux 483dba49a0 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:55:04 +01:00
Aditya Sharma 0cd36fe73d 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:31:08 +05:30
Aditya Sharma cea914ad86 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:31:00 +05:30
Aditya Sharma 416b6a1cdb Improved: no functional change
Added .gitignore file
2020-02-10 10:49:49 +05:30
Nicolas Malin 571fb3ae72 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:04:00 +01:00
Pawan Verma 7996d142b5 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:57:27 +05:30
Jacques Le Roux 3470703447 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 10:52:48 +01:00
akash 224d2f67b8 Fixed: User is unable to create return.
(OFBIZ-10850)
Thanks, Ashish and Ankush Upadhyay for your contribution.
2020-01-25 18:36:02 +05:30
Pawan Verma dc7304a5f6 Fixed: Corrected file path for ProcessPaymentSettings.groovy
(OFBIZ-11324)
2020-01-25 11:43:32 +05:30
James Yong a183733775 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:47:18 +08:00
Mathieu Lirzin 0a7770087d 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”.

# Conflicts handled by hand
#	msggateway/webapp/msggateway/WEB-INF/web.xml
2019-12-19 06:51:42 +01:00
Jacopo Cappellato 0276303d95 Fixed: Add missing view permissions checks to various screens. 2019-11-16 08:19:40 +01:00
Jacques Le Roux 34e6581c5e 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:06:07 +01:00
Jacques Le Roux ff75d41c9c 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:42:03 +01:00
Jacques Le Roux 6254c0ce6e "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/release17.12@1868549 13f79535-47bb-0310-9956-ffa450edef68
2019-10-17 12:20:29 +00:00
Jacques Le Roux feb6039c65 "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/release17.12@1867851 13f79535-47bb-0310-9956-ffa450edef68
2019-10-01 17:32:54 +00:00
Jacques Le Roux f1e5dd85fd "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/release17.12@1867721 13f79535-47bb-0310-9956-ffa450edef68
2019-09-29 11:00:38 +00:00
Jacques Le Roux 873057025a "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/release17.12@1867714 13f79535-47bb-0310-9956-ffa450edef68
2019-09-29 09:34:27 +00:00
Pawan Verma a062af9c05 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/release17.12@1865834 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 09:48:22 +00:00
Jacques Le Roux 9ef625b894 "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/release17.12@1865400 13f79535-47bb-0310-9956-ffa450edef68
2019-08-18 15:17:33 +00:00
Jacques Le Roux 72448ecebf "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/release17.12@1865351 13f79535-47bb-0310-9956-ffa450edef68
2019-08-17 11:39:37 +00:00
Aditya Sharma 5723446547 Applied fix from trunk for revision: 1838797
===

Improved: Change the uggly favicon with the new one ! | Using new OFBiz logo
(OFBIZ-10522)
Updated the icon for the ecommerce.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1865035 13f79535-47bb-0310-9956-ffa450edef68
2019-08-13 12:27:53 +00:00
Aditya Sharma b58aa998f8 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/release17.12@1863854 13f79535-47bb-0310-9956-ffa450edef68
2019-07-27 12:31:10 +00:00
Jacques Le Roux 9fa8357112 "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/release17.12@1862473 13f79535-47bb-0310-9956-ffa450edef68
2019-07-03 13:33:19 +00:00
Jacques Le Roux 77c20ee229 "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/release17.12@1861988 13f79535-47bb-0310-9956-ffa450edef68
2019-06-24 10:32:07 +00:00
Jacques Le Roux e53f7244b9 "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/release17.12@1861907 13f79535-47bb-0310-9956-ffa450edef68
2019-06-23 09:11:53 +00:00
Swapnil Mane c8f8ba8f2f 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/release17.12@1861827 13f79535-47bb-0310-9956-ffa450edef68
2019-06-22 09:17:10 +00:00
Suraj Khurana d3e892318f 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/release17.12@1860804 13f79535-47bb-0310-9956-ffa450edef68
2019-06-08 06:52:26 +00:00
Deepak Dixit 634e928124 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/release17.12@1860650 13f79535-47bb-0310-9956-ffa450edef68
2019-06-05 09:46:11 +00:00
Suraj Khurana b818e3a07c 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/release17.12@1859908 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 05:08:07 +00:00
Jacques Le Roux e187d9307f "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/release17.12@1859895 13f79535-47bb-0310-9956-ffa450edef68
2019-05-24 17:17:12 +00:00
Jacques Le Roux 40514d73e0 "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/release17.12@1859739 13f79535-47bb-0310-9956-ffa450edef68
2019-05-22 16:42:53 +00:00
Jacques Le Roux 11d158ad7f "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/release17.12@1859014 13f79535-47bb-0310-9956-ffa450edef68
2019-05-09 14:33:39 +00:00
Jacopo Cappellato 2e3e34d50c 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/release17.12@1858440 13f79535-47bb-0310-9956-ffa450edef68
2019-04-30 14:59:07 +00:00
Jacques Le Roux 5c2bf2f9b7 "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/release17.12@1858314 13f79535-47bb-0310-9956-ffa450edef68
2019-04-28 10:52:36 +00:00
Suraj Khurana f840c99e6e 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/release17.12@1858287 13f79535-47bb-0310-9956-ffa450edef68
2019-04-27 16:16:30 +00:00
Suraj Khurana bb5f21f4f6 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/release17.12@1858247 13f79535-47bb-0310-9956-ffa450edef68
2019-04-27 06:55:36 +00:00
Jacques Le Roux b2a23af862 "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/release17.12@1858143 13f79535-47bb-0310-9956-ffa450edef68
2019-04-25 14:28:30 +00:00
Jacques Le Roux 51ea2deb68 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/release17.12@1857588 13f79535-47bb-0310-9956-ffa450edef68
2019-04-15 14:42:44 +00:00
Jacques Le Roux 3205479542 "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/release17.12@1857177 13f79535-47bb-0310-9956-ffa450edef68
2019-04-09 11:51:44 +00:00
Deepak Dixit 6078d8ae6e 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/release17.12@1857122 13f79535-47bb-0310-9956-ffa450edef68
2019-04-08 16:56:39 +00:00
Jacques Le Roux 3bb9ee24c1 "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/release17.12@1856919 13f79535-47bb-0310-9956-ffa450edef68
2019-04-04 12:19:21 +00:00
Jacques Le Roux ac4cb72de9 "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/release17.12@1856804 13f79535-47bb-0310-9956-ffa450edef68
2019-04-02 07:57:26 +00:00
Jacques Le Roux 785757e657 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/release17.12@1856215 13f79535-47bb-0310-9956-ffa450edef68
2019-03-25 17:51:52 +00:00
Suraj Khurana 77a889ec97 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/release17.12@1855085 13f79535-47bb-0310-9956-ffa450edef68
2019-03-09 06:33:00 +00:00
Jacques Le Roux 88d76df718 Improved: no functional change
Copies Solr doc from trunk

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1854517 13f79535-47bb-0310-9956-ffa450edef68
2019-02-28 10:30:30 +00:00
Swapnil Mane 1d6d1206d0 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/release17.12@1852999 13f79535-47bb-0310-9956-ffa450edef68
2019-02-05 12:10:19 +00:00
Deepak Dixit b629615b3c 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/release17.12@1851187 13f79535-47bb-0310-9956-ffa450edef68
2019-01-12 19:18:11 +00:00
Deepak Dixit 56a228c9a1 Improved: Backporting the all the changes of ecommerce multiflex theme to OFBiz17.12, after the ecommerce markup update work it was broken.
(OFBIZ-9760)
Thanks Parakh Maheshwari for your contribution

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1851184 13f79535-47bb-0310-9956-ffa450edef68
2019-01-12 18:55:51 +00:00
Deepak Dixit b14305ae57 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/release17.12@1851144 13f79535-47bb-0310-9956-ffa450edef68
2019-01-12 06:53:35 +00:00
Deepak Dixit a5773f6be4 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/release17.12@1851138 13f79535-47bb-0310-9956-ffa450edef68
2019-01-12 06:35:19 +00:00
Jacques Le Roux 2fa1cc428d "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/release17.12@1851072 13f79535-47bb-0310-9956-ffa450edef68
2019-01-11 16:14:05 +00:00
Deepak Dixit c75da28008 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/release17.12@1851003 13f79535-47bb-0310-9956-ffa450edef68
2019-01-11 06:02:28 +00:00
Suraj Khurana bfee22492d Fixed: Quantity of the product added in the cart should not be negative.
(OFBIZ-10668)
Thanks Dikpal Kanungo for reporting and Prakhar Kumar for providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1849533 13f79535-47bb-0310-9956-ffa450edef68
2018-12-22 10:15:31 +00:00
Jacques Le Roux 0cb5d81015 "Applied fix from plugins for revision: 1849119"
------------------------------------------------------------------------
r1849119 | jleroux | 2018-12-17 18:42:20 +0100 (lun. 17 déc. 2018) | 5 lignes

Improved: Plugins Asciidoc documentation must be standalone
(OFBIZ-10658)

Removes toc information after ":toclevels:" 3 is used in build.gradle

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1849162 13f79535-47bb-0310-9956-ffa450edef68
2018-12-18 11:04:28 +00:00
Deepak Dixit 39ea9aadc4 Applied fix from trunk for revision: 1848921
===

Fixed: visual-editor not working on ecommerce (OFBIZ-10708)
The main issue was in js file loading, jQuery is being initialised twice thus eltre might not be available in the prototype of reinitialised jQuery object.
Thanks Aditya Sharama for the discussion


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1848922 13f79535-47bb-0310-9956-ffa450edef68
2018-12-14 10:34:53 +00:00
Michael Brohl 10e4c785e5 Fixed: Update and fix openstreetmap.org integration.
(OFBIZ-10553)

Manual backport because of the renamed paths.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1848437 13f79535-47bb-0310-9956-ffa450edef68
2018-12-08 08:06:32 +00:00
Jacques Le Roux 79df69b93c "Applied fix from plugins for revision: 1848398 "
------------------------------------------------------------------------
r1848398 | jleroux | 2018-12-07 14:14:48 +0100 (ven. 07 déc. 2018) | 17 lignes

Fixed: User's name is displayed on ecommerce even after user logs out
(OFBIZ-10666)

Steps to regenerate:
Open URL: https://demo-trunk.ofbiz.apache.org/ecommerce/control/main. 
  Welcome is displayed and user's name is not displayed when URL is opened.
Login at ecommerce, username will be displayed after user logs in.
Logout of ecommerce by clicking on logout. User will be logged out and login 
  link will be displayed in place of logout link, but the name of user is still 
  displayed.

Actual: Username is still displayed after user logs out
Expected: Username should not be displayed after the user logs out

Note: Similar issue also exists when the user clicks on (Not You?) link.

Thanks: Arpit Mor for detailled report, Deepak Dixit for discussion
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1848400 13f79535-47bb-0310-9956-ffa450edef68
2018-12-07 13:16:58 +00:00
Jacques Le Roux a925850041 "Applied fix from plugins for revision: 1848009"
------------------------------------------------------------------------
r1848009 | shijh | 2018-12-02 19:51:51 +0100 (dim. 02 déc. 2018) | 16 lignes

Improved: OFBizPricatUtil class don't use a org.apache.ofbiz.pricat package
(OFBIZ-10655)

I didn't realized OFBizPricatUtil under org.apache.poi package is a bug 
for OFBiz project at the first sight of this issue. When I tried to think from 
Jacques view as our project SQA, I understood this OFBizPricatUtil may be missed 
during code style check, and this is a major problem :).

Now I moved the OFBizPricatUtil under org.apache.ofbiz.pricat.util package and 
changed two other files accordingly.

I upgraded the implement to match the POI 3.7 used in the OFBiz plugins 
trunk, and I also tested it with POI 4.0.0 and it worked fine.

Thanks: Jacques for pointing out this issue

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

jleroux: I fixed 2 small conflicts by hand in AbstractPricatParser and 
SamplePricatParser.java

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1848026 13f79535-47bb-0310-9956-ffa450edef68
2018-12-03 08:17:47 +00:00
Jacques Le Roux 9ceb7d3ded "Applied fix from plugins for revision: 1847530 "
------------------------------------------------------------------------
r1847530 | jleroux | 2018-11-27 12:27:39 +0100 (mar. 27 nov. 2018) | 12 lignes

Reverted: User should be redirected to view cart page after adding the product 
from compare product screen
(OFBIZ-10667)

Revert r1847478

There was a problem with this fix. It changes the behaviour of additem when you 
add an item from the main or another page.

The behaviour is defined by the "Always View Cart After Adding An Item." 
checkbox in the cart view.

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1847531 13f79535-47bb-0310-9956-ffa450edef68
2018-11-27 11:28:13 +00:00
Jacques Le Roux 334a0136ff "Applied fix from plugins for revision: 1847528"
------------------------------------------------------------------------
r1847528 | jleroux | 2018-11-27 12:18:07 +0100 (mar. 27 nov. 2018) | 19 lignes

Fixed: User should be redirected to view cart page after adding the product 
from compare product screen
(OFBIZ-10667)

Currently user is navigating add item page instead of view cart page while 
adding product to cart from compare product screen. User gets stuck after 
navigating over add item page.

Steps to replicate the issue: 
 1. Go to eCommerce application.
 2. Click on add to compare button for the products - 
    Round Gizmo and Tiny Chrome Widget.
 3. Click on 'Compare Products' from right bar.
 4. Click on 'Add to cart' over compare product screen.

Expected behaviour : User should be redirected to view cart page instead 
of add item page.

Thanks: Ratnesh Upadhyay for report and Ritesh Kumar for the fix
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1847529 13f79535-47bb-0310-9956-ffa450edef68
2018-11-27 11:18:44 +00:00
Jacques Le Roux c841e9afc5 "Applied fix from plugins for revision: 1847398 "
------------------------------------------------------------------------
r1847398 | jleroux | 2018-11-25 09:40:23 +0100 (dim. 25 nov. 2018) | 15 lignes

Fixed: Instructions for Configurable PC don't work
(OFBIZ-10542)

This concerns only R16, R17 and the trunk. The "Instructions" button was not 
present in R13.

This kind of message shows:
Trunk:
<a href="javascript:showErrorAlert('The following errors occurred','');"
R16:
<a href="javascript:showErrorAlert(" the="" following="" errors="" occurred","")

The same exists for all configurable products, notably Gold Pizza

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1847400 13f79535-47bb-0310-9956-ffa450edef68
2018-11-25 08:41:49 +00:00
Suraj Khurana 183be07009 Fixed: Error message is displayed on ecommerce when user tries to use Split shipment functionality.
> (OFBIZ-10623)
> Thanks Arpit Mor for reporting and Praveen Sharma for providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1847349 13f79535-47bb-0310-9956-ffa450edef68
2018-11-24 09:13:01 +00:00
Deepak Dixit 8baa4f35e0 Applied fix from trunk for revision: 1847346
===

Fixed: Quote list is not showing on ecommerce
(OFBIZ-10628)
Thanks  Mohammed Rehan Khan for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1847347 13f79535-47bb-0310-9956-ffa450edef68
2018-11-24 08:51:49 +00:00
Jacques Le Roux ea125e1397 "Applied fix from plugins for revision: 1847272 "
------------------------------------------------------------------------
r1847272 | jleroux | 2018-11-23 15:27:05 +0100 (ven. 23 nov. 2018) | 10 lignes

Fixed: Plugins Asciidoc documentation must be standalone
(OFBIZ-10658)

Completes the standalone document part as required by guidelines.

Note that using ":toclevels: 3" does not work when generating with Gradle 
because of the OOTB definition "'toclevels': '5'" in build.gradle

It does when used apart in Asciidoc editors. I believe OOTB a 3 levels is enough
 and the numbers are superfluous if not unpleasant.
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1847274 13f79535-47bb-0310-9956-ffa450edef68
2018-11-23 14:33:48 +00:00
Jacques Le Roux d22074ab14 Documented: Backport the Asciidoc documentation and means to generate it to
R17 branch
(OFBIZ-10657)
Convert Birt component doc from Markdown to AsciiDoc 
(OFBIZ-10647)

As discussed in https://markmail.org/message/x7sv2mpvtytr4vl4 we decided to 
backport the Asciidoc documentation, and means to generate it, to R17 branch

This is related with OFBIZ-10651 and OFBIZ-10652 tasks. 
So 2 parts are impacted: code in framework and plugins and Buildbot script. 
It's only a copy from the trunk to the R17 branch, including *.adoc files, 
related images and the build.gradle script.

I previous commit I missed to remove security-impersonation.adoc now replaced 
by sy-impersonation.adoc
Forgot to commit the plugins part. Including replacing Birt Markdown 
documentation by Asciidoc  (OFBIZ-10647)



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1847253 13f79535-47bb-0310-9956-ffa450edef68
2018-11-23 12:16:52 +00:00
Jacques Le Roux 2bddf1baf9 "Applied fix from plugins for revision: 1845558 "
------------------------------------------------------------------------
r1845558 | jleroux | 2018-11-02 10:46:42 +0100 (ven. 02 nov. 2018) | 15 lignes

Fixed: Correct behaviour of Autologin cookies
(OFBIZ-10635)

Renames "keep-autologin-cookie" to "use-autologin-cookie", and only create 
Autologin cookies when needed. No need to create Autologin cookies in 
applications that don't need it.

Don't pass webAppName to LoginWorker::getSecuredUserLoginId, that can be handled
with improved LoginWorker::getSecuredLoginIdCookieName

Removes LoginWorker::autoLogoutCleanCookies, no longer needed since only those
needed are created and kept (1 year at least after creation).

For both autoLogin and securedLoginId cookies sets the path to the application.

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1845569 13f79535-47bb-0310-9956-ffa450edef68
2018-11-02 10:38:35 +00:00
Suraj Khurana ba76128822 Fixed: Added missing import.
(OFBIZ-10314)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1844967 13f79535-47bb-0310-9956-ffa450edef68
2018-10-27 13:28:29 +00:00
Suraj Khurana 0f2a9187be Fixed: Multiple records are shown in search modal in webpos.
(OFBIZ-10314)
Thanks Archana Asthana for reporting and Shikha Jaiswal for providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1844959 13f79535-47bb-0310-9956-ffa450edef68
2018-10-27 12:51:03 +00:00
Ashish Vijaywargiya ffac3cc539 Applied fix from trunk for revision: 1844946
=======================================================
Fixed: ECommerce landing page breaks if popular category does not exists.
(OFBIZ-10617)
Thanks Rehan for reporting the issue and providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1844947 13f79535-47bb-0310-9956-ffa450edef68
2018-10-27 08:27:27 +00:00
Aditya Sharma 23c29f7a0e Applied fix from trunk for revision: 1841650
===

Fixed: Webpos Keyboard Shortcut keys does not work correctly
(OFBIZ-7945)
Updated wrong function calls in switch case of activateHotKeys(). As support for Pin Payment transactions is still to be added under OFBIZ-5241. Commented code for Pin payment transaction and updated other shortcuts accordingly.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1841651 13f79535-47bb-0310-9956-ffa450edef68
2018-09-22 05:58:58 +00:00
Suraj Khurana 831e9cf6c5 Applied fix from trunk for revision: 1838816
===

Fixed: Java object rendering on billing section of one page anonymous checkout process.
(OFBIZ-10425)
Thanks Jason Hao for reporting and Priya Sharma for providing the patch.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1838818 13f79535-47bb-0310-9956-ffa450edef68
2018-08-24 11:01:39 +00:00
Jacques Le Roux 66c27fdc57 "Applied fix from plugins for revision: 1838381 "
------------------------------------------------------------------------
r1838381 | jleroux | 2018-08-19 17:30:42 +0200 (dim. 19 août 2018) | 8 lignes

Fixed: Search in Ecommerce no longer works
(OFBIZ-10531)

I guess that when I worked on OFBIZ-9164 I broke that.

I found 3 occurences where the dispatcher was not in the session because the 
session comes from the request and the request has not it in.

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1838383 13f79535-47bb-0310-9956-ffa450edef68
2018-08-19 15:31:41 +00:00
Suraj Khurana 029ee2810b Applied fix from trunk for revision: 1838249
===

Fixed: Could not find simple-method createWorkEffortSkillStandard as it was called as simple method and it is converted to entity-auto service.
(OFBIZ-10524)
Thanks Fernando Ortega for reporting the issue.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1838250 13f79535-47bb-0310-9956-ffa450edef68
2018-08-17 11:18:43 +00:00
Jacques Le Roux 5f954c4b6e "Applied fix from plugins for revision: 1837857"
------------------------------------------------------------------------
r1837857 | jleroux | 2018-08-11 12:37:40 +0200 (sam. 11 août 2018) | 10 lignes

Fixed: Update Apache Tomcat to 9.0.10 because of CVE-2018-8037
(OFBIZ-10517)

If an async request was completed by the application at the same time as the 
container triggered the async timeout, a race condition existed that could 
result in a user seeing a response intended for a different user. 
An additional issue was present in the NIO and NIO2 connectors that did not 
correctly track the closure of the connection when an async request was 
completed by the application and timed out by the container at the same time.
This could also result in a user seeing a response intended for another user. 
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1837862 13f79535-47bb-0310-9956-ffa450edef68
2018-08-11 10:40:20 +00:00
Suraj Khurana eeb88a9da9 Applied fix from trunk for revision: 1837845
===

Fixed: Party Search doesn't consider Billing Address and Shipping Address checkbox in WebPos.
(OFBIZ-7709)
Thanks Vishal for your patch.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1837846 13f79535-47bb-0310-9956-ffa450edef68
2018-08-11 06:24:31 +00:00
Suraj Khurana c0ed79e0bf Applied fix from trunk for revision: 1837796
===

Fixed: Not able to select Virtual Product in WebPos.
(OFBIZ-7719)
Thanks Vishal for your patch.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1837799 13f79535-47bb-0310-9956-ffa450edef68
2018-08-10 12:57:11 +00:00
Suraj Khurana aa729cad31 Reverted: Applied fix from trunk for revision: 1837796
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1837798 13f79535-47bb-0310-9956-ffa450edef68
2018-08-10 12:46:48 +00:00
Suraj Khurana 2470947ae5 Applied fix from trunk for revision: 1837796
===



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1837797 13f79535-47bb-0310-9956-ffa450edef68
2018-08-10 12:41:37 +00:00
Aditya Sharma f428a5b7ca Applied fix from trunk for revision: 1836107
===
Fixed: UI issue on blog screens on storefront
(OFBIZ-10466)
Thanks: Pritam Kute for reporting the issue and providing the patch

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1836108 13f79535-47bb-0310-9956-ffa450edef68
2018-07-17 12:10:43 +00:00
Jacques Le Roux 445cf20bc9 "Applied fix from plugins for revision: 1832800 "
------------------------------------------------------------------------
r1832800 | jleroux | 2018-06-04 10:34:35 +0200 (lun. 04 juin 2018) | 11 lignes

Fixed: Click on category the filter function doesn't work
(OFBIZ-10423)

Click on the left category, the page doesn't refresh, there are two issues.

productCategoryId not set in 
   ecommerce/groovyScripts/catalog/AjaxBreadcrumbs.groovy
updated data will fill in #div3, but the div id is missing in 
   ecommerce/widget/CommonScreens.xml
 
Thanks: Jason Hao
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1832802 13f79535-47bb-0310-9956-ffa450edef68
2018-06-04 08:57:48 +00:00
Jacques Le Roux d7b9688e50 "Applied fix from plugins for revision: 1832727"
------------------------------------------------------------------------
r1832727 | jleroux | 2018-06-02 11:11:22 +0200 (sam. 02 juin 2018) | 6 lignes

Fixed: jquery.jgrowl.min.css url out of date
(OFBIZ-10421)

jleroux: this is only in ecommerce and R16 is not concerned

Thanks: Jason Hao
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1832728 13f79535-47bb-0310-9956-ffa450edef68
2018-06-02 09:14:19 +00:00
Deepak Dixit 823cb88e86 Applied fix from trunk for revision: 1831084
===

Implemented: Upgraded to latest Tomcat (9.0.7), Updated tomcat embed websocket jar to 9.0.7
(OFBIZ-10036)



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1831085 13f79535-47bb-0310-9956-ffa450edef68
2018-05-07 09:00:44 +00:00
Deepak Dixit 30ac2dcc8f Applied fix from trunk for revision: 1830856
===

Fixed: The viewSize should be converted Integer for multiplication
Found one occurence in plugins component


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1830858 13f79535-47bb-0310-9956-ffa450edef68
2018-05-03 18:36:13 +00:00
Jacques Le Roux ccf1bd2e33 "Applied fix from plugins for revision: 1828569 "
------------------------------------------------------------------------
r1828569 | jleroux | 2018-04-06 23:06:48 +0200 (ven., 06 avr. 2018) | 12 lines

Fixed: One Page Checkout page cannot move to Step 5 due to javascript errors
(OFBIZ-10329)

When you click on continue to step 5 you encounter some javascript exception
which makes the checkout process hit the wall.

additional-methods.min.js was missing in ecommerce
 
Thanks: Sameer Gajanan Apte
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1828570 13f79535-47bb-0310-9956-ffa450edef68
2018-04-06 21:07:54 +00:00
Arun Patidar 617cfd4495 Fixed: Changed org.ofbiz package to org.apache.ofbiz in missing files. (OFBIZ-10235)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1825200 13f79535-47bb-0310-9956-ffa450edef68
2018-02-24 08:51:58 +00:00
Deepak Dixit 80ed21a8df Applied fix from trunk for revision: 1824654
===

Improved: Done some markup cleanup, Removed some unusd html tag. Added css rule to set padding=0 for  ul (OFBIZ-9760)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1824657 13f79535-47bb-0310-9956-ffa450edef68
2018-02-18 10:06:29 +00:00
Deepak Dixit ab60dc5991 Applied fix from trunk for revision: 1824650
===

Improved: UI improvement on various pages
1) Improvement of various button UI.

2) Improvement in layout at some screens.

3) Alignment issues of some card-header.

Thanks Nitish for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1824651 13f79535-47bb-0310-9956-ffa450edef68
2018-02-18 09:18:06 +00:00
Deepak Dixit d61f5740db Applied fix from trunk for revision: 1824648
===

Improved: Update markup of various product page according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10160)
Thanks Mayank for your contribution.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1824649 13f79535-47bb-0310-9956-ffa450edef68
2018-02-18 09:10:39 +00:00
Deepak Dixit 4978683fec Applied fix from trunk for revision: 1824646
===

Improved: Fix UI issue for error messages.(OFBIZ-10185)
Thanks  Mayank Lambhate for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1824647 13f79535-47bb-0310-9956-ffa450edef68
2018-02-18 09:03:37 +00:00
Arun Patidar 012accb56f Applied fix from trunk for revision: 1822377
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822925 13f79535-47bb-0310-9956-ffa450edef68
2018-02-02 06:46:28 +00:00
Rishi Solanki c8b62b8aa4 Fixed: Error on My Portal Request Overview Page. Issue was due to an incorrect path of OverViewRequestItems.ftl in ViewRequest screen. Applied fix from trunk revision 1822512.
(OFBIZ-10183)
Thanks Ratnesh Upadhyay for reporting the issue and Yogesh Naroliya for providing patch to fix the issue.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822513 13f79535-47bb-0310-9956-ffa450edef68
2018-01-29 15:12:22 +00:00
Deepak Dixit 75f24795e4 Applied fix from trunk for revision: 1822395
===

Improved: Update markup of Shopping Lists page according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10119)
Thanks Parakh Maheshwari for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822396 13f79535-47bb-0310-9956-ffa450edef68
2018-01-27 11:48:17 +00:00
Deepak Dixit 0434173e04 Applied fix from trunk for revision: 1822391
===

Improved: Improvement in UI of various pages of ecommerce(OFBIZ-10182)
Thanks  Nitish Mishra for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822392 13f79535-47bb-0310-9956-ffa450edef68
2018-01-27 11:42:10 +00:00
Deepak Dixit 25e8736a86 Applied fix from trunk for revision: 1822389
===

Improved: Update markup of Checkout page according to standard markup given by Bootstrap v4.0.s (OFBIZ-10105)
Thanks Mayank for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822390 13f79535-47bb-0310-9956-ffa450edef68
2018-01-27 11:18:04 +00:00
Deepak Dixit 2c2c60acef Applied fix from trunk for revision: 1822145
===

Improved: Update markup of qucik add page according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10161)
Thanks Nitish Mishra for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822146 13f79535-47bb-0310-9956-ffa450edef68
2018-01-24 18:07:23 +00:00
Deepak Dixit cc2f85960a Applied fix from trunk for revision: 1822143
===

Improved: Update markup of advanced seach page page according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10162)
Thanks Nitish Mishra for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822144 13f79535-47bb-0310-9956-ffa450edef68
2018-01-24 17:58:00 +00:00
Deepak Dixit 7c90e33250 Applied fix from trunk for revision: 1822139
===

Improved: Update markup of quick reorder section according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10163)
Thanks Nitish Mishra for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822140 13f79535-47bb-0310-9956-ffa450edef68
2018-01-24 17:52:13 +00:00
Deepak Dixit 3d621e5800 Applied fix from trunk for revision: 1822133
===

Improved: Update markup of Last Products section according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10169)
Thanks  Nitish Mishra for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822135 13f79535-47bb-0310-9956-ffa450edef68
2018-01-24 17:47:07 +00:00
Deepak Dixit 190fb25511 Applied fix from trunk for revision: 1822129
===

Improved: Update Bootstrap 4.0 library to stable version from bootstrap 4.0 beta-2 (OFBIZ-10179)
Thanks  Parakh Maheshwari for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1822130 13f79535-47bb-0310-9956-ffa450edef68
2018-01-24 17:41:19 +00:00
Deepak Dixit f6bc18fe84 Applied fix from trunk for revision: 1821051
===

Improved: Update markup of Quick Checkout Page according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10136)
Thanks Mayank Lambhate for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1821052 13f79535-47bb-0310-9956-ffa450edef68
2018-01-13 08:50:39 +00:00
Deepak Dixit fcce738985 Applied fix from trunk for revision: 1821049
===

Improved: Update markup of OrderHistory page according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10135)
Thanks Nitish Mishra for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1821050 13f79535-47bb-0310-9956-ffa450edef68
2018-01-13 08:43:19 +00:00
Deepak Dixit 5f8cbc75eb Applied fix from trunk for revision:1821045
==
Fixed: Recent markup changed breaks Product view page,  https://demo-trunk.ofbiz.apache.org/ecommerce/round-gizmo-GZ-2644-p (OFBIZ-10117)
Thanks Parakh and Mayank for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1821046 13f79535-47bb-0310-9956-ffa450edef68
2018-01-13 06:50:45 +00:00
Jacques Le Roux 54d832ac74 "Applied fix from plugins for revision: 1820962"
------------------------------------------------------------------------
r1820962 | taher | 2018-01-12 11:45:06 +0100 (ven., 12 janv. 2018) | 8 lines

Reverted: faulty code that caused a regression in installing birt plugin
(OFBIZ-9383)

The code removed used to draw a fixed hard dependency between the BIRT and
example components thus causing the build system to crash when issuing the
command ./gradlew pullPlugin -PpluginId=birt. To be replaced later with a
proper dependency declaration using the plugin manager dependency definitions.

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1820976 13f79535-47bb-0310-9956-ffa450edef68
2018-01-12 12:36:19 +00:00
Jacques Le Roux 7bae82c85f "Applied fix from plugins for revision: 1820973 "
------------------------------------------------------------------------
r1820973 | jleroux | 2018-01-12 13:22:29 +0100 (ven., 12 janv. 2018) | 16 lines

Fixed: Birt plugin depends on example plugin 
(OFBIZ-9383)

The BIRT demo data for flexible reports depends on the Example entity from the 
Example plugin.

We should either provide BIRT's own example data with example reports 
OR 
setup a gradle dependency on the example plugin so that everything is in place.

jleroux: this simply duplicates example data in birt component. There are
cases where duplication is the simplest solution even at the cost of possible
divergence in the future (not a problem for the birt component, so it's OK)


Thanks: Michael Brohl for report and Taher for discussion
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1820975 13f79535-47bb-0310-9956-ffa450edef68
2018-01-12 12:24:01 +00:00
Jacques Le Roux 7729116d4a "Applied fix from trunk plugins for revision: 1819589"
------------------------------------------------------------------------
r1819589 | jleroux | 2017-12-30 11:36:47 +0100 (sam., 30 déc. 2017) | 1 line

Fixes a wrong path to jgrowl
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1819593 13f79535-47bb-0310-9956-ffa450edef68
2017-12-30 12:13:51 +00:00
Jacques Le Roux 7c3176cb3a "Applied fix from trunk plugins for revision: 1819589 "
------------------------------------------------------------------------
Fixed: Exception Error rendering on all View Category pages
(OFBIZ-10006)

Steps to regenerate:
1. Open https://demo-trunk.ofbiz.apache.org/ecommerce/control/main
2. Go to Category section
3. Click any category
Exception Error renders

jleroux: the patch fixes the issue in log but the feature still does not work. 
I mean when you click on a category in the tree nothing happens. 
I see no related js error in browser console.

Thanks: Archana Asthana for report and Aman Agrawal for patch
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1819591 13f79535-47bb-0310-9956-ffa450edef68
2017-12-30 11:23:40 +00:00
Deepak Dixit 54cb008374 Merge from trunk revision:1819582
Improvement in UI of register page according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10127)
Thanks Nitish Mishra for your contribution

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1819583 13f79535-47bb-0310-9956-ffa450edef68
2017-12-30 09:51:57 +00:00
Deepak Dixit 75c2b12376 Merge from trunk revision:1819580
Improved: Update markup of Configure product page according to standard markup given by Bootstrap v4.0.0 (OFBIZ-10110)
Thanks Nitish Mishra for your contribution

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1819581 13f79535-47bb-0310-9956-ffa450edef68
2017-12-30 09:47:02 +00:00
Deepak Dixit c7f641c225 Applied fix from trunk for revision:1819576
Improved: Added responsive and thead-light class on quote list ecommerce page (OFBIZ-10095)
Thanks Nitish Mishra for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1819577 13f79535-47bb-0310-9956-ffa450edef68
2017-12-30 09:35:25 +00:00
Jacopo Cappellato a965a2d40c Created feature branch 17.12 for the ofbiz-plugins.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/branches/release17.12@1819408 13f79535-47bb-0310-9956-ffa450edef68
2017-12-28 09:03:30 +00:00
2437 changed files with 527704 additions and 21297 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/
.DS_Store
-2
View File
@@ -1,2 +0,0 @@
+6 -6
View File
@@ -1,4 +1,4 @@
Apache License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@@ -209,6 +209,11 @@ webpos/webapp/webpos/images/js/WebPosHotkeys.js
=========================================================================
This product bundles files from the "Birt" technology platform (www.eclipse.org/birt/)
which are available under the "Eclipse Public License - v 1.0".
For details, see birt/webapp/birt/webcontent/birt/
=========================================================================
This product bundles "Webhelp for DocBook", which is available
under the "MIT" License. For details, see cmssite/template/docbook/webhelp/
@@ -225,8 +230,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/
+22 -2
View File
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="AssetMaintApplication">
<value xml:lang="de">Instandhaltungsanwendung</value>
<value xml:lang="en">Asset Maintenance Application</value>
@@ -102,7 +102,7 @@
<value xml:lang="zh-TW">上級工作投入</value>
</property>
<property key="AssetMaintPartId">
<value xml:lang="en">Part ID</value>
<value xml:lang="en">Part Id</value>
<value xml:lang="fr">Réf. de la pièce</value>
<value xml:lang="it">Codice parte</value>
<value xml:lang="ja">部品ID</value>
@@ -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>
+1 -1
View File
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="IsMgrApplication">
<value xml:lang="en">Information Systems Management Application</value>
<value xml:lang="fr">Gestion du parc informatique</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>
+1 -1
View File
@@ -19,7 +19,7 @@
-->
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entitymodel.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
<!-- ========================================================= -->
<!-- ======================== Defaults ======================= -->
@@ -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>
+5 -7
View File
@@ -20,7 +20,7 @@
<ofbiz-component name="assetmaint" enabled="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-component.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
<!-- define resource loaders; most common is to use the component resource loader -->
<resource-loader name="main" type="component"/>
@@ -41,20 +41,18 @@
<webapp name="assetmaint"
title="AssetMaint"
position="19"
server="default-server"
location="webapp/assetmaint"
base-permission="OFBTOOLS,ASSETMAINT"
base-permission="ASSETMAINT"
mount-point="/assetmaint"
app-bar-display="true"/>
<webapp name="ismgr"
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>
+1 -1
View File
@@ -19,7 +19,7 @@ under the License.
-->
<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-eca.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
<!-- ECAs used to extend service permission checking -->
<eca service="fixedAssetPermissionCheck" event="return" run-on-failure="true">
+1 -1
View File
@@ -14,7 +14,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
<description>Assetmaint Services: Fixed Asset </description>
<vendor>OFBiz</vendor>
<version>1.0</version>
-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");
double requestedQty = 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.doubleValue();
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,47 +75,44 @@ 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();
String inventoryItemId = inventoryItem.getString("inventoryItemId");
atp = inventoryItem.getDouble("availableToPromiseTotal");
atp = inventoryItem.getDouble("availableToPromiseTotal").doubleValue();
findCurrInventoryParams = UtilMisc.toMap("inventoryItemId", inventoryItemId);
Double issueQuantity = null;
if (requestedQty > atp) {
issueQuantity = atp;
issueQuantity = new Double(atp);
} else {
issueQuantity = requestedQty;
issueQuantity = new Double(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;
requestedQty = requestedQty - issueQuantity.doubleValue();
}
} 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>
+3 -2
View File
@@ -20,9 +20,10 @@
<test-suite suite-name="assetmainttests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
xsi:noNamespaceSchemaLocation="http://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 -1
View File
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="BusinessIntelligenceApplication">
<value xml:lang="en">Business Intelligence Application</value>
<value xml:lang="fr">Application d'informatique décisionnelle</value>
+1 -2
View File
@@ -19,12 +19,11 @@ under the License.
-->
<entitygroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entitygroup.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitygroup.xsd">
<!-- ========================================================= -->
<!-- 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"/>
+1 -26
View File
@@ -19,7 +19,7 @@ under the License.
-->
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entitymodel.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
<!-- ========================================================= -->
<!-- ======================== Defaults ======================= -->
<!-- ========================================================= -->
@@ -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>
+1 -2
View File
@@ -20,7 +20,7 @@ under the License.
<ofbiz-component name="bi" enabled="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-component.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
<resource-loader name="main" type="component"/>
<classpath type="dir" location="config"/>
@@ -43,7 +43,6 @@ under the License.
<webapp name="bi"
title="Business Intelligence"
position="16"
menu-name="secondary"
server="default-server"
location="webapp/bi"
+1 -1
View File
@@ -19,7 +19,7 @@ under the License.
-->
<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-eca.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
<!-- dimension entities -->
<eca service="createProduct" event="global-commit-post-run">
+31 -31
View File
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
<service name="storeGenericDimension" engine="java"
location="org.apache.ofbiz.bi.util.DimensionServices" invoke="storeGenericDimension" auth="true">
@@ -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)
+1 -1
View File
@@ -20,7 +20,7 @@
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="BirtErrorCannotDetermineDataSource">
<value xml:lang="en">Failed to determine data source for report</value>
<value xml:lang="fr">La détermination de la source de données à échoué</value>
+1 -1
View File
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="BirtApplication">
<value xml:lang="en">Eclipse BIRT Application</value>
<value xml:lang="fr">Application Eclipse Birt</value>
+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" sequenceNum="" 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"/>
+6 -6
View File
@@ -22,7 +22,7 @@
portletName="Sale Orders by Channel"
screenName="SaleOrdersByChannelReport"
screenLocation="component://birt/widget/order/OrderScreens.xml"
/>
description=""/>
<PortletPortletCategory portalPortletId="OrderByChannel" portletCategoryId="REPORT"/>
<PortalPagePortlet portalPageId="OrderReportPage" portalPortletId="OrderByChannel" portletSeqId="00001" columnSeqId="00001" sequenceNum="6"/>
@@ -30,7 +30,7 @@
portletName="Orders with discount code"
screenName="SaleOrderDiscountCodeReport"
screenLocation="component://birt/widget/order/OrderScreens.xml"
/>
description=""/>
<PortletPortletCategory portalPortletId="OrderDiscountCode" portletCategoryId="REPORT"/>
<PortalPagePortlet portalPageId="OrderReportPage" portalPortletId="OrderDiscountCode" portletSeqId="00001" columnSeqId="00001" sequenceNum="7"/>
@@ -38,7 +38,7 @@
portletName="Last 3 Months Sales Report"
screenName="Last3MonthsSalesReport"
screenLocation="component://birt/widget/order/OrderScreens.xml"
/>
description=""/>
<PortletPortletCategory portalPortletId="Last3MSalesReport" portletCategoryId="REPORT"/>
<PortalPagePortlet portalPageId="OrderReportPage" portalPortletId="Last3MSalesReport" portletSeqId="00001" columnSeqId="00002" sequenceNum="8"/>
@@ -46,7 +46,7 @@
portletName="Coupon Sales Report"
screenName="CouponSalesReport"
screenLocation="component://birt/widget/order/OrderScreens.xml"
/>
description=""/>
<PortletPortletCategory portalPortletId="CouponSalesReport" portletCategoryId="REPORT"/>
<PortalPagePortlet portalPageId="OrderReportPage" portalPortletId="CouponSalesReport" portletSeqId="00001" columnSeqId="00002" sequenceNum="9"/>
@@ -54,7 +54,7 @@
portletName="Sales Report"
screenName="SalesReport"
screenLocation="component://birt/widget/order/OrderScreens.xml"
/>
description=""/>
<PortletPortletCategory portalPortletId="SalesReport" portletCategoryId="REPORT"/>
<PortalPagePortlet portalPageId="OrderReportPage" portalPortletId="SalesReport" portletSeqId="00001" columnSeqId="00002" sequenceNum="10"/>
@@ -62,7 +62,7 @@
portletName="Product Demand Report"
screenName="ProductDemandReport"
screenLocation="component://birt/widget/order/OrderScreens.xml"
/>
description=""/>
<PortletPortletCategory portalPortletId="PDR_Report" portletCategoryId="REPORT"/>
<PortalPagePortlet portalPageId="OrderReportPage" portalPortletId="PDR_Report" portletSeqId="00001" columnSeqId="00002" sequenceNum="12"/>
</entity-engine-xml>
+7 -7
View File
@@ -18,16 +18,16 @@ specific language governing permissions and limitations
under the License.
-->
<entity-engine-xml>
<ExampleType exampleTypeId="REAL_WORLD" description="Real World"/>
<ExampleType exampleTypeId="MADE_UP" description="Made Up"/>
<ExampleType exampleTypeId="REAL_WORLD" description="Real World" parentTypeId=""/>
<ExampleType exampleTypeId="MADE_UP" description="Made Up" parentTypeId=""/>
<ExampleType exampleTypeId="CONTRIVED" description="Contrived" parentTypeId="MADE_UP"/>
<ExampleType exampleTypeId="INSPIRED" description="Inspired" parentTypeId="MADE_UP"/>
<ExampleFeatureApplType exampleFeatureApplTypeId="REQUIRED" description="Required"/>
<ExampleFeatureApplType exampleFeatureApplTypeId="DESIRED" description="Desired"/>
<ExampleFeatureApplType exampleFeatureApplTypeId="NOT_ALLOWED" description="Not Allowed"/>
<ExampleFeatureApplType exampleFeatureApplTypeId="REQUIRED" description="Required" parentTypeId=""/>
<ExampleFeatureApplType exampleFeatureApplTypeId="DESIRED" description="Desired" parentTypeId=""/>
<ExampleFeatureApplType exampleFeatureApplTypeId="NOT_ALLOWED" description="Not Allowed" parentTypeId=""/>
<StatusType description="Example" statusTypeId="EXAMPLE_STATUS" hasTable="N"/>
<StatusType description="Example" statusTypeId="EXAMPLE_STATUS" hasTable="N" parentTypeId=""/>
<StatusItem description="In Design" sequenceId="01" statusCode="IN_DESIGN" statusId="EXST_IN_DESIGN" statusTypeId="EXAMPLE_STATUS"/>
<StatusItem description="Defined" sequenceId="02" statusCode="DEFINED" statusId="EXST_DEFINED" statusTypeId="EXAMPLE_STATUS"/>
<StatusItem description="Approved" sequenceId="03" statusCode="APPROVED" statusId="EXST_APPROVED" statusTypeId="EXAMPLE_STATUS"/>
@@ -46,7 +46,7 @@ under the License.
<StatusValidChange statusId="EXST_IMPLEMENTED" statusIdTo="EXST_CANCELLED" transitionName="Cancel Example"/>
<StatusValidChange statusId="EXST_TESTED" statusIdTo="EXST_CANCELLED" transitionName="Cancel Example"/>
<EnumerationType description="Example Feature Source" enumTypeId="EXMPL_FEAT_SOURCE" hasTable="N"/>
<EnumerationType description="Example Feature Source" enumTypeId="EXMPL_FEAT_SOURCE" hasTable="N" parentTypeId=""/>
<Enumeration description="Customer" enumCode="CUSTOMER" enumId="EXFTSRC_CUSTOMER" sequenceId="01" enumTypeId="EXMPL_FEAT_SOURCE"/>
<Enumeration description="Partner" enumCode="PARTNER" enumId="EXFTSRC_PARTNER" sequenceId="02" enumTypeId="EXMPL_FEAT_SOURCE"/>
<Enumeration description="Employee" enumCode="EMPLOYEE" enumId="EXFTSRC_EMPLOYEE" sequenceId="03" enumTypeId="EXMPL_FEAT_SOURCE"/>
+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>
+1 -1
View File
@@ -21,7 +21,7 @@ under the License.
<PortalPortlet portalPortletId="EXAMPLE_1" portletName="Example 1" description="Example portlet n. 1"
screenName="ExamplePortlet1" screenLocation="component://example/widget/example/PortletScreens.xml"
editFormName="ExamplePortlet1Edit" editFormLocation="component://example/widget/example/PortletEditForms.xml"
screenshot="/images/ofbiz_logo.png"/>
screenshot="/themes/common/webapp/images/ofbiz_logo.png"/>
<PortalPortlet portalPortletId="EXAMPLE_2" portletName="Example 2" description="Example portlet n. 2"
screenName="ExamplePortlet2" screenLocation="component://example/widget/example/PortletScreens.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>
+1 -1
View File
@@ -19,7 +19,7 @@ under the License.
-->
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entitymodel.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
<title>View definitions for master report services</title>
<description>None</description>
<version>1.0</version>
@@ -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)
+3 -5
View File
@@ -20,11 +20,12 @@ under the License.
<ofbiz-component name="birt" enabled="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-component.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
<resource-loader name="main" type="component"/>
<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"/>
@@ -45,13 +47,11 @@ under the License.
<webapp name="accounting"
title="Accounting"
server="default-server"
position="5"
location="webapp/accounting"
base-permission="OFBTOOLS,ACCOUNTING"
mount-point="/accounting"/>
<webapp name="facility"
title="Facility"
position="3"
description="FacilityComponentDescription"
server="default-server"
location="webapp/facility"
@@ -59,7 +59,6 @@ under the License.
mount-point="/facility"/>
<webapp name="order"
title="Order"
position="4"
description="OrderComponentDescription"
server="default-server"
location="webapp/ordermgr"
@@ -68,7 +67,6 @@ under the License.
<webapp name="birt"
title="BIRT"
position="17"
server="default-server"
location="webapp/birt"
base-permission="OFBTOOLS,WEBTOOLS"
+1 -1
View File
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
<description>OFBiz BIRT Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -1,37 +1,23 @@
////
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
NOTE: This feature will begin to be officially available with the R17.12 branch first release
==== Introduction
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.
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.
==== Pre-requisite
==== Pre-requisite
* OFBiz framework
* The Birt plugin
* The BIRT Report Designer: <<#_using_the_birt_report_designer,Using the Birt Report Designer>>
* 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 +26,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, ...).
+13 -20
View File
@@ -16,36 +16,29 @@ 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]
NOTE: This feature will begin to be officially available with the R17.12 branch first release
== 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) {
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.OutputStream;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
@@ -61,29 +62,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 +111,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 +139,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 +152,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 +166,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 +182,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;
}
@@ -218,6 +219,7 @@ public final class BirtWorker {
throw new GenericServiceException("Service and entity name cannot be both empty");
}
String modelType = null;
String modelElementName = null;
String workflowType = null;
if (UtilValidate.isEmpty(serviceName)) {
@@ -228,15 +230,17 @@ public final class BirtWorker {
workflowType = "Service";
}
//resolve the path location to store the RptDesign file, check if the file already exists under this name and increment index name if needed
List<GenericValue> listRptDesigns = null;
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,18 +256,15 @@ 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));
}
String reportForm = (String) resultElectronicText.get("textData");
if (!reportForm.startsWith("<?xml")) {
StringBuffer xmlHeaderForm = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
xmlHeaderForm.append("<forms xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xmlns=\"http://ofbiz.apache.org/Widget-Form\" "
+ "xsi:schemaLocation=\"http://ofbiz.apache.org/Widget-Form "
+ "http://ofbiz.apache.org/dtds/widget-form.xsd\">");
xmlHeaderForm.append("<forms xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:targetNamespace=\"http://ofbiz"
+ ".apache.org/dtds/widget-form.xsd\">");
xmlHeaderForm.append(reportForm);
xmlHeaderForm.append("</forms>");
reportForm = xmlHeaderForm.toString();
@@ -272,54 +273,20 @@ public final class BirtWorker {
reportForm = reportFormExpd.expandString(context);
//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));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
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));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceId, "dataResourceTypeId", "ELECTRONIC_TEXT", "dataTemplateTypeId", "FORM_COMBINED", "userLogin", userLogin));
dispatcher.runSync("createElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", reportForm, "userLogin", userLogin));
dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentId, "contentTypeId", "FLEXIBLE_REPORT", "dataResourceId", dataResourceId, "statusId", "CTNT_IN_PROGRESS", "contentName", reportName, "description", description, "userLogin", userLogin));
String dataResourceIdRpt = delegator.getNextSeqId("DataResource");
String contentIdRpt = delegator.getNextSeqId("Content");
String rptDesignName = BirtUtil.encodeReportName(reportName);
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));
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));
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));
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));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
result = dispatcher.runSync("createContentAttribute", UtilMisc.toMap("contentId", contentId, "attrName", workflowType, "attrValue",
modelElementName, "userLogin", userLogin));
if (ServiceUtil.isError(result)) {
throw new GeneralException(ServiceUtil.getErrorMessage(result));
}
dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceIdRpt, "dataResourceTypeId", "LOCAL_FILE", "mimeTypeId", "text/rptdesign", "dataResourceName", rptDesignName, "objectInfo", templateFileLocation, "userLogin", userLogin));
dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentIdRpt, "contentTypeId", "RPTDESIGN", "dataResourceId", dataResourceIdRpt, "statusId", "CTNT_PUBLISHED", "contentName", reportName, "description", description + " (.rptDesign file)", "userLogin", userLogin));
dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", masterContentId, "contentIdTo", contentId, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", contentId, "contentIdTo", contentIdRpt, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
dispatcher.runSync("createContentAttribute", UtilMisc.toMap("contentId", contentId, "attrName", workflowType, "attrValue", modelElementName, "userLogin", userLogin));
return contentId;
}
@@ -337,7 +304,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));
}
}
@@ -28,6 +28,7 @@ import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.apache.ofbiz.base.container.Container;
import org.apache.ofbiz.base.container.ContainerConfig;
import org.apache.ofbiz.base.container.ContainerException;
import org.apache.ofbiz.base.start.StartupCommand;
import org.apache.ofbiz.base.util.Debug;
@@ -36,9 +37,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 +54,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 +74,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 +101,7 @@ public class BirtContainer implements Container {
formatList = supportedFormat;
}
}
Debug.logInfo("BIRT supported formats: " + formatList, MODULE);
Debug.logInfo("BIRT supported formats: " + formatList, module);
return false;
}
@@ -44,6 +44,7 @@ import org.apache.ofbiz.birt.BirtFactory;
import org.apache.ofbiz.birt.BirtWorker;
import org.apache.ofbiz.common.email.NotificationServices;
import org.apache.ofbiz.entity.Delegator;
import org.apache.ofbiz.entity.util.EntityUtilProperties;
import org.apache.ofbiz.security.Security;
import org.apache.ofbiz.service.DispatchContext;
import org.apache.ofbiz.service.GenericServiceException;
@@ -63,10 +64,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 +78,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 +93,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 +120,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 +136,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 +164,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 +183,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 +202,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,26 +255,18 @@ 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 {
if (isMultiPart) {
Map<String, Object> resultMap = dispatcher.runSync("sendMailMultiPart", serviceContext);
if (ServiceUtil.isError(resultMap)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultMap));
}
dispatcher.runSync("sendMailMultiPart", serviceContext);
} else {
Map<String, Object> resultMap = dispatcher.runSync("sendMail", serviceContext);
if (ServiceUtil.isError(resultMap)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultMap));
}
dispatcher.runSync("sendMail", serviceContext);
}
} 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");
@@ -86,9 +87,9 @@ public class BirtMasterReportServices {
}
public static Map<String, Object> workEffortPerPerson(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Delegator 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");
@@ -207,14 +208,14 @@ public class BirtMasterReportServices {
}
public static Map<String, Object> turnOver(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Delegator 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);
@@ -76,6 +76,7 @@ import org.eclipse.birt.report.model.api.SimpleMasterPageHandle;
import org.eclipse.birt.report.model.api.SlotHandle;
import org.eclipse.birt.report.model.api.VariableElementHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.elements.SimpleMasterPage;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -88,9 +89,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 +102,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 +116,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 +135,14 @@ public class BirtServices {
String fieldType = mField.getType();
String birtType = null;
try {
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);
return ServiceUtil.returnError(errMsg + ServiceUtil.getErrorMessage(convertRes));
}
Map<String, Object> convertRes = dispatcher.runSync("convertFieldTypeToBirtType", UtilMisc.toMap("fieldType", fieldType, "userLogin", userLogin));
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 +159,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 +167,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 +209,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 +229,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 +242,55 @@ 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));
if (ServiceUtil.isError(resultFormDisplay)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultFormDisplay));
}
resultFormDisplay = dispatcher.runSync("prepareFlexibleReportSearchFormToEdit", UtilMisc.toMap("reportContentId", reportContentId, "userLogin", userLogin, "locale", locale));
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,33 +304,26 @@ 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 {
GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", reportContentId).queryOne();
String dataResourceId = content.getString("dataResourceId");
StringBuffer newForm = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?> <forms xmlns:xsi=\"http://www.w3"
+ ".org/2001/XMLSchema-instance\" "
+ "xmlns=\"http://ofbiz.apache.org/Widget-Form\" "
+ "xsi:schemaLocation=\"http://ofbiz.apache.org/Widget-Form "
+ "http://ofbiz.apache.org/dtds/widget-form.xsd\">");
+ ".org/2001/XMLSchema-instance\" xsi:targetNamespace=\"http://ofbiz.apache.org/dtds/widget-form.xsd\">");
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),
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 +341,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 +383,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);
@@ -436,27 +414,24 @@ public class BirtServices {
if (customMethod == null) {
return ServiceUtil.returnError("CustomMethod not exist : " + customMethodId); //TODO labelise
}
String customMethodName = customMethod.getString("customMethodName");
String customMethodName = (String) customMethod.getString("customMethodName");
if ("default".equalsIgnoreCase(serviceName)) {
serviceName = customMethodName + "PrepareFields";
}
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);
String rptDesignFileName = BirtUtil.resolveRptDesignFilePathFromContent(delegator, contentId);
Map<String, Object> serviceResult = dispatcher.runSync(serviceName, UtilMisc.toMap("locale", locale, "userLogin", userLogin));
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, Object> resultService = dispatcher.runSync(serviceName, UtilMisc.toMap("locale", locale, "userLogin", userLogin));
Map<String, String> dataMap = UtilGenerics.checkMap(resultService.get("dataMap"));
Map<String, String> filterMap = UtilGenerics.checkMap(resultService.get("filterMap"));
Map<String, String> fieldDisplayLabels = UtilGenerics.checkMap(resultService.get("fieldDisplayLabels"));
Map<String, String> filterDisplayLabels = UtilGenerics.checkMap(resultService.get("filterDisplayLabels"));
Map<String, Object> resultGeneration = dispatcher.runSync("createFlexibleReport", UtilMisc.toMap(
"locale", locale,
"dataMap", dataMap,
@@ -468,11 +443,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 +460,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 +497,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 +534,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 +568,24 @@ 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));
if (ServiceUtil.isError(returnMap)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(returnMap));
}
Map<String, Object> returnMap = dispatcher.runSync("deleteFlexibleReport", UtilMisc.toMap("contentId", contentId, "userLogin", userLogin, "locale", locale));
ServiceUtil.isError(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 +613,32 @@ 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));
if (ServiceUtil.isError(result)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
}
result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentIdRpt, "userLogin", userLogin, "locale",
locale));
if (ServiceUtil.isError(result)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
}
dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentId, "userLogin", userLogin, "locale", locale));
dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentIdRpt, "userLogin", userLogin, "locale", locale));
} 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 +650,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 +660,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 +668,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 +683,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 +692,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 +706,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 +728,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
@@ -783,12 +738,12 @@ public class BirtServices {
Iterator<DesignElementHandle> iterCube = cubesFromUser.iterator();
while (iterCube.hasNext()) {
DesignElementHandle item = iterCube.next();
DesignElementHandle item = (DesignElementHandle) iterCube.next();
DesignElementHandle copy = item.copy().getHandle(item.getModule());
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
}
}
@@ -799,12 +754,12 @@ public class BirtServices {
Iterator<DesignElementHandle> iter = bodyFromUser.iterator();
while (iter.hasNext()) {
DesignElementHandle item = iter.next();
DesignElementHandle item = (DesignElementHandle) iter.next();
DesignElementHandle copy = item.copy().getHandle(item.getModule());
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,18 +774,16 @@ 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) {
if (masterPage instanceof SimpleMasterPageHandle) {
SimpleMasterPageHandle masterPageHandle = (SimpleMasterPageHandle) masterPage;
designStored.getMasterPages().add(masterPageHandle.copy().getHandle(masterPage.getModule()));
designStored.getMasterPages().add((SimpleMasterPage) ((SimpleMasterPageHandle) masterPage).copy()); // TODO check what to use in place of add (deprecated)
}
}
} catch (Exception e) {
Debug.logError(e, MODULE);
Debug.logError(e, module);
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
}
@@ -840,7 +793,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,11 +803,11 @@ 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()) {
DesignElementHandle item = iterStored.next();
DesignElementHandle item = (DesignElementHandle) iterStored.next();
listStyleNames.add(item.getName());
}
@@ -863,13 +816,13 @@ public class BirtServices {
// adding to styles those which are not already present
while (iterUser.hasNext()) {
DesignElementHandle item = iterUser.next();
DesignElementHandle item = (DesignElementHandle) iterUser.next();
if (!listStyleNames.contains(item.getName())) {
DesignElementHandle copy = item.copy().getHandle(item.getModule());
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 +831,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;
}
}
}
@@ -34,21 +34,23 @@ import org.apache.ofbiz.entity.condition.EntityCondition;
import org.apache.ofbiz.entity.condition.EntityConditionList;
import org.apache.ofbiz.entity.condition.EntityExpr;
import org.apache.ofbiz.entity.util.EntityQuery;
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler;
import org.eclipse.birt.report.engine.api.RenderOption;
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 HTMLServerImageHandler imageHandler = new HTMLServerImageHandler(); // TODO not used yet or to remove
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 +72,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 +101,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 +115,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 +126,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 +138,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 +147,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 +158,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 +239,4 @@ public final class BirtUtil {
if (UtilValidate.isEmpty(reportName)) return "";
return StringUtil.replaceString(StringUtil.removeRegex(reportName.trim(), "[^\\p{L}\\s]"), " ", "_");
}
}
}
@@ -20,6 +20,7 @@
package org.apache.ofbiz.birt.flexible;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
@@ -66,35 +67,30 @@ 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"));
filterMap = UtilGenerics.cast(context.get("filterMap"));
dataMap = UtilGenerics.checkMap(context.get("dataMap"));
filterMap = (LinkedHashMap<String, String>) context.get("filterMap");
serviceName = (String) context.get("serviceName");
fieldDisplayLabels = UtilGenerics.cast(context.get("fieldDisplayLabels"));
filterDisplayLabels = UtilGenerics.cast(context.get("filterDisplayLabels"));
fieldDisplayLabels = UtilGenerics.checkMap(context.get("fieldDisplayLabels"));
filterDisplayLabels = (LinkedHashMap<String, String>) context.get("filterDisplayLabels");
rptDesignName = (String) context.get("rptDesignName");
String writeFilters = (String) context.get("writeFilters");
if (UtilValidate.isEmpty(dataMap)) {
@@ -109,14 +105,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 +147,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;
@@ -161,14 +156,11 @@ public class ReportDesignGenerator {
} else {
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.
ScalarParameterHandle scalParam = ((ElementFactory) 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.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 +214,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 +233,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 +263,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 +311,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 +335,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
@@ -84,11 +81,11 @@ public class BirtViewHandler implements ViewHandler {
// add dynamic parameter for page
if (UtilValidate.isEmpty(page) || "ExecuteFlexibleReport".equals(page)) {
page = request.getParameter("rptDesignFile");
page = (String) request.getParameter("rptDesignFile");
}
if (UtilValidate.isEmpty(page)) {
Locale locale = request.getLocale();
throw new ViewHandlerException(UtilProperties.getMessage(RES_ERROR, "BirtErrorNotPublishedReport", locale));
Locale locale = (Locale) request.getLocale();
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,15 +110,15 @@ public class BirtViewHandler implements ViewHandler {
if (locale == null) {
locale = UtilHttp.getLocale(request);
}
// set override content type
String overrideContentType = request.getParameter(BirtWorker.getBirtContentType());
String overrideContentType = (String) 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());
String outputFileName = (String) request.getParameter(BirtWorker.getBirtOutputFileName());
if (UtilValidate.isNotEmpty(outputFileName)) {
outputFileName = BirtUtil.encodeReportName(outputFileName);
String format = BirtUtil.getMimeTypeFileExtension(contentType);
@@ -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>

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