Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21860f7192 | ||
|
|
f7c583a1a1 | ||
|
|
7f8ec07b53 | ||
|
|
67cbf35e83 | ||
|
|
102eb51153 | ||
|
|
e18d5768ac | ||
|
|
34ba24e439 | ||
|
|
f8cb563d18 | ||
|
|
070c3c09d5 | ||
|
|
eac1fb508f | ||
|
|
2ddb605ae8 | ||
|
|
5792f452a9 | ||
|
|
4cce082e93 | ||
|
|
265cc7f83e | ||
|
|
daa5f74b42 | ||
|
|
a7bb363932 | ||
|
|
0da1f22334 | ||
|
|
20ce270211 | ||
|
|
a38685f23d | ||
|
|
cea04fea0f | ||
|
|
82f6198e2e | ||
|
|
9d66988c5b | ||
|
|
35af177893 | ||
|
|
9d491ca801 | ||
|
|
02b243eede | ||
|
|
a5b5e5055f | ||
|
|
7e4dc9a353 | ||
|
|
b3a0b8344c | ||
|
|
424b238582 | ||
|
|
82c5a574fb | ||
|
|
ac6acf03a3 | ||
|
|
efb113250d | ||
|
|
57ef5c81d3 | ||
|
|
537a4591e2 | ||
|
|
1eeb4026e6 | ||
|
|
921fee3c0c | ||
|
|
55c7d157f5 | ||
|
|
c5539184e0 | ||
|
|
a02c8ba350 | ||
|
|
4f26a91aec | ||
|
|
8d4aebb836 | ||
|
|
f33ff27059 | ||
|
|
5a69c225af | ||
|
|
576d5534a2 | ||
|
|
7b78e25f31 | ||
|
|
21c9f0fda9 | ||
|
|
b5cad1d5e1 | ||
|
|
1f0cca7fa4 | ||
|
|
cf086a2b47 | ||
|
|
923b42c2da | ||
|
|
421e0e7994 | ||
|
|
51501fe7e3 | ||
|
|
002bb61b6e | ||
|
|
f91339b576 | ||
|
|
97fe0058a8 | ||
|
|
b542a38b18 | ||
|
|
a03567363b | ||
|
|
7ab9d05412 | ||
|
|
553472c052 | ||
|
|
7b37304043 | ||
|
|
20e00c82a3 | ||
|
|
209f15f2b6 | ||
|
|
a6364a8afa | ||
|
|
48156518c9 | ||
|
|
ff03ec248a | ||
|
|
2218d9f9a1 | ||
|
|
9d4c9fcaff | ||
|
|
30ec649c57 | ||
|
|
229b9b9ca1 | ||
|
|
874c830fbb | ||
|
|
eee69f91c5 | ||
|
|
4f4328bf61 | ||
|
|
0606714363 | ||
|
|
69eea73ba2 | ||
|
|
190e816364 | ||
|
|
6106277bb4 | ||
|
|
af63249c4e | ||
|
|
e51dccb9bb | ||
|
|
88152045de | ||
|
|
dbfa4f0ca0 | ||
|
|
510239a5f2 | ||
|
|
45e246bce0 | ||
|
|
a3438121d8 | ||
|
|
57d24425df | ||
|
|
5eb003e1a6 | ||
|
|
66055a731a | ||
|
|
84d705373f | ||
|
|
b5c6a17024 | ||
|
|
1a6e4f8294 | ||
|
|
107b26b66c | ||
|
|
c6704e90c3 | ||
|
|
c257243fc0 | ||
|
|
cf1cb40479 | ||
|
|
32508bd437 | ||
|
|
3ade20a4f8 | ||
|
|
35a2eca9b4 | ||
|
|
2b6da24f7e | ||
|
|
8a3d230ba6 | ||
|
|
0474982534 | ||
|
|
9465c20566 | ||
|
|
3bfac03158 | ||
|
|
e964d61724 | ||
|
|
40096fd964 | ||
|
|
9cb1101e3f | ||
|
|
73876cdb14 | ||
|
|
728354a0cb | ||
|
|
f9069945ad | ||
|
|
2c1696e827 | ||
|
|
7bdbaa338b | ||
|
|
d45c377339 | ||
|
|
78bc570ac8 | ||
|
|
40d7c57662 | ||
|
|
4d34c9d43f | ||
|
|
4bf7288f24 | ||
|
|
e84c7ada87 | ||
|
|
0718b63544 | ||
|
|
f25852fef2 | ||
|
|
9d6a73f1d2 | ||
|
|
cf28c487ba | ||
|
|
53518c46d6 | ||
|
|
2f6b0f19a3 | ||
|
|
eebd368718 | ||
|
|
8a430c48a1 | ||
|
|
30aa0132e6 | ||
|
|
dd27ea556c | ||
|
|
88de8cd845 | ||
|
|
30bb85fb2b | ||
|
|
583d0a64ee | ||
|
|
8bb8fee36f | ||
|
|
c092a5714f | ||
|
|
7276348269 | ||
|
|
36601854f2 | ||
|
|
77b9733cf6 | ||
|
|
c8f0123845 | ||
|
|
c4c2a28741 | ||
|
|
908db34449 | ||
|
|
180ddef270 | ||
|
|
1c25201d7e | ||
|
|
70180cf254 | ||
|
|
f152d031cb | ||
|
|
9b92939318 | ||
|
|
6c9c0d6e36 | ||
|
|
e30634fba1 | ||
|
|
f45a295061 | ||
|
|
8545cfebb2 | ||
|
|
3b66ae1abe | ||
|
|
19a97b5819 | ||
|
|
1361c3cdaf | ||
|
|
364613e310 | ||
|
|
9c40c67e7a | ||
|
|
66070a6bc1 | ||
|
|
8ced392fde | ||
|
|
a4fb6d22ee | ||
|
|
0d8a5f0275 | ||
|
|
d2e34ebe10 | ||
|
|
78c5d25331 | ||
|
|
65969e5ebb | ||
|
|
7f7eee6eb4 | ||
|
|
43d4c0bd98 | ||
|
|
fc0a447a2e | ||
|
|
e31fd640fd | ||
|
|
5bcb7af25a | ||
|
|
7a92f0640a | ||
|
|
6ac1f28491 | ||
|
|
85e76a3997 | ||
|
|
476b42a15d | ||
|
|
6ac7dc934a | ||
|
|
93f5b6f4fb | ||
|
|
dabca1e416 | ||
|
|
2a85d30fdd | ||
|
|
290f0b8af9 | ||
|
|
b1c98eee47 | ||
|
|
dc20b79324 | ||
|
|
f21eda4542 | ||
|
|
94e77248e5 | ||
|
|
e314fc7c99 | ||
|
|
42192da7d3 | ||
|
|
964a5d075b | ||
|
|
72458a1ef2 | ||
|
|
f47525331e | ||
|
|
26ddcc0c8e | ||
|
|
310a2a58ef | ||
|
|
6a7136ada4 | ||
|
|
079f34e8fd | ||
|
|
46e0857e90 | ||
|
|
fb8cae5df4 | ||
|
|
6dfc3c19e7 | ||
|
|
0f8ca8cbcc | ||
|
|
3174bd92ec | ||
|
|
bf60a20d9d | ||
|
|
fabb323a53 | ||
|
|
3b9fbffc6d | ||
|
|
9892828d56 | ||
|
|
b049b93b55 | ||
|
|
b9a3be3e1e | ||
|
|
598cf6c27d | ||
|
|
9bf5e044f7 | ||
|
|
7d140f3e27 | ||
|
|
c8d22ed72a | ||
|
|
33d4d6c915 | ||
|
|
27c1bbed7e | ||
|
|
d4a41e39ef | ||
|
|
1c9f2ab9c6 | ||
|
|
031a16026d | ||
|
|
ba565306ad | ||
|
|
dce5c976f7 | ||
|
|
5545b13b13 | ||
|
|
964a0790a9 | ||
|
|
809d2ce300 | ||
|
|
429c9b4acd | ||
|
|
1207d24062 | ||
|
|
2841acfb81 | ||
|
|
ad4bb6ec86 | ||
|
|
403fc39d7f | ||
|
|
bcfa194edf | ||
|
|
13e465109b | ||
|
|
76b5ef7932 | ||
|
|
01e2e16681 | ||
|
|
2989420294 | ||
|
|
882246204e | ||
|
|
5366f7d85e | ||
|
|
04b8809124 | ||
|
|
fb7bdda1ef | ||
|
|
7f462731de | ||
|
|
aa2bfde7cc | ||
|
|
b65d9c94df | ||
|
|
30f796146c | ||
|
|
68e603fb4b | ||
|
|
b7ef54d494 | ||
|
|
743c627f40 | ||
|
|
4b88493e1b | ||
|
|
78801df453 | ||
|
|
dc55cb4746 | ||
|
|
cfba1f3fe2 | ||
|
|
d349811a26 | ||
|
|
8d6c36b624 | ||
|
|
cb502cae03 | ||
|
|
2a7ea475d3 | ||
|
|
9c87fb85b1 | ||
|
|
51cb1d7958 | ||
|
|
22ccc6801f | ||
|
|
a0f7e77e77 | ||
|
|
1d41025097 | ||
|
|
cb082af513 | ||
|
|
bf48bcb098 | ||
|
|
a321e5f49f | ||
|
|
0d8efd4a1b | ||
|
|
b76ee41197 | ||
|
|
8f57d0c87f | ||
|
|
7ecfaebc72 | ||
|
|
a905d459bd | ||
|
|
899d3061fe | ||
|
|
2144763bc0 | ||
|
|
df8b8213ff | ||
|
|
a50442d121 | ||
|
|
647e10377b | ||
|
|
e7ead3697f | ||
|
|
b18669cddc | ||
|
|
845de6eb63 | ||
|
|
6f264947c7 | ||
|
|
f8e17a5b00 | ||
|
|
40ddf41c1a | ||
|
|
c24db772c9 | ||
|
|
2cbb7bd278 | ||
|
|
c2925a43a4 | ||
|
|
8ca14ec910 | ||
|
|
d5a2fe0696 | ||
|
|
d931dfb9c9 | ||
|
|
8f14af21c5 | ||
|
|
2e415638b2 | ||
|
|
1f97f89bae | ||
|
|
7680c0d3ab | ||
|
|
0e1510701a | ||
|
|
df753f80b2 | ||
|
|
57fd870878 | ||
|
|
17c42bcddc | ||
|
|
32f3e468da | ||
|
|
8dd7f30247 | ||
|
|
670c08e7a3 | ||
|
|
3fe12199d3 | ||
|
|
b4bdfcdf92 | ||
|
|
dd1d408bc8 | ||
|
|
9c447f2486 | ||
|
|
b08fa4a944 | ||
|
|
12e9f087a4 | ||
|
|
a133199830 | ||
|
|
ae31c01fa7 | ||
|
|
2c65f7d17b | ||
|
|
ade15ec80a | ||
|
|
7aa38a284b | ||
|
|
9c6838ef0b | ||
|
|
9c369dc489 | ||
|
|
e7f587d8af | ||
|
|
9428ee9579 | ||
|
|
2e937378f4 | ||
|
|
ca5e6b45f1 | ||
|
|
a802ae0a02 | ||
|
|
071240205f | ||
|
|
b7baeb2b5f | ||
|
|
bd50c1417b | ||
|
|
c46a9c4db2 | ||
|
|
2c98bc3835 | ||
|
|
40143e6dba | ||
|
|
f572e74e7e | ||
|
|
ba246299d9 | ||
|
|
1cacb15000 | ||
|
|
208ef1b1be | ||
|
|
aa26d8f0cf | ||
|
|
cf272a9750 | ||
|
|
6b0c188f5a | ||
|
|
492dcb9208 | ||
|
|
417c3e4243 | ||
|
|
a8d3781cc6 | ||
|
|
38112fb346 | ||
|
|
d267d161e0 | ||
|
|
cca9d4d783 | ||
|
|
350571deaa | ||
|
|
9f87efe7ba | ||
|
|
e4388ba7c4 | ||
|
|
e72e1348c1 | ||
|
|
7a0386a68c | ||
|
|
b50d949376 | ||
|
|
d5731824c2 | ||
|
|
652050c9b9 | ||
|
|
57d709bc55 | ||
|
|
4afe6031a7 | ||
|
|
d5d0623e55 | ||
|
|
fd902848e8 | ||
|
|
b678615904 | ||
|
|
2de8058af8 | ||
|
|
6d031fe2db | ||
|
|
019cc010fc | ||
|
|
a73712b17a | ||
|
|
21e4a7299d | ||
|
|
a42ac97ce9 | ||
|
|
c6067e44cc | ||
|
|
8173afed0f | ||
|
|
7525177800 | ||
|
|
e5e7567798 | ||
|
|
c004c8f00b | ||
|
|
57de034e1c | ||
|
|
dbde1204e9 | ||
|
|
6f17e2253e | ||
|
|
031fb51255 | ||
|
|
e8021b7ede | ||
|
|
985840046a | ||
|
|
04b2c4c28a | ||
|
|
90e5f7deff | ||
|
|
ccb6219954 | ||
|
|
61ad77166b | ||
|
|
15750b9d5a | ||
|
|
0c6a80ac69 | ||
|
|
ffb54c2180 | ||
|
|
7cbc4b6d79 | ||
|
|
95deb6f87f | ||
|
|
1158664ba3 | ||
|
|
f435521da9 | ||
|
|
30cbad0392 | ||
|
|
c0db78c750 | ||
|
|
e49b345808 | ||
|
|
045f97b956 | ||
|
|
35c1dacdb1 | ||
|
|
25733c0981 | ||
|
|
3ec8fc30f4 | ||
|
|
448d820b93 | ||
|
|
d35a26937b | ||
|
|
229027647f | ||
|
|
23dbe19690 | ||
|
|
682f3438f3 | ||
|
|
fbbd9d893f | ||
|
|
63962f306a | ||
|
|
9274944a43 | ||
|
|
433fa628f5 | ||
|
|
6b3267d2cf | ||
|
|
9a33a3cc1e | ||
|
|
0572dfa89d | ||
|
|
09095590a8 | ||
|
|
e5077bed41 | ||
|
|
af4b7336c9 | ||
|
|
7d79da3b4c | ||
|
|
5d53e28b6d | ||
|
|
6a30378f06 | ||
|
|
4f19b762f3 | ||
|
|
3747e3d283 | ||
|
|
5ae9892e4e | ||
|
|
31fa95fd91 | ||
|
|
5154931f4f | ||
|
|
6e211a7c2a | ||
|
|
237a2fc8f7 | ||
|
|
82f440a4a1 | ||
|
|
6ed67067c7 | ||
|
|
a0fd98c02d | ||
|
|
280e24a57b | ||
|
|
363643717c | ||
|
|
acad8b02d8 | ||
|
|
72014e0d4f | ||
|
|
1e106e0c78 | ||
|
|
b6c99b8921 | ||
|
|
60a8a7e900 | ||
|
|
4ccff48b44 | ||
|
|
7dce2fcedc | ||
|
|
f00bccf762 | ||
|
|
f3c3271d12 | ||
|
|
cfea3ca859 | ||
|
|
3d63441ae7 | ||
|
|
0650a16d3b | ||
|
|
9354ac2997 | ||
|
|
f915292fdb | ||
|
|
642cc40eb3 | ||
|
|
2fb77f84f1 | ||
|
|
b5adaeee94 | ||
|
|
94c278ed63 | ||
|
|
8697d231bc | ||
|
|
ad14f70944 | ||
|
|
e011aa5572 | ||
|
|
992ed5d7c0 | ||
|
|
2df8887cb4 | ||
|
|
d30c1733c5 | ||
|
|
c91becf3b2 | ||
|
|
15266ea769 | ||
|
|
26849529b3 | ||
|
|
cad41b4496 | ||
|
|
07a0de688d | ||
|
|
332686244b | ||
|
|
76d4d6b2a7 | ||
|
|
1128cbc881 | ||
|
|
62c2ce7ce6 | ||
|
|
0bb4d1cb57 | ||
|
|
442a358732 | ||
|
|
7a2bed084b | ||
|
|
987888ed49 | ||
|
|
90c06a42b0 | ||
|
|
3238d53ecf | ||
|
|
94e4c3f48a | ||
|
|
6332aa5205 | ||
|
|
0f45353684 | ||
|
|
7865fec6b6 | ||
|
|
ac3ff2a2ac | ||
|
|
bd6ba0835d | ||
|
|
7c76483d91 | ||
|
|
833db83f03 | ||
|
|
73f7146d74 | ||
|
|
9ce999b656 | ||
|
|
2310144baf | ||
|
|
70895a3646 | ||
|
|
a600780684 | ||
|
|
513f18569b | ||
|
|
157f23f7d2 | ||
|
|
52c932ca5a | ||
|
|
ac7435bd81 | ||
|
|
65d1489261 | ||
|
|
5579e37bde | ||
|
|
c7f9cbdd0c | ||
|
|
c702407c32 | ||
|
|
81e93b444f | ||
|
|
5f6727ee53 | ||
|
|
8ba3822d60 | ||
|
|
84b11df4c5 | ||
|
|
44a7af62ed | ||
|
|
a6399b5c9f | ||
|
|
844fc542d8 | ||
|
|
d4308cd24a | ||
|
|
caae84841f | ||
|
|
baabf6b25d | ||
|
|
6a9ede0945 |
@@ -0,0 +1,34 @@
|
||||
# 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 +1,2 @@
|
||||
/bin/
|
||||
.DS_Store
|
||||
bin/
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Apache License
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
@@ -225,3 +225,8 @@ 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
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
<img src="http://ofbiz.apache.org/images/OFBiz-logo.png" alt="Apache OFBiz" />
|
||||
<img src="https://camo.githubusercontent.com/b313d4ec52b77b5024e2988aaf76720258233e69/68747470733a2f2f6f6662697a2e6170616368652e6f72672f696d616765732f6f6662697a5f6c6f676f2e706e67" 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
|
||||
|
||||
## issues
|
||||
JIRA issues related to this component can be found at
|
||||
https://issues.apache.org/jira/browse/OFBIZ/component/12311644
|
||||
## Features
|
||||
|
||||
Asset registration
|
||||
Maintenance planning
|
||||
Depreciation calculation and registration
|
||||
Meter registrations
|
||||
Allocation registration
|
||||
|
||||
## commits
|
||||
Committed revisions can be viewed at
|
||||
http://svn.apache.org/viewvc/ofbiz/trunk/plugins/assetmaint/
|
||||
@@ -155,16 +155,6 @@
|
||||
<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>
|
||||
@@ -176,16 +166,6 @@
|
||||
<value xml:lang="zh">查找维修保养</value>
|
||||
<value xml:lang="zh-TW">尋找維修保養</value>
|
||||
</property>
|
||||
<property key="PageTitleFindFixedAssets">
|
||||
<value xml:lang="en">Find Equipments</value>
|
||||
<value xml:lang="fr">Chercher des équipements</value>
|
||||
<value xml:lang="it">Ricerca cespite</value>
|
||||
<value xml:lang="ja">設備を検索</value>
|
||||
<value xml:lang="th">ค้นหาเครื่องมือ</value>
|
||||
<value xml:lang="vi">Tìm Thiết bị</value>
|
||||
<value xml:lang="zh">查找设备</value>
|
||||
<value xml:lang="zh-TW">尋找設備</value>
|
||||
</property>
|
||||
<property key="PageTitleListItemIssuance">
|
||||
<value xml:lang="en">Parts List</value>
|
||||
<value xml:lang="fr">Liste des pièces</value>
|
||||
|
||||
@@ -28,4 +28,5 @@ 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,146 +0,0 @@
|
||||
<?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>
|
||||
@@ -44,7 +44,7 @@
|
||||
position="19"
|
||||
server="default-server"
|
||||
location="webapp/assetmaint"
|
||||
base-permission="ASSETMAINT"
|
||||
base-permission="OFBTOOLS,ASSETMAINT"
|
||||
mount-point="/assetmaint"
|
||||
app-bar-display="true"/>
|
||||
|
||||
@@ -52,9 +52,9 @@
|
||||
title="IS Mgr"
|
||||
position="20"
|
||||
server="default-server"
|
||||
app-bar-display="false"
|
||||
location="webapp/ismgr"
|
||||
base-permission="ASSETMAINT"
|
||||
mount-point="/ismgr"/>
|
||||
base-permission="OFBTOOLS,ASSETMAINT"
|
||||
mount-point="/ismgr"
|
||||
app-bar-display="true"/>
|
||||
|
||||
</ofbiz-component>
|
||||
|
||||
@@ -0,0 +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
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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,31 +43,33 @@ import org.apache.ofbiz.service.ServiceUtil;
|
||||
|
||||
public class FixedAssetMaintServices {
|
||||
|
||||
public static final String module = FixedAssetMaintServices.class.getName();
|
||||
public static final String resource = "AssetMaintUiLabels";
|
||||
private static final String MODULE = FixedAssetMaintServices.class.getName();
|
||||
private static final String RESOURCE = "AssetMaintUiLabels";
|
||||
|
||||
public static Map<String, Object> addPartFixedAssetMaint(DispatchContext ctx, Map<String, Object> context) {
|
||||
LocalDispatcher dispatcher = ctx.getDispatcher();
|
||||
Delegator delegator = ctx.getDelegator();
|
||||
Locale locale = (Locale) context.get("locale");
|
||||
String fixedAssetId = (String)context.get("fixedAssetId");
|
||||
String maintHistSeqId = (String)context.get("maintHistSeqId");
|
||||
String productId = (String)context.get("productId");
|
||||
String facilityId = (String)context.get("facilityId");
|
||||
Double quantity = (Double)context.get("quantity");
|
||||
String fixedAssetId = (String) context.get("fixedAssetId");
|
||||
String maintHistSeqId = (String) context.get("maintHistSeqId");
|
||||
String productId = (String) context.get("productId");
|
||||
String facilityId = (String) context.get("facilityId");
|
||||
Double quantity = (Double) context.get("quantity");
|
||||
double requestedQty = quantity;
|
||||
|
||||
try {
|
||||
GenericValue product = ProductWorker.findProduct(delegator, productId);
|
||||
if (product == null) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AssetMaintInvalidPartProductIdError", UtilMisc.toMap("productId", productId), locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AssetMaintInvalidPartProductIdError", UtilMisc.toMap(
|
||||
"productId", productId), locale));
|
||||
}
|
||||
Map<String, ? extends Object> findCurrInventoryParams = UtilMisc.toMap("productId", productId, "facilityId", facilityId);
|
||||
Map<String, ? extends Object> findCurrInventoryParams = UtilMisc.toMap("productId", productId, "facilityId", facilityId);
|
||||
GenericValue userLogin = (GenericValue) context.get("userLogin");
|
||||
// Call issuance service
|
||||
Map<String, Object> result = dispatcher.runSync("getInventoryAvailableByFacility", findCurrInventoryParams);
|
||||
if (ServiceUtil.isError(result)) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AssetMaintProblemGettingInventoryLevel", locale) + productId , null, null, result);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AssetMaintProblemGettingInventoryLevel", locale) + productId,
|
||||
null, null, result);
|
||||
}
|
||||
Object atpObj = result.get("availableToPromiseTotal");
|
||||
double atp = 0.0;
|
||||
@@ -75,14 +77,16 @@ 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();
|
||||
@@ -95,24 +99,25 @@ public class FixedAssetMaintServices {
|
||||
} else {
|
||||
issueQuantity = requestedQty;
|
||||
}
|
||||
Map<String, Object> itemIssuanceCtx = new HashMap<String, Object>();
|
||||
Map<String, Object> itemIssuanceCtx = new HashMap<>();
|
||||
itemIssuanceCtx.put("userLogin", userLogin);
|
||||
itemIssuanceCtx.put("inventoryItemId", inventoryItemId);
|
||||
itemIssuanceCtx.put("fixedAssetId", fixedAssetId);
|
||||
itemIssuanceCtx.put("maintHistSeqId", maintHistSeqId);
|
||||
itemIssuanceCtx.put("quantity", issueQuantity);
|
||||
// Call issuance service
|
||||
result = dispatcher.runSync("issueInventoryItemToFixedAssetMaint",itemIssuanceCtx);
|
||||
result = dispatcher.runSync("issueInventoryItemToFixedAssetMaint", itemIssuanceCtx);
|
||||
if (ServiceUtil.isError(result)) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AssetMaintProblemCallingService", locale), null, null, result);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AssetMaintProblemCallingService", locale), null, null,
|
||||
result);
|
||||
}
|
||||
requestedQty = requestedQty - issueQuantity;
|
||||
}
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logError("Problem in retriving data from database", module);
|
||||
Debug.logError("Problem in retriving data from database", MODULE);
|
||||
} catch (GenericServiceException e) {
|
||||
Debug.logError("Problem in calling service issueInventoryItemToFixedAssetMaint", module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AssetMaintProblemCallingService", locale));
|
||||
Debug.logError("Problem in calling service issueInventoryItemToFixedAssetMaint", MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AssetMaintProblemCallingService", locale));
|
||||
}
|
||||
return ServiceUtil.returnSuccess();
|
||||
}
|
||||
|
||||
@@ -222,8 +222,7 @@ 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>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
|
||||
|
||||
<test-case case-name="assetmaint-tests">
|
||||
<simple-method-test location="component://assetmaint/minilang/test/FixedAssetMaintTests.xml"/>
|
||||
<junit-test-suite class-name="org.apache.ofbiz.assetmaint.test.FixedAssetMaintTests"/>
|
||||
</test-case>
|
||||
|
||||
</test-suite>
|
||||
|
||||
@@ -112,10 +112,6 @@
|
||||
<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,53 +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.
|
||||
--%>
|
||||
|
||||
<%@ 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>
|
||||
@@ -107,10 +107,6 @@
|
||||
<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,53 +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.
|
||||
--%>
|
||||
|
||||
<%@ 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>
|
||||
@@ -39,6 +39,7 @@ 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"/>
|
||||
@@ -138,6 +139,6 @@ under the License.
|
||||
</widgets>
|
||||
</section>
|
||||
</screen>
|
||||
|
||||
|
||||
</screens>
|
||||
|
||||
|
||||
@@ -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}" style="buttontext"/>
|
||||
<link target="ViewFacilityInventoryByProductExport?${searchParameterString}" text="${uiLabelMap.CommonExport}" style="buttontext"/>
|
||||
<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"/>
|
||||
</container>
|
||||
|
||||
<include-form name="FindFacilityInventoryByProduct" location="component://product/widget/facility/FacilityForms.xml"/>
|
||||
|
||||
@@ -34,6 +34,7 @@ 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,
|
||||
|
||||
@@ -24,6 +24,7 @@ under the License.
|
||||
<!-- ========================================================= -->
|
||||
<!-- Dimensions -->
|
||||
<!-- ========================================================= -->
|
||||
<entity-group group="org.apache.ofbiz.olap" entity="CountryDimension"/>
|
||||
<entity-group group="org.apache.ofbiz.olap" entity="CurrencyDimension"/>
|
||||
<entity-group group="org.apache.ofbiz.olap" entity="DateDimension"/>
|
||||
<entity-group group="org.apache.ofbiz.olap" entity="ProductDimension"/>
|
||||
|
||||
@@ -29,6 +29,31 @@ 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">
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,664 @@
|
||||
/*
|
||||
* 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()
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,761 +0,0 @@
|
||||
<?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("yyyy-MM-dd 07:00:00.000");
|
||||
def yesterday = sdf.format(nowDate-1);
|
||||
return yesterday;
|
||||
}" type="Timestamp"/>
|
||||
<set field="today" value="${groovy:
|
||||
import java.text.SimpleDateFormat;
|
||||
def sdf = new SimpleDateFormat("yyyy-MM-dd 07:00:00.000");
|
||||
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>
|
||||
@@ -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="simple"
|
||||
location="component://bi/minilang/DimensionServices.xml" invoke="quickInitDataWarehouse">
|
||||
<service name="quickInitDataWarehouse" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/DimensionServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/DimensionServices.xml" invoke="loadCurrencyDimension">
|
||||
<service name="loadCurrencyDimension" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/DimensionServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/DimensionServices.xml" invoke="prepareProductDimensionData">
|
||||
<service name="prepareProductDimensionData" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/DimensionServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/DimensionServices.xml" invoke="loadProductInProductDimension">
|
||||
<service name="loadProductInProductDimension" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/DimensionServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/DimensionServices.xml" invoke="loadProductInProductDimension">
|
||||
<service name="loadType1ProductInProductDimension" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/DimensionServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/DimensionServices.xml" invoke="loadProductInProductDimension">
|
||||
<service name="loadType2ProductInProductDimension" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/DimensionServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/DimensionServices.xml" invoke="loadAllProductsInProductDimension">
|
||||
<service name="loadAllProductsInProductDimension" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/DimensionServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/FactServices.xml" invoke="loadSalesInvoiceItemFact">
|
||||
<service name="loadSalesInvoiceItemFact" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/FactServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/FactServices.xml" invoke="loadSalesInvoiceFact">
|
||||
<service name="loadSalesInvoiceFact" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/FactServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/FactServices.xml" invoke="loadSalesOrderItemFact">
|
||||
<service name="loadSalesOrderItemFact" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/FactServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/FactServices.xml" invoke="loadSalesOrderFact">
|
||||
<service name="loadSalesOrderFact" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/FactServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/FactServices.xml" invoke="loadSalesOrderDataDaily" transaction-timeout="10000000">
|
||||
<service name="loadSalesOrderDataDaily" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/FactServices.groovy" invoke="loadSalesOrderDataDaily" transaction-timeout="10000000">
|
||||
<description>Load Sales Order Data Daily.</description>
|
||||
</service>
|
||||
<service name="importSalesOrderData" auth="true" engine="simple"
|
||||
location="component://bi/minilang/FactServices.xml" invoke="importSalesOrderData" transaction-timeout="10000000">
|
||||
<service name="importSalesOrderData" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/FactServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/FactServices.xml" invoke="convertUomCurrency">
|
||||
<service name="convertUomCurrency" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/FactServices.groovy" 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="simple"
|
||||
location="component://bi/minilang/FactServices.xml" invoke="loadInventoryFact">
|
||||
<service name="loadInventoryFact" auth="true" engine="groovy"
|
||||
location="component://bi/groovyScripts/FactServices.groovy" invoke="loadInventoryFact">
|
||||
<attribute name="inventoryItemId" type="String" mode="IN" optional="true"/>
|
||||
</service>
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ 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;
|
||||
@@ -41,8 +39,8 @@ import org.apache.ofbiz.service.ServiceUtil;
|
||||
|
||||
public class DimensionServices {
|
||||
|
||||
public static final String module = DimensionServices.class.getName();
|
||||
public static final String resource = "BiUiLabels";
|
||||
private static final String MODULE = DimensionServices.class.getName();
|
||||
private static final String RESOURCE = "BiUiLabels";
|
||||
|
||||
public static Map<String, Object> getDimensionIdFromNaturalKey(DispatchContext ctx, Map<String, ? extends Object> context) {
|
||||
Map<String, Object> resultMap = ServiceUtil.returnSuccess();
|
||||
@@ -65,7 +63,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.checkList(context.get("naturalKeyFields"), String.class);
|
||||
List<String> naturalKeyFields = UtilGenerics.checkCollection(context.get("naturalKeyFields"), String.class);
|
||||
String updateMode = (String) context.get("updateMode");
|
||||
Locale locale = (Locale) context.get("locale");
|
||||
|
||||
@@ -75,7 +73,8 @@ 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 {
|
||||
@@ -99,7 +98,8 @@ 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));
|
||||
|
||||
|
||||
@@ -92,10 +92,6 @@
|
||||
<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>
|
||||
|
||||
@@ -33,6 +33,7 @@ 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"/>
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
 And
|
||||

|
||||

|
||||
# 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,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<entity-engine-xml>
|
||||
<DataResource dataResourceId="HELP_BIRT" localeString="en" dataResourceTypeId="OFBIZ_FILE"
|
||||
objectInfo="plugins/birt/data/helpdata/HELP_BIRT.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS"
|
||||
dataResourceName="BIRT" mimeTypeId="text/xml" isPublic="Y" />
|
||||
<Content contentId="HELP_BIRT" contentTypeId="DOCUMENT" contentName="BIRT Overview" templateDataResourceId="HELP_TEMPL"
|
||||
dataResourceId="HELP_BIRT" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>
|
||||
<ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_BIRT" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" mapKey="BIRT_main"/>
|
||||
</entity-engine-xml>
|
||||
@@ -18,12 +18,6 @@
|
||||
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"/>
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
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
|
||||
@@ -17,14 +17,10 @@
|
||||
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>Project help</title>
|
||||
<section>
|
||||
<para>
|
||||
This screen displays Informations of the project. There are sprint, member and other.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
<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"/>
|
||||
</entity-engine-xml>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?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,87 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<chapter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0"
|
||||
xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xsi:schemaLocation="http://docbook.org/ns/docbook ../../applications/content/dtd/docbook.xsd"
|
||||
xmlns="http://docbook.org/ns/docbook">
|
||||
<title>BIRT report generator.</title>
|
||||
<para> An example report sales can be found in the example component. </para>
|
||||
<para>
|
||||
<xi:include href="../../../plugins/birt/data/helpdata/HELP_BIRT.xml"/>
|
||||
</para>
|
||||
</chapter>
|
||||
@@ -17,8 +17,6 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
def module = "AcctgTransEntriesSearchResultsParameters.groovy"
|
||||
|
||||
try {
|
||||
def birtParameters = [:]
|
||||
birtParameters.organizationPartyId = parameters.organizationPartyId
|
||||
@@ -43,6 +41,6 @@ try {
|
||||
birtParameters.userLoginId = userLogin.userLoginId
|
||||
request.setAttribute("birtParameters", birtParameters)
|
||||
} catch (e) {
|
||||
Debug.logError(e, module)
|
||||
logError(e)
|
||||
}
|
||||
return "success";
|
||||
@@ -18,9 +18,6 @@
|
||||
*/
|
||||
|
||||
import java.sql.Timestamp
|
||||
import org.apache.ofbiz.base.util.Debug
|
||||
|
||||
def module = "BalanceSheetParameters.groovy"
|
||||
|
||||
try {
|
||||
def birtParameters = [:]
|
||||
@@ -36,6 +33,6 @@ try {
|
||||
birtParameters.locale = locale
|
||||
request.setAttribute("birtParameters", birtParameters)
|
||||
} catch (e) {
|
||||
Debug.logError(e, module)
|
||||
logError(e)
|
||||
}
|
||||
return "success";
|
||||
@@ -18,9 +18,6 @@
|
||||
*/
|
||||
|
||||
import java.sql.Timestamp
|
||||
import org.apache.ofbiz.base.util.Debug
|
||||
|
||||
def module = "IncomeStatementParameters.groovy"
|
||||
|
||||
try {
|
||||
def birtParameters = [:]
|
||||
@@ -35,6 +32,6 @@ try {
|
||||
birtParameters.userLoginId = userLogin.userLoginId
|
||||
request.setAttribute("birtParameters", birtParameters)
|
||||
} catch (e) {
|
||||
Debug.logError(e, module)
|
||||
logError(e)
|
||||
}
|
||||
return "success";
|
||||
@@ -17,14 +17,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
def module = "InvoiceAcctgTransEntryParameters.groovy"
|
||||
|
||||
try {
|
||||
birtParameters = [:]
|
||||
birtParameters.invoiceId = parameters.invoiceId
|
||||
birtParameters.userLoginId = userLogin.userLoginId
|
||||
request.setAttribute("birtParameters", birtParameters)
|
||||
} catch (e) {
|
||||
Debug.logError(e, module)
|
||||
logError(e)
|
||||
}
|
||||
return "success";
|
||||
@@ -17,14 +17,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
def module = "PaymentAcctgTransEntryParameters.groovy"
|
||||
|
||||
try {
|
||||
birtParameters = [:]
|
||||
birtParameters.paymentId = parameters.paymentId
|
||||
birtParameters.userLoginId = userLogin.userLoginId
|
||||
request.setAttribute("birtParameters", birtParameters)
|
||||
} catch (e) {
|
||||
Debug.logError(e, module)
|
||||
logError(e)
|
||||
}
|
||||
return "success";
|
||||
@@ -17,8 +17,6 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
def module = "TrialBalanceParameters.groovy"
|
||||
|
||||
try {
|
||||
def birtParameters = [:]
|
||||
birtParameters.organizationPartyId = parameters.organizationPartyId
|
||||
@@ -26,6 +24,6 @@ try {
|
||||
birtParameters.userLoginId = userLogin.userLoginId
|
||||
request.setAttribute("birtParameters", birtParameters)
|
||||
} catch (e) {
|
||||
Debug.logError(e, module)
|
||||
logError(e)
|
||||
}
|
||||
return "success";
|
||||
@@ -22,17 +22,17 @@ import org.apache.ofbiz.base.util.UtilValidate
|
||||
reportBy = parameters.reportBy
|
||||
exportType = parameters.exportType
|
||||
|
||||
if (UtilValidate.isEmpty(parameters.fromDate)) {
|
||||
if (!parameters.fromDate) {
|
||||
request.setAttribute("_ERROR_MESSAGE_", "Please select From Date.")
|
||||
return "error"
|
||||
}
|
||||
|
||||
if (exportType == "pdf") {
|
||||
if (reportBy == "day") {
|
||||
if ("pdf" == exportType) {
|
||||
if ("day" == reportBy) {
|
||||
return "dayPDF"
|
||||
} else if (reportBy == "week") {
|
||||
} else if ("week" == reportBy) {
|
||||
return "weekPDF"
|
||||
} else if (reportBy == "month") {
|
||||
} else if ("month" == reportBy) {
|
||||
return "monthPDF"
|
||||
} else {
|
||||
request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.")
|
||||
@@ -40,12 +40,12 @@ if (exportType == "pdf") {
|
||||
}
|
||||
}
|
||||
|
||||
if (exportType == "excel") {
|
||||
if (reportBy == "day") {
|
||||
if ("excel" == exportType) {
|
||||
if ("day" == reportBy) {
|
||||
return "dayExcel"
|
||||
} else if (reportBy == "week") {
|
||||
} else if ("week" == reportBy) {
|
||||
return "weekExcel"
|
||||
} else if (reportBy == "month") {
|
||||
} else if ("month" == reportBy) {
|
||||
return "monthExcel"
|
||||
} else {
|
||||
request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.")
|
||||
@@ -53,12 +53,12 @@ if (exportType == "excel") {
|
||||
}
|
||||
}
|
||||
|
||||
if (exportType == "html") {
|
||||
if (reportBy == "day") {
|
||||
if ("html" == exportType) {
|
||||
if ("day" == reportBy) {
|
||||
return "dayHTML"
|
||||
} else if (reportBy == "week") {
|
||||
} else if ("week" == reportBy) {
|
||||
return "weekHTML"
|
||||
} else if (reportBy == "month") {
|
||||
} else if ("month"== reportBy) {
|
||||
return "monthHTML"
|
||||
} else {
|
||||
request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.")
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* 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.*
|
||||
|
||||
@@ -27,11 +26,11 @@ DateDay = DateStr.substring(0,10)
|
||||
DateMonth = DateStr.substring(5,7)
|
||||
DateYear = DateStr.substring(0,4)
|
||||
|
||||
if (DateMonth == "01"||DateMonth == "03"||DateMonth == "05"||DateMonth == "07"||DateMonth == "08"||DateMonth == "10"||DateMonth == "12")
|
||||
if ("01" == DateMonth||"03" == DateMonth||"05" == DateMonth||"07" == DateMonth||"08" == DateMonth||"10" == DateMonth||"12" == DateMonth)
|
||||
{
|
||||
NunberDate = 31
|
||||
}
|
||||
else if (DateMonth == "02")
|
||||
else if ("02" == DateMonth)
|
||||
{
|
||||
NunberDate = 29
|
||||
}
|
||||
@@ -48,7 +47,7 @@ try {
|
||||
birtParameters.DateYear = DateYear
|
||||
birtParameters.NunberDate = NunberDate
|
||||
} catch (e) {
|
||||
Debug.logError(e, "")
|
||||
logError(e)
|
||||
}
|
||||
|
||||
request.setAttribute("birtParameters", birtParameters)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* 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
|
||||
@@ -33,7 +32,7 @@ try
|
||||
birtParameters.Week = Week
|
||||
birtParameters.Year = Year
|
||||
} catch (e) {
|
||||
Debug.logError(e, "")
|
||||
logError(e)
|
||||
}
|
||||
|
||||
request.setAttribute("birtParameters", birtParameters)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.apache.ofbiz.base.util.Debug
|
||||
import java.sql.*
|
||||
|
||||
fromDateStr = parameters.fromDate
|
||||
@@ -36,7 +35,7 @@ try {
|
||||
birtParameters.thruMonth = month
|
||||
birtParameters.thisYear = year
|
||||
} catch (e) {
|
||||
Debug.logError(e, "")
|
||||
logError(e)
|
||||
}
|
||||
|
||||
request.setAttribute("birtParameters", birtParameters)
|
||||
|
||||
@@ -25,7 +25,6 @@ under the License.
|
||||
|
||||
|
||||
<classpath type="dir" location="config"/>
|
||||
<entity-resource type="data" reader-name="seed" loader="main" location="data/BirtHelpData.xml"/>
|
||||
<entity-resource type="data" reader-name="seed" loader="main" location="data/BirtTypeData.xml"/>
|
||||
<entity-resource type="data" reader-name="seed" loader="main" location="data/OrderPortletData.xml"/>
|
||||
<entity-resource type="data" reader-name="demo" loader="main" location="data/BirtSecurityGroupDemoData.xml"/>
|
||||
@@ -36,7 +35,6 @@ under the License.
|
||||
<entity-resource type="data" reader-name="demo" loader="main" location="data/example/ExampleSecurityGroupDemoData.xml"/>
|
||||
<entity-resource type="data" reader-name="seed" loader="main" location="data/example/ExamplePortletData.xml"/>
|
||||
<entity-resource type="data" reader-name="seed" loader="main" location="data/example/ExamplePortalSeedData.xml"/>
|
||||
<entity-resource type="data" reader-name="seed" loader="main" location="data/example/ExampleHelpData.xml"/>
|
||||
<entity-resource type="data" reader-name="demo" loader="main" location="data/example/ExampleDemoData.xml"/>
|
||||
|
||||
<entity-resource type="model" reader-name="main" loader="main" location="entitydef/ServiceReportsView.xml"/>
|
||||
|
||||
@@ -1,21 +1,37 @@
|
||||
=== Report creation
|
||||
////
|
||||
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
|
||||
|
||||
==== Introduction
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
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.
|
||||
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
|
||||
|
||||
==== Pre-requisite
|
||||
==== Introduction
|
||||
|
||||
* OFBiz framework
|
||||
* The Birt plugin
|
||||
* The BIRT Report Designer: <<#_using_the_birt_report_designer,Using the Birt Report Designer>>
|
||||
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
|
||||
* OFBiz framework
|
||||
* The Birt plugin
|
||||
* The BIRT Report Designer: <<#_using_the_birt_report_designer,Using the Birt Report Designer>>
|
||||
|
||||
. Get to Birt component in OFBiz image:Birt-Menus.png[Birt menus]
|
||||
==== How to do
|
||||
. 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]
|
||||
@@ -24,54 +40,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
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
////
|
||||
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,21 +1,37 @@
|
||||
=== Using a flexible report
|
||||
////
|
||||
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
|
||||
|
||||
==== Introduction
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
NOTE: this feature will be officially available with the R17.12 branch first release
|
||||
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
|
||||
|
||||
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.
|
||||
==== Introduction
|
||||
|
||||
==== Pre-requisite
|
||||
NOTE: this feature will be officially available with the R17.12 branch first release
|
||||
|
||||
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,12 +1,30 @@
|
||||
////
|
||||
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
|
||||
@@ -15,19 +33,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>
|
||||
----
|
||||
[start=3]
|
||||
. Add the informations about this Master in the database using the file
|
||||
plugins/birt/data/BirtMasterData.xml
|
||||
|
||||
. 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" />
|
||||
@@ -42,13 +60,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.
|
||||
[start=4]
|
||||
. Add in the file content/config/contentEntityLabels.xml the Property that will allow translation
|
||||
. 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">
|
||||
@@ -60,41 +78,48 @@ 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">
|
||||
@@ -104,9 +129,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.
|
||||
|
||||
. 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"/>
|
||||
@@ -125,10 +150,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,71 +1,89 @@
|
||||
=== Using the Birt Report Designer
|
||||
////
|
||||
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
|
||||
|
||||
==== Introduction
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
NOTE: this feature will be officially available with the R17.12 branch first release
|
||||
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
|
||||
|
||||
The creation of a flexible report goes through a design step of the initial flexible report output under the Birt Report
|
||||
Designer.
|
||||
==== Introduction
|
||||
|
||||
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.
|
||||
NOTE: this feature will be officially available with the R17.12 branch first release
|
||||
|
||||
==== Installing the BIRT Report Designer
|
||||
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 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.
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
==== Different areas of the screen and their role
|
||||
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.
|
||||
|
||||
===== Navigator - Report Builder
|
||||
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...
|
||||
|
||||
This is where you should find the .rptdesign files you downloaded.
|
||||
==== Different areas of the screen and their role
|
||||
|
||||
image::Report-Builder.png[Report Builder]
|
||||
===== Navigator - Report Builder
|
||||
|
||||
===== Data Explorer
|
||||
This is where you should find the .rptdesign files you downloaded.
|
||||
|
||||
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.
|
||||
image::Report-Builder.png[Report Builder]
|
||||
|
||||
image::Data-Explorer.png[Data Explorer]
|
||||
===== Data Explorer
|
||||
|
||||
===== Palette
|
||||
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.
|
||||
|
||||
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.
|
||||
image::Data-Explorer.png[Data Explorer]
|
||||
|
||||
image::Palette.png[Palette]
|
||||
===== Palette
|
||||
|
||||
===== Tabs
|
||||
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.
|
||||
|
||||
At the right bottom of the window is a series of five tabs.
|
||||
image::Palette.png[Palette]
|
||||
|
||||
We will use two:
|
||||
===== Tabs
|
||||
|
||||
At the right bottom of the window is a series of five tabs.
|
||||
|
||||
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
|
||||
@@ -77,40 +95,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, ...).
|
||||
|
||||
|
||||
@@ -16,27 +16,36 @@ KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
////
|
||||
= Birt Apache OFBiz® plugin
|
||||
= Birt OFBiz® plugin
|
||||
The Apache OFBiz Project
|
||||
Release 17.12
|
||||
:imagesdir: ./images
|
||||
ifdef::backend-pdf[]
|
||||
:title-logo-image: image::OFBiz-Logo.svg[Apache OFBiz Logo, pdfwidth=4.25in, align=center]
|
||||
:title-logo-image: image::images/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 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]
|
||||
There is an announce with some history in the OFBiz blog:
|
||||
https://blogs.apache.org/ofbiz/entry/the-birt-flexible-reports-a[Reporting in Apache OFBiz® and the OFBiz Flexible Reports]
|
||||
|
||||
== Technical Documentation
|
||||
include::_include/bt-creating reports.adoc[leveloffset=+0]
|
||||
|
||||
include::_include/bt-using the birt report designer.adoc[leveloffset=+0]
|
||||
|
||||
include::_include/bt-report master creation.adoc[leveloffset=+0]
|
||||
|
||||
== User documentation
|
||||
include::_include/bt-how to use flexible reports.adoc[leveloffset=+0]
|
||||
|
||||
|
||||
include::_include/bt-help.adoc[leveloffset=+1]
|
||||
|
||||
=== 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 {
|
||||
|
||||
public final static String module = BirtFactory.class.getName();
|
||||
private static final String MODULE = BirtFactory.class.getName();
|
||||
|
||||
private static IReportEngine engine;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class BirtFactory {
|
||||
* @throws ParserConfigurationException
|
||||
*/
|
||||
public static InputStream getReportInputStreamFromLocation(String resourceName)
|
||||
throws IOException, SAXException, ParserConfigurationException{
|
||||
throws IOException, SAXException, ParserConfigurationException {
|
||||
|
||||
InputStream reportInputStream = null;
|
||||
synchronized (BirtFactory.class) {
|
||||
@@ -81,8 +81,8 @@ public class BirtFactory {
|
||||
throw new IllegalArgumentException("Could not resolve location to URL: " + resourceName);
|
||||
}
|
||||
reportInputStream = reportFileUrl.openStream();
|
||||
double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0;
|
||||
Debug.logInfo("Got report in " + totalSeconds + "s from: " + reportFileUrl.toExternalForm(), module);
|
||||
double totalSeconds = (System.currentTimeMillis() - startTime) / 1000.0;
|
||||
Debug.logInfo("Got report in " + totalSeconds + "s from: " + reportFileUrl.toExternalForm(), MODULE);
|
||||
}
|
||||
|
||||
if (reportInputStream == null) {
|
||||
|
||||
@@ -61,29 +61,29 @@ import org.eclipse.birt.report.engine.api.RenderOption;
|
||||
|
||||
public final class BirtWorker {
|
||||
|
||||
public final static String module = BirtWorker.class.getName();
|
||||
private static final String MODULE = BirtWorker.class.getName();
|
||||
|
||||
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 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 HTMLServerImageHandler imageHandler = new HTMLServerImageHandler();
|
||||
private static final HTMLServerImageHandler IMAGE_HANDLER = new HTMLServerImageHandler();
|
||||
|
||||
private BirtWorker() {}
|
||||
private BirtWorker() { }
|
||||
|
||||
private static final Map<Integer, Level> levelIntMap = new HashMap<>();
|
||||
private static final Map<Integer, Level> LEVEL_INT_MAP = new HashMap<>();
|
||||
static {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,19 +110,19 @@ public final class BirtWorker {
|
||||
if (birtImageDirectory == null) {
|
||||
birtImageDirectory = "/";
|
||||
}
|
||||
Debug.logInfo("Get report engine", module);
|
||||
Debug.logInfo("Get report engine", MODULE);
|
||||
IReportEngine engine = BirtFactory.getReportEngine();
|
||||
|
||||
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
|
||||
if (birtLocale != null) {
|
||||
Debug.logInfo("Set BIRT locale:" + birtLocale, module);
|
||||
Debug.logInfo("Set BIRT locale:" + birtLocale, MODULE);
|
||||
task.setLocale(birtLocale);
|
||||
}
|
||||
|
||||
// set parameters if exists
|
||||
Map<String, Object> parameters = UtilGenerics.cast(context.get(BirtWorker.getBirtParameters()));
|
||||
if (parameters != null) {
|
||||
//Debug.logInfo("Set BIRT parameters:" + parameters, module);
|
||||
//Debug.logInfo("Set BIRT parameters:" + parameters, MODULE);
|
||||
task.setParameterValues(parameters);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public final class BirtWorker {
|
||||
HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
|
||||
htmlOptions.setImageDirectory(birtImageDirectory);
|
||||
htmlOptions.setBaseImageURL(birtImageDirectory);
|
||||
options.setImageHandler(imageHandler);
|
||||
options.setImageHandler(IMAGE_HANDLER);
|
||||
} else if ("application/pdf".equals(contentType)) { // PDF
|
||||
PDFRenderOption pdfOptions = new PDFRenderOption(options);
|
||||
pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, Boolean.TRUE);
|
||||
@@ -151,8 +151,8 @@ public final class BirtWorker {
|
||||
|
||||
// run report
|
||||
if (Debug.infoOn()) {
|
||||
Debug.logInfo("BIRT's locale is: " + task.getLocale(), module);
|
||||
Debug.logInfo("Run report's task", module);
|
||||
Debug.logInfo("BIRT's locale is: " + task.getLocale(), MODULE);
|
||||
Debug.logInfo("Run report's task", MODULE);
|
||||
}
|
||||
task.run();
|
||||
task.close();
|
||||
@@ -165,7 +165,7 @@ public final class BirtWorker {
|
||||
* @param response
|
||||
*/
|
||||
public static void setWebContextObjects(Map<String, Object> appContext, HttpServletRequest request, HttpServletResponse response)
|
||||
throws GeneralException {
|
||||
throws GeneralException {
|
||||
HttpSession session = request.getSession();
|
||||
ServletContext servletContext = session.getServletContext();
|
||||
|
||||
@@ -181,23 +181,23 @@ public final class BirtWorker {
|
||||
appContext.put("dispatcher", WebAppUtil.getDispatcher(servletContext));
|
||||
}
|
||||
|
||||
public static String getBirtParameters () {
|
||||
public static String getBirtParameters() {
|
||||
return BIRT_PARAMETERS;
|
||||
}
|
||||
|
||||
public static String getBirtLocale () {
|
||||
public static String getBirtLocale() {
|
||||
return BIRT_LOCALE;
|
||||
}
|
||||
|
||||
public static String getBirtImageDirectory () {
|
||||
public static String getBirtImageDirectory() {
|
||||
return BIRT_IMAGE_DIRECTORY;
|
||||
}
|
||||
|
||||
public static String getBirtContentType () {
|
||||
public static String getBirtContentType() {
|
||||
return BIRT_CONTENT_TYPE;
|
||||
}
|
||||
|
||||
public static String getBirtOutputFileName () {
|
||||
public static String getBirtOutputFileName() {
|
||||
return BIRT_OUTPUT_FILE_NAME;
|
||||
}
|
||||
|
||||
@@ -231,12 +231,12 @@ public final class BirtWorker {
|
||||
EntityCondition entityConditionRpt = EntityCondition.makeCondition("contentTypeId", "RPTDESIGN");
|
||||
String templatePathLocation = BirtUtil.resolveTemplatePathLocation();
|
||||
File templatePathLocationDir = new File(templatePathLocation);
|
||||
if (!templatePathLocationDir.exists()) {
|
||||
boolean created = templatePathLocationDir.mkdirs();
|
||||
if (!created) {
|
||||
throw new GeneralException(UtilProperties.getMessage(resourceError, "BirtErrorCannotLocateReportFolder", locale));
|
||||
}
|
||||
if (!templatePathLocationDir.exists()) {
|
||||
boolean created = templatePathLocationDir.mkdirs();
|
||||
if (!created) {
|
||||
throw new GeneralException(UtilProperties.getMessage(RES_ERROR, "BirtErrorCannotLocateReportFolder", locale));
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
String templateFileLocation = null;
|
||||
EntityCondition ecl = null;
|
||||
@@ -252,7 +252,8 @@ 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));
|
||||
}
|
||||
@@ -272,15 +273,18 @@ public final class BirtWorker {
|
||||
|
||||
//create content and dataressource strucutre
|
||||
Map<String, Object> result = null;
|
||||
result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceId, "dataResourceTypeId", "ELECTRONIC_TEXT", "dataTemplateTypeId", "FORM_COMBINED", "userLogin", userLogin));
|
||||
result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceId, "dataResourceTypeId", "ELECTRONIC_TEXT",
|
||||
"dataTemplateTypeId", "FORM_COMBINED", "userLogin", userLogin));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
throw new GeneralException(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
result = dispatcher.runSync("createElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", reportForm, "userLogin", userLogin));
|
||||
result = dispatcher.runSync("createElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", reportForm, "userLogin",
|
||||
userLogin));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
throw new GeneralException(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentId, "contentTypeId", "FLEXIBLE_REPORT", "dataResourceId", dataResourceId, "statusId", "CTNT_IN_PROGRESS", "contentName", reportName, "description", description, "userLogin", userLogin));
|
||||
result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentId, "contentTypeId", "FLEXIBLE_REPORT", "dataResourceId",
|
||||
dataResourceId, "statusId", "CTNT_IN_PROGRESS", "contentName", reportName, "description", description, "userLogin", userLogin));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
throw new GeneralException(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
@@ -290,23 +294,29 @@ public final class BirtWorker {
|
||||
if (!rptDesignName.endsWith(".rptdesign")) {
|
||||
rptDesignName = rptDesignName.concat(".rptdesign");
|
||||
}
|
||||
result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceIdRpt, "dataResourceTypeId", "LOCAL_FILE", "mimeTypeId", "text/rptdesign", "dataResourceName", rptDesignName, "objectInfo", templateFileLocation, "userLogin", userLogin));
|
||||
result = dispatcher.runSync("createDataResource", UtilMisc.toMap("dataResourceId", dataResourceIdRpt, "dataResourceTypeId", "LOCAL_FILE",
|
||||
"mimeTypeId", "text/rptdesign", "dataResourceName", rptDesignName, "objectInfo", templateFileLocation, "userLogin", userLogin));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
throw new GeneralException(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentIdRpt, "contentTypeId", "RPTDESIGN", "dataResourceId", dataResourceIdRpt, "statusId", "CTNT_PUBLISHED", "contentName", reportName, "description", description + " (.rptDesign file)", "userLogin", userLogin));
|
||||
result = dispatcher.runSync("createContent", UtilMisc.toMap("contentId", contentIdRpt, "contentTypeId", "RPTDESIGN", "dataResourceId",
|
||||
dataResourceIdRpt, "statusId", "CTNT_PUBLISHED", "contentName", reportName, "description", description + " (.rptDesign file)",
|
||||
"userLogin", userLogin));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
throw new GeneralException(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", masterContentId, "contentIdTo", contentId, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
|
||||
result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", masterContentId, "contentIdTo", contentId,
|
||||
"contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
throw new GeneralException(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", contentId, "contentIdTo", contentIdRpt, "contentAssocTypeId", "SUB_CONTENT", "userLogin", userLogin));
|
||||
result = dispatcher.runSync("createContentAssoc", UtilMisc.toMap("contentId", contentId, "contentIdTo", contentIdRpt, "contentAssocTypeId",
|
||||
"SUB_CONTENT", "userLogin", userLogin));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
throw new GeneralException(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
result = dispatcher.runSync("createContentAttribute", UtilMisc.toMap("contentId", contentId, "attrName", workflowType, "attrValue", modelElementName, "userLogin", userLogin));
|
||||
result = dispatcher.runSync("createContentAttribute", UtilMisc.toMap("contentId", contentId, "attrName", workflowType, "attrValue",
|
||||
modelElementName, "userLogin", userLogin));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
throw new GeneralException(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
@@ -327,6 +337,7 @@ public final class BirtWorker {
|
||||
break;
|
||||
}
|
||||
}
|
||||
config.setLogConfig(UtilProperties.getPropertyValue("debug", "log4j.appender.css.dir", ofbizHome + "/runtime/logs/"), levelIntMap.get(lowerLevel));
|
||||
config.setLogConfig(UtilProperties.getPropertyValue("debug", "log4j.appender.css.dir", ofbizHome + "/runtime/logs/"),
|
||||
LEVEL_INT_MAP.get(lowerLevel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,9 @@ import org.apache.ofbiz.birt.BirtWorker;
|
||||
|
||||
public class BirtContainer implements Container {
|
||||
|
||||
public static final String module = BirtContainer.class.getName();
|
||||
|
||||
protected String configFile;
|
||||
private static final String MODULE = BirtContainer.class.getName();
|
||||
|
||||
private String configFile;
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
@@ -53,7 +52,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) {
|
||||
@@ -73,20 +72,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);
|
||||
|
||||
@@ -100,7 +99,7 @@ public class BirtContainer implements Container {
|
||||
formatList = supportedFormat;
|
||||
}
|
||||
}
|
||||
Debug.logInfo("BIRT supported formats: " + formatList, module);
|
||||
Debug.logInfo("BIRT supported formats: " + formatList, MODULE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,11 +63,10 @@ import freemarker.template.TemplateException;
|
||||
|
||||
public class BirtEmailServices {
|
||||
|
||||
public static final String module = BirtEmailServices.class.getName();
|
||||
public static final String resource = "BirtUiLabels";
|
||||
private static final String MODULE = BirtEmailServices.class.getName();
|
||||
private 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
|
||||
@@ -77,7 +76,6 @@ 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");
|
||||
@@ -92,7 +90,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();
|
||||
@@ -119,12 +117,14 @@ 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,20 +135,24 @@ 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);
|
||||
}
|
||||
}
|
||||
@@ -163,7 +167,7 @@ public class BirtEmailServices {
|
||||
// create the output stream for the generation
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
Map<String, Object> birtContext = new HashMap<String, Object>();
|
||||
Map<String, Object> birtContext = new HashMap<>();
|
||||
if (birtLocale == null) {
|
||||
birtLocale = locale;
|
||||
}
|
||||
@@ -182,18 +186,17 @@ 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<Map<String,? extends Object>>();
|
||||
List<Map<String, ? extends Object>> bodyParts = new LinkedList<>();
|
||||
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"));
|
||||
@@ -201,39 +204,46 @@ 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());
|
||||
@@ -254,7 +264,9 @@ 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 {
|
||||
@@ -270,8 +282,8 @@ public class BirtEmailServices {
|
||||
}
|
||||
}
|
||||
} catch (GenericServiceException e) {
|
||||
String errMsg = UtilProperties.getMessage(resource, "BirtErrorInSendingEmail", UtilMisc.toMap("errorString", e.toString()), locale);
|
||||
Debug.logError(e, errMsg, module);
|
||||
String errMsg = UtilProperties.getMessage(RESOURCE, "BirtErrorInSendingEmail", UtilMisc.toMap("errorString", e.toString()), locale);
|
||||
Debug.logError(e, errMsg, MODULE);
|
||||
return ServiceUtil.returnError(errMsg);
|
||||
}
|
||||
result.put("body", bodyWriter.toString());
|
||||
|
||||
@@ -50,30 +50,29 @@ import org.eclipse.birt.report.engine.api.script.IReportContext;
|
||||
|
||||
public class BirtMasterReportServices {
|
||||
|
||||
public static final String module = BirtServices.class.getName();
|
||||
public static final String resource = "BirtUiLabels";
|
||||
public static final String resource_error = "BirtErrorUiLabels";
|
||||
private static final String MODULE = BirtServices.class.getName();
|
||||
private static final String RESOURCE = "BirtUiLabels";
|
||||
|
||||
// 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<String, String>();
|
||||
LinkedHashMap<String, String> filterMap = new LinkedHashMap<>();
|
||||
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<String, String>();
|
||||
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<>();
|
||||
filterDisplayLabels.put("firstName", "First name");
|
||||
filterDisplayLabels.put("lastName", "Last name");
|
||||
filterDisplayLabels.put("fromDate", "From date");
|
||||
@@ -89,7 +88,7 @@ public class BirtMasterReportServices {
|
||||
public static Map<String, Object> workEffortPerPerson(DispatchContext dctx, Map<String, Object> context) {
|
||||
Delegator delegator = dctx.getDelegator();
|
||||
IReportContext reportContext = (IReportContext) context.get("reportContext");
|
||||
Map<String, Object> parameters = UtilGenerics.checkMap(reportContext.getParameterValue("parameters"));
|
||||
Map<String, Object> parameters = UtilGenerics.cast(reportContext.getParameterValue("parameters"));
|
||||
List<GenericValue> listWorkEffortTime = null;
|
||||
|
||||
if (UtilValidate.isEmpty(parameters.get("firstName")) && UtilValidate.isEmpty(parameters.get("lastName"))) {
|
||||
@@ -98,7 +97,7 @@ public class BirtMasterReportServices {
|
||||
List<GenericValue> listPersons = null;
|
||||
try {
|
||||
// TODO: translate labels
|
||||
List<EntityExpr> listConditions = new ArrayList<EntityExpr>();
|
||||
List<EntityExpr> listConditions = new ArrayList<>();
|
||||
if (UtilValidate.isNotEmpty(parameters.get("firstName"))) {
|
||||
EntityExpr conditionFirstName = EntityCondition.makeCondition("firstName", parameters.get("firstName"));
|
||||
listConditions.add(conditionFirstName);
|
||||
@@ -119,7 +118,7 @@ public class BirtMasterReportServices {
|
||||
}
|
||||
String partyId = person.getString("partyId");
|
||||
|
||||
List<EntityExpr> listConditionsWorkEffort = new ArrayList<EntityExpr>();
|
||||
List<EntityExpr> listConditionsWorkEffort = new ArrayList<>();
|
||||
Timestamp thruDate = null;
|
||||
Timestamp fromDate = null;
|
||||
if (UtilValidate.isEmpty(parameters.get("fromDate"))) {
|
||||
@@ -144,10 +143,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<GenericValue>();
|
||||
List<GenericValue> listCompiled = new ArrayList<>();
|
||||
if (UtilValidate.isNotEmpty(listWorkEffortTime)) listCompiled.addAll(listWorkEffortTime);
|
||||
if (UtilValidate.isNotEmpty(listPersons)) listCompiled.addAll(listPersons);
|
||||
Map<String, Object> result = ServiceUtil.returnSuccess();
|
||||
@@ -157,43 +156,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<String, String>();
|
||||
LinkedHashMap<String, String> filterMap = new LinkedHashMap<>();
|
||||
filterMap.put("productCategoryId", "short-varchar");
|
||||
filterMap.put("productStoreId", "short-varchar");
|
||||
filterMap.put("fromDate", "date");
|
||||
filterMap.put("thruDate", "date");
|
||||
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<String, String>();
|
||||
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<>();
|
||||
//it's better to use Label Map, maybe an improvement point !
|
||||
filterDisplayLabels.put("productCategoryId", "product Category");
|
||||
filterDisplayLabels.put("productStoreId", "product Store");
|
||||
@@ -211,11 +210,11 @@ public class BirtMasterReportServices {
|
||||
Delegator delegator = dctx.getDelegator();
|
||||
Locale locale = (Locale) context.get("locale");
|
||||
IReportContext reportContext = (IReportContext) context.get("reportContext");
|
||||
Map<String, Object> parameters = UtilGenerics.checkMap(reportContext.getParameterValue("parameters"));
|
||||
Map<String, Object> parameters = UtilGenerics.cast(reportContext.getParameterValue("parameters"));
|
||||
|
||||
List<GenericValue> listTurnOver = null;
|
||||
List<Map<String, Object>> listInvoiceEditable = new ArrayList<Map<String, Object>>();
|
||||
List<EntityCondition> listAllConditions = new ArrayList<EntityCondition>();
|
||||
List<Map<String, Object>> listInvoiceEditable = new ArrayList<>();
|
||||
List<EntityCondition> listAllConditions = new ArrayList<>();
|
||||
try {
|
||||
// treating fromDate field condition
|
||||
if (UtilValidate.isNotEmpty(parameters.get("fromDate"))) {
|
||||
@@ -237,19 +236,23 @@ public class BirtMasterReportServices {
|
||||
|
||||
// product category field condition
|
||||
if (UtilValidate.isNotEmpty(parameters.get("productCategoryId"))) {
|
||||
List<String> productCategoryList = new ArrayList<String>();
|
||||
List<String> productCategoryList = new ArrayList<>();
|
||||
if (parameters.get("productCategoryId") instanceof String) {
|
||||
String productCategoryId = (String) parameters.get("productCategoryId");
|
||||
productCategoryList.add(productCategoryId);
|
||||
} else if (parameters.get("productStoreId") instanceof String) {
|
||||
productCategoryList = UtilGenerics.checkList(parameters.get("productCategoryId"));
|
||||
productCategoryList = UtilGenerics.cast(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)))
|
||||
@@ -260,20 +263,22 @@ public class BirtMasterReportServices {
|
||||
}
|
||||
|
||||
// productStoreId condition
|
||||
List<String> productStoreList = new ArrayList<String>();
|
||||
List<String> productStoreList = new ArrayList<>();
|
||||
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.checkList(parameters.get("productStoreId"));
|
||||
productStoreList = UtilGenerics.cast(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);
|
||||
@@ -282,7 +287,8 @@ 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");
|
||||
@@ -298,11 +304,13 @@ 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
|
||||
@@ -328,16 +336,18 @@ public class BirtMasterReportServices {
|
||||
|
||||
// adding missing fields
|
||||
for (GenericValue invoice : listTurnOver) {
|
||||
Map<String, Object> invoiceEditableTemp = UtilGenerics.checkMap(invoice.clone());
|
||||
Map<String, Object> invoiceEditableTemp = UtilGenerics.cast(invoice.clone());
|
||||
invoiceEditableTemp.remove("GenericEntity");
|
||||
Map<String, Object> invoiceEditable = new HashMap<String, Object>();
|
||||
Map<String, Object> invoiceEditable = new HashMap<>();
|
||||
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)
|
||||
@@ -350,8 +360,9 @@ 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"));
|
||||
@@ -362,8 +373,8 @@ public class BirtMasterReportServices {
|
||||
listInvoiceEditable.add(invoiceEditable);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Debug.logError(e, module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "BirtErrorRetrievingTurnOver", locale));
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "BirtErrorRetrievingTurnOver", locale));
|
||||
}
|
||||
Map<String, Object> result = ServiceUtil.returnSuccess();
|
||||
result.put("records", listInvoiceEditable);
|
||||
|
||||
@@ -88,10 +88,9 @@ import com.ibm.icu.util.ULocale;
|
||||
|
||||
public class BirtServices {
|
||||
|
||||
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";
|
||||
private static final String MODULE = BirtServices.class.getName();
|
||||
private static final String RESOURCE = "BirtUiLabels";
|
||||
private static final String RES_ERROR = "BirtErrorUiLabels";
|
||||
|
||||
/**
|
||||
* Instantiate a new Flexible report, using the data given in parameters and <code>ReportDesignGenerator</code> class.
|
||||
@@ -101,13 +100,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();
|
||||
@@ -115,14 +114,15 @@ 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<String>();
|
||||
List<String> listMultiFields = new ArrayList<>();
|
||||
Delegator delegator = dctx.getDelegator();
|
||||
LocalDispatcher dispatcher = dctx.getDispatcher();
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Locale locale = (Locale) context.get("locale");
|
||||
|
||||
ModelEntity modelEntity = delegator.getModelEntity(entityViewName);
|
||||
@@ -134,18 +134,19 @@ public class BirtServices {
|
||||
String fieldType = mField.getType();
|
||||
String birtType = null;
|
||||
try {
|
||||
Map<String, Object> convertRes = dispatcher.runSync("convertFieldTypeToBirtType", UtilMisc.toMap("fieldType", fieldType, "userLogin", userLogin));
|
||||
Map<String, Object> convertRes = dispatcher.runSync("convertFieldTypeToBirtType", UtilMisc.toMap("fieldType", fieldType,
|
||||
"userLogin", userLogin));
|
||||
if (ServiceUtil.isError(convertRes)) {
|
||||
String errMsg = UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale);
|
||||
String errMsg = UtilProperties.getMessage(RES_ERROR, "BirtErrorConversionFieldToBirtFailed", locale);
|
||||
return ServiceUtil.returnError(errMsg + ServiceUtil.getErrorMessage(convertRes));
|
||||
}
|
||||
birtType = (String) convertRes.get("birtType");
|
||||
if (UtilValidate.isEmpty(birtType)) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorConversionFieldToBirtFailed", locale));
|
||||
}
|
||||
} catch (GenericServiceException e) {
|
||||
Debug.logError(e, module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale));
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_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)) {
|
||||
@@ -162,7 +163,6 @@ public class BirtServices {
|
||||
/**
|
||||
* Perform find data on given view/entity and return these into Birt compatible format.
|
||||
* This service is meant to be used as default for View/entity report design
|
||||
*
|
||||
*/
|
||||
public static Map<String, Object> callPerformFindFromBirt(DispatchContext dctx, Map<String, Object> context) {
|
||||
LocalDispatcher dispatcher = dctx.getDispatcher();
|
||||
@@ -170,38 +170,38 @@ public class BirtServices {
|
||||
Locale locale = (Locale) context.get("locale");
|
||||
GenericValue userLogin = (GenericValue) context.get("userLogin");
|
||||
String entityViewName = (String) reportContext.getParameterValue("modelElementName");
|
||||
Map<String, Object> inputFields = UtilGenerics.checkMap(reportContext.getParameterValue("parameters"));
|
||||
Map<String, Object> resultPerformFind = new HashMap<String, Object>();
|
||||
Map<String, Object> inputFields = UtilGenerics.cast(reportContext.getParameterValue("parameters"));
|
||||
Map<String, Object> resultPerformFind = new HashMap<>();
|
||||
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(resource_error, "BirtErrorEntityViewNotFound", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_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(resource_error, "BirtErrorRunningPerformFind", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorRunningPerformFind", locale));
|
||||
}
|
||||
} catch (GenericServiceException e) {
|
||||
Debug.logError(e, module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorRunningPerformFind", locale));
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorRunningPerformFind", locale));
|
||||
}
|
||||
|
||||
try (EntityListIterator listIt = (EntityListIterator) resultPerformFind.get("listIt")) {
|
||||
if (UtilValidate.isNotEmpty(listIt)) {
|
||||
list = listIt.getCompleteList();
|
||||
} else {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorRunningPerformFind", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorRunningPerformFind", locale));
|
||||
}
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logError(e, module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorRunningPerformFind", locale));
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorRunningPerformFind", locale));
|
||||
}
|
||||
resultToBirt = ServiceUtil.returnSuccess();
|
||||
resultToBirt.put("records", list);
|
||||
@@ -212,8 +212,8 @@ public class BirtServices {
|
||||
* Analyse given master and create report design from its data
|
||||
* Two cases are implemented :
|
||||
* <ul>
|
||||
* <li>Entity : data retieval is based on a simple view/entity</li>
|
||||
* <li>Service : data retrieval is based on service</li>
|
||||
* <li>Entity : data retieval is based on a simple view/entity</li>
|
||||
* <li>Service : data retrieval is based on service</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static Map<String, Object> createFlexibleReportFromMaster(DispatchContext dctx, Map<String, Object> context) {
|
||||
@@ -232,12 +232,12 @@ public class BirtServices {
|
||||
EntityCondition entityCondition = EntityCondition.makeCondition("contentId", masterContentId);
|
||||
masterContentAttribute = EntityQuery.use(delegator).from("ContentAttribute").where(entityCondition).queryFirst();
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logError(e, module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorNoAttributeFound", locale));
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorNoAttributeFound", locale));
|
||||
}
|
||||
|
||||
if (masterContentAttribute == null) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorNoAttributeFound", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorNoAttributeFound", locale));
|
||||
}
|
||||
String attrName = masterContentAttribute.getString("attrName");
|
||||
String reportContentId;
|
||||
@@ -245,58 +245,66 @@ public class BirtServices {
|
||||
String entityViewName = masterContentAttribute.getString("attrValue");
|
||||
ModelEntity modelEntity = delegator.getModelEntity(entityViewName);
|
||||
if (modelEntity == null) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorEntityViewNotExist", locale) + " " + entityViewName);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_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)) {
|
||||
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultContent));
|
||||
}
|
||||
reportContentId = (String) resultContent.get("contentId");
|
||||
} catch (GenericServiceException e) {
|
||||
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("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(resource_error, "BirtErrorCannotDetermineDataSource", locale));
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_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));
|
||||
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));
|
||||
}
|
||||
} else {
|
||||
// TODO check: could create other workflows. WebService? Does it need to be independent from Service workflow?
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCannotDetermineDataSource", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCannotDetermineDataSource", locale));
|
||||
}
|
||||
|
||||
// prepare report form to display to allow override
|
||||
String textForm;
|
||||
Map<String, Object> resultFormDisplay;
|
||||
try {
|
||||
resultFormDisplay = dispatcher.runSync("prepareFlexibleReportSearchFormToEdit", UtilMisc.toMap("reportContentId", reportContentId, "userLogin", userLogin, "locale", locale));
|
||||
resultFormDisplay = dispatcher.runSync("prepareFlexibleReportSearchFormToEdit", UtilMisc.toMap("reportContentId", reportContentId,
|
||||
"userLogin", userLogin, "locale", locale));
|
||||
if (ServiceUtil.isError(resultFormDisplay)) {
|
||||
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultFormDisplay));
|
||||
}
|
||||
textForm = (String) resultFormDisplay.get("textForm");
|
||||
} catch (GenericServiceException e) {
|
||||
Debug.logError(e, module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCreatingDefaultSearchForm", locale).concat(": ").concat(e.getMessage()));
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_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
|
||||
*/
|
||||
@@ -310,8 +318,9 @@ 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(resource_error, "BirtErrorUnauthorisedCharacter", locale));
|
||||
if (overideFiltersNoWhiteSpace.contains("${groovy:") || overideFiltersNoWhiteSpace.contains("${bsh:")
|
||||
|| overideFiltersNoWhiteSpace.contains("javascript:")) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorUnauthorisedCharacter", locale));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -325,16 +334,17 @@ public class BirtServices {
|
||||
newForm.append(overrideFilters);
|
||||
newForm.append("</forms>");
|
||||
Document xmlForm = UtilXml.readXmlDocument(newForm.toString());
|
||||
Map<String, Object> result = dispatcher.runSync("updateElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", UtilXml.writeXmlDocument(xmlForm),
|
||||
Map<String, Object> result = dispatcher.runSync("updateElectronicTextForm", UtilMisc.toMap("dataResourceId", dataResourceId,
|
||||
"textData", UtilXml.writeXmlDocument(xmlForm),
|
||||
"userLogin", userLogin, "locale", locale));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
} catch (GeneralException | SAXException | ParserConfigurationException | IOException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("Error in overrideReportForm service."); //TODO labelise
|
||||
}
|
||||
return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "BirtSearchFormSuccessfullyOverridde", locale));
|
||||
return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "BirtSearchFormSuccessfullyOverridde", locale));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -352,23 +362,24 @@ 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.checkMap(resultMapsForGeneration.get("dataMap"));
|
||||
Map<String, String> dataMap = UtilGenerics.cast(resultMapsForGeneration.get("dataMap"));
|
||||
Map<String, String> fieldDisplayLabels = null;
|
||||
if (UtilValidate.isNotEmpty(resultMapsForGeneration.get("fieldDisplayLabels"))) {
|
||||
fieldDisplayLabels = UtilGenerics.checkMap(resultMapsForGeneration.get("fieldDisplayLabels"));
|
||||
fieldDisplayLabels = UtilGenerics.cast(resultMapsForGeneration.get("fieldDisplayLabels"));
|
||||
}
|
||||
Map<String, String> filterMap = null;
|
||||
if (UtilValidate.isNotEmpty(resultMapsForGeneration.get("filterMap"))) {
|
||||
filterMap = UtilGenerics.checkMap(resultMapsForGeneration.get("filterMap"));
|
||||
filterMap = UtilGenerics.cast(resultMapsForGeneration.get("filterMap"));
|
||||
}
|
||||
Map<String, String> filterDisplayLabels = null;
|
||||
if (UtilValidate.isNotEmpty(resultMapsForGeneration.get("filterDisplayLabels"))) {
|
||||
filterDisplayLabels = UtilGenerics.checkMap(resultMapsForGeneration.get("filterDisplayLabels"));
|
||||
filterDisplayLabels = UtilGenerics.cast(resultMapsForGeneration.get("filterDisplayLabels"));
|
||||
}
|
||||
contentId = BirtWorker.recordReportContent(delegator, dispatcher, context);
|
||||
// callPerformFindFromBirt is the customMethod for Entity workflow
|
||||
@@ -394,7 +405,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);
|
||||
@@ -431,9 +442,9 @@ public class BirtServices {
|
||||
}
|
||||
try {
|
||||
@SuppressWarnings("unused") // Used only to passively check
|
||||
ModelService modelService = dctx.getModelService(serviceName);
|
||||
ModelService modelService = dctx.getModelService(serviceName);
|
||||
} catch (GenericServiceException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("No service define with name " + serviceName); //TODO labelise
|
||||
}
|
||||
contentId = BirtWorker.recordReportContent(delegator, dispatcher, context);
|
||||
@@ -442,10 +453,10 @@ public class BirtServices {
|
||||
if (ServiceUtil.isError(serviceResult)) {
|
||||
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
|
||||
}
|
||||
Map<String, String> dataMap = UtilGenerics.checkMap(serviceResult.get("dataMap"));
|
||||
Map<String, String> filterMap = UtilGenerics.checkMap(serviceResult.get("filterMap"));
|
||||
Map<String, String> fieldDisplayLabels = UtilGenerics.checkMap(serviceResult.get("fieldDisplayLabels"));
|
||||
Map<String, String> filterDisplayLabels = UtilGenerics.checkMap(serviceResult.get("filterDisplayLabels"));
|
||||
Map<String, 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> resultGeneration = dispatcher.runSync("createFlexibleReport", UtilMisc.toMap(
|
||||
"locale", locale,
|
||||
"dataMap", dataMap,
|
||||
@@ -457,11 +468,11 @@ public class BirtServices {
|
||||
"fieldDisplayLabels", fieldDisplayLabels,
|
||||
"filterDisplayLabels", filterDisplayLabels));
|
||||
if (ServiceUtil.isError(resultGeneration)) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCreatingFlexibleReport", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCreatingFlexibleReport", locale));
|
||||
}
|
||||
} catch (GeneralException e) {
|
||||
Debug.logError(e, module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "BirtErrorCreatingFlexibleReport", locale));
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCreatingFlexibleReport", locale));
|
||||
}
|
||||
result.put("contentId", contentId);
|
||||
return result;
|
||||
@@ -474,14 +485,15 @@ public class BirtServices {
|
||||
Locale locale = (Locale) context.get("locale");
|
||||
ModelEntity modelEntity = (ModelEntity) context.get("modelEntity");
|
||||
|
||||
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>();
|
||||
Map<String, String> dataMap = new HashMap<>();
|
||||
Map<String, String> fieldDisplayLabels = new HashMap<>();
|
||||
LinkedHashMap<String, String> filterMap = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, String> filterDisplayLabels = new LinkedHashMap<>();
|
||||
|
||||
List<String> listEntityFields = modelEntity.getAllFieldNames();
|
||||
Map<Object, Object> uiLabelMap = new HashMap<Object, Object>();
|
||||
final String[] resourceGlob = {"OrderUiLabels", "ProductUiLabels", "PartyUiLabels", "ContentUiLabels", "AccountingUiLabels", "CommonUiLabels", "BirtUiLabels"};
|
||||
Map<Object, Object> uiLabelMap = new HashMap<>();
|
||||
final String[] resourceGlob = {"OrderUiLabels", "ProductUiLabels", "PartyUiLabels", "ContentUiLabels", "AccountingUiLabels",
|
||||
"CommonUiLabels", "BirtUiLabels"};
|
||||
for (String res : resourceGlob) {
|
||||
uiLabelMap.putAll(UtilProperties.getProperties(res, locale));
|
||||
}
|
||||
@@ -511,15 +523,20 @@ 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();
|
||||
@@ -548,14 +565,17 @@ 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);
|
||||
@@ -582,26 +602,27 @@ 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(resource_error, "BirtErrorNoFlexibleReportToDelete", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorNoFlexibleReportToDelete", locale));
|
||||
}
|
||||
listContentId = EntityUtil.getFieldListFromEntityList(listContent, "contentId", true);
|
||||
|
||||
try {
|
||||
for (String contentId : listContentId) {
|
||||
Map<String, Object> returnMap = dispatcher.runSync("deleteFlexibleReport", UtilMisc.toMap("contentId", contentId, "userLogin", userLogin, "locale", locale));
|
||||
Map<String, Object> returnMap = dispatcher.runSync("deleteFlexibleReport", UtilMisc.toMap("contentId", contentId, "userLogin",
|
||||
userLogin, "locale", locale));
|
||||
if (ServiceUtil.isError(returnMap)) {
|
||||
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(returnMap));
|
||||
}
|
||||
}
|
||||
} catch (GenericServiceException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("Error in deleteAllReports service."); //TODO labelise
|
||||
}
|
||||
return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "BirtFlexibleReportsSuccessfullyDeleted", locale));
|
||||
return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "BirtFlexibleReportsSuccessfullyDeleted", locale));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -629,38 +650,40 @@ 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(resource_error, "BirtErrorUnexpectedNumberReportToDelete", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_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(resource_error, "BirtErrorCannotLocateReportFile", locale));
|
||||
ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorCannotLocateReportFile", locale));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("Error in deleteFlexibleReport service."); //TODO labelise
|
||||
}
|
||||
try {
|
||||
delegator.removeByAnd("ContentAttribute", UtilMisc.toMap("contentId", contentId));
|
||||
Map<String, Object> result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentId, "userLogin", userLogin, "locale", locale));
|
||||
Map<String, Object> result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentId, "userLogin",
|
||||
userLogin, "locale", locale));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentIdRpt, "userLogin", userLogin, "locale", locale));
|
||||
result = dispatcher.runSync("removeContentAndRelated", UtilMisc.toMap("contentId", contentIdRpt, "userLogin", userLogin, "locale",
|
||||
locale));
|
||||
if (ServiceUtil.isError(result)) {
|
||||
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
|
||||
}
|
||||
} catch (GenericServiceException | GenericEntityException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("Error in deleteFlexibleReport service."); //TODO labelise
|
||||
}
|
||||
return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "BirtFlexibleReportSuccessfullyDeleted", locale));
|
||||
return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "BirtFlexibleReportSuccessfullyDeleted", locale));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -672,7 +695,7 @@ public class BirtServices {
|
||||
Locale locale = (Locale) context.get("locale");
|
||||
Delegator delegator = dctx.getDelegator();
|
||||
Map<String, Object> result = null;
|
||||
List<String> listSuccessMessage = new ArrayList<String>();
|
||||
List<String> listSuccessMessage = new ArrayList<>();
|
||||
|
||||
// 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();
|
||||
@@ -682,7 +705,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));
|
||||
@@ -690,14 +713,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(resource_error, "BirtErrorCannotFindUploadedFile", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_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");
|
||||
@@ -705,7 +728,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");
|
||||
}
|
||||
|
||||
@@ -714,7 +737,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
|
||||
}
|
||||
|
||||
@@ -728,7 +751,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
|
||||
}
|
||||
}
|
||||
@@ -750,8 +773,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(resource_error, "BirtErrorInuploadRptDesignNoFile", locale));
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "BirtErrorInuploadRptDesignNoFile", locale));
|
||||
}
|
||||
|
||||
//copy cube
|
||||
@@ -765,7 +788,7 @@ public class BirtServices {
|
||||
try {
|
||||
designStored.getCubes().add(copy);
|
||||
} catch (Exception e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
|
||||
}
|
||||
}
|
||||
@@ -781,7 +804,7 @@ public class BirtServices {
|
||||
try {
|
||||
designStored.getBody().add(copy);
|
||||
} catch (Exception e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
|
||||
}
|
||||
}
|
||||
@@ -796,7 +819,8 @@ 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) {
|
||||
@@ -806,7 +830,7 @@ public class BirtServices {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
|
||||
}
|
||||
|
||||
@@ -816,7 +840,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
|
||||
}
|
||||
}
|
||||
@@ -826,7 +850,7 @@ public class BirtServices {
|
||||
SlotHandle stylesStored = designStored.getStyles();
|
||||
|
||||
// getting style names from stored report
|
||||
List<String> listStyleNames = new ArrayList<String>();
|
||||
List<String> listStyleNames = new ArrayList<>();
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterator<DesignElementHandle> iterStored = stylesStored.iterator();
|
||||
while (iterStored.hasNext()) {
|
||||
@@ -845,7 +869,7 @@ public class BirtServices {
|
||||
try {
|
||||
designStored.getStyles().add(copy);
|
||||
} catch (Exception e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
|
||||
}
|
||||
}
|
||||
@@ -854,17 +878,18 @@ public class BirtServices {
|
||||
try {
|
||||
designStored.saveAs(rptDesignName);
|
||||
} catch (IOException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError("Error in uploadRptDesign service."); //TODO labelise
|
||||
}
|
||||
designFromUser.close();
|
||||
designStored.close();
|
||||
if (Debug.infoOn()) Debug.logInfo("####### Design uploaded: ".concat(rptDesignName), module);
|
||||
if (Debug.infoOn()) {
|
||||
Debug.logInfo("####### Design uploaded: ".concat(rptDesignName), MODULE);
|
||||
}
|
||||
|
||||
// TODO check: should we, as a secondary safety precaution, delete any file finishing with _TEMP_.rptdesign?
|
||||
listSuccessMessage.add(UtilProperties.getMessage(resource, "BirtFlexibleRptDesignSuccessfullyUploaded", locale));
|
||||
listSuccessMessage.add(UtilProperties.getMessage(RESOURCE, "BirtFlexibleRptDesignSuccessfullyUploaded", locale));
|
||||
result = ServiceUtil.returnSuccess(listSuccessMessage);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,16 +39,16 @@ import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
|
||||
|
||||
public final class BirtUtil {
|
||||
|
||||
public final static String module = BirtUtil.class.getName();
|
||||
private static final String MODULE = BirtUtil.class.getName();
|
||||
|
||||
private final static Map<String, String> entityFieldTypeBirtTypeMap = MapUtils.unmodifiableMap(UtilMisc.toMap(
|
||||
private static final Map<String, String> ENTITY_FIELD_TYPE_BIRT_TYPE_MAP = MapUtils.unmodifiableMap(UtilMisc.toMap(
|
||||
"id", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"url", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"name", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"value", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"email", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"comment", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"id-long",DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"id-long", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"id-vlong", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"very-long", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
"indicator", DesignChoiceConstants.COLUMN_DATA_TYPE_STRING,
|
||||
@@ -70,14 +70,14 @@ public final class BirtUtil {
|
||||
"object", DesignChoiceConstants.COLUMN_DATA_TYPE_JAVA_OBJECT,
|
||||
"blob", DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB));
|
||||
|
||||
private final static Map<String, String> entityFieldTypeBirtParameterTypeMap = MapUtils.unmodifiableMap(UtilMisc.toMap(
|
||||
private static final Map<String, String> ENTITY_FIELD_TYPE_BIRT_PARAM_TYPE_MAP = MapUtils.unmodifiableMap(UtilMisc.toMap(
|
||||
"id", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"url", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"name", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"value", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"email", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"comment", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"id-long",DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"id-long", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"id-vlong", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"very-long", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
"indicator", DesignChoiceConstants.PARAM_TYPE_STRING,
|
||||
@@ -99,7 +99,7 @@ public final class BirtUtil {
|
||||
"object", DesignChoiceConstants.PARAM_TYPE_JAVA_OBJECT,
|
||||
"blob", DesignChoiceConstants.PARAM_TYPE_JAVA_OBJECT));
|
||||
|
||||
private final static Map<String, String> mimeTypeOutputFormatMap = UtilMisc.toMap(
|
||||
private static final Map<String, String> MIME_TYPE_OUTPUT_FORMAT_MAP = UtilMisc.toMap(
|
||||
"text/html", RenderOption.OUTPUT_FORMAT_HTML,
|
||||
"application/pdf", RenderOption.OUTPUT_FORMAT_PDF,
|
||||
"application/postscript", "postscript",
|
||||
@@ -113,7 +113,7 @@ public final class BirtUtil {
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation", "pptx");
|
||||
|
||||
private BirtUtil() {}
|
||||
private BirtUtil() { }
|
||||
|
||||
/**
|
||||
* Return birt field type corresponding to given entity field type
|
||||
@@ -124,11 +124,11 @@ public final class BirtUtil {
|
||||
if (UtilValidate.isEmpty(entityFieldType)) {
|
||||
return null;
|
||||
}
|
||||
return entityFieldTypeBirtTypeMap.get(entityFieldType.toLowerCase());
|
||||
return ENTITY_FIELD_TYPE_BIRT_TYPE_MAP.get(entityFieldType.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return birt parameter type corresponding to given entity field type
|
||||
* Return birt parameter type corresponding to given entity field type
|
||||
* @param entityFieldType
|
||||
* @return birt parameter type corresponding to given entity field type
|
||||
*/
|
||||
@@ -136,7 +136,7 @@ public final class BirtUtil {
|
||||
if (UtilValidate.isEmpty(entityFieldType)) {
|
||||
return null;
|
||||
}
|
||||
return entityFieldTypeBirtParameterTypeMap.get(entityFieldType.toLowerCase());
|
||||
return ENTITY_FIELD_TYPE_BIRT_PARAM_TYPE_MAP.get(entityFieldType.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,7 +145,7 @@ public final class BirtUtil {
|
||||
* @return true if mime type related to a contentType is supported by Birt
|
||||
*/
|
||||
public static boolean isSupportedMimeType(String contentType) {
|
||||
return mimeTypeOutputFormatMap.containsKey(contentType);
|
||||
return MIME_TYPE_OUTPUT_FORMAT_MAP.containsKey(contentType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +156,7 @@ public final class BirtUtil {
|
||||
*/
|
||||
public static String getMimeTypeOutputFormat(String contentType) throws GeneralException {
|
||||
if (isSupportedMimeType(contentType)) {
|
||||
return mimeTypeOutputFormatMap.get(contentType);
|
||||
return MIME_TYPE_OUTPUT_FORMAT_MAP.get(contentType);
|
||||
}
|
||||
throw new GeneralException("Unknown content type : " + contentType);
|
||||
}
|
||||
@@ -237,4 +237,4 @@ public final class BirtUtil {
|
||||
if (UtilValidate.isEmpty(reportName)) return "";
|
||||
return StringUtil.replaceString(StringUtil.removeRegex(reportName.trim(), "[^\\p{L}\\s]"), " ", "_");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,29 +66,34 @@ import com.ibm.icu.util.ULocale;
|
||||
|
||||
public class ReportDesignGenerator {
|
||||
|
||||
private static final String module = ReportDesignGenerator.class.getName();
|
||||
private static final String MODULE = ReportDesignGenerator.class.getName();
|
||||
private static final String RES_ERROR = "BirtErrorUiLabels";
|
||||
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.checkMap(context.get("dataMap"));
|
||||
dataMap = UtilGenerics.cast(context.get("dataMap"));
|
||||
filterMap = UtilGenerics.cast(context.get("filterMap"));
|
||||
serviceName = (String) context.get("serviceName");
|
||||
fieldDisplayLabels = UtilGenerics.checkMap(context.get("fieldDisplayLabels"));
|
||||
fieldDisplayLabels = UtilGenerics.cast(context.get("fieldDisplayLabels"));
|
||||
filterDisplayLabels = UtilGenerics.cast(context.get("filterDisplayLabels"));
|
||||
rptDesignName = (String) context.get("rptDesignName");
|
||||
String writeFilters = (String) context.get("writeFilters");
|
||||
@@ -104,13 +109,14 @@ 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();
|
||||
@@ -146,7 +152,7 @@ public class ReportDesignGenerator {
|
||||
for (String filter : filterMap.keySet()) {
|
||||
String birtType = BirtUtil.convertFieldTypeToBirtParameterType(filterMap.get(filter));
|
||||
if (birtType == null) {
|
||||
throw new GeneralException(UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale));
|
||||
throw new GeneralException(UtilProperties.getMessage(RES_ERROR, "BirtErrorConversionFieldToBirtFailed", locale));
|
||||
}
|
||||
// get label
|
||||
String displayFilterName;
|
||||
@@ -156,10 +162,13 @@ public class ReportDesignGenerator {
|
||||
displayFilterName = filter;
|
||||
}
|
||||
ScalarParameterHandle scalParam = factory.newScalarParameter(filter);
|
||||
// scalParam.setDisplayName(displayFilterName); // TODO has no incidence at all right now, is only displayed when using birt's report parameter system. Not our case. I leave it here if any idea arise of how to translate these.
|
||||
// scalParam.setDisplayName(displayFilterName); // TODO has no incidence at all right now, is only displayed when using birt's
|
||||
// report parameter system. Not our case. I leave it here if any idea arise of how to translate these.
|
||||
scalParam.setPromptText(displayFilterName);
|
||||
if ("javaObject".equals(birtType)) { //Fields of type='blob' are rejected by Birt: org.eclipse.birt.report.model.api.metadata.PropertyValueException: The choice value "javaObject" is not allowed.
|
||||
throw new GeneralException("Fields of type='blob' are rejected by Birt. Create a view entity, based on the requested entity, where you exclude the field of type='blob'");
|
||||
if ("javaObject".equals(birtType)) { //Fields of type='blob' are rejected by Birt: org.eclipse.birt.report.model.api.metadata
|
||||
// .PropertyValueException: The choice value "javaObject" is not allowed.
|
||||
throw new GeneralException("Fields of type='blob' are rejected by Birt. Create a view entity, based on the requested entity, "
|
||||
+ "where you exclude the field of type='blob'");
|
||||
} else {
|
||||
scalParam.setDataType(birtType);
|
||||
}
|
||||
@@ -213,16 +222,18 @@ public class ReportDesignGenerator {
|
||||
ImageHandle image = factory.newImage(null);
|
||||
CellHandle cell = (CellHandle) row.getCells().get(0);
|
||||
cell.getContent().add(image);
|
||||
image.setURL("http://ofbiz.apache.org/images/ofbiz_logo.png");
|
||||
image.setURL("https://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();
|
||||
}
|
||||
@@ -232,7 +243,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");
|
||||
@@ -262,20 +273,22 @@ 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");
|
||||
@@ -310,7 +323,7 @@ public class ReportDesignGenerator {
|
||||
resultSetCol.setColumnName(field);
|
||||
String birtType = BirtUtil.convertFieldTypeToBirtType(dataMap.get(field));
|
||||
if (birtType == null) {
|
||||
throw new GeneralException(UtilProperties.getMessage(resource_error, "BirtErrorConversionFieldToBirtFailed", locale));
|
||||
throw new GeneralException(UtilProperties.getMessage(RES_ERROR, "BirtErrorConversionFieldToBirtFailed", locale));
|
||||
}
|
||||
resultSetCol.setPosition(i);
|
||||
resultSetCol.setDataType(birtType);
|
||||
@@ -334,7 +347,9 @@ 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);
|
||||
|
||||
@@ -37,12 +37,12 @@ import org.apache.ofbiz.birt.BirtWorker;
|
||||
@SuppressWarnings("serial")
|
||||
public class BirtViewerServlet extends ViewerServlet {
|
||||
|
||||
public final static String module = BirtViewerServlet.class.getName();
|
||||
private static final 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,8 +50,6 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,24 +24,22 @@ 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 BirtEngineServlet extends org.eclipse.birt.report.servlet.BirtEngineServlet {
|
||||
|
||||
public final static String module = BirtEngineServlet.class.getName();
|
||||
public class OfbizBirtEngineServlet extends org.eclipse.birt.report.servlet.BirtEngineServlet {
|
||||
|
||||
@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 {
|
||||
@@ -49,7 +47,6 @@ public class BirtEngineServlet extends org.eclipse.birt.report.servlet.BirtEngin
|
||||
} 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,16 +30,13 @@ import org.apache.ofbiz.base.location.FlexibleLocation;
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
|
||||
public class ViewerServletRequest extends HttpServletRequestWrapper {
|
||||
|
||||
public final static String module = ViewerServletRequest.class.getName();
|
||||
|
||||
protected String originalReportParam = null;
|
||||
private static final String MODULE = ViewerServletRequest.class.getName();
|
||||
private 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)) {
|
||||
@@ -53,7 +50,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,29 +51,32 @@ import org.xml.sax.SAXException;
|
||||
|
||||
public class BirtViewHandler implements ViewHandler {
|
||||
|
||||
public static final String module = BirtViewHandler.class.getName();
|
||||
public static final String resource_error = "BirtErrorUiLabels";
|
||||
|
||||
protected ServletContext servletContext = null;
|
||||
private static final String MODULE = BirtViewHandler.class.getName();
|
||||
private static final String RES_ERROR = "BirtErrorUiLabels";
|
||||
private 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
|
||||
@@ -85,7 +88,7 @@ public class BirtViewHandler implements ViewHandler {
|
||||
}
|
||||
if (UtilValidate.isEmpty(page)) {
|
||||
Locale locale = request.getLocale();
|
||||
throw new ViewHandlerException(UtilProperties.getMessage(resource_error, "BirtErrorNotPublishedReport", locale));
|
||||
throw new ViewHandlerException(UtilProperties.getMessage(RES_ERROR, "BirtErrorNotPublishedReport", locale));
|
||||
}
|
||||
if (page.startsWith("component://")) {
|
||||
InputStream reportInputStream = BirtFactory.getReportInputStreamFromLocation(page);
|
||||
@@ -93,13 +96,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<String, Object>();
|
||||
Map<String, Object> context = new HashMap<>();
|
||||
// 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 {
|
||||
@@ -110,13 +113,13 @@ public class BirtViewHandler implements ViewHandler {
|
||||
if (locale == null) {
|
||||
locale = UtilHttp.getLocale(request);
|
||||
}
|
||||
|
||||
|
||||
// set override content type
|
||||
String overrideContentType = request.getParameter(BirtWorker.getBirtContentType());
|
||||
if (UtilValidate.isNotEmpty(overrideContentType)) {
|
||||
contentType = overrideContentType;
|
||||
}
|
||||
|
||||
|
||||
// set output file name to get also file extension
|
||||
String outputFileName = request.getParameter(BirtWorker.getBirtOutputFileName());
|
||||
if (UtilValidate.isNotEmpty(outputFileName)) {
|
||||
@@ -151,11 +154,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,10 +98,6 @@ 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>
|
||||
|
||||
@@ -141,10 +141,6 @@ 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>
|
||||
|
||||
@@ -1,52 +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.
|
||||
--%>
|
||||
<%@ 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>
|
||||
@@ -109,10 +109,6 @@ 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>
|
||||
|
||||
@@ -105,10 +105,6 @@ under the License.
|
||||
<url-pattern>/products/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<session-config>
|
||||
<session-timeout>60</session-timeout><!-- in minutes -->
|
||||
</session-config>
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
|
||||
@@ -43,6 +43,7 @@ under the License.
|
||||
<set field="applicationMenuName" value="BirtAppBar" global="true"/>
|
||||
<set field="applicationMenuLocation" value="component://birt/widget/birt/BirtMenus.xml" global="true"/>
|
||||
<set field="applicationTitle" from-field="uiLabelMap.BirtExampleApplication" global="true"/>
|
||||
<set field="helpAnchor" from-field="helpAnchor" default-value="_birt_ofbiz_plugin"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/>
|
||||
@@ -225,12 +226,12 @@ under the License.
|
||||
<field-map field-name="mainAction" value="CREATE"/>
|
||||
</service>
|
||||
<set field="hasCreatePermission" from-field="permCreateResult.hasPermission"/>
|
||||
|
||||
|
||||
<service service-name="genericBirtPermission" result-map="permDeleteResult">
|
||||
<field-map field-name="mainAction" value="DELETE"/>
|
||||
</service>
|
||||
<set field="hasDeletePermission" from-field="permDeleteResult.hasPermission"/>
|
||||
|
||||
|
||||
<service service-name="genericBirtPermission" result-map="permUpdateResult">
|
||||
<field-map field-name="mainAction" value="UPDATE"/>
|
||||
</service>
|
||||
|
||||
@@ -55,8 +55,8 @@ under the License.
|
||||
<label style="h1" text="${uiLabelMap.ProductInventoryByProduct} ${uiLabelMap.CommonFor} ${facility.facilityName}"/>
|
||||
</container>
|
||||
<container>
|
||||
<link target="ViewFacilityInventoryByProductReport?${searchParameterString}" text="${uiLabelMap.CommonPrint}" style="buttontext"/>
|
||||
<link target="ViewFacilityInventoryByProductExport?${searchParameterString}" text="${uiLabelMap.CommonExport}" style="buttontext"/>
|
||||
<link target="ViewFacilityInventoryByProductReport?${searchParameterString}" text="${uiLabelMap.CommonPrint}" style="buttontext" target-window="_blank"/>
|
||||
<link target="ViewFacilityInventoryByProductExport?${searchParameterString}" text="${uiLabelMap.CommonExport}" style="buttontext" target-window="_blank"/>
|
||||
<link target="ViewFacilityInventoryHistoryReport?${searchParameterString}" text="${uiLabelMap.BirtFacilityReportInventoryHistoryReport}" style="buttontext"/>
|
||||
</container>
|
||||
<screenlet title="${uiLabelMap.PageTitleFindFacilityInventoryItemsByProduct}">
|
||||
@@ -86,8 +86,8 @@ under the License.
|
||||
<label style="h1" text="${uiLabelMap.ProductInventoryByProduct} ${uiLabelMap.CommonFor} ${facility.facilityName}"/>
|
||||
</container>
|
||||
<container>
|
||||
<link target="ViewFacilityInventoryByProductReport?facilityId=${parameters.facilityId}" text="${uiLabelMap.CommonPrint}" style="buttontext"/>
|
||||
<link target="ViewFacilityInventoryByProductExport?facilityId=${parameters.facilityId}" text="${uiLabelMap.CommonExport}" style="buttontext"/>
|
||||
<link target="ViewFacilityInventoryByProductReport?facilityId=${parameters.facilityId}" text="${uiLabelMap.CommonPrint}" style="buttontext" target-window="_blank"/>
|
||||
<link target="ViewFacilityInventoryByProductExport?facilityId=${parameters.facilityId}" text="${uiLabelMap.CommonExport}" style="buttontext" target-window="_blank"/>
|
||||
<link target="ViewFacilityInventoryHistoryReport?facilityId=${parameters.facilityId}" text="${uiLabelMap.BirtFacilityReportInventoryHistoryReport}" style="buttontext"/>
|
||||
</container>
|
||||
<screenlet title="${uiLabelMap.BirtFacilityReportInventoryHistoryReport}">
|
||||
|
||||
@@ -57,7 +57,8 @@ under the License.
|
||||
|
||||
<form name="SaleOrdersByChannel" type="single" target="OrdersByChannel.pdf" target-window="_BLANK">
|
||||
<field name="SalesChannel" title="${uiLabelMap.OrderSalesChannel}">
|
||||
<drop-down allow-empty="true">
|
||||
<drop-down allow-empty="false">
|
||||
<option key="" description="${uiLabelMap.CommonAll}"/>
|
||||
<entity-options entity-name="Enumeration" key-field-name="enumId" description="${description}">
|
||||
<entity-constraint name="enumTypeId" operator="equals" value="ORDER_SALES_CHANNEL"/>
|
||||
</entity-options>
|
||||
|
||||
@@ -44,7 +44,6 @@ under the License.
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>${(decoratedContent.subcontent.title.render)!"WebSite 1 Generic Title (Set subcontent 'title' on your content!)"}</title>
|
||||
<link rel="shortcut icon" href="/images/ofbiz.ico" />
|
||||
<script src="/common/js/util/dompurify/dist/purify.min.js" type="application/javascript"></script>
|
||||
<script src="/common/js/util/fieldlookup.js" type="application/javascript"></script>
|
||||
<script src="/common/js/util/OfbizUtil.js" type="application/javascript"></script>
|
||||
<link rel="stylesheet" href="/ecommerce/images/ecommain.css" type="text/css"/>
|
||||
@@ -126,7 +125,6 @@ under the License.
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>${(decoratedContent.subcontent.title.render)!"WebSite 2 Generic Title (Set subcontent 'title' on your content!)"}</title>
|
||||
<link rel="shortcut icon" href="/images/ofbiz.ico" />
|
||||
<script src="/common/js/util/dompurify/dist/purify.min.js" type="application/javascript"></script>
|
||||
<script src="/common/js/util/fieldlookup.js" type="application/javascript"></script>
|
||||
<script src="/common/js/util/OfbizUtil.js" type="application/javascript"></script>
|
||||
<link rel="stylesheet" href="/ecommerce/images/ecommain.css" type="text/css"/>
|
||||
|
||||
@@ -114,7 +114,6 @@ under the License.
|
||||
<li><a href="${thisContent.content.CMSS_DEMO_SCREEN.link}">Demo Page with screen widget and screen decorator</a></li>
|
||||
<li><a href="${thisContent.content.CMSS_DEMO_BLOG.link}">Demo Page with blog using screen decorator</a></li>
|
||||
<li><a href="${thisContent.content.CMSS_DEMO_TPL_DATA.link}">Demo Page with an xml resource formatted with a template ftl resource</a></li>
|
||||
<li><a href="${thisContent.content.PUBLIC_DOCS.link}">The ofbiz public documents</a></li>
|
||||
<li><a href="/cmssite/website-1">WebSite 1</a></li>
|
||||
<li><a href="/cmssite/website-2">WebSite 2</a></li>
|
||||
</ul>
|
||||
@@ -229,26 +228,5 @@ under the License.
|
||||
<DataResource dataResourceId="DOCBOOK_HTML_TEMPL" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/template/docbook/html/docbook.xsl" dataTemplateTypeId="XSLT" statusId="CTNT_IN_PROGRESS" dataResourceName="Help template file" mimeTypeId="text/html" isPublic="Y"/>
|
||||
<DataResource dataResourceId="DOCBOOK_PDF_TEMPL" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/template/docbook/fo/docbook.xsl" dataTemplateTypeId="XSLT" statusId="CTNT_IN_PROGRESS" dataResourceName="Help template file" mimeTypeId="text/html" isPublic="Y"/>
|
||||
|
||||
<DataResource dataResourceId="PUBLIC_DOCS" dataResourceTypeId="URL_RESOURCE" dataTemplateTypeId="SCREEN_COMBINED" objectInfo="component://cmssite/widget/CmssiteScreens.xml#publicDocs"/>
|
||||
<Content contentId="PUBLIC_DOCS" contentTypeId="DOCUMENT" contentName="OFBIz public documents" dataResourceId="PUBLIC_DOCS"/>
|
||||
|
||||
<DataResource dataResourceId="APACHE_OFBIZ" localeString="en" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/documents/ApacheOfbiz.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Apache OFBiz document" mimeTypeId="text/xml" isPublic="Y" />
|
||||
<Content contentId="APACHE_OFBIZ_HTML" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_HTML_TEMPL" dataResourceId="APACHE_OFBIZ" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The User & Technical Apache OFBiz document in one page HTML" mimeTypeId="text/html"/>
|
||||
<ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01"/>/>
|
||||
|
||||
<Content contentId="APACHE_OFBIZ_PDF" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_PDF_TEMPL" dataResourceId="APACHE_OFBIZ" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The general Apache document in PDF format" mimeTypeId="application/pdf"/>
|
||||
<ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_PDF" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01"/>/>
|
||||
|
||||
<DataResource dataResourceId="APACHE_OFBIZ_TECH" localeString="en" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/documents/ApacheOfbizTechnical.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Apache OFBiz document" mimeTypeId="text/xml" isPublic="Y" />
|
||||
<Content contentId="APACHE_OFBIZ_T_HTML" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_HTML_TEMPL" dataResourceId="APACHE_OFBIZ_TECH" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The Apache OFBiz Technical Guide in one page HTML" mimeTypeId="text/html"/>
|
||||
<ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_T_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01"/>/>
|
||||
<DataResource dataResourceId="APACHE_OFBIZ_USER" localeString="en" dataResourceTypeId="OFBIZ_FILE" objectInfo="plugins/cmssite/documents/ApacheOfbizUser.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Apache OFBiz User document" mimeTypeId="text/xml" isPublic="Y" />
|
||||
<Content contentId="APACHE_OFBIZ_U_HTML" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_HTML_TEMPL" dataResourceId="APACHE_OFBIZ_USER" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The Apache OFBizUser Guide in one page HTML" mimeTypeId="text/html"/>
|
||||
<ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_U_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01"/>/>
|
||||
|
||||
|
||||
<ContentAssoc contentId="CMSS_PPOINT" contentIdTo="PUBLIC_DOCS" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00"/>
|
||||
<ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="documents"/>
|
||||
<ContentAssoc contentId="CMSS_PPOINT" contentIdTo="APACHE_OFBIZ_PDF" contentAssocTypeId="SUB_CONTENT" fromDate="2001-01-01 00:00:00" mapKey="documents"/>
|
||||
<WebSiteContent webSiteId="CmsSite" contentId="MAINTENANCE_PAGE" webSiteContentTypeId="MAINTENANCE_PAGE" fromDate="2016-05-21 00:00:00"/>
|
||||
</entity-engine-xml>
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0"
|
||||
xmlns:xl="http://www.w3.org/1999/xlink"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xsi:schemaLocation="http://docbook.org/ns/docbook ../../content/dtd/docbook.xsd"
|
||||
xmlns="http://docbook.org/ns/docbook">
|
||||
|
||||
<info>
|
||||
<title>Apache OFBiz official documentation.</title>
|
||||
<abstract>
|
||||
<para>
|
||||
This Book is currently in an experimental stage. It will be the start of moving the OFBiz documentation from the current
|
||||
<link xl:href="https://cwiki.apache.org/confluence/display/OFBIZ/Home">OFBiz documentation site</link> and the old ofbiz website (Entity documents) to the OFBiz content component.
|
||||
The layout is currently open for discussion by the OFBiz community.
|
||||
</para>
|
||||
<para>
|
||||
The advantages of using it within OFBiz are:
|
||||
<orderedlist>
|
||||
<listitem><para>No external system required for documentation</para></listitem>
|
||||
<listitem><para>The content of the internal help files can be used within the documentation</para></listitem>
|
||||
<listitem><para>The documentation always has the same version as the system (It is part of it)</para></listitem>
|
||||
<listitem><para>The content is stored in a internationally accepted <link xl:href="http://docbook.org">'DocBook'</link> format</para></listitem>
|
||||
<listitem><para>The content can be easily presented in the selected visual schemas (To be implemented)</para></listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
<para>
|
||||
If you want to contribute to this document, you are very welcome.
|
||||
Several possibilities exist:
|
||||
<orderedlist>
|
||||
<listitem><para>Convert existing OFBiz documents on the <link xl:href="https://cwiki.apache.org/confluence/display/OFBIZ/Documentation">OFBiz documentation site</link> to the <link xl:href="http://docbook.org">docbookformat</link></para></listitem>
|
||||
<listitem><para>Write new document chapters for an OFBiz component</para></listitem>
|
||||
<listitem><para>Write new Help screens which can be inserted as sections in the document.</para></listitem>
|
||||
</orderedlist>
|
||||
How to contribute? It depends if you have a local OFBiz system or not. If you have, check the appendix for an explanation how the document text is stored within the OFBiz system.
|
||||
If you do not have a local OFBiz system write your text in an xml editor using the DocBook V5.0 schema's.
|
||||
If you have text to contribute create a Jira issue and upload your text to the issue.
|
||||
</para>
|
||||
</abstract>
|
||||
</info>
|
||||
|
||||
<xi:include href="ApacheOfbizUser.xml"/>
|
||||
<xi:include href="ApacheOfbizTechnical.xml"/>
|
||||
|
||||
</set>
|
||||
@@ -1,219 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0"
|
||||
xmlns:xl="http://www.w3.org/1999/xlink"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xsi:schemaLocation="http://docbook.org/ns/docbook ../../content/dtd/docbook.xsd"
|
||||
xmlns="http://docbook.org/ns/docbook">
|
||||
|
||||
<info>
|
||||
<title>Apache OFBiz Technical documentation.</title>
|
||||
</info>
|
||||
|
||||
<dedication>
|
||||
<para>
|
||||
I was reading the book in development from Norman Walsh called <link xl:href="http://www.docbook.org/tdg5/en/html/docbook.html">DocBook 5.0: The Definitive Guide
|
||||
</link> and found that a book can have a dedication. My first thought was there is only one man to whom this book can be dedicated. Without him I would not have been writing it.
|
||||
Sometimes i talk to other people about my dinners with David Jones in Pucket, Thailand which were very revealing to me. At a relative young age David designed and developed with Andy Zenesky
|
||||
the cornerstones of the OFBiz system called entity engine and recognized that in 2001 SOA (System Oriented Architecture) would be the future.
|
||||
So, David, thank you very much spending your efforts creating this excellent system.
|
||||
</para>
|
||||
</dedication>
|
||||
|
||||
<chapter>
|
||||
<title>Introduction.</title>
|
||||
<para>
|
||||
Welcome to Apache OFBiz, the ready to use open source ERP system. Let me first say if you downloaded
|
||||
the system for the first time it will be very overwhelming because the system is pretty big what is actually pretty normal for an ERP system
|
||||
because of its size.
|
||||
</para>
|
||||
<para>
|
||||
This document is describing the technical aspects of the system. How to install it, how to load the data and how to make the system available to the Internet.
|
||||
This is described pretty well in the 'production setup guide' in the next section. If you looking how to setup the system from a user point of view then better
|
||||
have a look at the Apache OFBiz user guide.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
<title>The production setup guide.</title>
|
||||
<para>
|
||||
An excellent guide to configure the system in a production environment, read the document at the <link xl:href="http://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+Production+Setup+Guide">OFBiz documentation site</link>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>The quick setup of an Ubuntu/Debian Linux with Postgresql Apache OFBiz server</title>
|
||||
<para>
|
||||
Ubuntu/Debian is certainly not the only distribution which is suitable for OFBiz. In general all Linux distributions can be used.
|
||||
The OFBiz system will also run on Windows, however this is not preferred and much less experience is available in the OFBiz communiy.
|
||||
The preferred data base is Postgresql although most databases will do.
|
||||
</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Upgrade Linux to Ubuntu/Debian remotely using Grub menu</para>
|
||||
<para>
|
||||
If you have a version of Linux running already on your server which using the GRUB menu, it is possible to upgrade to Debian/Ubuntu
|
||||
without even touching the server physically. With the method below the Debian installer is loaded into a Ram disk from where it can
|
||||
reformat and re-partition the harddisk and install the system.
|
||||
Practice this first on a local server, because if after the reboot the server is unreachable you have to ask somebody at the datacenter to manually reboot the system.
|
||||
</para>
|
||||
<para>
|
||||
If you have a proper Linux installed go to the Postgres installation.
|
||||
</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Get the OS kernel and the related initrd.gz</para>
|
||||
<para>
|
||||
Make sure you server can handle 64bit if you take that version, if not sure take the 32bit version.
|
||||
Example url for 64bit Ubuntu: http://us.archive.ubuntu.com/ubuntu/dists/hardy/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux for the kernel and
|
||||
http://us.archive.ubuntu.com/ubuntu/dists/jaunty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz for the initrd.gz file
|
||||
</para>
|
||||
<para>
|
||||
If not sure take the 32bit version:
|
||||
Example url for 32bit Ubuntu: http://us.archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/ubuntu-installer/amd64/linux for the kernel and
|
||||
http://us.archive.ubuntu.com/ubuntu/dists/jaunty/main/installer-i386/current/images/netboot/ubuntu-installer/i386/initrd.gz for the initrd.gz file
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Uncompress the initrd.gz: gzip -dc ../initrd.gz | cpio -id</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Edit the preseed.cfg file inside the initrd.gz file</para>
|
||||
<para>
|
||||
The file I used had the following content:
|
||||
<programlisting>
|
||||
d-i debconf/priority select critical
|
||||
d-i debian-installer/locale string en_US
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i console-setup/layoutcode string us
|
||||
d-i auto-install/enabled boolean true
|
||||
d-i netcfg/choose_interface select eth0
|
||||
d-i netcfg/disable_dhcp boolean true
|
||||
d-i netcfg/get_nameservers string x.x.x.x <--- EDIT! (max 3)
|
||||
d-i netcfg/get_ipaddress string x.x.x.x <--- EDIT!
|
||||
d-i netcfg/get_netmask string 255.255.255.0 <--- EDIT!
|
||||
d-i netcfg/get_gateway string x.x.x.x <--- EDIT!
|
||||
d-i netcfg/confirm_static boolean true
|
||||
d-i netcfg/get_hostname string servername <--- EDIT!
|
||||
d-i netcfg/get_domain string yourdomain.com <--- EDIT!
|
||||
d-i network-console/password password password <--- EDIT!
|
||||
d-i network-console/password-again password password <--- EDIT!
|
||||
d-i preseed/early_command string anna-install network-console
|
||||
</programlisting>
|
||||
You can find the ip addresses in the current Linux normally in the /etc/network/interfaces file.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Create the new Archive:
|
||||
<programlisting>
|
||||
find ./ | cpio -H newc -o > initrd-preseed
|
||||
gzip initrd-preseed
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Copy the Kernel and the new initrd.gz to the server</para>
|
||||
<para>
|
||||
Copy these to files to the /boot/ directory on the server.
|
||||
</para>
|
||||
<para>If using LiLo</para>
|
||||
<para>
|
||||
You have to download the vmlinuz image and put that in the /boot directory under the name vmlinuzNew
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If Grub is used: Edit the /boot/grub/menu.lst file on the server:
|
||||
<programlisting>
|
||||
# menu entry before the first:(for root, look at the other menu items)
|
||||
title Ubuntu Install
|
||||
root xxxxx
|
||||
kernel /linux
|
||||
initrd /initrd-preseed.gz
|
||||
savedefault 1
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>If Lilo is used edit the /etc/lilo.conf file on the server:
|
||||
<programlisting>
|
||||
image=/boot/vmlinuzNew
|
||||
label="newUbuntu"
|
||||
initrd=/boot/init-preseed.gz
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Reboot the server</para>
|
||||
<para>and hopfully after some time you can login with SSH and using the username "installer" and the password you specified in the preseed file</para>
|
||||
<para>From that point you can configure the server and repartition the harddisk</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Install Subversion</para>
|
||||
<para>use the command (as root) apt-get install subversion</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Install Apache using proxy AJP to talk to OFBiz</para>
|
||||
<para>Use the command (as root): apt-get install apache2</para>
|
||||
<para>Make symbolic links from mods-available to mods-enabled for ssl.config, ssl.load, proxy.load, proxy_ajp.load and proxy.config. Modify proxy.config and replace "Deny from all" with "Allow from all"</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Install Java SDK</para>
|
||||
<para>Use the command (as root): apt-get install sun-java6-jdk</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Install PostGresql</para>
|
||||
<para>Use the command (as root): apt-get install postgresql</para>
|
||||
<para>
|
||||
Then logon as root, and su to the user "postgres" and issue the command: createuser "ofbiz"
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Install Ofbiz</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Start ofbiz.....and look for he result in your browser.....</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
</chapter>
|
||||
<xi:include href="../../../framework/documents/Framework.xml"/>
|
||||
<xi:include href="../../../framework/base/documents/FrameworkBase.xml" />
|
||||
<xi:include href="../../../framework/common/documents/FrameworkCommon.xml" />
|
||||
<xi:include href="../../../framework/entity/documents/EntityEngine.xml" />
|
||||
<xi:include href="../../../framework/service/documents/ServiceEngine.xml" />
|
||||
<xi:include href="../../../framework/webtools/documents/Webtools.xml" />
|
||||
<xi:include href="../../../framework/documents/UnitTest.xml" />
|
||||
<xi:include href="../../../framework/documents/SingleSignOn.xml" />
|
||||
<xi:include href="../../../framework/documents/DataFiles.xml"/>
|
||||
|
||||
<appendix>
|
||||
<xi:include href="../../../applications/commonext/data/helpdata/HELP_OFBizDocumentationSystem.xml"/>
|
||||
</appendix>
|
||||
|
||||
<appendix>
|
||||
<section>
|
||||
<title>Revisions Requiring Data Migration.</title>
|
||||
<para>
|
||||
A List of migration actions you need to perform can be found at the <link xl:href="http://cwiki.apache.org/confluence/display/OFBTECH/Revisions+Requiring+Data+Migration">OFBiz documentation site</link>
|
||||
</para>
|
||||
</section>
|
||||
</appendix>
|
||||
|
||||
|
||||
</book>
|
||||
@@ -1,64 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0"
|
||||
xmlns:xl="http://www.w3.org/1999/xlink"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xsi:schemaLocation="http://docbook.org/ns/docbook ../../content/dtd/docbook.xsd"
|
||||
xmlns="http://docbook.org/ns/docbook">
|
||||
|
||||
<info>
|
||||
<title>Apache OFBiz User documentation</title>
|
||||
</info>
|
||||
|
||||
<chapter>
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
Welcome to Apache OFBiz the ready to use open source ERP system.
|
||||
</para>
|
||||
<para>
|
||||
A project introduction can be found at the <link xl:href="http://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Project+Overview">OFBiz documentation site</link>
|
||||
</para>
|
||||
<para>
|
||||
A general Business setup guide can be found at <link xl:href="http://cwiki.apache.org/confluence/display/OFBENDUSER/Apache+OFBiz+Business+Setup+Guide">OFBiz documentation site</link>
|
||||
For a quick setup check the <link xl:href="#componentSetup">Setup component.</link>
|
||||
</para>
|
||||
|
||||
</chapter>
|
||||
<xi:include href="../../../applications/commonext/documents/Setup.xml"/>
|
||||
<xi:include href="../../../applications/accounting/documents/Accounting.xml"/>
|
||||
<xi:include href="../../../applications/party/documents/Party.xml"/>
|
||||
<xi:include href="../../../applications/product/documents/Product.xml"/>
|
||||
<xi:include href="../../../applications/order/documents/Order.xml"/>
|
||||
<xi:include href="../../../applications/content/documents/Content.xml"/>
|
||||
<xi:include href="../../../applications/marketing/documents/Marketing.xml"/>
|
||||
<xi:include href="../../../applications/humanres/documents/Humanres.xml"/>
|
||||
<xi:include href="../../myportal/documents/MyPortal.xml"/>
|
||||
<xi:include href="../../projectmgr/documents/ProjectMgr.xml"/>
|
||||
<xi:include href="../../ebay/documents/Ebay.xml"/>
|
||||
<xi:include href="../../ebaystore/documents/EbayStore.xml"/>
|
||||
|
||||
<appendix>
|
||||
<title>New features recently added</title>
|
||||
<para>
|
||||
A description of the new features recently added can be found at the <link xl:href="http://cwiki.apache.org/confluence/display/OFBIZ/Main+New+Features">OFBiz documentation site</link>
|
||||
</para>
|
||||
</appendix>
|
||||
|
||||
</book>
|
||||
@@ -54,7 +54,9 @@ public class MultiSiteRequestWrapper implements HttpServletRequest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String changeSessionId() { return request.changeSessionId(); }
|
||||
public String changeSessionId() {
|
||||
return request.changeSessionId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthType() {
|
||||
@@ -114,9 +116,9 @@ public class MultiSiteRequestWrapper implements HttpServletRequest {
|
||||
}
|
||||
}
|
||||
return pathInfo.substring(nextPathSegmentStart);
|
||||
} else {
|
||||
return pathInfo;
|
||||
}
|
||||
} else {
|
||||
return pathInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,7 +215,7 @@ public class MultiSiteRequestWrapper implements HttpServletRequest {
|
||||
public int getContentLength() {
|
||||
return request.getContentLength();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getContentLengthLong() {
|
||||
return request.getContentLengthLong();
|
||||
@@ -278,134 +280,134 @@ public class MultiSiteRequestWrapper implements HttpServletRequest {
|
||||
public String getProtocol() {
|
||||
return request.getProtocol();
|
||||
}
|
||||
|
||||
/** get reader */
|
||||
@Override
|
||||
public BufferedReader getReader() throws IOException {
|
||||
return request.getReader();
|
||||
}
|
||||
|
||||
/** get real path */
|
||||
@Override @Deprecated
|
||||
public String getRealPath(String arg0) {
|
||||
return request.getServletContext().getRealPath(arg0);
|
||||
}
|
||||
|
||||
/** get remote addr */
|
||||
@Override
|
||||
public String getRemoteAddr() {
|
||||
return request.getRemoteAddr();
|
||||
}
|
||||
|
||||
/** get remote host */
|
||||
@Override
|
||||
public String getRemoteHost() {
|
||||
return request.getRemoteHost();
|
||||
}
|
||||
|
||||
/** get remote port */
|
||||
@Override
|
||||
public int getRemotePort() {
|
||||
return request.getRemotePort();
|
||||
}
|
||||
|
||||
/** get request dispatcher */
|
||||
@Override
|
||||
public RequestDispatcher getRequestDispatcher(String arg0) {
|
||||
return request.getRequestDispatcher(arg0);
|
||||
}
|
||||
|
||||
/** get scheme */
|
||||
@Override
|
||||
public String getScheme() {
|
||||
return request.getScheme();
|
||||
}
|
||||
|
||||
/** get server name */
|
||||
@Override
|
||||
public String getServerName() {
|
||||
return request.getServerName();
|
||||
}
|
||||
|
||||
/** get server port */
|
||||
@Override
|
||||
public int getServerPort() {
|
||||
return request.getServerPort();
|
||||
}
|
||||
|
||||
/** is secure */
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
return request.isSecure();
|
||||
}
|
||||
|
||||
/** remove attribute */
|
||||
@Override
|
||||
public void removeAttribute(String arg0) {
|
||||
request.removeAttribute(arg0);
|
||||
}
|
||||
|
||||
/** set attribute */
|
||||
@Override
|
||||
public void setAttribute(String arg0, Object arg1) {
|
||||
request.setAttribute(arg0, arg1);
|
||||
}
|
||||
|
||||
/** set character encoding */
|
||||
@Override
|
||||
public void setCharacterEncoding(String arg0) throws UnsupportedEncodingException {
|
||||
request.setCharacterEncoding(arg0);
|
||||
}
|
||||
|
||||
/** authenticate */
|
||||
@Override
|
||||
public boolean authenticate(HttpServletResponse arg0) throws IOException, ServletException {
|
||||
return request.authenticate(arg0);
|
||||
}
|
||||
|
||||
/** get part */
|
||||
@Override
|
||||
public Part getPart(String arg0) throws IOException, IllegalStateException, ServletException {
|
||||
return request.getPart(arg0);
|
||||
}
|
||||
|
||||
/** get parts */
|
||||
@Override
|
||||
public Collection<Part> getParts() throws IOException, IllegalStateException, ServletException {
|
||||
return request.getParts();
|
||||
}
|
||||
|
||||
/** login */
|
||||
@Override
|
||||
public void login(String arg0, String arg1) throws ServletException {
|
||||
request.login(arg0, arg1);
|
||||
}
|
||||
|
||||
/** logout */
|
||||
@Override
|
||||
public void logout() throws ServletException {
|
||||
request.logout();
|
||||
}
|
||||
|
||||
/** get async context */
|
||||
@Override
|
||||
public AsyncContext getAsyncContext() {
|
||||
return request.getAsyncContext();
|
||||
}
|
||||
|
||||
/** get dispatcher type */
|
||||
@Override
|
||||
public DispatcherType getDispatcherType() {
|
||||
return request.getDispatcherType();
|
||||
}
|
||||
|
||||
/** get servlet context */
|
||||
@Override
|
||||
public ServletContext getServletContext() {
|
||||
return request.getServletContext();
|
||||
}
|
||||
|
||||
/** is async started */
|
||||
@Override
|
||||
public boolean isAsyncStarted() {
|
||||
return request.isAsyncStarted();
|
||||
}
|
||||
|
||||
/** is async supported */
|
||||
@Override
|
||||
public boolean isAsyncSupported() {
|
||||
return request.isAsyncSupported();
|
||||
}
|
||||
|
||||
/** start async */
|
||||
@Override
|
||||
public AsyncContext startAsync() {
|
||||
return request.startAsync();
|
||||
}
|
||||
|
||||
/** start async */
|
||||
@Override
|
||||
public AsyncContext startAsync(ServletRequest arg0, ServletResponse arg1) {
|
||||
return request.startAsync(arg0, arg1);
|
||||
}
|
||||
|
||||
/** upgrade */
|
||||
@Override
|
||||
public <T extends HttpUpgradeHandler> T upgrade (Class<T> handlerClass) throws IOException, ServletException {
|
||||
public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException {
|
||||
return request.upgrade(handlerClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,14 +51,14 @@ import org.apache.ofbiz.webapp.stats.VisitHandler;
|
||||
// Used to filter website on the basis of hosted pathAlias.
|
||||
public class WebSiteFilter implements Filter {
|
||||
|
||||
public static final String module = WebSiteFilter.class.getName();
|
||||
private static final String MODULE = WebSiteFilter.class.getName();
|
||||
|
||||
protected FilterConfig m_config = null;
|
||||
private FilterConfig mConfig = null;
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
m_config = filterConfig;
|
||||
m_config.getServletContext().setAttribute("MULTI_SITE_ENABLED", true);
|
||||
mConfig = filterConfig;
|
||||
mConfig.getServletContext().setAttribute("MULTI_SITE_ENABLED", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +67,7 @@ public class WebSiteFilter implements Filter {
|
||||
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
||||
HttpSession session = httpRequest.getSession();
|
||||
|
||||
String webSiteId = (String) m_config.getServletContext().getAttribute("webSiteId");
|
||||
String webSiteId = (String) mConfig.getServletContext().getAttribute("webSiteId");
|
||||
String pathInfo = httpRequest.getPathInfo();
|
||||
// get the WebSite id segment, cheat here and use existing logic
|
||||
String webSiteAlias = RequestHandler.getRequestUri(pathInfo);
|
||||
@@ -85,7 +85,7 @@ public class WebSiteFilter implements Filter {
|
||||
webSite = EntityQuery.use(delegator).from("WebSite").where("isDefault", "Y").cache().queryFirst();
|
||||
}
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
}
|
||||
if (webSite != null) {
|
||||
webSiteId = webSite.getString("webSiteId");
|
||||
@@ -93,7 +93,7 @@ public class WebSiteFilter implements Filter {
|
||||
try {
|
||||
productStore = webSite.getRelatedOne("ProductStore", false);
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
}
|
||||
|
||||
String newLocale = request.getParameter("newLocale");
|
||||
@@ -103,13 +103,14 @@ public class WebSiteFilter implements Filter {
|
||||
newLocale = session.getAttribute("locale").toString();
|
||||
}
|
||||
|
||||
if (newLocale == null)
|
||||
if (newLocale == null) {
|
||||
newLocale = UtilHttp.getLocale(httpRequest).toString();
|
||||
}
|
||||
// If the webSiteId has changed then invalidate the existing session
|
||||
if (!webSiteId.equals(session.getAttribute("webSiteId"))) {
|
||||
ShoppingCart cart = (ShoppingCart) session.getAttribute("shoppingCart");
|
||||
if (cart != null && !(webSite.getString("productStoreId").equals(cart.getProductStoreId())) ) {
|
||||
// clearing cart items from previous store
|
||||
if (cart != null && !(webSite.getString("productStoreId").equals(cart.getProductStoreId()))) {
|
||||
// clearing cart items from previous store
|
||||
cart.clear();
|
||||
// Put product Store for this webSite in cart
|
||||
cart.setProductStoreId(webSite.getString("productStoreId"));
|
||||
@@ -120,7 +121,7 @@ public class WebSiteFilter implements Filter {
|
||||
try {
|
||||
cart.setCurrency(dispatcher, productStore.getString("defaultCurrencyUomId"));
|
||||
} catch (CartItemModifyException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
}
|
||||
}
|
||||
session.removeAttribute("webSiteId");
|
||||
@@ -129,7 +130,7 @@ public class WebSiteFilter implements Filter {
|
||||
}
|
||||
request.setAttribute("webSiteId", webSiteId);
|
||||
session.setAttribute("displayMaintenancePage", webSite.getString("displayMaintenancePage"));
|
||||
if(UtilValidate.isEmpty(webSite.getString("hostedPathAlias"))) {
|
||||
if (UtilValidate.isEmpty(webSite.getString("hostedPathAlias"))) {
|
||||
request.setAttribute("removePathAlias", false);
|
||||
} else {
|
||||
request.setAttribute("removePathAlias", true);
|
||||
@@ -143,13 +144,14 @@ public class WebSiteFilter implements Filter {
|
||||
chain.doFilter(httpRequest, response);
|
||||
}
|
||||
|
||||
private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher) {
|
||||
private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator,
|
||||
LocalDispatcher dispatcher) {
|
||||
HttpSession session = request.getSession();
|
||||
Security security = null;
|
||||
try {
|
||||
security = SecurityFactory.getInstance(delegator);
|
||||
} catch (SecurityConfigurationException e) {
|
||||
Debug.logError(e, module);
|
||||
Debug.logError(e, MODULE);
|
||||
}
|
||||
request.setAttribute("delegator", delegator);
|
||||
request.setAttribute("dispatcher", dispatcher);
|
||||
@@ -160,7 +162,6 @@ public class WebSiteFilter implements Filter {
|
||||
session.setAttribute("dispatcher", dispatcher);
|
||||
session.setAttribute("security", security);
|
||||
session.setAttribute("_WEBAPP_NAME_", UtilHttp.getApplicationName(request));
|
||||
|
||||
// get rid of the visit info since it was pointing to the previous database, and get a new one
|
||||
session.removeAttribute("visitor");
|
||||
session.removeAttribute("visit");
|
||||
@@ -170,4 +171,4 @@ public class WebSiteFilter implements Filter {
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
The DocBook XSL stylesheets are maintained by Norman Walsh,
|
||||
<ndw@nwalsh.com>, and members of the DocBook Project,
|
||||
<docbook-developers@sf.net>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
To view a list of all open DocBook Project XSL stylesheet bugs:
|
||||
|
||||
http://docbook.sf.net/tracker/xsl/bugs
|
||||
|
||||
To submit a bug report against the stylesheets:
|
||||
|
||||
http://docbook.sf.net/tracker/submit/bug
|
||||
|
||||
To do a full-text search of all DocBook Project issues:
|
||||
|
||||
http://docbook.sf.net/tracker/search
|
||||
|
||||
Discussion about the DocBook Project XSL stylesheets takes place
|
||||
on the docbook-apps mailing list:
|
||||
|
||||
http://wiki.docbook.org/topic/DocBookAppsMailingList
|
||||
|
||||
Real-time discussion takes place on IRC:
|
||||
|
||||
http://wiki.docbook.org/topic/DocBookIrcChannel
|
||||
irc://irc.freenode.net/docbook
|
||||
@@ -1,48 +0,0 @@
|
||||
Copyright
|
||||
---------
|
||||
Copyright (C) 1999-2007 Norman Walsh
|
||||
Copyright (C) 2003 Jiří Kosek
|
||||
Copyright (C) 2004-2007 Steve Ball
|
||||
Copyright (C) 2005-2008 The DocBook Project
|
||||
Copyright (C) 2011-2012 O'Reilly Media
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the ``Software''), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the names of individuals
|
||||
credited with contribution to this software shall not be used in
|
||||
advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization
|
||||
from the individuals in question.
|
||||
|
||||
Any stylesheet derived from this Software that is publically
|
||||
distributed will be identified with a different name and the
|
||||
version strings in any derived Software will be changed so that
|
||||
no possibility of confusion between the derived package and this
|
||||
Software will exist.
|
||||
|
||||
Warranty
|
||||
--------
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL NORMAN WALSH OR ANY OTHER
|
||||
CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Contacting the Author
|
||||
---------------------
|
||||
The DocBook XSL stylesheets are maintained by Norman Walsh,
|
||||
<ndw@nwalsh.com>, and members of the DocBook Project,
|
||||
<docbook-developers@sf.net>
|
||||
@@ -1,88 +0,0 @@
|
||||
$Id: INSTALL 6145 2006-08-06 13:13:03Z xmldoc $
|
||||
|
||||
INSTALL file for the DocBook XSL stylesheets distribution
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Case #1: Installation using a package management system
|
||||
----------------------------------------------------------------------
|
||||
If you have installed the DocBook XSL distribution using "apt-get",
|
||||
"yum", "urpmi", or some similar package-management front-end,
|
||||
then, as part of the package installation, the stylesheets have
|
||||
already been automatically installed in the appropriate location
|
||||
for your system, and your XML catalog environment has probably
|
||||
been updated to use that location.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Case #2: Installing manually
|
||||
----------------------------------------------------------------------
|
||||
If you have downloaded a docbook-xsl zip, tar.gz, or tar.bz2
|
||||
file, use the following steps to install it.
|
||||
|
||||
1. Move the zip, tar.gz, or tar.bz2 file to the directory where
|
||||
you'd like to install it (not to a temporary directory).
|
||||
|
||||
2. unzip or untar/uncompress the file
|
||||
|
||||
That will create a docbook-xsl-$VERSION directory (where
|
||||
$VERSION is the version number for the release).
|
||||
|
||||
The remaining steps are all OPTIONAL. They are intended to
|
||||
automatically update your user environment with XML Catalog
|
||||
information about the DocBook XSL distribution. You are NOT
|
||||
REQUIRED to complete these remaining steps. However, if you do
|
||||
not, and you want to use XML catalogs with the DocBook XSL
|
||||
stylesheets, you will need to manually update your XML catalog
|
||||
environment
|
||||
|
||||
3. Change to the docbook-xsl-$VERSION directory and execute the
|
||||
install.sh script:
|
||||
|
||||
./install.sh
|
||||
|
||||
That will launch an interactive installer, which will emit a
|
||||
series of prompts for you to respond to.
|
||||
|
||||
To instead run it non-interactively without being prompted
|
||||
for confirmation of the changes it makes, invoke it with the
|
||||
"--batch" switch, like this:
|
||||
|
||||
./install.sh --batch
|
||||
|
||||
After the process is complete, the installer will emit a
|
||||
message with a command you need to run in order to source
|
||||
your environment for use with the stylesheets.
|
||||
|
||||
4. To test that he installation has updated your environment
|
||||
correctly, execute the test.sh script:
|
||||
|
||||
./test.sh
|
||||
|
||||
That will test your XML catalog environment, using both the
|
||||
xmlcatalog application and the Apache XML Commons Resolver.
|
||||
|
||||
NOTE: The test.sh file is not created until the install.sh
|
||||
file is run for the first time.
|
||||
|
||||
5. (UNINSTALLING) If/when you want to uninstall the release,
|
||||
execute the uninstall.sh script.
|
||||
|
||||
./uninstall.sh
|
||||
|
||||
To instead run it non-interactively without being prompted
|
||||
for confirmation of the changes it makes, invoke it with the
|
||||
"--batch" switch, like this:
|
||||
|
||||
./uninstall.sh --batch
|
||||
|
||||
NOTE: The uninstall.sh file is not created until the install.sh
|
||||
file is run for the first time.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Note to packagers
|
||||
----------------------------------------------------------------------
|
||||
The install.sh, .CatalogManager.properties.example, and .urilist
|
||||
files should not be packaged. They are useful only to users who
|
||||
are installing the stylesheets manually.
|
||||
|
||||
The catalog.xml file should be packaged.
|
||||
@@ -1,89 +0,0 @@
|
||||
# $Id: Makefile.tests 8481 2009-07-13 20:18:41Z abdelazer $
|
||||
#
|
||||
# This makefile does a "smoketest" of stylesheets for various
|
||||
# output formats in the DocBook XSL Stylesheets release package.
|
||||
# It doesn't actually check the output -- it's just useful for
|
||||
# confirming whether each XSLT transformation actually executes
|
||||
# successfully without any errors.
|
||||
#
|
||||
# To use it, run "make check" or just "make"
|
||||
|
||||
XSLTPROC=xsltproc
|
||||
XSLTPROC_FLAGS=
|
||||
|
||||
TESTFILE=tests/refentry.007.xml
|
||||
TESTFILE_NS=tests/refentry.007.ns.xml
|
||||
|
||||
NORMAL_STYLES=fo/docbook.xsl html/docbook.xsl xhtml/docbook.xsl
|
||||
NORMAL_PROFILE_STYLES=fo/profile-docbook.xsl html/profile-docbook.xsl xhtml/profile-docbook.xsl
|
||||
CHUNK_STYLES=html/chunk.xsl html/onechunk.xsl xhtml/chunk.xsl xhtml/onechunk.xsl
|
||||
HELP_STYLES=htmlhelp/htmlhelp.xsl javahelp/javahelp.xsl eclipse/eclipse.xsl
|
||||
MULTIFILE_STYLES=$(CHUNK_STYLES) $(HELP_STYLES)
|
||||
CHUNK_PROFILE_STYLES=html/profile-chunk.xsl html/profile-onechunk.xsl xhtml/profile-chunk.xsl xhtml/profile-onechunk.xsl
|
||||
HELP_PROFILE_STYLES=htmlhelp/profile-htmlhelp.xsl eclipse/profile-eclipse.xsl javahelp/profile-javahelp.xsl
|
||||
MULTIFILE_PROFILE_STYLES=$(CHUNK_PROFILE_STYLES) $(HELP_PROFILE_STYLES)
|
||||
|
||||
MAN_STYLE=manpages/docbook.xsl
|
||||
MAN_PROFILE_STYLE=manpages/profile-docbook.xsl
|
||||
|
||||
TWO_PROFILE_STYLE=profiling/profile.xsl
|
||||
|
||||
ROUNDTRIP_STYLES=roundtrip/dbk2ooo.xsl roundtrip/dbk2pages.xsl roundtrip/dbk2wordml.xsl
|
||||
SLIDES_STYLES=slides/html/default.xsl slides/xhtml/default.xsl slides/fo/plain.xsl
|
||||
WEBSITE_STYLES=website/website.xsl
|
||||
WEBSITE_CHUNK_STYLES=website/chunk-website.xsl
|
||||
|
||||
# chunked output gets written to TMP_OUTPUT_DIR
|
||||
TMP_OUTPUT_DIR=/tmp/smoketest-output/
|
||||
# if you don't want TMP_OUTPUT_DIR and its contents deleted, unset
|
||||
# SMOKETEST_CLEAN_TARGET; e.g. "make check SMOKETEST_CLEAN_TARGET=''"
|
||||
SMOKETEST_CLEAN_TARGET=smoketest-clean
|
||||
|
||||
check: smoketest-make-tmp-dir smoketest-normal smoketest-normal-profile smoketest-chunk smoketest-chunk-profile smoketest-man smoketest-man-profile smoketest-two-profile $(SMOKETEST_CLEAN_TARGET)
|
||||
|
||||
smoketest-make-tmp-dir:
|
||||
$(RM) -r $(TMP_OUTPUT_DIR)
|
||||
mkdir '$(TMP_OUTPUT_DIR)'
|
||||
|
||||
smoketest-normal:
|
||||
for stylesheet in $(NORMAL_STYLES); do \
|
||||
echo "$(XSLT) $(TESTFILE) $$stylesheet > /dev/null"; \
|
||||
$(XSLT) $(TESTFILE) $$stylesheet > /dev/null; \
|
||||
echo "$(XSLT) $(TESTFILE_NS) $$stylesheet > /dev/null"; \
|
||||
$(XSLT) $(TESTFILE_NS) $$stylesheet > /dev/null; \
|
||||
done
|
||||
|
||||
smoketest-normal-profile:
|
||||
for stylesheet in $(NORMAL_PROFILE_STYLES); do \
|
||||
echo "$(XSLT) $(TESTFILE) $$stylesheet > /dev/null"; \
|
||||
$(XSLT) $(TESTFILE) $$stylesheet > /dev/null; \
|
||||
echo "$(XSLT) $(TESTFILE_NS) $$stylesheet > /dev/null"; \
|
||||
$(XSLT) $(TESTFILE_NS) $$stylesheet > /dev/null; \
|
||||
done
|
||||
|
||||
smoketest-chunk:
|
||||
for stylesheet in $(MULTIFILE_STYLES) ; do \
|
||||
$(XSLT) $(TESTFILE) $$stylesheet manifest.in.base.dir=1 base.dir=$(TMP_OUTPUT_DIR) ; \
|
||||
$(XSLT) $(TESTFILE_NS) $$stylesheet manifest.in.base.dir=1 base.dir=$(TMP_OUTPUT_DIR) ; \
|
||||
done;
|
||||
|
||||
smoketest-chunk-profile:
|
||||
for stylesheet in $(MULTIFILE_PROFILE_STYLES) ; do \
|
||||
$(XSLT) $(TESTFILE) $$stylesheet manifest.in.base.dir=1 base.dir=$(TMP_OUTPUT_DIR) ; \
|
||||
$(XSLT) $(TESTFILE_NS) $$stylesheet manifest.in.base.dir=1 base.dir=$(TMP_OUTPUT_DIR) ; \
|
||||
done;
|
||||
|
||||
smoketest-man:
|
||||
$(XSLT) $(TESTFILE) $(MAN_STYLE) man.output.in.separate.dir=1 man.output.base.dir=$(TMP_OUTPUT_DIR) ; \
|
||||
$(XSLT) $(TESTFILE_NS) $(MAN_STYLE) man.output.in.separate.dir=1 man.output.base.dir=$(TMP_OUTPUT_DIR) ;
|
||||
|
||||
smoketest-man-profile:
|
||||
$(XSLT) $(TESTFILE) $(MAN_PROFILE_STYLE) man.output.in.separate.dir=1 man.output.base.dir=$(TMP_OUTPUT_DIR) ; \
|
||||
$(XSLT) $(TESTFILE_NS) $(MAN_PROFILE_STYLE) man.output.in.separate.dir=1 man.output.base.dir=$(TMP_OUTPUT_DIR) ;
|
||||
|
||||
smoketest-two-profile:
|
||||
$(XSLT) $(TESTFILE_NS) $(TWO_PROFILE_STYLE) > /dev/null ;
|
||||
|
||||
smoketest-clean:
|
||||
$(RM) -r $(TMP_OUTPUT_DIR)
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
Changes since the 1.77.0 release
|
||||
|
||||
Note: This document lists changes only since the 1.77.0 release. If you instead
|
||||
want a record of the complete list of changes for the codebase over its entire
|
||||
history, you can obtain one by running the following commands:
|
||||
|
||||
svn checkout https://docbook.svn.sourceforge.net/svnroot/docbook/trunk/xsl
|
||||
svn log --xml --verbose xsl > ChangeHistory.xml
|
||||
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
Table of Contents
|
||||
|
||||
Release Notes: 1.77.1
|
||||
|
||||
FO
|
||||
HTML
|
||||
Roundtrip
|
||||
Slides
|
||||
Website
|
||||
Webhelp
|
||||
Template
|
||||
|
||||
Release Notes: 1.77.1
|
||||
|
||||
The following is a list of changes that have been made since the 1.77.0
|
||||
release.
|
||||
|
||||
FO
|
||||
|
||||
The following changes have been made to the fo code since the 1.77.0 release.
|
||||
|
||||
• Robert Stayton: docbook.xsl
|
||||
|
||||
Import the VERSION.xsl file instead of VERSION so mimetype is interpreted correctly
|
||||
from the filename.
|
||||
|
||||
• Robert Stayton: block.xsl
|
||||
|
||||
In sidebar, turn off space before first para if there is no title.
|
||||
|
||||
• Robert Stayton: math.xsl
|
||||
|
||||
Restored templates for mml:* elements that were accidentally deleted.
|
||||
|
||||
HTML
|
||||
|
||||
The following changes have been made to the html code since the 1.77.0 release.
|
||||
|
||||
• Robert Stayton: docbook.xsl
|
||||
|
||||
Import the VERSION.xsl file instead of VERSION so mimetype is interpreted correctly
|
||||
from the filename.
|
||||
|
||||
• Robert Stayton: sections.xsl
|
||||
|
||||
Use $div.element variable in place of div to support html5 section element.
|
||||
output
|
||||
|
||||
• Robert Stayton: autoidx.xsl
|
||||
|
||||
Fix bug 3528673, missing "separator" param on template with
|
||||
match="indexterm" mode="reference". That param is passed
|
||||
for endofrange processing to output the range separator.
|
||||
|
||||
Roundtrip
|
||||
|
||||
The following changes have been made to the roundtrip code since the 1.77.0
|
||||
release.
|
||||
|
||||
• Robert Stayton: dbk2ooo.xsl; dbk2pages.xsl; dbk2wordml.xsl; dbk2wp.xsl
|
||||
|
||||
Import the VERSION.xsl file instead of VERSION so mimetype is interpreted correctly
|
||||
from the filename.
|
||||
|
||||
Slides
|
||||
|
||||
The following changes have been made to the slides code since the 1.77.0
|
||||
release.
|
||||
|
||||
• Robert Stayton: html/slides-common.xsl
|
||||
|
||||
Import the VERSION.xsl file instead of VERSION so mimetype is interpreted correctly
|
||||
from the filename.
|
||||
|
||||
Website
|
||||
|
||||
The following changes have been made to the website code since the 1.77.0
|
||||
release.
|
||||
|
||||
• Robert Stayton: website-common.xsl
|
||||
|
||||
Import the VERSION.xsl file instead of VERSION so mimetype is interpreted correctly
|
||||
from the filename.
|
||||
|
||||
Webhelp
|
||||
|
||||
The following changes have been made to the webhelp code since the 1.77.0
|
||||
release.
|
||||
|
||||
• David Cramer: xsl/webhelp-common.xsl
|
||||
|
||||
Webhelp: Increase default value for chunk.section.depth
|
||||
|
||||
• kasunbg: docsrc/readme.xml
|
||||
|
||||
updated webhelp documentation
|
||||
|
||||
• kasunbg: template/content/search/nwSearchFnt.js; xsl/webhelp-common.xsl
|
||||
|
||||
Removed the script htmlFileList.js since it's content is in htmlFileInfoList.js
|
||||
|
||||
• Robert Stayton: xsl/webhelp-common.xsl
|
||||
|
||||
In the <h1> output, replace call to 'get.doc.title' with
|
||||
mode="title.markup" because get.doc.title returns only
|
||||
the string value of the title, losing any markup such
|
||||
as <trademark> or <superscript>.
|
||||
|
||||
• kasunbg: template/common/css/positioning.css; template/content/search/
|
||||
nwSearchFnt.js
|
||||
|
||||
Remove unnecessary bits of code from webhelp
|
||||
|
||||
• David Cramer: docsrc/readme.xml
|
||||
|
||||
Webhelp: Minor edits to the readme
|
||||
|
||||
• David Cramer: xsl/webhelp.xsl; xsl/titlepage.templates.xsl; xsl/
|
||||
titlepage.templates.xml
|
||||
|
||||
Webhelp: Suppress abstracts from titlepages. These are used to create the search result summary sentence and should not be shown
|
||||
|
||||
• David Cramer: build.xml
|
||||
|
||||
Webhelp: calculate path to profile.xsl from main build.xml file
|
||||
|
||||
Template
|
||||
|
||||
The following changes have been made to the template code since the 1.77.0
|
||||
release.
|
||||
|
||||
• Robert Stayton: titlepage.xsl
|
||||
|
||||
Undo last change because not implemented correctly.
|
||||
|
||||
• Robert Stayton: titlepage.xsl
|
||||
|
||||
Fix xsl:element to not overwrite the incoming fo: namespace
|
||||
if the $ns param is not set.
|
||||
|
||||