mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-14 08:54:21 +01:00
Compare commits
387 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6537faa35e | ||
|
|
0aeb27ba97 | ||
|
|
fb42333b3e | ||
|
|
81bb85c4df | ||
|
|
fdc958a172 | ||
|
|
854bbf8405 | ||
|
|
58a7640dc3 | ||
|
|
a8837f5645 | ||
|
|
fc1d4704a5 | ||
|
|
abbc9062ef | ||
|
|
fa986e311d | ||
|
|
d69b20311b | ||
|
|
be695a8e1a | ||
|
|
244d21bd2b | ||
|
|
12d3a7021f | ||
|
|
49db277368 | ||
|
|
f2ea78f2ec | ||
|
|
70319031ba | ||
|
|
07fb930a79 | ||
|
|
e1ee079254 | ||
|
|
c5572e0176 | ||
|
|
162498d2f8 | ||
|
|
1ae9d94de9 | ||
|
|
6790930283 | ||
|
|
d5479cd9ae | ||
|
|
ad725b3bb0 | ||
|
|
20471c54e1 | ||
|
|
d41850c7cd | ||
|
|
4696d35bcb | ||
|
|
1277e36179 | ||
|
|
c9883eecd2 | ||
|
|
144f2a5159 | ||
|
|
de3ec5682c | ||
|
|
7f127989b2 | ||
|
|
d85ec982e5 | ||
|
|
862e20e820 | ||
|
|
ae1ad80994 | ||
|
|
70f19b3a3d | ||
|
|
43123d6a87 | ||
|
|
b98874848f | ||
|
|
84575df7e6 | ||
|
|
3d185b6818 | ||
|
|
3c4956838e | ||
|
|
04606ec6a3 | ||
|
|
7bbbe49b70 | ||
|
|
7e10208619 | ||
|
|
0854984a08 | ||
|
|
b153019000 | ||
|
|
ec7ebe9f39 | ||
|
|
200b66d11f | ||
|
|
c725db166d | ||
|
|
70c950bd7c | ||
|
|
9093be2f0a | ||
|
|
e5298d0666 | ||
|
|
0865bdb60f | ||
|
|
b21006614c | ||
|
|
6a68c8cd99 | ||
|
|
9305403bea | ||
|
|
252bd6d9ba | ||
|
|
7c29fb614c | ||
|
|
26c12c61a7 | ||
|
|
4574ad2eeb | ||
|
|
53688e2d0f | ||
|
|
d840c8f831 | ||
|
|
4c7a689fb5 | ||
|
|
33f39bdfcb | ||
|
|
31a53b72ae | ||
|
|
3ad13adf31 | ||
|
|
7331e43db8 | ||
|
|
20e00ca290 | ||
|
|
ae00743590 | ||
|
|
81bca34a08 | ||
|
|
6e9874b95a | ||
|
|
6afda6a47a | ||
|
|
27f52dd0bd | ||
|
|
f6f66f2a77 | ||
|
|
c62f370959 | ||
|
|
a399e3f63d | ||
|
|
c0a30d1ff5 | ||
|
|
5a4f2fa0b3 | ||
|
|
a73ae49c4d | ||
|
|
8afffc8762 | ||
|
|
239e41f6c4 | ||
|
|
1d2c9c9df4 | ||
|
|
a163623dc6 | ||
|
|
e6b6246fea | ||
|
|
5bac3d4d2b | ||
|
|
787e1319b9 | ||
|
|
9a5ac7d1c7 | ||
|
|
3e6b7208cc | ||
|
|
319bc7ec8a | ||
|
|
4b1f0d1ac2 | ||
|
|
b6f477fc83 | ||
|
|
28218a00b3 | ||
|
|
1318e26cda | ||
|
|
4cbfb67d63 | ||
|
|
4f5f03b893 | ||
|
|
0bf7512f28 | ||
|
|
47746fd17d | ||
|
|
9ba102b6b9 | ||
|
|
25031e534d | ||
|
|
afe1ec633b | ||
|
|
2d52537106 | ||
|
|
1b6b471cb7 | ||
|
|
8447259f25 | ||
|
|
420f3bbdab | ||
|
|
8f612bc1b2 | ||
|
|
0ce2c2aab5 | ||
|
|
91a5547362 | ||
|
|
b36f80ab2e | ||
|
|
b73d287953 | ||
|
|
4ed7e281c5 | ||
|
|
63d9e963b8 | ||
|
|
2e201abac0 | ||
|
|
deb9ac25a8 | ||
|
|
3ff154c1d0 | ||
|
|
c8ab7dee45 | ||
|
|
9c7c1ddceb | ||
|
|
ad95b66842 | ||
|
|
f11db8396a | ||
|
|
ca6a624112 | ||
|
|
ab77051317 | ||
|
|
ba68e3d7ff | ||
|
|
36df2f1026 | ||
|
|
7b3242693b | ||
|
|
5726b40a10 | ||
|
|
7fd1051efc | ||
|
|
094719e099 | ||
|
|
fc37c393ce | ||
|
|
57cfb4b007 | ||
|
|
a20d824b97 | ||
|
|
300f46cb01 | ||
|
|
a1a9313487 | ||
|
|
4bbef9b478 | ||
|
|
7020e1ef29 | ||
|
|
db7ea5f52a | ||
|
|
2b3c5902e6 | ||
|
|
cb927847ab | ||
|
|
40b212d5cc | ||
|
|
190cf8aba5 | ||
|
|
3e9fbf0148 | ||
|
|
b40041146b | ||
|
|
916d3ce931 | ||
|
|
d47913ed19 | ||
|
|
0372276a7b | ||
|
|
6dd01e86e9 | ||
|
|
9ab2f44946 | ||
|
|
15fd24a511 | ||
|
|
f2088a084f | ||
|
|
12c1531b3b | ||
|
|
cd75794aaa | ||
|
|
dedd85c8b5 | ||
|
|
bdd54ae245 | ||
|
|
69efc54fb6 | ||
|
|
e11bd8c70d | ||
|
|
912e29a746 | ||
|
|
3c05cfe690 | ||
|
|
b46b675b7c | ||
|
|
a491de01b3 | ||
|
|
a26c8c0714 | ||
|
|
6e9cd819c1 | ||
|
|
35b021f203 | ||
|
|
a853764f6d | ||
|
|
2352463c21 | ||
|
|
666e4fdb5f | ||
|
|
991e247e30 | ||
|
|
f5d51dab5f | ||
|
|
02fc896612 | ||
|
|
1c6ddd25c4 | ||
|
|
7db643fff0 | ||
|
|
93c395fe10 | ||
|
|
7964bb12ce | ||
|
|
4596ec7d38 | ||
|
|
71da27f333 | ||
|
|
c79b9b9704 | ||
|
|
08a731ab39 | ||
|
|
45aaafd4d6 | ||
|
|
a40e5ca66c | ||
|
|
c04d082ad1 | ||
|
|
bad565cc64 | ||
|
|
0fc7ad7c1f | ||
|
|
769fbdb429 | ||
|
|
49991eabf8 | ||
|
|
63824861a6 | ||
|
|
83d883c36a | ||
|
|
4863ddcb00 | ||
|
|
89455672a2 | ||
|
|
7a0c6859bd | ||
|
|
545cdd0762 | ||
|
|
5d6e4a444a | ||
|
|
abc7c2f0f8 | ||
|
|
aaaad71347 | ||
|
|
49385fcab3 | ||
|
|
54f8c98b27 | ||
|
|
66dd7e30ae | ||
|
|
f99f1d83c2 | ||
|
|
16f7d96ed1 | ||
|
|
a7f5f3fb94 | ||
|
|
dcf77520ea | ||
|
|
18a6ed17cf | ||
|
|
5131e7a5b7 | ||
|
|
61ead06950 | ||
|
|
479f8616e1 | ||
|
|
f283e24b48 | ||
|
|
84781cabac | ||
|
|
ebf252f8a3 | ||
|
|
2a2fcf6784 | ||
|
|
ea5ffbb0bf | ||
|
|
71ef8c881b | ||
|
|
e4d87ab2e7 | ||
|
|
7738787729 | ||
|
|
6e7fe1a6c2 | ||
|
|
4311a1ece8 | ||
|
|
0f3ae6dc39 | ||
|
|
2fd3eb8bdf | ||
|
|
684cbbdddb | ||
|
|
234ad4c76a | ||
|
|
32485c2782 | ||
|
|
83c38570e9 | ||
|
|
1d980342ec | ||
|
|
3e3ed6f9e7 | ||
|
|
9b805f742b | ||
|
|
34b5399329 | ||
|
|
4f64250ad6 | ||
|
|
ea4dcbc77a | ||
|
|
6c195d7bdf | ||
|
|
ea1efa5e88 | ||
|
|
28a4785b3a | ||
|
|
6c4a4c34c4 | ||
|
|
d4f356c8f6 | ||
|
|
095fd2769a | ||
|
|
92dbc3ec1f | ||
|
|
b5187db6d0 | ||
|
|
68118e55dc | ||
|
|
ba88d89ff5 | ||
|
|
590ee589c1 | ||
|
|
aed71be7f1 | ||
|
|
1af69d4c8f | ||
|
|
b85ed3e0b7 | ||
|
|
2a2f0557cf | ||
|
|
e2408fb54d | ||
|
|
9242c1a630 | ||
|
|
644f247910 | ||
|
|
1626c9fb6e | ||
|
|
c67d79a4e2 | ||
|
|
072a455ca4 | ||
|
|
7041c3246e | ||
|
|
40229c9d96 | ||
|
|
f4ca6916cd | ||
|
|
3a99ef7319 | ||
|
|
3ae2d71ea6 | ||
|
|
91ae365588 | ||
|
|
6206519456 | ||
|
|
2e6cb2afaa | ||
|
|
dc9f8a349f | ||
|
|
80ef97e215 | ||
|
|
759427f6ac | ||
|
|
81bf7d07e3 | ||
|
|
eed2b97913 | ||
|
|
069df82380 | ||
|
|
46ecdb8d4d | ||
|
|
95326c3d63 | ||
|
|
22c548e80b | ||
|
|
14b11b3cc5 | ||
|
|
5625c94c44 | ||
|
|
72dd3705ed | ||
|
|
2df026b903 | ||
|
|
e36df726a1 | ||
|
|
2b182c1cc1 | ||
|
|
6b626ab12c | ||
|
|
d53117da3f | ||
|
|
1e970fa8d7 | ||
|
|
bf3de83c5d | ||
|
|
677b333d0a | ||
|
|
af8d2e0e1a | ||
|
|
d3bbb93ada | ||
|
|
4c90ba1a64 | ||
|
|
50563ab126 | ||
|
|
7883ac4a8d | ||
|
|
08fcfded76 | ||
|
|
541da011a4 | ||
|
|
c2abedeb24 | ||
|
|
f6de2d091d | ||
|
|
b5d8bc732d | ||
|
|
af436b6559 | ||
|
|
f2e24ed96e | ||
|
|
21c355dd9d | ||
|
|
12409e944c | ||
|
|
f661b926fa | ||
|
|
c4798c34b0 | ||
|
|
c86318ea66 | ||
|
|
99b068b625 | ||
|
|
6797c95164 | ||
|
|
e694d0b2c2 | ||
|
|
6a5af0511d | ||
|
|
e0c3cf8360 | ||
|
|
4e94d92b70 | ||
|
|
9b21c827c3 | ||
|
|
4899d03ff8 | ||
|
|
8d7f24a6d9 | ||
|
|
79754eb326 | ||
|
|
45d618cd7a | ||
|
|
ae7ba162f2 | ||
|
|
7bd99c0eee | ||
|
|
cbe23741eb | ||
|
|
1a16dc1166 | ||
|
|
50b1a54dca | ||
|
|
3bda9be775 | ||
|
|
2136bce4b0 | ||
|
|
d9a1c2b235 | ||
|
|
b13bc0e698 | ||
|
|
f2ecdac454 | ||
|
|
d55c440740 | ||
|
|
ef8bb1f5ca | ||
|
|
101f6a5af3 | ||
|
|
5d40124b22 | ||
|
|
627ef14454 | ||
|
|
899f41d68c | ||
|
|
5253c759af | ||
|
|
70975b36c7 | ||
|
|
789a76320a | ||
|
|
6b2b996935 | ||
|
|
c43bc63d2e | ||
|
|
a7530b7eff | ||
|
|
0532598ecf | ||
|
|
410a3801da | ||
|
|
143cbec281 | ||
|
|
9760ed5c8d | ||
|
|
63c0ab93fb | ||
|
|
01075081cb | ||
|
|
5259547b96 | ||
|
|
31897f54ac | ||
|
|
a15f1350be | ||
|
|
50a4d54d8a | ||
|
|
07caf22647 | ||
|
|
becf096bf8 | ||
|
|
82093f5891 | ||
|
|
560b026d68 | ||
|
|
b62323939e | ||
|
|
70017da95a | ||
|
|
287b8ebe53 | ||
|
|
f0bb9288bf | ||
|
|
f5fb8363d8 | ||
|
|
1264857211 | ||
|
|
fb01f550f4 | ||
|
|
e0b71fd258 | ||
|
|
21b79d314a | ||
|
|
6e425d1895 | ||
|
|
740fddcd42 | ||
|
|
41a82023e3 | ||
|
|
3231e54abd | ||
|
|
84ec39f043 | ||
|
|
bf7fcce1b2 | ||
|
|
09914f31f9 | ||
|
|
11d737f23a | ||
|
|
83205e6963 | ||
|
|
c9445ee700 | ||
|
|
83cf08f2eb | ||
|
|
0855d84ccf | ||
|
|
2b6cdd2e33 | ||
|
|
f412ce6a9c | ||
|
|
113c2dd717 | ||
|
|
91af1f8702 | ||
|
|
c0defe3965 | ||
|
|
1669d497b4 | ||
|
|
93365addd1 | ||
|
|
d4a7c0abc6 | ||
|
|
1b5cabad71 | ||
|
|
3d5006f8fc | ||
|
|
54b3acc997 | ||
|
|
6cd24ab210 | ||
|
|
8fa8d7fa08 | ||
|
|
9a24007c0a | ||
|
|
524b186959 | ||
|
|
36aa53e88d | ||
|
|
dccad0b19d | ||
|
|
f4efc86dd3 | ||
|
|
ffca289bff | ||
|
|
125796b0f5 | ||
|
|
c1f0826005 | ||
|
|
153e563c9f | ||
|
|
47acbf4f54 | ||
|
|
cd1322de79 | ||
|
|
b23f74eab1 | ||
|
|
ea87b2ddb6 | ||
|
|
ba34b601b3 | ||
|
|
0b6c7d2d63 |
204
ChangeLog
204
ChangeLog
@@ -2,6 +2,91 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 9.0.4 compared to 9.0.3 *****
|
||||
FIX: #5249
|
||||
FIX: #11025
|
||||
FIX: #11032
|
||||
FIX: #11097
|
||||
FIX: #11169
|
||||
FIX: #11202
|
||||
FIX: #11244
|
||||
FIX: #11296
|
||||
FIX: #11316
|
||||
FIX: #11335
|
||||
FIX: Add missing end date of subscription in export
|
||||
FIX: A user may read holiday and expense report without permissions
|
||||
FIX: better syntax
|
||||
FIX: condition
|
||||
FIX: confirmation of mass email sending + option MAILING_NO_USING_PHPMAIL
|
||||
FIX: crabe pdf: bad detailed VAT for situation invoices, in situations S2 and above
|
||||
FIX: default value for duration of validity can be set from generic
|
||||
FIX: do not include tpl from disabled modules
|
||||
FIX: Error management when MAILING_NO_USING_PHPMAIL is set
|
||||
FIX: Even with permission, can't validate leave once validator defined.
|
||||
FIX: extrafield list search: SQL error when field is multiselect
|
||||
FIX: if last char of customercode is accent making the truncate of first
|
||||
FIX: Import of chart of account
|
||||
FIX: in edit mode, dictionary inputs do not escape the string inside the 'value' attribute, causing errors if there are any double quotes
|
||||
FIX: invalid link on user.fk_user
|
||||
FIX: invoice class: bad SQL request if product type not set
|
||||
FIX: javascript error when ckeditor module not enabled
|
||||
FIX: mail presend: can overwrite a file previously uploaded (Issue #11056)
|
||||
FIX: mass send mail
|
||||
FIX: missing compatibility with multicompany transverse mode
|
||||
FIX: missing llx_const encrypt
|
||||
FIX: modulebuilder: hardcoded llx_
|
||||
FIX: Not showing Contract and Project columns on ficheinter list
|
||||
FIX: only profid1 to 4 were editable for pdf option to show. Not 5 and 6.
|
||||
FIX: productaccount buylist with pages
|
||||
FIX: remove isolated transaction commit
|
||||
FIX: security (a user can read leave or holiday of other without perm.
|
||||
FIX: situation invoices: bad detailed VAT in situations following the first one
|
||||
FIX: situation invoices: block progress percentage change for discount lines
|
||||
FIX: syntax error
|
||||
FIX: the id was not loaded in fetch of accounting system
|
||||
FIX: try to use WHERE EXISTS instead of DISTINCT
|
||||
FIX: use dol_sanitizeFileName() function to remove double spaces in filenames, as well as done on document.php when we want to download pdf
|
||||
FIX: Use of cron with multicompany
|
||||
FIX: var name
|
||||
FIX: we need to fetch fourn invoice with ref in current entity
|
||||
FIX: Wrong stock movement on supplier credit notes
|
||||
FIX: Import of record in ledger
|
||||
|
||||
***** ChangeLog for 9.0.3 compared to 9.0.2 *****
|
||||
FIX: #11013
|
||||
FIX: #11041
|
||||
FIX: actioncomm: sort events by date after external calendars and hook (into 7.0)
|
||||
FIX: better test
|
||||
FIX: Combo list was limited to 20 in stock correction
|
||||
FIX: Confusion between expired and late
|
||||
FIX: Cursor pointer in payment screen for autofill
|
||||
FIX: CVE-2019-11199
|
||||
FIX: CVE-2019-11200
|
||||
FIX: CVE-2019-11201
|
||||
FIX: Default value on form to send email
|
||||
FIX: error messages not displayed
|
||||
FIX: Massive debug in lettering function
|
||||
FIX: missing compatibility with multicompany
|
||||
FIX: missing global $user
|
||||
FIX: missing situation invoice in list
|
||||
FIX: MultiEntity in lettering functionality
|
||||
FIX: Product accountancey sell intra code must be visible if main feature level 1
|
||||
FIX: ref for table without ref manager are set to NULL.
|
||||
FIX: Sending email to mass actions send same email on same customer
|
||||
FIX: Several fixes on import of services/products
|
||||
FIX: shipping default warehouse if only one warehouse
|
||||
FIX: sortfield on lettering function
|
||||
FIX: Status of opportunity should never be -1
|
||||
FIX: test to display create invoice button on supplier_order card
|
||||
FIX: The autocopy feature was ko for suppliers
|
||||
FIX: Total per day in timespent per week
|
||||
FIX: Total per day shows 00:00 if the total time spent is equal to 12:00
|
||||
FIX: Update/delete currency on same languages
|
||||
FIX: Wrong variable name make contact of supplier order not used on PDF.
|
||||
FIX: Add hidden option MAIN_PDF_HIDE_SITUATION to hide situation (quick hack to fix output pb).
|
||||
FIX: attached files list with link file was broked
|
||||
|
||||
***** ChangeLog for 9.0.2 compared to 9.0.1 *****
|
||||
FIX: #10822
|
||||
FIX: Accountancy - Format EBP import
|
||||
@@ -220,6 +305,125 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Remove the no more used and deprecated dol_print_graph function
|
||||
|
||||
|
||||
***** ChangeLog for 8.0.6 compared to 8.0.5 *****
|
||||
FIX: #11244
|
||||
FIX: #11316
|
||||
FIX: Add missing end date of subscription in export
|
||||
FIX: A user may read holiday and expense report without permissions
|
||||
FIX: better syntax
|
||||
FIX: condition
|
||||
FIX: confirmation of mass email sending + option MAILING_NO_USING_PHPMAIL
|
||||
FIX: crabe pdf: bad detailed VAT for situation invoices, in situations S2 and above
|
||||
FIX: default value for duration of validity can be set from generic
|
||||
FIX: do not include tpl from disabled modules
|
||||
FIX: Error management when MAILING_NO_USING_PHPMAIL is set
|
||||
FIX: Even with permission, can't validate leave once validator defined.
|
||||
FIX: extrafield list search: SQL error when field is multiselect
|
||||
FIX: if last char of customercode is accent making the truncate of first
|
||||
FIX: in edit mode, dictionary inputs do not escape the string inside the 'value' attribute, causing errors if there are any double quotes
|
||||
FIX: invalid link on user.fk_user
|
||||
FIX: invoice class: bad SQL request if product type not set
|
||||
FIX: mail presend: can overwrite a file previously uploaded
|
||||
FIX: mail presend: can overwrite a file previously uploaded (Issue #11056)
|
||||
FIX: mass send mail
|
||||
FIX: missing compatibility with multicompany transverse mode
|
||||
FIX: modulebuilder: hardcoded llx_
|
||||
FIX: Not showing Contract and Project columns on ficheinter list
|
||||
FIX: remove isolated transaction commit
|
||||
FIX: security (a user can read leave or holiday of other without perm.
|
||||
FIX: situation invoices: bad detailed VAT in situations following the first one
|
||||
FIX: situation invoices: block progress percentage change for discount lines
|
||||
FIX: syntax error
|
||||
FIX: try to use WHERE EXISTS instead DISTINCT
|
||||
FIX: use dol_sanitizeFileName() function to remove double spaces in filenames, as well as done on document.php when we want to download pdf
|
||||
FIX: var name
|
||||
FIX: we need to fetch fourn invoice with ref in current entity
|
||||
FIX: Wrong stock movement on supplier credit notes
|
||||
|
||||
***** ChangeLog for 8.0.5 compared to 8.0.4 *****
|
||||
FIX: #10381
|
||||
FIX: #10460 compatibility with MariaDB 10.4
|
||||
FIX: #11025
|
||||
FIX: Accountancy - Add transaction with multicompany use all the time 1st entity
|
||||
FIX: Accountancy - Format EBP import
|
||||
FIX: actioncomm export: ORDER BY clause is in wrong export property + event type filter does not work
|
||||
FIX: actioncomm: sort events by date after external calendars and hook
|
||||
FIX: action list: add printFieldListSelect and printFieldListWhere hooks
|
||||
FIX: add fk_unit on addline action
|
||||
FIX: avoid php warning
|
||||
FIX: bad sql request
|
||||
FIX: better method
|
||||
FIX: better test
|
||||
FIX: better test on fetch
|
||||
FIX: broken external authentication module feature and avoid warning
|
||||
FIX: Can not create contract with numbering module without autogen rule
|
||||
FIX: can't add lines on invoices
|
||||
FIX: Can't generate invoice pdf
|
||||
FIX: Can't insert if there is extrafields mandatory on another entity.
|
||||
FIX: Can't insert if there is extrafields mandatory on another entity. FIX: Can't set default value of extrafield of type varchar
|
||||
FIX: Check for old picture name if the new one was not found
|
||||
FIX: Civility not saved when creating a member.
|
||||
FIX: $conf->fournisseur->commande->enabled doesn't exist, we must use $conf->fournisseur->enabled
|
||||
FIX: could not create several superadmin in transversal mode
|
||||
FIX: credit note can have negative value
|
||||
FIX: Default value on sales representative on third party creation
|
||||
FIX: Don't show journal:getNomUrl without data
|
||||
FIX: Erreur dans le Total
|
||||
FIX: error messages not displayed
|
||||
FIX: expedition: reset status on rollback + replace hardcoded status with const
|
||||
FIX: Fix PHP warning "count(): Parameter must be an array..."
|
||||
FIX: fk_default_warehouse missing in group by
|
||||
FIX: function sendEmailsReminder isn't completely developed, then MAIN_FEATURES_LEVEL must be 2 to "use" it
|
||||
FIX: holidays get natural_search if search params are set only
|
||||
FIX: if empty error message, we just see "error" displayed
|
||||
FIX: if(!method_exists(dol_loginfunction))
|
||||
FIX: If we build one invoice for several orders, we must put the ref of order on the line to not lose information.
|
||||
FIX: in fact expensereport must be in $check array
|
||||
FIX: Interface regression for bind people. Fix option MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
FIX: line edit template: keep fk_parent_line
|
||||
FIX: Loan impossible to account
|
||||
FIX: Mark credit note as available for credit note in other currency
|
||||
FIX: missing access security checking with multicompany
|
||||
FIX: missing entity filter and wrong var name
|
||||
FIX: missing entity filter in function "build_filterField()" (export)
|
||||
FIX: Missing field in import/export of users
|
||||
FIX: missing hook completeTabsHead in margins module
|
||||
FIX: missing $ismultientitymanaged for previous/next ref
|
||||
FIX: Missing province in export of invoice
|
||||
FIX: multicompany compatibility
|
||||
FIX: must fetch member in current entity
|
||||
FIX: need an order by in case we found other invoice with same number but not same date
|
||||
FIX: need to round with 2 decimals to avoid movements not correctly balanced
|
||||
FIX: no need to test anything to display documents tabs on expense report
|
||||
FIX: positive values creating diff on addline rounding
|
||||
FIX: problem with multicompany transverse mode
|
||||
FIX: Product accountancey sell intra code must be visible if main feature level 1
|
||||
FIX: project_title for display of getNomUrl()
|
||||
FIX: quick search for supplier orders
|
||||
FIX: Remane of project
|
||||
FIX: same thing here
|
||||
FIX: Selection of email recipient with option MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
FIX: several hooks in shipping/delivery cards
|
||||
FIX: shipping default warehouse if only one warehouse
|
||||
FIX: SQL injection on rowid of dict.php
|
||||
FIX: 'statut' is ignored when updating a user with the REST API.
|
||||
FIX: supplier invoice payment total dont care about deposit or credit
|
||||
FIX: supplier invoice product stats total ht is line total not invoice total
|
||||
FIX: The minimum amount filter does not work in the VAT report per customer
|
||||
FIX: Total per day shows 00:00 if the total time spent is equal to 12:00
|
||||
FIX: Update/delete currency on same languages
|
||||
FIX: [URGENT] broken feature, "$usercancreate" is for Dolibarr 9
|
||||
FIX: useless join
|
||||
FIX: we need to keep originline special_code
|
||||
FIX: we want to be able to reopen fourn credit note
|
||||
FIX: when 2 extra fields are mandatory in 2 different entities
|
||||
FIX: when we add a payment on an invoice which already has payments with credit note or deposit amount, and then we get an excess received, discount amount must be $total_paiements + $total_creditnote_and_deposit - $object->total_ttc;
|
||||
FIX: when we create deposit with multi tva, we mustn't add line if amount = 0 (example when we have a 100% reduc on one of origin invoice line)
|
||||
FIX: wrong redirect link on holiday refuse
|
||||
FIX: wrong test enabled
|
||||
FIX: Wrong variable name
|
||||
FIX: XSS
|
||||
|
||||
***** ChangeLog for 8.0.4 compared to 8.0.3 *****
|
||||
FIX: #10030 better german chart
|
||||
FIX: #10036
|
||||
|
||||
@@ -121,6 +121,7 @@ else
|
||||
}
|
||||
|
||||
print "Release : ".$release."\n";
|
||||
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
|
||||
print "Include custom in signature : ".$includecustom."\n";
|
||||
print "Include constants in signature : ";
|
||||
foreach ($includeconstants as $countrycode => $tmp)
|
||||
|
||||
@@ -357,16 +357,16 @@ if ($nboftargetok) {
|
||||
}
|
||||
else
|
||||
{
|
||||
print "ChangeLog for $MAJOR.$MINOR\.$BUILD was found into '$SOURCE/ChangeLog. But you can regenerate it with command:'\n";
|
||||
print "ChangeLog for $MAJOR.$MINOR\.$BUILD was found into '$SOURCE/ChangeLog'. But you can regenerate it with command:\n";
|
||||
}
|
||||
if (! $BUILD || $BUILD eq '0-rc') # For a major version
|
||||
{
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\|CLOSE\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
}
|
||||
else # For a maintenance release
|
||||
{
|
||||
#print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. | grep -v "Merge branch" | grep -v "Merge pull" | grep "^ " | sed -e "s/^[0-9a-z]* *//" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. | grep -v "Merge branch" | grep -v "Merge pull" | grep "^ " | sed -e "s/^[0-9a-z]* *//" | grep -e \'^FIX\|NEW\|CLOSE\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
|
||||
}
|
||||
print "\n";
|
||||
@@ -387,6 +387,8 @@ if ($nboftargetok) {
|
||||
#-----------------------
|
||||
if ($CHOOSEDTARGET{'-CHKSUM'})
|
||||
{
|
||||
chdir("$SOURCE");
|
||||
|
||||
$ret=`git ls-files . --exclude-standard --others`;
|
||||
if ($ret)
|
||||
{
|
||||
|
||||
@@ -279,7 +279,8 @@ if ($result)
|
||||
if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc);
|
||||
if ($search_current_account > 0) $param.="&search_current_account=".urlencode($search_current_account);
|
||||
if ($search_current_account_valid && $search_current_account_valid != '-1') $param.="&search_current_account_valid=".urlencode($search_current_account_valid);
|
||||
|
||||
if ($accounting_product_mode) $param.="&accounting_product_mode=".urlencode($accounting_product_mode);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,17 +30,19 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta","accountancy"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$socid = GETPOST('socid','int')?GETPOST('socid','int'):GETPOST('id','int');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@@ -53,26 +55,31 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "")
|
||||
$sortorder = "DESC";
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "bk.doc_date";
|
||||
|
||||
$search_year = GETPOST("search_year", 'int');
|
||||
$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
/*
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
//$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
||||
*/
|
||||
|
||||
$lettering = GETPOST('lettering', 'alpha');
|
||||
if (! empty($lettering)) {
|
||||
$action = $lettering;
|
||||
}
|
||||
|
||||
// Did we click on purge search criteria ?
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_year = '';
|
||||
$search_doc_type = '';
|
||||
/*
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
//$search_doc_type = '';
|
||||
$search_doc_ref = '';
|
||||
}
|
||||
*/
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", 'int');
|
||||
@@ -102,6 +109,7 @@ if ($action == 'lettering') {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $lettering->letteringThirdparty($socid);
|
||||
@@ -111,9 +119,9 @@ if ($action == 'autolettrage') {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
@@ -136,20 +144,19 @@ dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'n
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )";
|
||||
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
|
||||
/*
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($search_date_start) . "' AND '" . $db->idate($search_date_end) . "' )";
|
||||
}
|
||||
*/
|
||||
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$debit = 0;
|
||||
@@ -180,92 +187,123 @@ if (! $resql) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$param='';
|
||||
$param.="&socid=".urlencode($socid);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
|
||||
$param="&socid=".$socid;
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
|
||||
/*
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Piece
|
||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
||||
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("", "","",'','',"",$sortfield,$sortorder,'maxwidthsearch center ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td colspan="5"> </td>';
|
||||
print '<td align="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
|
||||
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
} else {
|
||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
|
||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td align="right">' . price($obj->debit) . '</td>';
|
||||
print '<td align="right">' . price($obj->credit) . '</td>';
|
||||
print '<td align="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td align="center">' . $obj->code_journal . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
} else
|
||||
print '<td align="center">' . $obj->lettering_code . '</td>';
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('',$obj->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $obj->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a></td>' . "\n";
|
||||
} else {
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td align="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td align="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="4"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td align="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettering">' . $langs->trans('AccountancyAutoLettering') . '</a>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print $letteringbutton;
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,17 +30,19 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta","accountancy"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$socid = GETPOST('socid','int')?GETPOST('socid','int'):GETPOST('id','int');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@@ -53,27 +55,31 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "")
|
||||
$sortorder = "DESC";
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "bk.doc_date";
|
||||
|
||||
$search_year = GETPOST("search_year",'int');
|
||||
$search_doc_type = GETPOST("search_doc_type",'alpha');
|
||||
/*
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
//$search_doc_type = GETPOST("search_doc_type",'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref",'alpha');
|
||||
*/
|
||||
|
||||
$lettering = GETPOST('lettering', 'alpha');
|
||||
if (!empty($lettering)) {
|
||||
$action=$lettering;
|
||||
}
|
||||
|
||||
// Did we click on purge search criteria ?
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha'))
|
||||
/*
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_year='';
|
||||
$search_doc_type='';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
//$search_doc_type='';
|
||||
$search_doc_ref='';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Security check
|
||||
@@ -103,6 +109,7 @@ if ($action == 'lettering') {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $lettering->letteringThirdparty($socid);
|
||||
@@ -112,7 +119,7 @@ if ($action == 'autolettrage') {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -143,12 +150,11 @@ $sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.l
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
$sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )";
|
||||
}
|
||||
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$debit = 0;
|
||||
@@ -173,7 +179,7 @@ while ($obj = $db->fetch_object($resql)) {
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG );
|
||||
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG );
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@@ -181,43 +187,68 @@ if (! $resql)
|
||||
exit;
|
||||
}
|
||||
|
||||
$param='';
|
||||
$param.="&socid=".urlencode($socid);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG );
|
||||
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG );
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param="&socid=".$socid;
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
|
||||
/*
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Piece
|
||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
||||
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("", "","",'','',"",$sortfield,$sortorder,'maxwidthsearch center ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
@@ -227,48 +258,53 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
} else {
|
||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
|
||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td align="right">' . price($obj->debit) . '</td>';
|
||||
print '<td align="right">' . price($obj->credit) . '</td>';
|
||||
print '<td align="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td align="center">' . $obj->code_journal . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('',$obj->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $obj->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
} else
|
||||
print '<td align="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a></td>' . "\n";
|
||||
} else {
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td align="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td align="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td align="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="4"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="' . $langs->trans('AccountancyLettering') . '" name="lettering" id="lettering">';
|
||||
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print $letteringbutton;
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@@ -83,13 +83,13 @@ class AccountancySystem
|
||||
|
||||
if ($rowid > 0 || $ref)
|
||||
{
|
||||
$sql = "SELECT a.pcg_version, a.label, a.active";
|
||||
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||
$sql .= " WHERE";
|
||||
if ($rowid) {
|
||||
$sql .= " a.rowid = '" . $rowid . "'";
|
||||
} elseif ($ref) {
|
||||
$sql .= " a.pcg_version = '" . $ref . "'";
|
||||
$sql .= " a.pcg_version = '" . $this->db->escape($ref) . "'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||
|
||||
@@ -149,12 +149,13 @@ class AccountingAccount extends CommonObject
|
||||
/**
|
||||
* Load record in memory
|
||||
*
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
|
||||
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account
|
||||
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC'.
|
||||
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
||||
*/
|
||||
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
|
||||
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -172,6 +173,9 @@ class AccountingAccount extends CommonObject
|
||||
if (! empty($limittocurrentchart)) {
|
||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';
|
||||
}
|
||||
if (! empty($limittoachartaccount)) {
|
||||
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -66,13 +66,13 @@ class Lettering extends BookKeeping
|
||||
$sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||
$sql .= " WHERE ( ";
|
||||
$sql .= " WHERE ( ";
|
||||
if (! empty($object->code_compta))
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
|
||||
$sql .= " OR ";
|
||||
$sql .= " OR ";
|
||||
if (! empty($object->code_compta_fournisseur))
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
|
||||
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||
@@ -128,15 +128,15 @@ class Lettering extends BookKeeping
|
||||
$sql .= " AND facf.entity = ".$conf->entity;
|
||||
$sql .= " AND ( ";
|
||||
if (! empty($object->code_compta)) {
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
}
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " OR ";
|
||||
$sql .= " OR ";
|
||||
}
|
||||
if (! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
}
|
||||
$sql .= " ) ";
|
||||
$sql .= ") ";
|
||||
|
||||
$resql2 = $this->db->query($sql);
|
||||
if ($resql2) {
|
||||
@@ -253,7 +253,7 @@ class Lettering extends BookKeeping
|
||||
$error++;
|
||||
}
|
||||
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@@ -120,6 +120,12 @@ $modules=array(
|
||||
'img' => 'trip'
|
||||
)*/
|
||||
),
|
||||
'holiday' => array(
|
||||
array(
|
||||
'code' => 'MAIN_DELAY_HOLIDAYS',
|
||||
'img' => 'holiday'
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly"));
|
||||
|
||||
@@ -1982,7 +1982,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
}
|
||||
if (! $transfound)
|
||||
{
|
||||
print '<input type="text" class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" class="flat'.($class?' '.$class:'').'" value="'.dol_escape_htmltag(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||
if (! class_exists('PrestaShopWebservice')) // We keep this because some modules add this lib too into a different path. This is to avoid "Cannot declare class PrestaShopWebservice" errors.
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,8 +33,8 @@ include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectorfilter.class
|
||||
include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectoraction.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
if (empty($conf->emailcollector->enabled)) accessforbidden();
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("admin", "mails", "other"));
|
||||
|
||||
@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
dol_include_once('/emailcollector/class/emailcollector.class.php');
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
if (empty($conf->emailcollector->enabled)) accessforbidden();
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("admin", "other"));
|
||||
@@ -450,10 +451,10 @@ while ($i < min($num, $limit))
|
||||
$cssforfield='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
|
||||
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
|
||||
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
|
||||
@@ -66,8 +66,8 @@ else
|
||||
|
||||
if ($action == 'add' || GETPOST("modify"))
|
||||
{
|
||||
$external_rss_title = "external_rss_title_" . GETPOST("norss");
|
||||
$external_rss_urlrss = "external_rss_urlrss_" . GETPOST("norss");
|
||||
$external_rss_title = "external_rss_title_" . GETPOST("norss", 'int');
|
||||
$external_rss_urlrss = "external_rss_urlrss_" . GETPOST("norss", 'int');
|
||||
|
||||
if (! empty($_POST[$external_rss_urlrss]))
|
||||
{
|
||||
@@ -95,7 +95,7 @@ if ($action == 'add' || GETPOST("modify"))
|
||||
{
|
||||
// Ajoute boite box_external_rss dans definition des boites
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)";
|
||||
$sql.= " VALUES ('box_external_rss.php','".$db->escape(GETPOST("norss").' ('.GETPOST($external_rss_title)).")')";
|
||||
$sql.= " VALUES ('box_external_rss.php','".$db->escape(GETPOST("norss", 'int').' ('.GETPOST($external_rss_title, 'alpha')).")')";
|
||||
if (! $db->query($sql))
|
||||
{
|
||||
dol_print_error($db);
|
||||
@@ -103,8 +103,8 @@ if ($action == 'add' || GETPOST("modify"))
|
||||
}
|
||||
}
|
||||
|
||||
$result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . GETPOST("norss"),GETPOST($external_rss_title),'chaine',0,'',$conf->entity);
|
||||
if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . GETPOST("norss"),GETPOST($external_rss_urlrss),'chaine',0,'',$conf->entity);
|
||||
$result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . GETPOST("norss", 'int'), GETPOST($external_rss_title, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . GETPOST("norss", 'int'), GETPOST($external_rss_urlrss, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($result1 && $result2)
|
||||
{
|
||||
@@ -122,13 +122,13 @@ if ($action == 'add' || GETPOST("modify"))
|
||||
|
||||
if ($_POST["delete"])
|
||||
{
|
||||
if(GETPOST("norss"))
|
||||
if (GETPOST("norss", 'int'))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
// Supprime boite box_external_rss de definition des boites
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||
$sql.= " WHERE file = 'box_external_rss.php' AND note LIKE '".$db->escape(GETPOST("norss"))." %'";
|
||||
$sql.= " WHERE file = 'box_external_rss.php' AND note LIKE '".$db->escape(GETPOST("norss", 'int'))." %'";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@@ -168,8 +168,8 @@ if ($_POST["delete"])
|
||||
}
|
||||
|
||||
|
||||
$result1=dolibarr_del_const($db,"EXTERNAL_RSS_TITLE_" . GETPOST("norss"),$conf->entity);
|
||||
if ($result1) $result2=dolibarr_del_const($db,"EXTERNAL_RSS_URLRSS_" . GETPOST("norss"),$conf->entity);
|
||||
$result1=dolibarr_del_const($db,"EXTERNAL_RSS_TITLE_" . GETPOST("norss", 'int'), $conf->entity);
|
||||
if ($result1) $result2=dolibarr_del_const($db,"EXTERNAL_RSS_URLRSS_" . GETPOST("norss", 'int'), $conf->entity);
|
||||
|
||||
if ($result1 && $result2)
|
||||
{
|
||||
@@ -270,13 +270,13 @@ if ($resql)
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td width=\"100px\">".$langs->trans("Title")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_title_" . $idrss . "\" value=\"" . $conf->global->$keyrsstitle . "\"></td>";
|
||||
print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_title_" . $idrss . "\" value=\"" . dol_escape_htmltag($conf->global->$keyrsstitle) . "\"></td>";
|
||||
print "</tr>";
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("URL")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_urlrss_" . $idrss . "\" value=\"" . $conf->global->$keyrssurl . "\"></td>";
|
||||
print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_urlrss_" . $idrss . "\" value=\"" . dol_escape_htmltag($conf->global->$keyrssurl) . "\"></td>";
|
||||
print "</tr>";
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2011-2019 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -55,7 +55,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconst = GETPOST('maskconstholidaty','alpha');
|
||||
$maskconst = GETPOST('maskconstholiday','alpha');
|
||||
$maskvalue = GETPOST('maskholiday','alpha');
|
||||
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
|
||||
|
||||
|
||||
@@ -49,15 +49,14 @@ $action = GETPOST('action', 'alpha');
|
||||
if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
|
||||
$value=GETPOST($code, 'alpha');
|
||||
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,12 +65,11 @@ if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
|
||||
$code=$reg[1];
|
||||
if (dolibarr_del_const($db, $code, 0) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,9 +104,7 @@ elseif ($action == 'update_currency')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$submit = GETPOST('submit', 'alpha');
|
||||
|
||||
if ($submit == $langs->trans('Modify'))
|
||||
if (GETPOST('updatecurrency', 'alpha'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
@@ -127,7 +123,7 @@ elseif ($action == 'update_currency')
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($submit == $langs->trans('Delete'))
|
||||
elseif (GETPOST('deletecurrency', 'alpha'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$currency = new MultiCurrency($db);
|
||||
@@ -334,8 +330,8 @@ foreach ($TCurrency as &$currency)
|
||||
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
|
||||
print '1 '.$conf->currency.' = ';
|
||||
print '<input type="text" name="rate" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13" /> '.$currency->code.' ';
|
||||
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '<input type="submit" name="updatecurrency" class="button" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="deletecurrency" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", $_POST["MAIN_PROFID5_IN_ADDRESS"],'chaine',0,'', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", $_POST["MAIN_PROFID6_IN_ADDRESS"],'chaine',0,'', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"],'chaine',0,'', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"],'chaine',0,'', $conf->entity);
|
||||
@@ -177,76 +179,25 @@ if ($action == 'edit') // Edit
|
||||
print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS',(! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Show prof id 1 in address into pdf
|
||||
|
||||
if (! $noCountryCode)
|
||||
// Show prof id in address into pdf
|
||||
for($i=1; $i<=6; $i++)
|
||||
{
|
||||
$pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
|
||||
if ($pid1 == '-') $pid1=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid1)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
|
||||
print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS',isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0,1,$noCountryCode);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Show prof id 2 in address into pdf
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
|
||||
if ($pid2 == '-') $pid2=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid2)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
|
||||
print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS',isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0,1,$noCountryCode);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Show prof id 3 in address into pdf
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
|
||||
if ($pid3 == '-') $pid3=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid3)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
|
||||
print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS',isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0,1,$noCountryCode);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Show prof id 4 in address into pdf
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
|
||||
if ($pid4 == '-') $pid4=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid4)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
|
||||
print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS',isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0,1,$noCountryCode);
|
||||
print '</td></tr>';
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid=$langs->transcountry("ProfId".$i, $mysoc->country_code);
|
||||
if ($pid == '-') $pid=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>';
|
||||
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
|
||||
print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant)?$conf->global->$keyforconstant:0, 1, $noCountryCode);
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@@ -419,77 +370,26 @@ else // Show
|
||||
print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Show prof id 1 in address into pdf
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
|
||||
if ($pid1 == '-') $pid1=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid1)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
|
||||
print yn($conf->global->MAIN_PROFID1_IN_ADDRESS,1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Show prof id 2 in address into pdf
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
|
||||
if ($pid2 == '-') $pid2=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid2)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
|
||||
print yn($conf->global->MAIN_PROFID2_IN_ADDRESS,1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Show prof id 3 in address into pdf
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
|
||||
if ($pid3 == '-') $pid3=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid3)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
|
||||
print yn($conf->global->MAIN_PROFID3_IN_ADDRESS,1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Show prof id 4 in address into pdf
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
|
||||
if ($pid4 == '-') $pid4=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid4)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
|
||||
print yn($conf->global->MAIN_PROFID4_IN_ADDRESS,1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Show prof id in address into pdf
|
||||
for ($i=1; $i<=6; $i++)
|
||||
{
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid=$langs->transcountry("ProfId".$i, $mysoc->country_code);
|
||||
if ($pid == '-') $pid=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pid = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
}
|
||||
if ($pid)
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>';
|
||||
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
|
||||
print yn($conf->global->$keyforconstant, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
|
||||
@@ -36,7 +36,13 @@ $action=GETPOST('action','alpha');
|
||||
|
||||
if ($action == 'convert')
|
||||
{
|
||||
$db->query("alter table ".$_GET["table"]." ENGINE=INNODB");
|
||||
$sql="ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB";
|
||||
$db->query($sql);
|
||||
}
|
||||
if ($action == 'convertutf8')
|
||||
{
|
||||
$sql="ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,9 +117,9 @@ else
|
||||
|
||||
print '<td><a href="dbtable.php?table='.$obj->Name.'">'.$obj->Name.'</a></td>';
|
||||
print '<td>'.$obj->Engine.'</td>';
|
||||
if (isset($row[1]) && $row[1] == "MyISAM")
|
||||
if (isset($obj->Engine) && $obj->Engine == "MyISAM")
|
||||
{
|
||||
print '<td><a href="database-tables.php?action=convert&table='.$row[0].'">'.$langs->trans("Convert").'</a></td>';
|
||||
print '<td><a class="reposition" href="database-tables.php?action=convert&table='.$obj->Name.'">'.$langs->trans("Convert").' InnoDB</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -127,7 +133,12 @@ else
|
||||
print '<td align="right">'.$obj->Index_length.'</td>';
|
||||
print '<td align="right">'.$obj->Auto_increment.'</td>';
|
||||
print '<td align="right">'.$obj->Check_time.'</td>';
|
||||
print '<td align="right">'.$obj->Collation.'</td>';
|
||||
print '<td align="right">'.$obj->Collation;
|
||||
if (isset($obj->Collation) && ($obj->Collation == "utf8mb4_general_ci" || $obj->Collation == "utf8mb4_unicode_ci"))
|
||||
{
|
||||
print '<br><a class="reposition" href="database-tables.php?action=convertutf8&table='.$obj->Name.'">'.$langs->trans("Convert").' UTF8</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ if (! $user->admin)
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
|
||||
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
|
||||
@@ -133,7 +133,8 @@ if ($what == 'mysql')
|
||||
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
|
||||
foreach($arrayofallowedcommand as $allowedcommand)
|
||||
{
|
||||
if (preg_match('/'.preg_quote($allowedcommand,'/').'/', $cmddump))
|
||||
$basenamecmddump=basename($cmddump);
|
||||
if (preg_match('/^'.preg_quote($allowedcommand,'/').'$/', $basenamecmddump)) // the provided command $cmddump must be an allowed command
|
||||
{
|
||||
$ok=1;
|
||||
break;
|
||||
|
||||
@@ -36,6 +36,8 @@ $export_type=GETPOST('export_type','alpha');
|
||||
$file=GETPOST('zipfilename_template','alpha');
|
||||
$compression = GETPOST('compression');
|
||||
|
||||
$file = dol_sanitizeFileName($file);
|
||||
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
@@ -57,10 +59,11 @@ $errormsg='';
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
|
||||
$ret=dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
$filerelative = dol_sanitizeFileName(GETPOST('urlfile', 'alpha'));
|
||||
$filepath=$conf->admin->dir_output.'/'.$filerelative;
|
||||
$ret=dol_delete_file($filepath, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", $filerelative), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", $filerelative), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
@@ -122,7 +125,7 @@ elseif (in_array($compression, array('gz', 'bz')))
|
||||
$cmd = 'tar -cf '.$outputdir."/".$file." --exclude=documents/admin/documents -C ".DOL_DATA_ROOT." ".DOL_DATA_ROOT."/../documents/";
|
||||
exec($cmd, $out, $retval);
|
||||
//var_dump($cmd, DOL_DATA_ROOT);exit;
|
||||
|
||||
|
||||
if ($retval != 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
@@ -139,7 +142,7 @@ elseif (in_array($compression, array('gz', 'bz')))
|
||||
{
|
||||
$cmd = "bzip2 " . $outputdir."/".$file;
|
||||
}
|
||||
|
||||
|
||||
exec($cmd, $out, $retval);
|
||||
if ($retval != 0)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,17 @@ if (! empty($conf->syslog->enabled))
|
||||
*/
|
||||
if ($action=='purge' && ! preg_match('/^confirm/i',$choice) && ($choice != 'allfiles' || $confirm == 'yes') )
|
||||
{
|
||||
// Increase limit of time. Works only if we are not in safe mode
|
||||
$ExecTimeLimit=600;
|
||||
if (!empty($ExecTimeLimit))
|
||||
{
|
||||
$err=error_reporting();
|
||||
error_reporting(0); // Disable all errors
|
||||
//error_reporting(E_ALL);
|
||||
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
|
||||
error_reporting($err);
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
|
||||
$utils = new Utils($db);
|
||||
$result = $utils->purgeFiles($choice);
|
||||
|
||||
@@ -49,11 +49,11 @@ switch($action)
|
||||
// Recuperation des donnees en fonction de la source (liste deroulante ou champ texte) ...
|
||||
if ( $_POST['hdnSource'] == 'LISTE' )
|
||||
{
|
||||
$sql.= " AND p.rowid = ".$_POST['selProduit'];
|
||||
$sql.= " AND p.rowid = ".((int) GETPOST('selProduit', 'int'));
|
||||
}
|
||||
else if ( $_POST['hdnSource'] == 'REF' )
|
||||
{
|
||||
$sql.= " AND p.ref = '".$_POST['txtRef']."'";
|
||||
$sql.= " AND p.ref = '".$db->escape(GETPOST('txtRef', 'alpha'))."'";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
@@ -55,17 +55,6 @@ $langs->loadLangs(array("main","bills","cashdesk"));
|
||||
onfocus="javascript: this.select();" />
|
||||
</td>
|
||||
<td class="select_design maxwidthonsmartphone">
|
||||
<?php /*
|
||||
$selected='';
|
||||
$htmlname='idprod';
|
||||
$status=-1;
|
||||
$rice_level=$company->price_level;
|
||||
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', 'outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT);
|
||||
if (! $hidelabel) print $langs->trans("RefOrLabel").' : ';
|
||||
print '<input type="text" size="4" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'" />';
|
||||
*/
|
||||
?>
|
||||
|
||||
<select id="selProduit" class="maxwidthonsmartphone" name="selProduit" onchange="javascript: setSource('LISTE');">
|
||||
<?php
|
||||
print '<option value="0">'.$top_liste_produits.'</option>'."\n";
|
||||
|
||||
@@ -65,9 +65,12 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
|
||||
|
||||
llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss);
|
||||
|
||||
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle">'.$langs->trans("NewCategory").'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
$newcardbutton.= '</a>';
|
||||
$newcardbutton='';
|
||||
if (! empty($user->rights->categorie->creer)) {
|
||||
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle">'.$langs->trans("NewCategory").'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
$newcardbutton.= '</a>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($title, $newcardbutton);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -268,7 +268,7 @@ if ($action == 'add')
|
||||
$object->datep = $datep;
|
||||
$object->datef = $datef;
|
||||
$object->percentage = $percentage;
|
||||
$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
|
||||
$object->duree=(((int) GETPOST('dureehour') * 60) + (int) GETPOST('dureemin')) * 60;
|
||||
|
||||
$transparency=(GETPOST("transparency")=='on'?1:0);
|
||||
|
||||
|
||||
@@ -1009,6 +1009,11 @@ if (! empty($hookmanager->resArray['eventarray'])) {
|
||||
}
|
||||
}
|
||||
|
||||
// Sort events
|
||||
foreach($eventarray as $keyDate => &$dateeventarray)
|
||||
{
|
||||
usort($dateeventarray, 'sort_events_by_date');
|
||||
}
|
||||
|
||||
|
||||
$maxnbofchar=0;
|
||||
@@ -1703,3 +1708,22 @@ function dol_color_minus($color, $minus, $minusunit = 16)
|
||||
}
|
||||
return $newcolor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sort events by date
|
||||
*
|
||||
* @param object $a Event A
|
||||
* @param object $b Event B
|
||||
* @return int < 0 if event A should be before event B, > 0 otherwise, 0 if they have the exact same time slot
|
||||
*/
|
||||
function sort_events_by_date($a, $b)
|
||||
{
|
||||
if($a->datep != $b->datep)
|
||||
{
|
||||
return $a->datep - $b->datep;
|
||||
}
|
||||
|
||||
// If both events have the same start time, longest first
|
||||
return $b->datef - $a->datef;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
if (empty($page) || $page == -1) { $page = 0 ; }
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
if (empty($page) || $page == -1) { $page = 0 ; }
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="a.datep";
|
||||
|
||||
@@ -471,13 +471,13 @@ if (empty($reshook))
|
||||
if ($result)
|
||||
{
|
||||
setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)), null, 'mesgs');
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, null, 'errors');
|
||||
$action = 'test';
|
||||
}
|
||||
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ else
|
||||
}
|
||||
$text.=$langs->trans('ConfirmSendingEmailing').'<br>';
|
||||
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,300);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 330, 600);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ if (empty($reshook))
|
||||
|
||||
$datep = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$date_delivery = dol_mktime(12, 0, 0, GETPOST('date_livraisonmonth'), GETPOST('date_livraisonday'), GETPOST('date_livraisonyear'));
|
||||
$duration = GETPOST('duree_validite');
|
||||
$duration = GETPOST('duree_validite', 'int');
|
||||
|
||||
if (empty($datep)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
@@ -759,6 +759,7 @@ if (empty($reshook))
|
||||
|
||||
$qty = GETPOST('qty' . $predef);
|
||||
$remise_percent = GETPOST('remise_percent' . $predef);
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
@@ -1543,7 +1544,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Validaty duration
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td><input name="duree_validite" size="5" value="' . $conf->global->PROPALE_VALIDITY_DURATION . '"> ' . $langs->trans("days") . '</td></tr>';
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td><input name="duree_validite" class="width50" value="' . (GETPOST('duree_validite', 'int') ? GETPOST('duree_validite', 'int') : $conf->global->PROPALE_VALIDITY_DURATION) . '"> ' . $langs->trans("days") . '</td></tr>';
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap fieldrequired">' . $langs->trans('PaymentConditionsShort') . '</td><td>';
|
||||
|
||||
@@ -265,13 +265,12 @@ $sql.= " ava.rowid as availability,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
|
||||
$sql.= ' p.datec as date_creation, p.tms as date_update,';
|
||||
$sql.= " pr.rowid as project_id, pr.ref as project_ref,";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
$sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
|
||||
$sql.= ' u.login';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user,";
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@@ -760,6 +759,12 @@ if ($resql)
|
||||
$objectstatic->id=$obj->rowid;
|
||||
$objectstatic->ref=$obj->ref;
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->code_client=$obj->code_client;
|
||||
$companystatic->email=$obj->email;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
@@ -812,20 +817,16 @@ if ($resql)
|
||||
{
|
||||
// Project ref
|
||||
print '<td class="nocellnopadd nowrap">';
|
||||
if ($obj->project_id) {
|
||||
$projectstatic->fetch($obj->project_id);
|
||||
if ($obj->project_id > 0) {
|
||||
$projectstatic->id=$obj->project_id;
|
||||
$projectstatic->ref=$obj->project_ref;
|
||||
$projectstatic->title=$obj->project_label;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->code_client=$obj->code_client;
|
||||
$companystatic->email=$obj->email;
|
||||
|
||||
// Thirdparty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -127,6 +128,8 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
||||
|
||||
$db->begin();
|
||||
$discount->fk_facture_source=0; // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_facture_source
|
||||
// This is to delete only the require record (that we will recreate with two records) and not all family with same fk_invoice_supplier_source
|
||||
$discount->fk_invoice_supplier_source=0;
|
||||
$res=$discount->delete($user);
|
||||
$newid1=$newdiscount1->create($user);
|
||||
$newid2=$newdiscount2->create($user);
|
||||
|
||||
@@ -243,11 +243,10 @@ $sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||
$sql.= ' c.date_creation as date_creation, c.tms as date_update,';
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref";
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@@ -957,10 +956,14 @@ if ($resql)
|
||||
// Project
|
||||
if (! empty($arrayfields['p.project_ref']['checked']))
|
||||
{
|
||||
$projectstatic->id=$obj->project_id;
|
||||
$projectstatic->ref=$obj->project_ref;
|
||||
print '<td>';
|
||||
if ($obj->project_id > 0) print $projectstatic->getNomUrl(1);
|
||||
print '<td class="nocellnopadd nowrap">';
|
||||
if ($obj->project_id > 0)
|
||||
{
|
||||
$projectstatic->id=$obj->project_id;
|
||||
$projectstatic->ref=$obj->project_ref;
|
||||
$projectstatic->title=$obj->project_label;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 Pierre-Henry Favre <support@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* \file htdocs/compta/compta-files.php
|
||||
* \file htdocs/compta/accounting-files.php
|
||||
* \ingroup compta
|
||||
* \brief Page to show portoflio and files of a thirdparty and download it
|
||||
*/
|
||||
@@ -25,15 +25,14 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
$langs->loadLangs(array("accountancy","bills"));
|
||||
$langs->loadLangs(array("accountancy", "bills", "companies", "salaries"));
|
||||
|
||||
$date_start =GETPOST('date_start', 'alpha');
|
||||
$date_startDay= GETPOST('date_startday', 'int');
|
||||
@@ -45,7 +44,7 @@ $date_stopDay= GETPOST('date_stopday', 'int');
|
||||
$date_stopMonth= GETPOST('date_stopmonth', 'int');
|
||||
$date_stopYear= GETPOST('date_stopyear', 'int');
|
||||
//FIXME doldate
|
||||
$date_stop=($date_stopDay)?dol_mktime(0, 0, 0, $date_stopMonth, $date_stopDay, $date_stopYear):strtotime($date_stop);
|
||||
$date_stop=($date_stopDay)?dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear):strtotime($date_stop);
|
||||
$action =GETPOST('action', 'alpha');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@@ -65,6 +64,7 @@ if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
|
||||
$arrayfields=array(
|
||||
'type'=>array('label'=>"Type", 'checked'=>1),
|
||||
'date'=>array('label'=>"Date", 'checked'=>1),
|
||||
//...
|
||||
);
|
||||
@@ -74,8 +74,9 @@ if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
accessforbidden();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -90,157 +91,211 @@ $entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity;
|
||||
|
||||
$filesarray=array();
|
||||
$result=false;
|
||||
if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){
|
||||
$wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
|
||||
$sql="SELECT rowid as id, facnumber as ref,paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.=" WHERE datef between ".$wheretail;
|
||||
$sql.=" AND entity IN (".($entity==1?'0,1':$entity).')';
|
||||
$sql.=" AND fk_statut <> ".Facture::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT rowid as id, ref, paye as paid, total_ttc, fk_soc, datef as date, 'SupplierInvoice' as item FROM ".MAIN_DB_PREFIX."facture_fourn";
|
||||
$sql.=" WHERE datef between ".$wheretail;
|
||||
$sql.=" AND entity IN (".($entity==1?'0,1':$entity).')';
|
||||
$sql.=" AND fk_statut <> ".FactureFournisseur::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT rowid as id, ref, paid, total_ttc, fk_user_author as fk_soc, date_fin as date,'ExpenseReport' as item FROM ".MAIN_DB_PREFIX."expensereport";
|
||||
$sql.=" WHERE date_fin between ".$wheretail;
|
||||
$sql.=" AND entity IN (".($entity==1?'0,1':$entity).')';
|
||||
$sql.=" AND fk_statut <> ".ExpenseReport::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT rowid as id, ref,paid,amount as total_ttc, '0' as fk_soc, datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don";
|
||||
$sql.=" WHERE datedon between ".$wheretail;
|
||||
$sql.=" AND entity IN (".($entity==1?'0,1':$entity).')';
|
||||
$sql.=" AND fk_statut <> ".Don::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT rowid as id, label as ref, 1 as paid, amount as total_ttc, fk_user as fk_soc,datep as date,'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary";
|
||||
$sql.=" WHERE datep between ".$wheretail;
|
||||
$sql.=" AND entity IN (".($entity==1?'0,1':$entity).')';
|
||||
//$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT rowid as id, libelle as ref, paye as paid, amount as total_ttc, 0 as fk_soc, date_creation as date, 'SocialContributions' as item FROM ".MAIN_DB_PREFIX."chargesociales";
|
||||
$sql.=" WHERE date_creation between ".$wheretail;
|
||||
$sql.=" AND entity IN (".($entity==1?'0,1':$entity).')';
|
||||
//$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if (($action=="searchfiles" || $action=="dl" )) {
|
||||
|
||||
$resd = $db->query($sql);
|
||||
$files=array();
|
||||
$link='';
|
||||
|
||||
if ($resd)
|
||||
if (empty($date_start))
|
||||
{
|
||||
$numd = $db->num_rows($resd);
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($date_stop))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
$tmpinvoice=new Facture($db);
|
||||
$tmpinvoicesupplier=new FactureFournisseur($db);
|
||||
$tmpdonation=new Don($db);
|
||||
if (! $error)
|
||||
{
|
||||
$wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
|
||||
|
||||
$upload_dir ='';
|
||||
$i=0;
|
||||
while ($i < $numd)
|
||||
$sql="SELECT t.rowid as id, t.facnumber as ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql.=" WHERE datef between ".$wheretail;
|
||||
$sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')';
|
||||
$sql.=" AND t.fk_statut <> ".Facture::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT t.rowid as id, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql.=" WHERE datef between ".$wheretail;
|
||||
$sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')';
|
||||
$sql.=" AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT t.rowid as id, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql.=" WHERE date_fin between ".$wheretail;
|
||||
$sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')';
|
||||
$sql.=" AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT t.rowid as id, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country";
|
||||
$sql.=" WHERE datedon between ".$wheretail;
|
||||
$sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')';
|
||||
$sql.=" AND t.fk_statut <> ".Don::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT t.rowid as id, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql.=" WHERE datep between ".$wheretail;
|
||||
$sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')';
|
||||
//$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT t.rowid as id, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."chargesociales as t";
|
||||
$sql.=" WHERE date_creation between ".$wheretail;
|
||||
$sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')';
|
||||
//$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
//print $sql;
|
||||
|
||||
$resd = $db->query($sql);
|
||||
$files=array();
|
||||
$link='';
|
||||
|
||||
if ($resd)
|
||||
{
|
||||
$objd = $db->fetch_object($resd);
|
||||
$numd = $db->num_rows($resd);
|
||||
|
||||
switch($objd->item)
|
||||
{
|
||||
case "Invoice":
|
||||
$subdir=dol_sanitizeFileName($objd->ref);
|
||||
$upload_dir = $conf->facture->dir_output.'/'.$subdir;
|
||||
$link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "SupplierInvoice":
|
||||
$tmpinvoicesupplier->fetch($objd->id);
|
||||
$subdir=get_exdir($tmpinvoicesupplier->id, 2, 0, 0, $tmpinvoicesupplier, 'invoice_supplier').'/'.dol_sanitizeFileName($objd->ref);
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir;
|
||||
$link="document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "ExpenseReport":
|
||||
$subdir=dol_sanitizeFileName($objd->ref);
|
||||
$upload_dir = $conf->expensereport->dir_output.'/'.$subdir;
|
||||
$link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "SalaryPayment":
|
||||
$subdir=dol_sanitizeFileName($objd->id);
|
||||
$upload_dir = $conf->salaries->dir_output.'/'.$subdir;
|
||||
$link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "Donation":
|
||||
$tmpdonation->fetch($objp->id);
|
||||
$subdir=get_exdir(0, 0, 0, 1, $tmpdonation, 'donation'). '/'. dol_sanitizeFileName($objd->id);
|
||||
$upload_dir = $conf->don->dir_output . '/' . $subdir;
|
||||
$link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "SocialContributions":
|
||||
$subdir=dol_sanitizeFileName($objd->id);
|
||||
$upload_dir = $conf->tax->dir_output . '/' . $subdir;
|
||||
$link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
default:
|
||||
$subdir='';
|
||||
$upload_dir='';
|
||||
$link='';
|
||||
break;
|
||||
}
|
||||
$tmpinvoice=new Facture($db);
|
||||
$tmpinvoicesupplier=new FactureFournisseur($db);
|
||||
$tmpdonation=new Don($db);
|
||||
|
||||
if (!empty($upload_dir))
|
||||
$upload_dir ='';
|
||||
$i=0;
|
||||
while ($i < $numd)
|
||||
{
|
||||
$result=true;
|
||||
$files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1);
|
||||
//var_dump($upload_dir);
|
||||
if (count($files) < 1)
|
||||
$objd = $db->fetch_object($resd);
|
||||
|
||||
switch($objd->item)
|
||||
{
|
||||
$nofile['date']=$db->idate($objd->date);
|
||||
$nofile['paid']=$objd->paid;
|
||||
$nofile['amount']=$objd->total_ttc;
|
||||
$nofile['ref']=$objd->ref;
|
||||
$nofile['fk']=$objd->fk_soc;
|
||||
$nofile['item']=$objd->item;
|
||||
|
||||
$filesarray[]=$nofile;
|
||||
case "Invoice":
|
||||
$subdir = '';
|
||||
$subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref);
|
||||
$upload_dir = $conf->facture->dir_output.'/'.$subdir;
|
||||
$link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "SupplierInvoice":
|
||||
$tmpinvoicesupplier->fetch($objd->id);
|
||||
$subdir = get_exdir($tmpinvoicesupplier->id, 2, 0, 1, $tmpinvoicesupplier, 'invoice_supplier'); // TODO Use first file
|
||||
$subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref);
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir;
|
||||
$link="document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "ExpenseReport":
|
||||
$subdir = '';
|
||||
$subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref);
|
||||
$upload_dir = $conf->expensereport->dir_output.'/'.$subdir;
|
||||
$link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "SalaryPayment":
|
||||
$subdir = '';
|
||||
$subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id);
|
||||
$upload_dir = $conf->salaries->dir_output.'/'.$subdir;
|
||||
$link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "Donation":
|
||||
$tmpdonation->fetch($objp->id);
|
||||
$subdir=get_exdir(0, 0, 0, 0, $tmpdonation, 'donation');
|
||||
$subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id);
|
||||
$upload_dir = $conf->don->dir_output . '/' . $subdir;
|
||||
$link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
case "SocialContributions":
|
||||
$subdir = '';
|
||||
$subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id);
|
||||
$upload_dir = $conf->tax->dir_output . '/' . $subdir;
|
||||
$link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F';
|
||||
break;
|
||||
default:
|
||||
$subdir='';
|
||||
$upload_dir='';
|
||||
$link='';
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($files as $key => $file)
|
||||
{
|
||||
$file['date']=$db->idate($objd->date);
|
||||
$file['paid']=$objd->paid;
|
||||
$file['amount']=$objd->total_ttc;
|
||||
$file['ref']=$objd->ref;
|
||||
$file['fk']=$objd->fk_soc;
|
||||
$file['item']=$objd->item;
|
||||
$file['link']=$link.$file['name'];
|
||||
$file['relpathnamelang'] = $langs->trans($file['item']).'/'.$file['name'];
|
||||
|
||||
$filesarray[]=$file;
|
||||
if (!empty($upload_dir))
|
||||
{
|
||||
$result=true;
|
||||
$files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1);
|
||||
//var_dump($upload_dir);
|
||||
if (count($files) < 1)
|
||||
{
|
||||
$nofile['id']=$objd->id;
|
||||
$nofile['date']=$db->idate($objd->date);
|
||||
$nofile['paid']=$objd->paid;
|
||||
$nofile['amount_ht']=$objd->total_ht;
|
||||
$nofile['amount_ttc']=$objd->total_ttc;
|
||||
$nofile['amount_vat']=$objd->total_vat;
|
||||
$nofile['ref']=($objd->ref ? $objd->ref : $objd->id);
|
||||
$nofile['fk']=$objd->fk_soc;
|
||||
$nofile['item']=$objd->item;
|
||||
$nofile['thirdparty_name']=$objd->thirdparty_name;
|
||||
$nofile['thirdparty_code']=$objd->thirdparty_code;
|
||||
$nofile['country_code']=$objd->country_code;
|
||||
$nofile['vatnum']=$objd->vatnum;
|
||||
|
||||
$filesarray[]=$nofile;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($files as $key => $file)
|
||||
{
|
||||
$file['id']=$objd->id;
|
||||
$file['date']=$db->idate($objd->date);
|
||||
$file['paid']=$objd->paid;
|
||||
$file['amount_ht']=$objd->total_ht;
|
||||
$file['amount_ttc']=$objd->total_ttc;
|
||||
$file['amount_vat']=$objd->total_vat;
|
||||
$file['ref']=($objd->ref ? $objd->ref : $objd->id);
|
||||
$file['fk']=$objd->fk_soc;
|
||||
$file['item']=$objd->item;
|
||||
|
||||
$file['thirdparty_name']=$objd->thirdparty_name;
|
||||
$file['thirdparty_code']=$objd->thirdparty_code;
|
||||
$file['country_code']=$objd->country_code;
|
||||
$file['vatnum']=$objd->vatnum;
|
||||
|
||||
$file['link']=$link.$file['name'];
|
||||
$file['relpathnamelang'] = $langs->trans($file['item']).'/'.$file['name'];
|
||||
|
||||
$filesarray[]=$file;
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$db->free($resd);
|
||||
$db->free($resd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* cleanup of old ZIP
|
||||
*/
|
||||
//FIXME
|
||||
|
||||
/*
|
||||
*ZIP creation
|
||||
*/
|
||||
|
||||
if ($result && $action == "dl")
|
||||
$dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->comptabilite->dir_temp);
|
||||
if (empty($dirfortmpfile))
|
||||
{
|
||||
$dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->compta->dir_temp);
|
||||
setEventMessages($langs->trans("ErrorNoAccountingModuleEnabled"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if ($result && $action == "dl" && ! $error)
|
||||
{
|
||||
if (! extension_loaded('zip'))
|
||||
{
|
||||
setEventMessages('PHPZIPExtentionNotLoaded', null, 'errors');
|
||||
exit;
|
||||
}
|
||||
|
||||
dol_mkdir($dirfortmpfile);
|
||||
|
||||
$log='date,type,ref,total,paid,filename,item_id'."\n";
|
||||
$log=$langs->transnoentitiesnoconv("Type").','.$langs->transnoentitiesnoconv("Date").','.$langs->transnoentitiesnoconv("Ref").','.$langs->transnoentitiesnoconv("TotalHT").','.$langs->transnoentitiesnoconv("TotalTTC").','.$langs->transnoentitiesnoconv("TotalVAT").','.$langs->transnoentitiesnoconv("Paid").',filename,item_id,'.$langs->transnoentitiesnoconv("ThirdParty").','.$langs->transnoentitiesnoconv("Code").','.$langs->transnoentitiesnoconv("Country").','.$langs->transnoentitiesnoconv("VATIntra")."\n";
|
||||
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip';
|
||||
|
||||
dol_delete_file($zipname);
|
||||
@@ -249,10 +304,10 @@ if ($result && $action == "dl")
|
||||
$res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE);
|
||||
if ($res)
|
||||
{
|
||||
foreach ($filesarray as $key=> $file)
|
||||
foreach ($filesarray as $key => $file)
|
||||
{
|
||||
if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); //
|
||||
$log.=dol_print_date($file['date'], 'dayrfc').','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n";
|
||||
$log.=$file['item'].','.dol_print_date($file['date'], 'dayrfc').','.$file['ref'].','.$file['amount_ht'].','.$file['amount_ttc'].','.$file['amount_vat'].','.$file['paid'].','.$file["name"].','.$file['fk'].','.$file['thirdparty_name'].','.$file['thirdparty_code'].','.$file['country_code'].',"'.$file['vatnum'].'"'."\n";
|
||||
}
|
||||
$zip->addFromString('transactions.csv', $log);
|
||||
$zip->close();
|
||||
@@ -267,6 +322,10 @@ if ($result && $action == "dl")
|
||||
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("FailedToOpenFile", $zipname), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -283,7 +342,7 @@ llxHeader('', $title, $help_url);
|
||||
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
|
||||
$head[$h][1] = $langs->trans("AccountancyFiles");
|
||||
$head[$h][1] = $langs->trans("AccountantFiles");
|
||||
$head[$h][2] = 'AccountancyFiles';
|
||||
|
||||
dol_fiche_head($head, 'AccountancyFiles');
|
||||
@@ -293,45 +352,20 @@ print '<form name="searchfiles" action="?action=searchfiles'.$tail.'" method="PO
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0);
|
||||
print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n</a>";
|
||||
// Multicompany
|
||||
/*if (! empty($conf->multicompany->enabled) && is_object($mc))
|
||||
{
|
||||
print '<br>';
|
||||
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
|
||||
if (method_exists($mc, 'formObjectOptions'))
|
||||
{
|
||||
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode
|
||||
{
|
||||
print "<tr>".'<td>'.$langs->trans("Entity").'</td>';
|
||||
print "<td>".$mc->select_entities($entity);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
||||
}
|
||||
}
|
||||
|
||||
$object = new stdClass();
|
||||
// Other attributes
|
||||
$parameters=array('objectsrc' => null, 'colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
}
|
||||
}*/
|
||||
// Export is for current company only !
|
||||
if (! empty($conf->multicompany->enabled) && is_object($mc))
|
||||
{
|
||||
print ' - '.$langs->trans("Entity").' : ';
|
||||
print '<span class="marginleftonly marginrightonly">('.$langs->trans("Entity").' : ';
|
||||
$mc->dao->getEntities();
|
||||
$mc->dao->fetch($conf->entity);
|
||||
print $mc->dao->label;
|
||||
print "<br>\n";
|
||||
print ")</span>\n";
|
||||
}
|
||||
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Refresh").'" /></form>'."\n";
|
||||
print '<input class="button" type="submit" name="search" value="'.$langs->trans("Search").'">';
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@@ -369,14 +403,18 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'nowrap ');
|
||||
print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Link").'</td>';
|
||||
print '<td>'.$langs->trans("Document").'</td>';
|
||||
print '<td>'.$langs->trans("Paid").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Balance").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalVAT").'</td>';
|
||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Code").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Country").'</td>';
|
||||
print '<td class="center">'.$langs->trans("VATIntra").'</td>';
|
||||
print '</tr>';
|
||||
if ($result)
|
||||
{
|
||||
@@ -390,20 +428,11 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
{
|
||||
// Sort array by date ASC to calculate balance
|
||||
|
||||
$totalET = 0;
|
||||
$totalIT = 0;
|
||||
$totalVAT = 0;
|
||||
$totalDebit = 0;
|
||||
$totalCredit = 0;
|
||||
// Balance calculation
|
||||
$balance = 0;
|
||||
foreach($TData as &$data1) {
|
||||
if ($data1['item']!='Invoice'&& $data1['item']!='Donation' ){
|
||||
$data1['amount']=-$data1['amount'];
|
||||
}
|
||||
if ($data1['amount']>0){
|
||||
}else{
|
||||
}
|
||||
$balance += $data1['amount'];
|
||||
$data1['balance'] = $balance;
|
||||
}
|
||||
|
||||
// Display array
|
||||
foreach($TData as $data)
|
||||
@@ -412,30 +441,79 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
|
||||
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
|
||||
print '<tr class="oddeven '.$html_class.'">';
|
||||
print "<td align=\"center\">";
|
||||
|
||||
// Type
|
||||
print '<td>'.$langs->trans($data['item']).'</td>';
|
||||
|
||||
// Date
|
||||
print '<td class="center">';
|
||||
print dol_print_date($data['date'], 'day');
|
||||
print "</td>\n";
|
||||
print '<td aling="left">'.$langs->trans($data['item']).'</td>';
|
||||
|
||||
// Ref
|
||||
print '<td aling="left">'.$data['ref'].'</td>';
|
||||
|
||||
// File link
|
||||
print '<td><a href='.DOL_URL_ROOT.'/'.$data['link'].">".$data['name']."</a></td>\n";
|
||||
print '<td>';
|
||||
if ($data['link'])
|
||||
{
|
||||
print '<a href='.DOL_URL_ROOT.'/'.$data['link'].' target="_blank">'.($data['name'] ? $data['name'] : $data['ref']).'</a>';
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Paid
|
||||
print '<td aling="left">'.$data['paid'].'</td>';
|
||||
print '<td align="right">'.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."</td>\n";
|
||||
$totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
|
||||
print '<td align="right">'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."</td>\n";
|
||||
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
|
||||
|
||||
// Total ET
|
||||
print '<td align="right">'.price($data['amount_ht'])."</td>\n";
|
||||
// Total IT
|
||||
print '<td align="right">'.price($data['amount_ttc'])."</td>\n";
|
||||
// Total VAT
|
||||
print '<td align="right">'.price($data['amount_vat'])."</td>\n";
|
||||
|
||||
print '<td>'.$data['thirdparty_name']."</td>\n";
|
||||
|
||||
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
||||
|
||||
print '<td class="center">'.$data['country_code']."</td>\n";
|
||||
|
||||
print '<td align="right">'.$data['vatnum']."</td>\n";
|
||||
|
||||
// Debit
|
||||
//print '<td align="right">'.(($data['amount_ttc'] > 0) ? price(abs($data['amount_ttc'])) : '')."</td>\n";
|
||||
// Credit
|
||||
//print '<td align="right">'.(($data['amount_ttc'] > 0) ? '' : price(abs($data['amount_ttc'])))."</td>\n";
|
||||
|
||||
$totalET += $data['amount_ht'];
|
||||
$totalIT += $data['amount_ttc'];
|
||||
$totalVAT += $data['amount_vat'];
|
||||
|
||||
$totalDebit += ($data['amount_ttc'] > 0) ? abs($data['amount_ttc']) : 0;
|
||||
$totalCredit += ($data['amount_ttc'] > 0) ? 0 : abs($data['amount_ttc']);
|
||||
|
||||
// Balance
|
||||
print '<td align="right">'.price($data['balance'])."</td>\n";
|
||||
//print '<td align="right">'.price($data['balance'])."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="5"> </td>';
|
||||
print '<td align="right">'.price($totalDebit).'</td>';
|
||||
print '<td align="right">'.price($totalCredit).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalDebit - $totalCredit, 'MT')).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">'.price($totalET).'</td>';
|
||||
print '<td align="right">'.price($totalIT).'</td>';
|
||||
print '<td align="right">'.price($totalVAT).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
/*print '<td align="right">'.price($totalDebit).'</td>';
|
||||
print '<td align="right">'.price($totalCredit).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalDebit - $totalCredit, 'MT')).'</td>';
|
||||
*/
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,8 @@ if (empty($reshook))
|
||||
// Change status of invoice
|
||||
else if ($action == 'reopen' && $usercancreate) {
|
||||
$result = $object->fetch($id);
|
||||
if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced') || ($object->statut == 1 && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted
|
||||
|
||||
if ($object->statut == Facture::STATUS_CLOSED || ($object->statut == Facture::STATUS_ABANDONED && ($object->close_code != 'replaced' || $object->getIdReplacingInvoice() == 0)) || ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted
|
||||
$result = $object->set_unpaid($user);
|
||||
if ($result > 0) {
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
|
||||
@@ -1326,7 +1327,7 @@ if (empty($reshook))
|
||||
} elseif ($typeamount=='variable') {
|
||||
$descline.= ' ('. $valuedeposit.'%)';
|
||||
}
|
||||
|
||||
|
||||
$descline.= ' - '.$srcobject->ref;
|
||||
$result = $object->addline(
|
||||
$descline,
|
||||
@@ -1382,8 +1383,9 @@ if (empty($reshook))
|
||||
{
|
||||
// Don't add lines with qty 0 when coming from a shipment including all order lines
|
||||
if($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
|
||||
// Don't add closed lines when coming from a contract
|
||||
if($srcobject->element == 'contrat' && $lines[$i]->statut == 5) continue;
|
||||
// Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines)
|
||||
if (! isset( $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE)) $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE = '5';
|
||||
if ($srcobject->element == 'contrat' && in_array($lines[$i]->statut, explode(',', $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE))) continue;
|
||||
|
||||
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
|
||||
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
@@ -1540,14 +1542,16 @@ if (empty($reshook))
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($datefacture)) {
|
||||
$error++;
|
||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("Date")) . '</div>';
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->trans("Date"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
if (!($_POST['situations'] > 0)) {
|
||||
$error++;
|
||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>';
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@@ -2275,11 +2279,13 @@ if (empty($reshook))
|
||||
if (!$object->fetch($id) > 0) dol_print_error($db);
|
||||
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "")
|
||||
{
|
||||
$all_progress = GETPOST('all_progress', 'int');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
if (GETPOST('all_progress') < $percent) {
|
||||
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
||||
if (floatval($all_progress) < floatval($percent)) {
|
||||
$mesg = $langs->trans("Line") . ' ' . $i . ' '. $line->ref .' : ' . $langs->trans("CantBeLessThanMinPercent");
|
||||
setEventMessages($mesg, null, 'warnings');
|
||||
$result = -1;
|
||||
} else
|
||||
$object->update_percent($line, $_POST['all_progress']);
|
||||
@@ -2948,7 +2954,7 @@ if ($action == 'create')
|
||||
{
|
||||
// First situation invoice
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input id="radio_situation invoice" type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '> ';
|
||||
$tmp='<input id="radio_situation" type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '> ';
|
||||
$tmp = $tmp.'<label for="radio_situation invoice" >'.$langs->trans("InvoiceFirstSituationAsk").'</label>';
|
||||
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
@@ -3003,7 +3009,26 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
if (! empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceFirstSituationAsk") . '</label> ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceSituationAsk") . '</label> ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceReplacement") . '</label> ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
@@ -4666,11 +4691,11 @@ else if ($id > 0 || ! empty($ref))
|
||||
&& ($object->statut == 2 || $object->statut == 3 || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
|
||||
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) // A paid invoice (partially or completely)
|
||||
{
|
||||
if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice
|
||||
if ($object->close_code != 'replaced' || (! $objectidnext)) // Not replaced by another invoice or replaced but the replacement invoice has been deleted
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ReOpen') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ReOpen') . '</span></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,10 +72,10 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
|
||||
// Get payment details
|
||||
$this->invoice->totalpaye = $this->invoice->getSommePaiement();
|
||||
$this->invoice->totalpaid = $this->invoice->getSommePaiement();
|
||||
$this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
|
||||
$this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed();
|
||||
$this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
|
||||
$this->invoice->remaintopay = price2num($this->invoice->total_ttc - $this->invoice->totalpaid - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
|
||||
@@ -3136,7 +3136,13 @@ class Facture extends CommonInvoice
|
||||
// phpcs:enable
|
||||
global $mysoc,$user;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
|
||||
// Progress should never be changed for discount lines
|
||||
if (($line->info_bits & 2) == 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Cap percentages to 100
|
||||
if ($percent > 100) $percent = 100;
|
||||
@@ -3152,7 +3158,6 @@ class Facture extends CommonInvoice
|
||||
$line->multicurrency_total_ttc = $tabprice[18];
|
||||
$line->update($user);
|
||||
$this->update_price(1);
|
||||
$this->db->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4409,13 +4414,13 @@ class FactureLigne extends CommonInvoiceLine
|
||||
// From llx_product
|
||||
/**
|
||||
* @deprecated
|
||||
* @see product_ref
|
||||
* @see $product_ref
|
||||
*/
|
||||
public $ref; // Product ref (deprecated)
|
||||
public $product_ref; // Product ref
|
||||
/**
|
||||
* @deprecated
|
||||
* @see product_label
|
||||
* @see $product_label
|
||||
*/
|
||||
public $libelle; // Product label (deprecated)
|
||||
public $product_label; // Product label
|
||||
@@ -4599,6 +4604,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->error='ErrorProductIdDoesNotExists';
|
||||
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -4629,7 +4635,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql.= " '".$this->db->escape($this->localtax1_type)."',";
|
||||
$sql.= " '".$this->db->escape($this->localtax2_type)."',";
|
||||
$sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
|
||||
$sql.= " ".$this->product_type.",";
|
||||
$sql.= " ".((int) $this->product_type).",";
|
||||
$sql.= " ".price2num($this->remise_percent).",";
|
||||
$sql.= " ".price2num($this->subprice).",";
|
||||
$sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").',';
|
||||
|
||||
@@ -354,8 +354,6 @@ $facturestatic=new Facture($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
$thirdpartystatic=new Societe($db);
|
||||
|
||||
// llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' f.rowid as id, f.facnumber as ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
|
||||
@@ -372,9 +370,8 @@ $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@@ -1024,7 +1021,7 @@ if ($resql)
|
||||
// Project
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
print '<td class="nocellnopadd nowrap">';
|
||||
if ($obj->project_id > 0)
|
||||
{
|
||||
$projectstatic->id=$obj->project_id;
|
||||
|
||||
@@ -840,7 +840,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
*/
|
||||
if (! GETPOST('action','aZ09'))
|
||||
{
|
||||
if ($page == -1) $page = 0 ;
|
||||
if (empty($page) || $page == -1) $page = 0 ;
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ $sql.= " AND pl.fk_prelevement_bons = p.rowid";
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($prev_id) $sql.= " AND p.rowid=".$prev_id;
|
||||
if ($object->id) $sql.= " AND p.rowid=".$object->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) {
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $conf->liste_limit * $page;
|
||||
|
||||
@@ -56,9 +56,10 @@ $result = restrictedArea($user, 'tax', $id, 'vat','charges');
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) {
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
}
|
||||
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@@ -377,21 +377,24 @@ if (empty($reshook))
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
$result = $object->update($contactid, $user);
|
||||
|
||||
if ($result > 0) {
|
||||
// Categories association
|
||||
$categories = GETPOST('contcats', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
$object->old_lastname='';
|
||||
$object->old_firstname='';
|
||||
$action = 'view';
|
||||
}
|
||||
else
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'edit';
|
||||
$result = $object->update($contactid, $user);
|
||||
|
||||
if ($result > 0) {
|
||||
// Categories association
|
||||
$categories = GETPOST('contcats', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
$object->old_lastname='';
|
||||
$object->old_firstname='';
|
||||
$action = 'view';
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,8 +503,8 @@ else
|
||||
$linkback='';
|
||||
print load_fiche_titre($title,$linkback,'title_companies.png');
|
||||
|
||||
// Affiche les erreurs
|
||||
dol_htmloutput_errors(is_numeric($error)?'':$error,$errors);
|
||||
// Show errors
|
||||
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
@@ -775,8 +778,8 @@ else
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($object->socid);
|
||||
|
||||
// Affiche les erreurs
|
||||
dol_htmloutput_errors($error,$errors);
|
||||
// Show errors
|
||||
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
@@ -1073,11 +1076,10 @@ else
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
|
||||
/*
|
||||
* Fiche en mode visualisation
|
||||
*/
|
||||
// View mode
|
||||
|
||||
dol_htmloutput_errors($error,$errors);
|
||||
// Show errors
|
||||
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
|
||||
|
||||
dol_fiche_head($head, 'card', $title, -1, 'contact');
|
||||
|
||||
|
||||
@@ -2108,7 +2108,7 @@ class Contrat extends CommonObject
|
||||
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
|
||||
if ($mode == 'inactives')
|
||||
if ($mode == 'inactive')
|
||||
{
|
||||
$sql = "SELECT cd.rowid, cd.date_ouverture_prevue as datefin";
|
||||
$sql.= $this->from;
|
||||
@@ -2123,25 +2123,43 @@ class Contrat extends CommonObject
|
||||
$sql.= " WHERE c.statut = 1";
|
||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||
$sql.= " AND cd.statut = 4";
|
||||
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(time())."'";
|
||||
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(dol_now())."'";
|
||||
}
|
||||
elseif ($mode == 'active')
|
||||
{
|
||||
$sql = "SELECT cd.rowid, cd.date_fin_validite as datefin";
|
||||
$sql.= $this->from;
|
||||
$sql.= " WHERE c.statut = 1";
|
||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||
$sql.= " AND cd.statut = 4";
|
||||
//$datetouse = dol_now();
|
||||
//$sql.= " AND cd.date_fin_validite < '".$this->db->idate($datetouse)."'";
|
||||
}
|
||||
$sql.= " AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
$now=dol_now();
|
||||
|
||||
if ($mode == 'inactives') {
|
||||
if ($mode == 'inactive') {
|
||||
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
|
||||
$label = $langs->trans("BoardNotActivatedServices");
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
}
|
||||
elseif ($mode == 'expired') {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
$label = $langs->trans("BoardExpiredServices");
|
||||
} else {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
//$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year'];
|
||||
//if ($warning_delay >= 0) $url.='&filter=expired';
|
||||
$label = $langs->trans("BoardRunningServices");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014-2019 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
@@ -45,14 +45,14 @@ $confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractlist'; // To manage different context of search
|
||||
|
||||
$search_name=GETPOST('search_name');
|
||||
$search_email=GETPOST('search_email');
|
||||
$search_name=GETPOST('search_name', 'alpha');
|
||||
$search_email=GETPOST('search_email', 'alpha');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$search_zip=GETPOST('search_zip','alpha');
|
||||
$search_state=trim(GETPOST("search_state"));
|
||||
$search_country=GETPOST("search_country",'int');
|
||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||
$search_contract=GETPOST('search_contract');
|
||||
$search_contract=GETPOST('search_contract','alpha');
|
||||
$search_ref_customer=GETPOST('search_ref_customer','alpha');
|
||||
$search_ref_supplier=GETPOST('search_ref_supplier','alpha');
|
||||
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -47,9 +48,9 @@ if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
$mode = GETPOST("mode");
|
||||
$filter=GETPOST("filter");
|
||||
$search_name=GETPOST("search_name");
|
||||
$search_contract=GETPOST("search_contract");
|
||||
$search_service=GETPOST("search_service");
|
||||
$search_name=GETPOST("search_name", 'alpha');
|
||||
$search_contract=GETPOST("search_contract", 'alpha');
|
||||
$search_service=GETPOST("search_service", 'alpha');
|
||||
$search_status=GETPOST("search_status","alpha");
|
||||
$statut=GETPOST('statut')?GETPOST('statut'):1;
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
|
||||
@@ -194,7 +194,7 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha'))
|
||||
// Security:
|
||||
// Disallow file with some extensions. We rename them.
|
||||
// Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code.
|
||||
if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED))
|
||||
if (isAFileWithExecutableContent($filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED))
|
||||
{
|
||||
$filenameto.= '.noexe';
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -43,7 +43,7 @@ if (GETPOST('addfile','alpha'))
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
|
||||
|
||||
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid, 0);
|
||||
dol_add_file_process($upload_dir_tmp, 1, 0, 'addedfile', '', null, $trackid, 0);
|
||||
$action='presend';
|
||||
}
|
||||
|
||||
|
||||
@@ -522,6 +522,31 @@ class CMailFile
|
||||
return true;
|
||||
}
|
||||
|
||||
$sendingmode = $this->sendmode;
|
||||
if ($this->context == 'emailing' && ! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
|
||||
{
|
||||
// List of sending methods
|
||||
$listofmethods=array();
|
||||
$listofmethods['mail']='PHP mail function';
|
||||
//$listofmethods['simplemail']='Simplemail class';
|
||||
$listofmethods['smtps']='SMTP/SMTPS socket library';
|
||||
|
||||
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
|
||||
// You ensure that every user is using its own SMTP server when using the mass emailing module.
|
||||
$linktoadminemailbefore='';
|
||||
$linktoadminemailend='';
|
||||
$this->error = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]);
|
||||
$this->errors[] = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]);
|
||||
$this->error .= '<br>'.$langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']);
|
||||
$this->errors[] = $langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']);
|
||||
if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS))
|
||||
{
|
||||
$this->error .= '<br>'.$langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS);
|
||||
$this->errors[] = $langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
|
||||
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10;
|
||||
$tmparray1 = explode(',', $this->addr_to);
|
||||
|
||||
@@ -1192,7 +1192,7 @@ abstract class CommonObject
|
||||
$sql.= " AND ec.fk_c_type_contact = tc.rowid";
|
||||
$sql.= " AND tc.element = '".$element."'";
|
||||
$sql.= " AND tc.source = '".$source."'";
|
||||
$sql.= " AND tc.code = '".$code."'";
|
||||
if ($code) $sql.= " AND tc.code = '".$code."'";
|
||||
$sql.= " AND tc.active = 1";
|
||||
if ($status) $sql.= " AND ec.statut = ".$status;
|
||||
|
||||
@@ -3806,10 +3806,11 @@ abstract class CommonObject
|
||||
|
||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
|
||||
foreach($dirtpls as $reldir)
|
||||
{
|
||||
$tpl = dol_buildpath($reldir.'/objectline_create.tpl.php');
|
||||
|
||||
if (empty($conf->file->strict_mode)) {
|
||||
$res=@include $tpl;
|
||||
} else {
|
||||
@@ -4059,10 +4060,11 @@ abstract class CommonObject
|
||||
|
||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
|
||||
foreach($dirtpls as $reldir)
|
||||
{
|
||||
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
|
||||
|
||||
if (empty($conf->file->strict_mode)) {
|
||||
$res=@include $tpl;
|
||||
} else {
|
||||
@@ -4082,10 +4084,11 @@ abstract class CommonObject
|
||||
|
||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
|
||||
foreach($dirtpls as $reldir)
|
||||
{
|
||||
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php');
|
||||
|
||||
if (empty($conf->file->strict_mode)) {
|
||||
$res=@include $tpl;
|
||||
} else {
|
||||
@@ -4278,10 +4281,11 @@ abstract class CommonObject
|
||||
|
||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
|
||||
foreach($dirtpls as $reldir)
|
||||
{
|
||||
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
|
||||
|
||||
if (empty($conf->file->strict_mode)) {
|
||||
$res=@include $tpl;
|
||||
} else {
|
||||
@@ -6442,7 +6446,7 @@ abstract class CommonObject
|
||||
jQuery(document).ready(function() {
|
||||
function showOptions(child_list, parent_list)
|
||||
{
|
||||
var val = $("select[name=\"options_"+parent_list+"\"]").val();
|
||||
var val = $("select[name=\""+parent_list+"\"]").val();
|
||||
var parentVal = parent_list + ":" + val;
|
||||
if(val > 0) {
|
||||
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
||||
|
||||
@@ -615,6 +615,10 @@ class Conf
|
||||
$this->expensereport->payment = new stdClass();
|
||||
$this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60;
|
||||
}
|
||||
if (isset($this->holiday)) {
|
||||
$this->holiday->approve = new stdClass();
|
||||
$this->holiday->approve->warning_delay=(isset($this->global->MAIN_DELAY_HOLIDAYS)?$this->global->MAIN_DELAY_HOLIDAYS:0)*24*60*60;
|
||||
}
|
||||
|
||||
if (! empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT))
|
||||
{
|
||||
|
||||
@@ -177,7 +177,7 @@ class DolEditor
|
||||
$out.= $this->content;
|
||||
$out.= '</textarea>';
|
||||
|
||||
if ($this->tool == 'ckeditor' && ! empty($conf->use_javascript_ajax))
|
||||
if ($this->tool == 'ckeditor' && ! empty($conf->use_javascript_ajax) && ! empty($conf->fckeditor->enabled))
|
||||
{
|
||||
if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR','1');
|
||||
|
||||
|
||||
@@ -1224,13 +1224,14 @@ class ExtraFields
|
||||
|
||||
if ($value == $obj->rowid)
|
||||
{
|
||||
foreach ($fields_label as $field_toshow)
|
||||
{
|
||||
$translabel=$langs->trans($obj->$field_toshow);
|
||||
if ($translabel!=$obj->$field_toshow) {
|
||||
$labeltoshow=dol_trunc($translabel,18).' ';
|
||||
}else {
|
||||
$labeltoshow=dol_trunc($obj->$field_toshow,18).' ';
|
||||
if (! $notrans) {
|
||||
foreach ($fields_label as $field_toshow) {
|
||||
$translabel = $langs->trans($obj->$field_toshow);
|
||||
if ($translabel != $obj->$field_toshow) {
|
||||
$labeltoshow = dol_trunc($translabel, 18) . ' ';
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
$out.='<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
|
||||
@@ -1860,7 +1861,7 @@ class ExtraFields
|
||||
function setOptionalsFromPost($extralabels, &$object, $onlykey='')
|
||||
{
|
||||
global $_POST, $langs;
|
||||
$nofillrequired='';// For error when required field left blank
|
||||
$nofillrequired=0;// For error when required field left blank
|
||||
$error_field_required = array();
|
||||
|
||||
if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label'];
|
||||
@@ -1891,7 +1892,8 @@ class ExtraFields
|
||||
if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
|
||||
{
|
||||
// Check if empty without using GETPOST, value can be alpha, int, array, etc...
|
||||
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0')
|
||||
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0')
|
||||
|| (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select')
|
||||
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
|
||||
{
|
||||
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];
|
||||
@@ -1899,7 +1901,6 @@ class ExtraFields
|
||||
$error_field_required[] = $langs->transnoentitiesnoconv($value);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($key_type,array('date')))
|
||||
{
|
||||
// Clean parameters
|
||||
|
||||
@@ -235,9 +235,9 @@ class Form
|
||||
}
|
||||
else if (preg_match('/^ckeditor/',$typeofdata))
|
||||
{
|
||||
$tmp=explode(':',$typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols
|
||||
$tmp=explode(':',$typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($htmlname, ($editvalue?$editvalue:$value), ($tmp[2]?$tmp[2]:''), ($tmp[3]?$tmp[3]:'100'), ($tmp[1]?$tmp[1]:'dolibarr_notes'), 'In', ($tmp[5]?$tmp[5]:0), true, true, ($tmp[6]?$tmp[6]:'20'), ($tmp[7]?$tmp[7]:'100'));
|
||||
$doleditor=new DolEditor($htmlname, ($editvalue?$editvalue:$value), ($tmp[2]?$tmp[2]:''), ($tmp[3]?$tmp[3]:'100'), ($tmp[1]?$tmp[1]:'dolibarr_notes'), 'In', ($tmp[5]?$tmp[5]:0), (isset($tmp[8])?($tmp[8]?true:false):true), true, ($tmp[6]?$tmp[6]:'20'), ($tmp[7]?$tmp[7]:'100'));
|
||||
$ret.=$doleditor->Create(1);
|
||||
}
|
||||
if (empty($notabletag)) $ret.='</td>';
|
||||
@@ -1873,8 +1873,10 @@ class Form
|
||||
// phpcs:enable
|
||||
global $langs,$conf;
|
||||
|
||||
// check parameters
|
||||
$price_level = (! empty($price_level) ? $price_level : 0);
|
||||
|
||||
if (is_null($ajaxoptions)) $ajaxoptions=array();
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
||||
{
|
||||
$placeholder='';
|
||||
|
||||
@@ -767,7 +767,7 @@ class FormFile
|
||||
$out.= '<a class="documentdownload paddingright" href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).($param?'&'.$param:'').'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
|
||||
$out.= ' target="_blank">';
|
||||
$out.= '>';
|
||||
$out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]);
|
||||
$out.= dol_trunc($file["name"], 150);
|
||||
$out.= '</a>'."\n";
|
||||
@@ -833,7 +833,7 @@ class FormFile
|
||||
{
|
||||
$out.='<tr class="oddeven">';
|
||||
$out.='<td colspan="'.$colspan.'" class="maxwidhtonsmartphone">';
|
||||
$out.='<a data-ajax="false" href="' . $link->url . '" target="_blank">';
|
||||
$out.='<a data-ajax="false" href="' . $file->url . '" target="_blank">';
|
||||
$out.=$file->label;
|
||||
$out.='</a>';
|
||||
$out.='</td>';
|
||||
|
||||
@@ -394,6 +394,7 @@ class FormMail extends Form
|
||||
if ($this->param['models'] != 'none')
|
||||
{
|
||||
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
@@ -711,7 +712,7 @@ class FormMail extends Form
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
|
||||
$out.= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.(GETPOST("sendtocc", "alpha") ? GETPOST("sendtocc", "alpha") : ((! is_array($this->withtocc) && ! is_numeric($this->withtocc)) ? $this->withtocc : '')).'" />';
|
||||
if (! empty($this->withtocc) && is_array($this->withtocc))
|
||||
{
|
||||
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||
@@ -762,7 +763,7 @@ class FormMail extends Form
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
|
||||
$out.= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.(GETPOST("sendtoccc", "alpha") ? GETPOST("sendtoccc", "alpha") : ((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc)) ? $this->withtoccc : '')).'" />';
|
||||
if (! empty($this->withtoccc) && is_array($this->withtoccc))
|
||||
{
|
||||
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||
@@ -779,9 +780,12 @@ class FormMail extends Form
|
||||
|
||||
$showinfobcc='';
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'propal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'order_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'invoice_supplier_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) && ! empty($this->param['models']) && $this->param['models'] == 'project') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO;
|
||||
if ($showinfobcc) $out.=' + '.$showinfobcc;
|
||||
$out.= "</td></tr>\n";
|
||||
}
|
||||
@@ -1026,7 +1030,6 @@ class FormMail extends Form
|
||||
$defaultmessage=preg_replace("/^(<br>)+/","",$defaultmessage);
|
||||
$defaultmessage=preg_replace("/^\n+/","",$defaultmessage);
|
||||
}
|
||||
|
||||
$out.= '<tr>';
|
||||
$out.= '<td valign="top">';
|
||||
$out.=$form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody');
|
||||
|
||||
@@ -96,7 +96,7 @@ class FormMargin
|
||||
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
}
|
||||
|
||||
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
$pv = $line->total_ht;
|
||||
$pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
|
||||
$pa = $line->qty * $pa_ht;
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ class FormOther
|
||||
* @param int $showempty Add also an empty line
|
||||
* @param string $morecss More CSS
|
||||
* @return string Html combo list code
|
||||
* @see select_all_categories
|
||||
* @see select_all_categories()
|
||||
*/
|
||||
function select_categories($type, $selected=0, $htmlname='search_categ', $nocateg=0, $showempty=1, $morecss='')
|
||||
{
|
||||
@@ -389,10 +389,11 @@ class FormOther
|
||||
* @param string $morecss More CSS
|
||||
* @return string Html combo list code
|
||||
*/
|
||||
function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0,$showempty=1,$morecss='')
|
||||
function select_salesrepresentatives($selected, $htmlname, $user, $showstatus=0, $showempty=1, $morecss='')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load('users');
|
||||
|
||||
$out = '';
|
||||
@@ -414,17 +415,44 @@ class FormOther
|
||||
// Get list of users allowed to be viewed
|
||||
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
|
||||
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
|
||||
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
{
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql_usr.= " WHERE u.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql_usr.= " WHERE EXISTS (SELECT ug.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug WHERE u.rowid = ug.fk_user AND ug.entity IN (".getEntity('user')."))";
|
||||
$sql_usr.= " OR u.entity = 0"; // Show always superadmin
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_usr.= " WHERE u.entity IN (".getEntity('user').")";
|
||||
}
|
||||
|
||||
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id;
|
||||
if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_soc = ".$user->societe_id;
|
||||
if (! empty($user->socid)) $sql_usr.=" AND u.fk_soc = ".$user->socid;
|
||||
// Add existing sales representatives of thirdparty of external user
|
||||
if (empty($user->rights->user->user->lire) && $user->societe_id)
|
||||
if (empty($user->rights->user->user->lire) && $user->socid)
|
||||
{
|
||||
$sql_usr.=" UNION ";
|
||||
$sql_usr.= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
|
||||
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql_usr.= " WHERE u2.entity IN (0,".$conf->entity.")";
|
||||
$sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id;
|
||||
|
||||
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
{
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql_usr.= " WHERE u2.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql_usr.= " WHERE EXISTS (SELECT ug2.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('user')."))";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_usr.= " WHERE u2.entity IN (".getEntity('user').")";
|
||||
}
|
||||
|
||||
$sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->socid;
|
||||
}
|
||||
$sql_usr.= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
|
||||
//print $sql_usr;exit;
|
||||
|
||||
@@ -466,7 +466,9 @@ class Translate
|
||||
if (! $found && ! empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
// Overwrite translation with database read
|
||||
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."'";
|
||||
$sql ="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."' OR lang IS NULL";
|
||||
$sql.=" AND entity IN (0, ".getEntity('overwrite_trans').")";
|
||||
$sql.=$db->order("lang", "DESC");
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
|
||||
@@ -50,33 +50,36 @@ class Utils
|
||||
* Purge files into directory of data files.
|
||||
* CAN BE A CRON TASK
|
||||
*
|
||||
* @param string $choice Choice of purge mode ('tempfiles', '' or 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfile')
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
* @param string $choice Choice of purge mode ('tempfiles', '' or 'tempfilesold' to purge temp older than $nbsecondsold seconds, 'allfiles', 'logfile')
|
||||
* @param int $nbsecondsold Nb of seconds old to accept deletion of a directory if $choice is 'tempfilesold'
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
function purgeFiles($choice='tempfilesold')
|
||||
function purgeFiles($choice = 'tempfilesold', $nbsecondsold = 86400)
|
||||
{
|
||||
global $conf, $langs, $dolibarr_main_data_root;
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
dol_syslog("Utils::purgeFiles choice=".$choice, LOG_DEBUG);
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$filesarray=array();
|
||||
if (empty($choice)) $choice='tempfilesold';
|
||||
|
||||
dol_syslog("Utils::purgeFiles choice=".$choice, LOG_DEBUG);
|
||||
|
||||
if ($choice=='tempfiles' || $choice=='tempfilesold')
|
||||
{
|
||||
// Delete temporary files
|
||||
if ($dolibarr_main_data_root)
|
||||
{
|
||||
$filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', 'name', SORT_ASC, 2, 0, '', 1); // Do not follow symlinks
|
||||
if ($choice == 'tempfilesold')
|
||||
$filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', 'name', SORT_ASC, 2, 0, '', 1); // Do not follow symlinks
|
||||
|
||||
if ($choice == 'tempfilesold')
|
||||
{
|
||||
$now = dol_now();
|
||||
foreach($filesarray as $key => $val)
|
||||
{
|
||||
if ($val['date'] > ($now - (24 * 3600))) unset($filesarray[$key]); // Discard files not older than 24h
|
||||
if ($val['date'] > ($now - ($nbsecondsold))) unset($filesarray[$key]); // Discard temp dir not older than $nbsecondsold
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,13 +122,14 @@ class Utils
|
||||
$counterror=0;
|
||||
if (count($filesarray))
|
||||
{
|
||||
foreach($filesarray as $key => $value)
|
||||
foreach($filesarray as $key => $value)
|
||||
{
|
||||
//print "x ".$filesarray[$key]['fullname']."-".$filesarray[$key]['type']."<br>\n";
|
||||
if ($filesarray[$key]['type'] == 'dir')
|
||||
if ($filesarray[$key]['type'] == 'dir')
|
||||
{
|
||||
$startcount=0;
|
||||
$tmpcountdeleted=0;
|
||||
|
||||
$result=dol_delete_dir_recursive($filesarray[$key]['fullname'], $startcount, 1, 0, $tmpcountdeleted);
|
||||
$count+=$result;
|
||||
$countdeleted+=$tmpcountdeleted;
|
||||
@@ -165,6 +169,13 @@ class Utils
|
||||
}
|
||||
else $this->output=$langs->trans("PurgeNothingToDelete").($choice == 'tempfilesold' ? ' (older than 24h)':'');
|
||||
|
||||
// Recreate temp dir that are not automatically recreated by core code for performance purpose, we need them
|
||||
if (! empty($conf->api->enabled))
|
||||
{
|
||||
dol_mkdir($conf->api->dir_temp);
|
||||
}
|
||||
dol_mkdir($conf->user->dir_temp);
|
||||
|
||||
//return $count;
|
||||
return 0; // This function can be called by cron so must return 0 if OK
|
||||
}
|
||||
@@ -239,36 +250,37 @@ class Utils
|
||||
dol_mkdir($conf->admin->dir_output.'/backup');
|
||||
|
||||
// Parameteres execution
|
||||
$command=$cmddump;
|
||||
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command
|
||||
$command = $cmddump;
|
||||
$command = preg_replace('/(\$|%)/', '', $command); // We removed chars that can be used to inject vars that contains space inside path of command without seeing there is a space to bypass the escapeshellarg.
|
||||
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // If there is spaces, we add quotes on command to be sure $command is only a program and not a program+parameters
|
||||
|
||||
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
|
||||
$param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host;
|
||||
$param.=" -u ".$dolibarr_main_db_user;
|
||||
if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port;
|
||||
if (! GETPOST("use_transaction")) $param.=" -l --single-transaction";
|
||||
if (GETPOST("disable_fk") || $usedefault) $param.=" -K";
|
||||
if (GETPOST("sql_compat") && GETPOST("sql_compat") != 'NONE') $param.=" --compatible=".escapeshellarg(GETPOST("sql_compat","alpha"));
|
||||
if (GETPOST("drop_database")) $param.=" --add-drop-database";
|
||||
if (GETPOST("sql_structure") || $usedefault)
|
||||
if (! GETPOST("use_transaction", "alpha")) $param.=" -l --single-transaction";
|
||||
if (GETPOST("disable_fk", "alpha") || $usedefault) $param.=" -K";
|
||||
if (GETPOST("sql_compat", "alpha") && GETPOST("sql_compat", "alpha") != 'NONE') $param.=" --compatible=".escapeshellarg(GETPOST("sql_compat", "alpha"));
|
||||
if (GETPOST("drop_database", "alpha")) $param.=" --add-drop-database";
|
||||
if (GETPOST("sql_structure", "alpha") || $usedefault)
|
||||
{
|
||||
if (GETPOST("drop") || $usedefault) $param.=" --add-drop-table=TRUE";
|
||||
else $param.=" --add-drop-table=FALSE";
|
||||
if (GETPOST("drop", "alpha") || $usedefault) $param.=" --add-drop-table=TRUE";
|
||||
else $param.=" --add-drop-table=FALSE";
|
||||
}
|
||||
else
|
||||
{
|
||||
$param.=" -t";
|
||||
}
|
||||
if (GETPOST("disable-add-locks")) $param.=" --add-locks=FALSE";
|
||||
if (GETPOST("sql_data") || $usedefault)
|
||||
if (GETPOST("disable-add-locks", "alpha")) $param.=" --add-locks=FALSE";
|
||||
if (GETPOST("sql_data", "alpha") || $usedefault)
|
||||
{
|
||||
$param.=" --tables";
|
||||
if (GETPOST("showcolumns") || $usedefault) $param.=" -c";
|
||||
if (GETPOST("extended_ins") || $usedefault) $param.=" -e";
|
||||
if (GETPOST("showcolumns", "alpha") || $usedefault) $param.=" -c";
|
||||
if (GETPOST("extended_ins", "alpha") || $usedefault) $param.=" -e";
|
||||
else $param.=" --skip-extended-insert";
|
||||
if (GETPOST("delayed")) $param.=" --delayed-insert";
|
||||
if (GETPOST("sql_ignore")) $param.=" --insert-ignore";
|
||||
if (GETPOST("hexforbinary") || $usedefault) $param.=" --hex-blob";
|
||||
if (GETPOST("delayed", "alpha")) $param.=" --delayed-insert";
|
||||
if (GETPOST("sql_ignore", "alpha")) $param.=" --insert-ignore";
|
||||
if (GETPOST("hexforbinary", "alpha") || $usedefault) $param.=" --hex-blob";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -436,8 +448,9 @@ class Utils
|
||||
dol_mkdir($conf->admin->dir_output.'/backup');
|
||||
|
||||
// Parameteres execution
|
||||
$command=$cmddump;
|
||||
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command
|
||||
$command = $cmddump;
|
||||
$command = preg_replace('/(\$|%)/', '', $command); // We removed chars that can be used to inject vars that contains space inside path of command without seeing there is a space to bypass the escapeshellarg.
|
||||
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // If there is spaces, we add quotes on command to be sure $command is only a program and not a program+parameters
|
||||
|
||||
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
|
||||
//$param="-F c";
|
||||
|
||||
@@ -90,24 +90,20 @@ function pad(n) {
|
||||
|
||||
|
||||
/* function from http://www.timlabonne.com/2013/07/parsing-a-time-string-with-javascript/ */
|
||||
/* timeStr must be a duration with format XX:YY (AM/PM not supported) */
|
||||
function parseTime(timeStr, dt)
|
||||
{
|
||||
if (!dt) {
|
||||
dt = new Date();
|
||||
}
|
||||
|
||||
var time = timeStr.match(/(\d+)(?::(\d\d))?\s*(p?)/i);
|
||||
//var time = timeStr.match(/(\d+)(?::(\d\d))?\s*(p?)/i);
|
||||
var time = timeStr.match(/(\d+)(?::(\d\d))?/i);
|
||||
if (!time) {
|
||||
return -1;
|
||||
}
|
||||
var hours = parseInt(time[1], 10);
|
||||
if (hours == 12 && !time[3]) {
|
||||
hours = 0;
|
||||
}
|
||||
else {
|
||||
hours += (hours < 12 && time[3]) ? 12 : 0;
|
||||
}
|
||||
|
||||
|
||||
dt.setHours(hours);
|
||||
dt.setMinutes(parseInt(time[2], 10) || 0);
|
||||
dt.setSeconds(0, 0);
|
||||
|
||||
@@ -469,7 +469,7 @@ function actions_prepare_head($object)
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
|
||||
$listofresourcelinked = $resource->getElementResources($object->element, $object->id);
|
||||
$nbResources=count($listofresourcelinked);
|
||||
$nbResources=(is_array($listofresourcelinked)?count($listofresourcelinked):0);
|
||||
$head[$h][1] = $langs->trans("Resources");
|
||||
if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
|
||||
$head[$h][2] = 'resources';
|
||||
|
||||
@@ -1053,7 +1053,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
// Security:
|
||||
// Disallow file with some extensions. We rename them.
|
||||
// Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code.
|
||||
if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$dest_file) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED))
|
||||
if (isAFileWithExecutableContent($dest_file) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED))
|
||||
{
|
||||
$file_name.= '.noexe';
|
||||
}
|
||||
@@ -1554,7 +1554,13 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
||||
$info = pathinfo($destfull);
|
||||
$destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : ''));
|
||||
$info = pathinfo($destfile);
|
||||
|
||||
$destfile = dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : ''));
|
||||
// We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because
|
||||
// this function is also applied when we make try to download file (by the GETPOST(filename, 'alphanohtml') call).
|
||||
$destfile = dol_string_nohtmltag($destfile);
|
||||
$destfull = dol_string_nohtmltag($destfull);
|
||||
|
||||
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
|
||||
|
||||
if (is_numeric($resupload) && $resupload > 0) // $resupload can be 'ErrorFileAlreadyExists'
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
use PhpOffice\PhpSpreadsheet\NamedRange;
|
||||
|
||||
/* Copyright (C) 2000-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
@@ -349,7 +351,7 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu
|
||||
}
|
||||
if (! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
||||
{
|
||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
if (! empty($_GET['action']) && (preg_match('/^create/', $_GET['action']) || preg_match('/^presend/', $_GET['action'])) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
// Now search in setup to overwrite default values
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
|
||||
@@ -7925,3 +7927,18 @@ function roundUpToNextMultiple($n, $x=5)
|
||||
{
|
||||
return (ceil($n)%$x === 0) ? ceil($n) : round(($n+$x/2)/$x)*$x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a file can contains executable content
|
||||
*
|
||||
* @param string $filename File NamedRange
|
||||
* @return boolean True if yes, False if no
|
||||
*/
|
||||
function isAFileWithExecutableContent($filename)
|
||||
{
|
||||
if (preg_match('/\.(htm|html|js|php|phtml|pl|py|cgi|ksh|sh|bash)$/i', $filename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -717,8 +717,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
global $conf,$user;
|
||||
|
||||
if (! is_object($objsoc)) $valueforccc=$objsoc;
|
||||
else if ($table == "commande_fournisseur" || $table == "facture_fourn" ) $valueforccc=$objsoc->code_fournisseur;
|
||||
else $valueforccc=$objsoc->code_client;
|
||||
else if ($table == "commande_fournisseur" || $table == "facture_fourn" ) $valueforccc=dol_string_unaccent($objsoc->code_fournisseur);
|
||||
else $valueforccc=dol_string_unaccent($objsoc->code_client);
|
||||
|
||||
$sharetable = $table;
|
||||
if ($table == 'facture' || $table == 'invoice') $sharetable = 'invoicenumber'; // for getEntity function
|
||||
@@ -966,6 +966,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
// Define $maskLike
|
||||
$maskLike = dol_string_nospecial($mask);
|
||||
$maskLike = str_replace("%","_",$maskLike);
|
||||
|
||||
// Replace protected special codes with matching number of _ as wild card caracter
|
||||
$maskLike = preg_replace('/\{yyyy\}/i','____',$maskLike);
|
||||
$maskLike = preg_replace('/\{yy\}/i','__',$maskLike);
|
||||
@@ -1141,7 +1142,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
// Now we replace the refclient
|
||||
if ($maskrefclient)
|
||||
{
|
||||
//print "maskrefclient=".$maskrefclient." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode."\n<br>";
|
||||
//print "maskrefclient=".$maskrefclient." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskrefclient_clientcode=".$maskrefclient_clientcode."\n<br>";exit;
|
||||
$maskrefclient_maskbefore='{'.$maskrefclient.'}';
|
||||
$maskrefclient_maskafter=$maskrefclient_clientcode.str_pad($maskrefclient_counter,dol_strlen($maskrefclient_maskcounter),"0",STR_PAD_LEFT);
|
||||
$numFinal = str_replace($maskrefclient_maskbefore,$maskrefclient_maskafter,$numFinal);
|
||||
@@ -1260,6 +1261,10 @@ function check_value($mask,$value)
|
||||
if (! empty($reg[3]) && preg_match('/^@/',$reg[3])) $maskraz=preg_replace('/^@/','',$reg[3]);
|
||||
if ($maskraz >= 0)
|
||||
{
|
||||
if ($maskraz == 99) {
|
||||
$maskraz = date('m');
|
||||
$resetEveryMonth = true;
|
||||
}
|
||||
if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth';
|
||||
|
||||
// Define reg
|
||||
|
||||
@@ -68,7 +68,7 @@ function commande_prepare_head(Commande $object)
|
||||
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
|
||||
if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings");
|
||||
if ($nbShipments > 0 || $nbReceiption > 0) $text.= ' <span class="badge">'.($nbShipments?$nbShipments:0);
|
||||
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
|
||||
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text.='/';
|
||||
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text.= ($nbReceiption?$nbReceiption:0);
|
||||
if ($nbShipments > 0 || $nbReceiption > 0) $text.= '</span>';
|
||||
$head[$h][1] = $text;
|
||||
|
||||
@@ -461,7 +461,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
}
|
||||
|
||||
// Ref of task
|
||||
print '<td>';
|
||||
print '<td class="nowraponall">';
|
||||
if ($showlineingray)
|
||||
{
|
||||
print '<i>'.img_object('','projecttask').' '.$lines[$i]->ref.'</i>';
|
||||
|
||||
@@ -51,7 +51,7 @@ function shipping_prepare_head($object)
|
||||
{
|
||||
// delivery link
|
||||
$object->fetchObjectLinked($object->id,$object->element);
|
||||
if (count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery
|
||||
if (is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery
|
||||
{
|
||||
// Take first one element of array
|
||||
$tmp = reset($object->linkedObjectsIds['delivery']);
|
||||
|
||||
@@ -145,8 +145,8 @@ function user_prepare_head($object)
|
||||
|
||||
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|
||||
|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))
|
||||
|| (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id)
|
||||
|| (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id )
|
||||
|| (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall))
|
||||
|| (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all))
|
||||
)
|
||||
{
|
||||
// Bank
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* @param string $content Content to replace
|
||||
* @param int $removephppart 0=Replace PHP sections with a PHP badge. 1=Remove completely PHP sections.
|
||||
* @return boolean True if OK
|
||||
* @see dolWebsiteOutput for function used to replace content in a web server context
|
||||
* @see dolWebsiteOutput() for function used to replace content in a web server context
|
||||
*/
|
||||
function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
|
||||
{
|
||||
@@ -101,6 +101,7 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
|
||||
* @param string $str String to clean
|
||||
* @param string $replacewith String to use as replacement
|
||||
* @return string Result string without php code
|
||||
* @see dolKeepOnlyPhpCode()
|
||||
*/
|
||||
function dolStripPhpCode($str, $replacewith='')
|
||||
{
|
||||
@@ -133,6 +134,44 @@ function dolStripPhpCode($str, $replacewith='')
|
||||
return $newstr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep only PHP code part from a HTML string page.
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @return string Result string with php code only
|
||||
* @see dolStripPhpCode()
|
||||
*/
|
||||
function dolKeepOnlyPhpCode($str)
|
||||
{
|
||||
$newstr = '';
|
||||
|
||||
//split on each opening tag
|
||||
$parts = explode('<?php',$str);
|
||||
if (!empty($parts))
|
||||
{
|
||||
$i=0;
|
||||
foreach($parts as $part)
|
||||
{
|
||||
if ($i == 0) // The first part is never php code
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
$newstr.='<?php';
|
||||
//split on closing tag
|
||||
$partlings = explode('?>', $part, 2);
|
||||
if (!empty($partlings))
|
||||
{
|
||||
$newstr .= $partlings[0].'?>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$newstr .= $part.'?>';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $newstr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a string of an HTML content and output it.
|
||||
@@ -140,7 +179,7 @@ function dolStripPhpCode($str, $replacewith='')
|
||||
*
|
||||
* @param string $content Content string
|
||||
* @return void
|
||||
* @see dolWebsiteReplacementOfLinks for function used to replace content in the backoffice context when USEDOLIBARREDITOR is not on
|
||||
* @see dolWebsiteReplacementOfLinks() for function used to replace content in the backoffice context when USEDOLIBARREDITOR is not on
|
||||
*/
|
||||
function dolWebsiteOutput($content)
|
||||
{
|
||||
|
||||
@@ -1439,9 +1439,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
$langs->load("hrm");
|
||||
|
||||
$newmenu->add("/user/list.php?leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/user/card.php?action=create&employee=1", $langs->trans("NewEmployee"), 1,$user->rights->hrm->employee->write);
|
||||
$newmenu->add("/user/list.php?leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1,$user->rights->hrm->employee->read);
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/user/card.php?mainmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1,$user->rights->hrm->employee->write);
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1,$user->rights->hrm->employee->read);
|
||||
}
|
||||
|
||||
// Leave/Holiday/Vacation module
|
||||
@@ -1450,17 +1450,17 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("holiday","trips"));
|
||||
|
||||
$newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/holiday/card.php?action=request", $langs->trans("New"), 1,$user->rights->holiday->write);
|
||||
$newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("List"), 1,$user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=1&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=2&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=3&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=4&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=5&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
|
||||
$newmenu->add("/holiday/define_holiday.php?action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read);
|
||||
$newmenu->add("/holiday/month_report.php", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all);
|
||||
$newmenu->add("/holiday/view_log.php?action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
|
||||
$newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("New"), 1,$user->rights->holiday->write);
|
||||
$newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1,$user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->rights->holiday->read);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
|
||||
$newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read);
|
||||
$newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all);
|
||||
$newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
|
||||
}
|
||||
|
||||
// Trips and expenses (old module)
|
||||
|
||||
@@ -1691,8 +1691,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
$r_subperms = isset($this->rights[$key][5])?$this->rights[$key][5]:'';
|
||||
$r_modul = empty($this->rights_class)?strtolower($this->name):$this->rights_class;
|
||||
|
||||
if (empty($r_type)) { $r_type='w';
|
||||
}
|
||||
if (empty($r_type)) { $r_type='w'; }
|
||||
if (empty($r_def)) { $r_def=0; }
|
||||
|
||||
// Search if perm already present
|
||||
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def";
|
||||
|
||||
@@ -180,6 +180,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$this->posxtva=110;
|
||||
$this->posxup=126;
|
||||
$this->posxqty=145;
|
||||
$this->posxunit=162;
|
||||
}
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
@@ -314,14 +315,16 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS))
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
$delta = ($this->postotalht - $this->posxdiscount);
|
||||
$this->posxpicture+=$delta;
|
||||
$this->posxtva+=$delta;
|
||||
$this->posxup+=$delta;
|
||||
$this->posxqty+=$delta;
|
||||
$this->posxunit+=$delta;
|
||||
$this->posxdiscount+=$delta;
|
||||
// post of fields after are not modified, stay at same position
|
||||
}
|
||||
|
||||
// New page
|
||||
@@ -475,15 +478,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
|
||||
|
||||
// Unit
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
@@ -1185,14 +1180,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS) {
|
||||
|
||||
@@ -256,15 +256,6 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
|
||||
@@ -915,7 +915,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->postotalttc-$this->posxqty - 1,2, $outputlangs->transnoentities("Qty"),'','R');
|
||||
$pdf->MultiCell($this->postotalttc-$this->posxqty - 1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
|
||||
// Total with all taxes
|
||||
|
||||
@@ -117,7 +117,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
/**
|
||||
* Issuer
|
||||
* @var Company object that emits
|
||||
* @var Societe object that emits
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
@@ -179,7 +179,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
// Define position of columns
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
$this->posxtva=101;
|
||||
$this->posxup=118;
|
||||
@@ -191,9 +191,10 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$this->posxtva=110;
|
||||
$this->posxup=126;
|
||||
$this->posxqty=145;
|
||||
$this->posxunit=162;
|
||||
}
|
||||
$this->posxdiscount=162;
|
||||
$this->posxprogress=126; // Only displayed for situation invoices
|
||||
$this->posxprogress=174;
|
||||
$this->postotalht=174;
|
||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup;
|
||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||
@@ -363,30 +364,31 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS)) // retreive space not used by discount
|
||||
if (empty($this->atleastonediscount)) // retreive space not used by discount
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
$delta = ($this->posxprogress - $this->posxdiscount);
|
||||
$this->posxpicture+=$delta;
|
||||
$this->posxtva+=$delta;
|
||||
$this->posxup+=$delta;
|
||||
$this->posxqty+=$delta;
|
||||
$this->posxunit+=$delta;
|
||||
$this->posxdiscount+=$delta;
|
||||
// post of fields after are not modified, stay at same position
|
||||
}
|
||||
|
||||
$progress_width = 0;
|
||||
// Situation invoice handling
|
||||
if ($object->situation_cycle_ref)
|
||||
if ($object->situation_cycle_ref && empty($conf->global->MAIN_PDF_HIDE_SITUATION))
|
||||
{
|
||||
$this->situationinvoice = true;
|
||||
$progress_width = 18;
|
||||
$progress_width = 10;
|
||||
$this->posxpicture -= $progress_width;
|
||||
$this->posxtva -= $progress_width;
|
||||
$this->posxup -= $progress_width;
|
||||
$this->posxqty -= $progress_width;
|
||||
if(empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$this->posxprogress += $progress_width;
|
||||
}
|
||||
/*$this->posxdiscount -= $progress_width;
|
||||
$this->posxprogress -= $progress_width;*/
|
||||
$this->posxunit -= $progress_width;
|
||||
$this->posxdiscount -= $progress_width;
|
||||
$this->posxprogress -= $progress_width;
|
||||
}
|
||||
|
||||
// New page
|
||||
@@ -444,7 +446,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($notetoshow), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_note=$nexY-$tab_top;
|
||||
@@ -566,42 +568,10 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
|
||||
if ($this->situationinvoice)
|
||||
{
|
||||
$pdf->MultiCell($this->posxprogress-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
|
||||
// Situation progress
|
||||
if ($this->situationinvoice)
|
||||
{
|
||||
$progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxprogress, $curY);
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxprogress-1, 3, $progress, 0, 'R');
|
||||
}
|
||||
else if ($this->atleastonediscount)
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxprogress-1, 3, $progress, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->postotalht-$this->posxprogress-1, 3, $progress, 0, 'R');
|
||||
}
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
|
||||
|
||||
// Unit
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
$unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
|
||||
$pdf->SetXY($this->posxunit, $curY);
|
||||
@@ -613,7 +583,15 @@ class pdf_crabe extends ModelePDFFactures
|
||||
{
|
||||
$pdf->SetXY($this->posxdiscount-2, $curY);
|
||||
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
|
||||
$pdf->MultiCell($this->posxprogress-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
|
||||
}
|
||||
|
||||
// Situation progress
|
||||
if ($this->situationinvoice)
|
||||
{
|
||||
$progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxprogress, $curY);
|
||||
$pdf->MultiCell($this->postotalht-$this->posxprogress-1, 3, $progress, 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
@@ -1253,23 +1231,6 @@ class pdf_crabe extends ModelePDFFactures
|
||||
//}
|
||||
|
||||
// VAT
|
||||
// Situations totals migth be wrong on huge amounts
|
||||
if ($object->situation_cycle_ref && $object->situation_counter > 1) {
|
||||
|
||||
$sum_pdf_tva = 0;
|
||||
foreach($this->tva as $tvakey => $tvaval){
|
||||
$sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object
|
||||
}
|
||||
|
||||
if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one)
|
||||
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
|
||||
|
||||
foreach($this->tva as $tvakey => $tvaval) {
|
||||
$this->tva[$tvakey]=$tvaval * $coef_fix_tva;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($this->tva as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
@@ -1524,76 +1485,38 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
|
||||
if($this->situationinvoice)
|
||||
{
|
||||
$pdf->MultiCell($this->posxprogress-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
else if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
|
||||
if ($this->situationinvoice) {
|
||||
$pdf->line($this->posxprogress - 1, $tab_top, $this->posxprogress - 1, $tab_top + $tab_height);
|
||||
|
||||
if (empty($hidetop)) {
|
||||
|
||||
$pdf->SetXY($this->posxprogress, $tab_top+1);
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C');
|
||||
}
|
||||
else if ($this->atleastonediscount)
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->postotalht-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS) {
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
$pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxunit - 1, $tab_top + 1);
|
||||
$pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '',
|
||||
'C');
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if ($this->atleastonediscount)
|
||||
{
|
||||
$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->situationinvoice)
|
||||
{
|
||||
$pdf->line($this->postotalht+4, $tab_top, $this->postotalht+4, $tab_top + $tab_height);
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->postotalht-19, $tab_top+1);
|
||||
$pdf->MultiCell(30,2, $outputlangs->transnoentities("Situation"),'','C');
|
||||
$pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->atleastonediscount)
|
||||
{
|
||||
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
|
||||
}
|
||||
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxprogress-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->situationinvoice) {
|
||||
$pdf->line($this->posxprogress - 1, $tab_top, $this->posxprogress - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxprogress, $tab_top+1);
|
||||
$pdf->MultiCell($this->postotalht-$this->posxprogress, 2, $outputlangs->transnoentities("ProgressShort"), '', 'C');
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->postotalht-1, $tab_top+1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
/* Copyright (C) 2011-2019 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -72,7 +72,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$texte.= '<input type="hidden" name="action" value="updateMask">';
|
||||
$texte.= '<input type="hidden" name="maskconstcontract" value="HOLIDAY_IMMACULATE_MASK">';
|
||||
$texte.= '<input type="hidden" name="maskconstholiday" value="HOLIDAY_IMMACULATE_MASK">';
|
||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday"));
|
||||
|
||||
@@ -137,7 +137,7 @@ class ImportCsv extends ModeleImports
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param array $headerlinefields Array of fields name
|
||||
* @return string
|
||||
* @return string$limittoachartaccount
|
||||
*/
|
||||
function write_title_example($outputlangs,$headerlinefields)
|
||||
{
|
||||
@@ -443,11 +443,29 @@ class ImportCsv extends ModeleImports
|
||||
}
|
||||
$classinstance=new $class($this->db);
|
||||
// Try the fetch from code or ref
|
||||
call_user_func_array(array($classinstance, $method),array('', $newval));
|
||||
$param_array = array('', $newval);
|
||||
if ($class == 'AccountingAccount')
|
||||
{
|
||||
//var_dump($arrayrecord[0]['val']);
|
||||
/*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php';
|
||||
$tmpchartofaccount = new AccountancySystem($this->db);
|
||||
$tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS);
|
||||
var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']);
|
||||
if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val'])
|
||||
{
|
||||
$this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref);
|
||||
$this->errors[$error]['type']='RESTRICTONCURRENCTCHART';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}*/
|
||||
$param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart.
|
||||
}
|
||||
call_user_func_array(array($classinstance, $method), $param_array);
|
||||
// If not found, try the fetch from label
|
||||
if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel')
|
||||
{
|
||||
call_user_func_array(array($classinstance, $method),array('', '', $newval));
|
||||
$param_array = array('', '', $newval);
|
||||
call_user_func_array(array($classinstance, $method), $param_array);
|
||||
}
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id;
|
||||
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
|
||||
@@ -459,7 +477,7 @@ class ImportCsv extends ModeleImports
|
||||
{
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn',$key,$newval,'code',$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
else if (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn',$key,$newval,$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
|
||||
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
|
||||
else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile';
|
||||
$this->errors[$error]['type']='FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
@@ -615,18 +633,30 @@ class ImportCsv extends ModeleImports
|
||||
if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table
|
||||
if ($val == 'user->id')
|
||||
{
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias).'\./','',$key);
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$listvalues[] = $user->id;
|
||||
}
|
||||
elseif (preg_match('/^lastrowid-/',$val))
|
||||
{
|
||||
$tmp=explode('-',$val);
|
||||
$lastinsertid=(isset($last_insert_id_array[$tmp[1]]))?$last_insert_id_array[$tmp[1]]:0;
|
||||
$keyfield = preg_replace('/^'.preg_quote($alias).'\./','',$key);
|
||||
$keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$listfields[] = $keyfield;
|
||||
$listvalues[] = $lastinsertid;
|
||||
//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
|
||||
}
|
||||
elseif (preg_match('/^const-/', $val))
|
||||
{
|
||||
$tmp=explode('-', $val, 2);
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$listvalues[] = "'".$tmp[1]."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors[$error]['lib']='Bad value of profile setup '.$val.' for array_import_fieldshidden';
|
||||
$this->errors[$error]['type']='Import profile setup';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//print 'listfields='.$listfields.'<br>listvalues='.$listvalues.'<br>';
|
||||
|
||||
@@ -470,11 +470,29 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
$classinstance=new $class($this->db);
|
||||
// Try the fetch from code or ref
|
||||
call_user_func_array(array($classinstance, $method),array('', $newval));
|
||||
$param_array = array('', $newval);
|
||||
if ($class == 'AccountingAccount')
|
||||
{
|
||||
//var_dump($arrayrecord[0]['val']);
|
||||
/*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php';
|
||||
$tmpchartofaccount = new AccountancySystem($this->db);
|
||||
$tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS);
|
||||
var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']);
|
||||
if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val'])
|
||||
{
|
||||
$this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref);
|
||||
$this->errors[$error]['type']='RESTRICTONCURRENCTCHART';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}*/
|
||||
$param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart.
|
||||
}
|
||||
call_user_func_array(array($classinstance, $method), $param_array);
|
||||
// If not found, try the fetch from label
|
||||
if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel')
|
||||
{
|
||||
call_user_func_array(array($classinstance, $method),array('', '', $newval));
|
||||
$param_array = array('', '', $newval);
|
||||
call_user_func_array(array($classinstance, $method), $param_array);
|
||||
}
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id;
|
||||
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
|
||||
@@ -486,7 +504,7 @@ class ImportXlsx extends ModeleImports
|
||||
{
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn',$key,$newval,'code',$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
else if (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn',$key,$newval,$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
|
||||
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
|
||||
else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile';
|
||||
$this->errors[$error]['type']='FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
@@ -635,21 +653,33 @@ class ImportXlsx extends ModeleImports
|
||||
// Loop on each hidden fields to add them into listfields/listvalues
|
||||
foreach($objimport->array_import_fieldshidden[0] as $key => $val)
|
||||
{
|
||||
if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table
|
||||
if (! preg_match('/^'.preg_quote($alias, '/').'\./', $key)) continue; // Not a field of current table
|
||||
if ($val == 'user->id')
|
||||
{
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias).'\./','',$key);
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$listvalues[] = $user->id;
|
||||
}
|
||||
elseif (preg_match('/^lastrowid-/',$val))
|
||||
{
|
||||
$tmp=explode('-',$val);
|
||||
$lastinsertid=(isset($last_insert_id_array[$tmp[1]]))?$last_insert_id_array[$tmp[1]]:0;
|
||||
$keyfield = preg_replace('/^'.preg_quote($alias).'\./','',$key);
|
||||
$keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$listfields[] = $keyfield;
|
||||
$listvalues[] = $lastinsertid;
|
||||
//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
|
||||
}
|
||||
elseif (preg_match('/^const-/', $val))
|
||||
{
|
||||
$tmp=explode('-', $val, 2);
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$listvalues[] = "'".$tmp[1]."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors[$error]['lib']='Bad value of profile setup '.$val.' for array_import_fieldshidden';
|
||||
$this->errors[$error]['type']='Import profile setup';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//print 'listfields='.$listfields.'<br>listvalues='.$listvalues.'<br>';
|
||||
|
||||
@@ -262,15 +262,38 @@ class modAccounting extends DolibarrModules
|
||||
$this->import_icon[$r]=$this->picto;
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('b'=>MAIN_DB_PREFIX.'accounting_bookkeeping'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r]=array('b.doc_date'=>"Docdate",'b.code_journal'=>'Codejournal','b.numero_compte'=>'AccountAccountingShort','b.label_operation'=>'LabelOperation','b.debit'=>"Debit",'b.credit'=>"Credit",'b.date_creation'=>"DateCreation");
|
||||
$this->import_fieldshidden_array[$r]=array('b.fk_user'=>'user->id'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
't.fk_projet'=>array('rule'=>'fetchidfromref','classfile'=>'/projet/class/project.class.php','class'=>'Project','method'=>'fetch','element'=>'Project'),
|
||||
't.ref'=>array('rule'=>'getrefifauto')
|
||||
$this->import_fields_array[$r]=array(
|
||||
'b.piece_num'=>"TransactionNumShort",
|
||||
'b.doc_date'=>"Docdate",
|
||||
//'b.doc_type'=>'Doctype',
|
||||
'b.doc_ref'=>'Piece',
|
||||
'b.code_journal'=>'Codejournal',
|
||||
//'b.journal_label'=>'JournalLabel',
|
||||
'b.numero_compte'=>'AccountAccounting',
|
||||
//'b.label_compte'=>'LabelAccount',
|
||||
'b.subledger_account'=>'SubledgerAccount',
|
||||
'b.subledger_label'=>'SubledgerAccountLabel',
|
||||
'b.label_operation'=>'LabelOperation',
|
||||
'b.debit'=>"Debit",
|
||||
'b.credit'=>"Credit"
|
||||
);
|
||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||
$this->import_fieldshidden_array[$r]=array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_regex_array[$r]=array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
//$this->import_examplevalues_array[$r]=array('t.fk_projet'=>'MyProjectRef','t.ref'=>"auto or TK2010-1234",'t.label'=>"My task",'t.progress'=>"0 (not started) to 100 (finished)",'t.datec'=>'1972-10-10','t.note_private'=>"My private note",'t.note_public'=>"My public note");
|
||||
$this->import_examplevalues_array[$r]=array(
|
||||
'b.piece_num'=>'123 (!!! use next value not already used)',
|
||||
'b.doc_date'=>dol_print_date(dol_now(), "%Y-%m-%d"),
|
||||
//'b.doc_type'=>'import',
|
||||
'b.doc_ref'=>'My document ABC',
|
||||
'b.code_journal'=>"VTE",
|
||||
//'b.journal_label'=>"Sale journal",
|
||||
'b.numero_compte'=>"707",
|
||||
//'b.label_compte'=>'Product account 707',
|
||||
'b.subledger_account'=>'',
|
||||
'b.subledger_label'=>'',
|
||||
'b.label_operation'=>"Sale of ABC",
|
||||
'b.debit'=>"0",
|
||||
'b.credit'=>"100"
|
||||
);
|
||||
|
||||
// Chart of accounts
|
||||
$r++;
|
||||
@@ -281,11 +304,12 @@ class modAccounting extends DolibarrModules
|
||||
$this->import_tables_array[$r]=array('aa'=>MAIN_DB_PREFIX.'accounting_account');
|
||||
$this->import_tables_creator_array[$r]=array('aa'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r]=array('aa.fk_pcg_version'=>"Chartofaccounts*",'aa.account_number'=>"AccountAccounting*",'aa.label'=>"Label*",'aa.account_parent'=>"Accountparent","aa.fk_accounting_category"=>"AccountingCategory","aa.pcg_type"=>"Pcgtype*",'aa.pcg_subtype'=>'Pcgsubtype*','aa.active'=>'Status*','aa.datec'=>"DateCreation");
|
||||
$this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^\d{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^\d{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
|
||||
$this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^.{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^.{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'),
|
||||
'aa.account_parent'=>array('rule'=>'zeroifnull'),
|
||||
'aa.account_parent'=>array('rule'=>'fetchidfromref','classfile'=>'/accountancy/class/accountingaccount.class.php','class'=>'AccountingAccount','method'=>'fetch','element'=>'AccountingAccount'),
|
||||
'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'),
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28");
|
||||
$this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"ref:7 or id:1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28");
|
||||
$this->import_updatekeys_array[$r]=array('aa.fk_pcg_version'=>'Chartofaccounts','aa.account_number'=>'AccountAccounting');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,20 +273,22 @@ class modAdherent extends DolibarrModules
|
||||
'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status",
|
||||
'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation',
|
||||
'a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel',
|
||||
'c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.subscription'=>'Amount'
|
||||
'c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.datef'=>'DateEndSubscription','c.subscription'=>'Amount'
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",
|
||||
'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",
|
||||
'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date',
|
||||
'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle::member_type','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric'
|
||||
'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle::member_type','ta.libelle'=>'Text',
|
||||
'c.rowid'=>'Numeric','c.dateadh'=>'Date','c.datef'=>'Date','c.subscription'=>'Numeric'
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
'a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member',
|
||||
'a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member",
|
||||
'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",
|
||||
'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member',
|
||||
'a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.subscription'=>'subscription'
|
||||
'a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type',
|
||||
'c.rowid'=>'subscription','c.dateadh'=>'subscription','c.datef'=>'subscription','c.subscription'=>'subscription'
|
||||
);
|
||||
// Add extra fields
|
||||
$keyforselect='adherent'; $keyforelement='member'; $keyforaliasextra='extra';
|
||||
|
||||
@@ -201,6 +201,11 @@ class modProduct extends DolibarrModules
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
|
||||
@@ -218,7 +223,7 @@ class modProduct extends DolibarrModules
|
||||
$this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
@@ -240,7 +245,39 @@ class modProduct extends DolibarrModules
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
's.nom'=>'ThirdParty',
|
||||
'pr.price_base_type'=>"PriceBase",
|
||||
'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceVATRate',
|
||||
'pr.default_vat_code'=>'PriceVATCode',
|
||||
'pr.datec'=>'DateCreation');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
||||
's.nom'=>'company',
|
||||
'pr.price_base_type'=>"product",'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.default_vat_code'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.datec'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
@@ -287,7 +324,7 @@ class modProduct extends DolibarrModules
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
}
|
||||
|
||||
@@ -362,7 +399,7 @@ class modProduct extends DolibarrModules
|
||||
'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
|
||||
'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('sp.fk_product'=>"PREF123456",
|
||||
$this->import_examplevalues_array[$r]=array('sp.fk_product'=>"PRODUCT_REF or id:123456",
|
||||
'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef", 'sp.quantity'=>"1", 'sp.tva_tx'=>'21',
|
||||
'sp.price'=>"50",
|
||||
'sp.unitprice'=>'50',
|
||||
@@ -381,16 +418,19 @@ class modProduct extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price');
|
||||
$this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*",
|
||||
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
|
||||
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductOrService*",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
'pr.date_price'=>'DateCreation*');
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) $this->import_fields_array[$r]['pr.tva_tx']='VATRate';
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('pr.recuperableonly'=>'NPR'));
|
||||
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
|
||||
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
|
||||
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'pr.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"PRODUCT_REF or id:123456",
|
||||
'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)",'pr.price_level'=>"1",
|
||||
'pr.price'=>"100",'pr.price_ttc'=>"110",
|
||||
'pr.price_min'=>"100",'pr.price_min_ttc'=>"110",
|
||||
'pr.tva_tx'=>'20',
|
||||
@@ -407,13 +447,13 @@ class modProduct extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('l'=>MAIN_DB_PREFIX.'product_lang');
|
||||
// multiline translation, one line per translation
|
||||
$this->import_fields_array[$r]=array('l.fk_product'=>'Ref', 'l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
|
||||
$this->import_fields_array[$r]=array('l.fk_product'=>'ProductOrService*', 'l.lang'=>'Language*', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
|
||||
//$this->import_fields_array[$r]['l.note']='TranslatedNote';
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'l.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'MyProductRef','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
|
||||
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'Ref','l.lang'=>'Language');
|
||||
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'PRODUCT_REF or id:123456','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
|
||||
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'ProductOrService','l.lang'=>'Language');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -247,8 +247,8 @@ class modProjet extends DolibarrModules
|
||||
$keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
// Add fields for tasks
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pt.rowid'=>'RefTask','pt.label'=>'LabelTask','pt.dateo'=>"TaskDateStart",'pt.datee'=>"TaskDateEnd",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"PlannedWorkload",'pt.progress'=>"Progress",'pt.description'=>"TaskDescription"));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask','pt.label'=>'projecttask','pt.dateo'=>"projecttask",'pt.datee'=>"projecttask",'pt.duration_effective'=>"projecttask",'pt.planned_workload'=>"projecttask",'pt.progress'=>"projecttask",'pt.description'=>"projecttask"));
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask','pt.dateo'=>"TaskDateStart",'pt.datee'=>"TaskDateEnd",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"PlannedWorkload",'pt.progress'=>"Progress",'pt.description'=>"TaskDescription"));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask','pt.dateo'=>"projecttask",'pt.datee'=>"projecttask",'pt.duration_effective'=>"projecttask",'pt.planned_workload'=>"projecttask",'pt.progress'=>"projecttask",'pt.description'=>"projecttask"));
|
||||
// Add extra fields for task
|
||||
$keyforselect='projet_task'; $keyforelement='projecttask'; $keyforaliasextra='extra2';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
|
||||
@@ -136,8 +136,8 @@ class modReceiptPrinter extends DolibarrModules
|
||||
// Clean before activation
|
||||
$this->remove($options);
|
||||
$sql = array(
|
||||
"CREATE TABLE IF NOT EXISTS llx_printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;",
|
||||
"CREATE TABLE IF NOT EXISTS llx_printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
|
||||
"CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;",
|
||||
"CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
|
||||
);
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
@@ -145,60 +145,43 @@ class modService extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="Services"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("service","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock'));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
//$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date');
|
||||
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date');
|
||||
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date');
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.accountancy_code_sell'=>'service','p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.tosell'=>"service",'p.tobuy'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service");
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'service'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'service'));
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$fieldname='extra.'.$obj->name;
|
||||
$fieldlabel=ucfirst($obj->label);
|
||||
$typeFilter="Text";
|
||||
switch($obj->type)
|
||||
{
|
||||
case 'int':
|
||||
case 'double':
|
||||
case 'price':
|
||||
$typeFilter="Numeric";
|
||||
break;
|
||||
case 'date':
|
||||
case 'datetime':
|
||||
$typeFilter="Date";
|
||||
break;
|
||||
case 'boolean':
|
||||
$typeFilter="Boolean";
|
||||
break;
|
||||
case 'sellist':
|
||||
$tmp='';
|
||||
$tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
|
||||
if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options']));
|
||||
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
|
||||
break;
|
||||
}
|
||||
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
||||
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
||||
$this->export_entities_array[$r][$fieldname]='product';
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text'));
|
||||
$this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity('product').')';
|
||||
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
|
||||
|
||||
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
|
||||
{
|
||||
@@ -210,11 +193,12 @@ class modService extends DolibarrModules
|
||||
$this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
'pr.date_price'=>'DateCreation');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||
//$this->export_TypeFields_array[$r]=array(
|
||||
// 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
// 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
|
||||
@@ -226,15 +210,95 @@ class modService extends DolibarrModules
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.date_price'=>"product");
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.date_price'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product';
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
's.nom'=>'ThirdParty',
|
||||
'pr.price_base_type'=>"PriceBase",
|
||||
'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceVATRate',
|
||||
'pr.default_vat_code'=>'PriceVATCode',
|
||||
'pr.datec'=>'DateCreation');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
||||
's.nom'=>'company',
|
||||
'pr.price_base_type'=>"product",'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.default_vat_code'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.datec'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
{
|
||||
// Exports virtual products
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",
|
||||
'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date','p.tms'=>'Date'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('pa.qty'=>'Numeric'));
|
||||
$this->export_entities_array[$r]=array(
|
||||
'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')';
|
||||
$this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Imports
|
||||
//--------
|
||||
$r=0;
|
||||
@@ -250,11 +314,17 @@ class modService extends DolibarrModules
|
||||
'p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",
|
||||
'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",
|
||||
'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",
|
||||
'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation'
|
||||
'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation'
|
||||
);
|
||||
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||
//if (! empty($conf->stock->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.cost_price'=>'CostPrice'));
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.recuperableonly'=>'NPR'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
|
||||
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
// Add extra fields
|
||||
$import_extrafield_sample=array();
|
||||
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0,".$conf->entity.")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
@@ -264,13 +334,15 @@ class modService extends DolibarrModules
|
||||
$fieldname='extra.'.$obj->name;
|
||||
$fieldlabel=ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
|
||||
$import_extrafield_sample[$fieldname]=$fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
$this->import_examplevalues_array[$r]=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31');
|
||||
|
||||
$this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','p.recuperableonly'=>'^[0|1]$');
|
||||
$import_sample=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31','p.recuperableonly'=>'0 or 1');
|
||||
$this->import_examplevalues_array[$r]=array_merge($import_sample,$import_extrafield_sample);
|
||||
$this->import_updatekeys_array[$r]=array('p.ref'=>'Ref','p.barcode'=>'BarCode');
|
||||
|
||||
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
|
||||
{
|
||||
@@ -301,12 +373,13 @@ class modService extends DolibarrModules
|
||||
'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
|
||||
'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('sp.fk_product'=>"PREF123456",
|
||||
$this->import_examplevalues_array[$r]=array('sp.fk_product'=>"SERVICE_REF or id:123456",
|
||||
'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef", 'sp.quantity'=>"1", 'sp.tva_tx'=>'21',
|
||||
'sp.price'=>"50",
|
||||
'sp.unitprice'=>'50',
|
||||
'sp.remise_percent'=>'0'
|
||||
);
|
||||
$this->import_updatekeys_array[$r]=array('sp.fk_product'=>'ProductOrService','sp.ref_fourn'=>'SupplierRef','sp.fk_soc'=>'Supplier');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
@@ -319,18 +392,23 @@ class modService extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price');
|
||||
$this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*",
|
||||
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
|
||||
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductOrService*",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
'pr.date_price'=>'DateCreation*');
|
||||
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
|
||||
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) $this->import_fields_array[$r]['pr.tva_tx']='VATRate';
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('pr.recuperableonly'=>'NPR'));
|
||||
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'pr.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"SERVICE_REF or id:123456",
|
||||
'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)",'pr.price_level'=>"1",
|
||||
'pr.price'=>"100",'pr.price_ttc'=>"110",
|
||||
'pr.price_min'=>"100",'pr.price_min_ttc'=>"110",
|
||||
'pr.tva_tx'=>'19.6',
|
||||
'pr.tva_tx'=>'20',
|
||||
'pr.recuperableonly'=>'0',
|
||||
'pr.date_price'=>'2013-04-10');
|
||||
}
|
||||
|
||||
@@ -343,13 +421,13 @@ class modService extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('l'=>MAIN_DB_PREFIX.'product_lang');
|
||||
// multiline translation, one line per translation
|
||||
$this->import_fields_array[$r]=array('l.fk_product'=>'Ref', 'l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
|
||||
$this->import_fields_array[$r]=array('l.fk_product'=>'ProductOrService*', 'l.lang'=>'Language*', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
|
||||
//$this->import_fields_array[$r]['l.note']='TranslatedNote';
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'l.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'MyProductRef','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
|
||||
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'Ref','l.lang'=>'Language');
|
||||
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'SERVICE_REF or id:123456','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
|
||||
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'ProductOrService','l.lang'=>'Language');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ class modStock extends DolibarrModules
|
||||
'ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10"
|
||||
);
|
||||
$this->import_run_sql_after_array[$r]=array( // Because we may change data that are denormalized, we must update dernormalized data after.
|
||||
'UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid);'
|
||||
'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -422,15 +422,7 @@ class pdf_standard extends ModelePDFProduct
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
|
||||
|
||||
// Unit
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
@@ -663,14 +655,7 @@ class pdf_standard extends ModelePDFProduct
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS) {
|
||||
|
||||
@@ -278,7 +278,7 @@ class pdf_beluga extends ModelePDFProjects
|
||||
'table'=>'commande',
|
||||
'datefieldname'=>'date_commande',
|
||||
'test'=>$conf->commande->enabled && $user->rights->commande->lire,
|
||||
'lang'=>'order'),
|
||||
'lang'=>'orders'),
|
||||
'invoice'=>array(
|
||||
'name'=>"CustomersInvoices",
|
||||
'title'=>"ListInvoicesAssociatedProject",
|
||||
|
||||
@@ -179,6 +179,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$this->posxtva=110;
|
||||
$this->posxup=126;
|
||||
$this->posxqty=145;
|
||||
$this->posxunit=162;
|
||||
}
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
@@ -368,14 +369,16 @@ class pdf_azur extends ModelePDFPropales
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS))
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
$delta = ($this->postotalht - $this->posxdiscount);
|
||||
$this->posxpicture+=$delta;
|
||||
$this->posxtva+=$delta;
|
||||
$this->posxup+=$delta;
|
||||
$this->posxqty+=$delta;
|
||||
$this->posxunit+=$delta;
|
||||
$this->posxdiscount+=$delta;
|
||||
// post of fields after are not modified, stay at same position
|
||||
}
|
||||
|
||||
// New page
|
||||
@@ -573,15 +576,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
|
||||
|
||||
// Unit
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
@@ -1389,14 +1384,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS) {
|
||||
|
||||
@@ -636,89 +636,11 @@ class pdf_standard extends ModelePDFStock
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
||||
|
||||
// VAT Rate
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
|
||||
{
|
||||
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxtva, $curY);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
|
||||
}
|
||||
|
||||
// Unit price before discount
|
||||
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxup, $curY);
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);
|
||||
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
|
||||
// Unit
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
|
||||
$pdf->SetXY($this->posxunit, $curY);
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxunit-0.8, 4, $unit, 0, 'L');
|
||||
}
|
||||
|
||||
// Discount on line
|
||||
$pdf->SetXY($this->posxdiscount, $curY);
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$pdf->SetXY($this->posxdiscount-2, $curY);
|
||||
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->postotalht, $curY);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
|
||||
|
||||
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
||||
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva;
|
||||
else $tvaligne=$object->lines[$i]->total_tva;
|
||||
|
||||
$localtax1ligne=$object->lines[$i]->total_localtax1;
|
||||
$localtax2ligne=$object->lines[$i]->total_localtax2;
|
||||
$localtax1_rate=$object->lines[$i]->localtax1_tx;
|
||||
$localtax2_rate=$object->lines[$i]->localtax2_tx;
|
||||
$localtax1_type=$object->lines[$i]->localtax1_type;
|
||||
$localtax2_type=$object->lines[$i]->localtax2_type;
|
||||
|
||||
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
|
||||
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
|
||||
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
|
||||
|
||||
$vatrate=(string) $object->lines[$i]->tva_tx;
|
||||
|
||||
// Retrieve type from database for backward compatibility with old records
|
||||
if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined
|
||||
&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax
|
||||
{
|
||||
$localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc);
|
||||
$localtax1_type = $localtaxtmp_array[0];
|
||||
$localtax2_type = $localtaxtmp_array[2];
|
||||
}
|
||||
|
||||
// retrieve global local tax
|
||||
if ($localtax1_type && $localtax1ligne != 0)
|
||||
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
|
||||
if ($localtax2_type && $localtax2ligne != 0)
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0;
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
|
||||
@@ -153,6 +153,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$this->posxtva=112;
|
||||
$this->posxup=126;
|
||||
$this->posxqty=145;
|
||||
$this->posxunit=162;
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
|
||||
@@ -302,14 +303,16 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS))
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
$delta = ($this->postotalht - $this->posxdiscount);
|
||||
$this->posxpicture+=$delta;
|
||||
$this->posxtva+=$delta;
|
||||
$this->posxup+=$delta;
|
||||
$this->posxqty+=$delta;
|
||||
$this->posxunit+=$delta;
|
||||
$this->posxdiscount+=$delta;
|
||||
// post of fields after are not modified, stay at same position
|
||||
}
|
||||
|
||||
// New page
|
||||
@@ -447,15 +450,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
|
||||
|
||||
// Unit
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
@@ -470,7 +465,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent."%", 0, 'R');
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent, 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
@@ -887,14 +882,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS) {
|
||||
|
||||
@@ -110,7 +110,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
/**
|
||||
* Issuer
|
||||
* @var Company object that emits
|
||||
* @var Societe object that emits
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
@@ -159,7 +159,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$this->emetteur=$mysoc;
|
||||
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
|
||||
|
||||
// Defini position des colonnes
|
||||
// Define position of columns
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
@@ -174,6 +174,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$this->posxtva=110;
|
||||
$this->posxup=126;
|
||||
$this->posxqty=145;
|
||||
$this->posxunit=162;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxup = $this->posxtva; // posxtva is picture position reference
|
||||
@@ -350,14 +351,16 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS))
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
$delta = ($this->postotalht - $this->posxdiscount);
|
||||
$this->posxpicture+=$delta;
|
||||
$this->posxtva+=$delta;
|
||||
$this->posxup+=$delta;
|
||||
$this->posxqty+=$delta;
|
||||
$this->posxunit+=$delta;
|
||||
$this->posxdiscount+=$delta;
|
||||
// post of fields after are not modified, stay at same position
|
||||
}
|
||||
|
||||
// New page
|
||||
@@ -526,15 +529,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
|
||||
|
||||
// Unit
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
@@ -1072,14 +1067,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS) {
|
||||
@@ -1306,9 +1294,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
|
||||
|
||||
// If BILLING contact defined on order, we use it
|
||||
// If CUSTOMER contact defined on order, we use it. Note: Even if this is a supplier object, the code for external contat that follow object is 'CUSTOMER'
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->getIdContact('external','BILLING');
|
||||
$arrayidcontact=$object->getIdContact('external','CUSTOMER');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
|
||||
@@ -171,6 +171,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$this->posxtva=102;
|
||||
$this->posxup=126;
|
||||
$this->posxqty=145;
|
||||
$this->posxunit=162;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxup=$this->posxtva;
|
||||
@@ -339,14 +340,16 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS))
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
$delta = ($this->postotalht - $this->posxdiscount);
|
||||
$this->posxpicture+=$delta;
|
||||
$this->posxtva+=$delta;
|
||||
$this->posxup+=$delta;
|
||||
$this->posxqty+=$delta;
|
||||
$this->posxunit+=$delta;
|
||||
$this->posxdiscount+=$delta;
|
||||
// post of fields after are not modified, stay at same position
|
||||
}
|
||||
|
||||
// New page
|
||||
@@ -518,15 +521,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 3, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 3, $qty, 0, 'R');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
|
||||
|
||||
// Unit
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
@@ -1230,14 +1225,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||
}
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS) {
|
||||
|
||||
@@ -171,7 +171,7 @@ if ($action == 'presend')
|
||||
$listeuser=array();
|
||||
$fuserdest = new User($db);
|
||||
|
||||
$result= $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\''));
|
||||
$result= $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\''), 'AND', true);
|
||||
if ($result>0 && is_array($fuserdest->users) && count($fuserdest->users)>0) {
|
||||
foreach($fuserdest->users as $uuserdest) {
|
||||
$listeuser[$uuserdest->id] = $uuserdest->user_get_property($uuserdest->id,'email');
|
||||
|
||||
@@ -28,6 +28,7 @@ if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array
|
||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||
if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text
|
||||
if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string
|
||||
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,8 @@ if ($massaction == 'presend')
|
||||
$formmail->withtoreadonly = 1;
|
||||
}
|
||||
|
||||
$formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste))? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1);
|
||||
$formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1);
|
||||
|
||||
$formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste;
|
||||
$formmail->withtofree = empty($liste)?1:0;
|
||||
$formmail->withtocc = 1;
|
||||
|
||||
@@ -71,7 +71,7 @@ elseif ($module == 'shipping') { $permission=$user->rights->expedition->cr
|
||||
elseif ($module == 'product') { $permission=$user->rights->produit->creer;}
|
||||
//else dol_print_error('','Bad value '.$module.' for param module');
|
||||
|
||||
if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
else $typeofdata='textarea:12:95%';
|
||||
|
||||
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user