mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-13 19:25:22 +01:00
Compare commits
335 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8104c97f77 | ||
|
|
7b853d8981 | ||
|
|
d808add499 | ||
|
|
d07ec07896 | ||
|
|
ed467aa74b | ||
|
|
1becbb8805 | ||
|
|
afc1938676 | ||
|
|
5411699256 | ||
|
|
8ce723b4c9 | ||
|
|
19adbaf84b | ||
|
|
337d6d9f08 | ||
|
|
7767f03e9c | ||
|
|
711bbe0afb | ||
|
|
76efc31b00 | ||
|
|
69c47aa7d9 | ||
|
|
13cb806436 | ||
|
|
d28188d19d | ||
|
|
fef6440ff2 | ||
|
|
0b808fa2aa | ||
|
|
c4b3dc40c3 | ||
|
|
888e5ed2c5 | ||
|
|
90964d25ce | ||
|
|
26e537e328 | ||
|
|
7c30b3ca5d | ||
|
|
ea5c54ad9c | ||
|
|
ec8db116f8 | ||
|
|
884fc5d249 | ||
|
|
b5bfc3e2c7 | ||
|
|
be84b52d19 | ||
|
|
7c690ae8b8 | ||
|
|
17b286ef59 | ||
|
|
6a05645295 | ||
|
|
4a63e6b6ec | ||
|
|
f510f3062b | ||
|
|
30a9e40f4e | ||
|
|
7ba2dd8397 | ||
|
|
93cf135d5e | ||
|
|
537a551bb5 | ||
|
|
8866683a72 | ||
|
|
7f807986d7 | ||
|
|
c5f30f0d80 | ||
|
|
04f4a81736 | ||
|
|
dc790e62ce | ||
|
|
15c8515d53 | ||
|
|
0dfbc8d72f | ||
|
|
eacb221ffe | ||
|
|
76f1dbe16b | ||
|
|
49982b36ac | ||
|
|
1002923dea | ||
|
|
7f420f3246 | ||
|
|
59571b1ce1 | ||
|
|
c5287e68b1 | ||
|
|
3cc7f66e90 | ||
|
|
919d29fdf7 | ||
|
|
fe55feb82f | ||
|
|
4c7b39f49e | ||
|
|
d2c23ebc8d | ||
|
|
35ae0e435d | ||
|
|
485b1ba88e | ||
|
|
d3d6fca350 | ||
|
|
cef7b9c92d | ||
|
|
4b92e2a705 | ||
|
|
270aba99fa | ||
|
|
adb3827d1e | ||
|
|
554a640c2b | ||
|
|
3a7aea48d7 | ||
|
|
1bb5408d83 | ||
|
|
73494a23df | ||
|
|
ef61407d95 | ||
|
|
5776a948c4 | ||
|
|
84173f3759 | ||
|
|
2ca5f2e27e | ||
|
|
339d1eb124 | ||
|
|
e1b4788bc2 | ||
|
|
72108c3a4e | ||
|
|
8f19ffd097 | ||
|
|
76c3fe1260 | ||
|
|
cafcbe03e1 | ||
|
|
5240217144 | ||
|
|
d68abf8237 | ||
|
|
03ffbe55ce | ||
|
|
a918fd1cf2 | ||
|
|
21959aec8f | ||
|
|
68c9d08909 | ||
|
|
e61032a313 | ||
|
|
fc5c9ad2f2 | ||
|
|
1daa0204aa | ||
|
|
7706020805 | ||
|
|
77fea1983c | ||
|
|
5e2cc05047 | ||
|
|
052e025537 | ||
|
|
6a0ef4b561 | ||
|
|
f87614e2d3 | ||
|
|
ddeca6cc06 | ||
|
|
cec91ae837 | ||
|
|
13d5471dd0 | ||
|
|
8123562ded | ||
|
|
14e1306b20 | ||
|
|
f4ddce7274 | ||
|
|
cc7aee6c3e | ||
|
|
d5966f944f | ||
|
|
caf4ca7451 | ||
|
|
949eef82f0 | ||
|
|
815d0aff90 | ||
|
|
848bc0779a | ||
|
|
f5bc9c08b1 | ||
|
|
7375afca3e | ||
|
|
978702d04b | ||
|
|
f936b17d68 | ||
|
|
9838199de1 | ||
|
|
70b11f18b5 | ||
|
|
c11ff4a18c | ||
|
|
aba907d1a8 | ||
|
|
0c01c7ceba | ||
|
|
6ac1b6e82e | ||
|
|
0536d6cbed | ||
|
|
278bcfa8da | ||
|
|
52ebdcc27f | ||
|
|
4c97f5514d | ||
|
|
c6f7687bbb | ||
|
|
8536d0f6e9 | ||
|
|
4043141ae3 | ||
|
|
31721165b5 | ||
|
|
eaee8ee586 | ||
|
|
f76b675e09 | ||
|
|
99149b5cfe | ||
|
|
196c5c1267 | ||
|
|
2c3428a1bf | ||
|
|
94368accc1 | ||
|
|
ee774f1bf9 | ||
|
|
bb73da4c5e | ||
|
|
39acb46139 | ||
|
|
9e29ea8011 | ||
|
|
97e8974fdf | ||
|
|
279988bd60 | ||
|
|
ff7a17eb96 | ||
|
|
5bb4590348 | ||
|
|
e4767b1a51 | ||
|
|
058b690e25 | ||
|
|
8986640a10 | ||
|
|
5e4b500b5d | ||
|
|
bb6b3db0ac | ||
|
|
087e22ab94 | ||
|
|
48ae76e295 | ||
|
|
7b8699f54c | ||
|
|
59f644a3e2 | ||
|
|
17eec5f9e9 | ||
|
|
45b5819b8d | ||
|
|
97d5c067ac | ||
|
|
9dfd4bb430 | ||
|
|
ff7b542bfa | ||
|
|
8b9b99ac40 | ||
|
|
cce1549f66 | ||
|
|
affaec2a6f | ||
|
|
c52e593ea8 | ||
|
|
5d920be880 | ||
|
|
062152c723 | ||
|
|
84359a0078 | ||
|
|
5d068083e5 | ||
|
|
42399952ea | ||
|
|
4bc8773417 | ||
|
|
9e7108ff60 | ||
|
|
22b2446c05 | ||
|
|
d9947f2374 | ||
|
|
2de76d733b | ||
|
|
2798726dba | ||
|
|
f16d88fd53 | ||
|
|
69f86fc0af | ||
|
|
53c73054f4 | ||
|
|
b80b7bbcb9 | ||
|
|
225d78c767 | ||
|
|
a38bbdcc05 | ||
|
|
047f01888a | ||
|
|
f2d092c815 | ||
|
|
8392158ee3 | ||
|
|
93defa5f59 | ||
|
|
24436b550d | ||
|
|
ed8e08b78a | ||
|
|
f0983353f2 | ||
|
|
dbb50d7b16 | ||
|
|
2d7916f77d | ||
|
|
7d5dc08a0a | ||
|
|
fe1ce5b3ac | ||
|
|
9523bf5fbd | ||
|
|
ed013c1b7e | ||
|
|
aafc108260 | ||
|
|
3b56663e4d | ||
|
|
d7b84bd35f | ||
|
|
4b8862c1ec | ||
|
|
fed3165b53 | ||
|
|
6d40f797d2 | ||
|
|
f2cd96b9c0 | ||
|
|
dc38ec5051 | ||
|
|
38621b622e | ||
|
|
9b22f046f5 | ||
|
|
a5a08006e9 | ||
|
|
e0eef2080e | ||
|
|
60078300b8 | ||
|
|
58b49f9a08 | ||
|
|
3deacaa5c4 | ||
|
|
c44a5ede43 | ||
|
|
e11c7a08ea | ||
|
|
939d33cce7 | ||
|
|
0744b5d91b | ||
|
|
f68d31d7c5 | ||
|
|
6e3174e71a | ||
|
|
d572e1ddad | ||
|
|
30eb03af4c | ||
|
|
f0e0df2660 | ||
|
|
cd888a2149 | ||
|
|
e038e1a2f5 | ||
|
|
681c2a67bd | ||
|
|
44405e5415 | ||
|
|
e9bc5b719d | ||
|
|
2fdad0f11d | ||
|
|
6da5a6b82f | ||
|
|
029f1c411f | ||
|
|
206e44431d | ||
|
|
31b5ca17f1 | ||
|
|
5a68d69067 | ||
|
|
19e780c53f | ||
|
|
e9912c020e | ||
|
|
646e8713f2 | ||
|
|
b87ce172c3 | ||
|
|
a300a635d8 | ||
|
|
61a0f04bbe | ||
|
|
214bad26db | ||
|
|
e9e6a8e5ad | ||
|
|
26385fa10d | ||
|
|
d13c4b7b84 | ||
|
|
c315ad7801 | ||
|
|
762b4eb876 | ||
|
|
67e9b65a2e | ||
|
|
a8fdf0b5ea | ||
|
|
7404a6cf98 | ||
|
|
db02c32a9f | ||
|
|
c1c75208ec | ||
|
|
bb53146192 | ||
|
|
23c5b0366f | ||
|
|
310e912a9d | ||
|
|
c498ce3c41 | ||
|
|
8b20c5edab | ||
|
|
a6a142753a | ||
|
|
17da808325 | ||
|
|
03fe9d4e97 | ||
|
|
d4c20a919d | ||
|
|
1a389b6faf | ||
|
|
34f08ce082 | ||
|
|
20ed279489 | ||
|
|
da2f971345 | ||
|
|
835cd43565 | ||
|
|
7dbd0bd355 | ||
|
|
7c743eb7da | ||
|
|
863c575580 | ||
|
|
f92eded0a2 | ||
|
|
a97b87d2cd | ||
|
|
faaebbf5e1 | ||
|
|
6701ad8b73 | ||
|
|
b9af2d6b97 | ||
|
|
3393947dbc | ||
|
|
7648d300b5 | ||
|
|
bde293af22 | ||
|
|
e43b13968e | ||
|
|
b5c30ea679 | ||
|
|
451adb077f | ||
|
|
4bbd42123e | ||
|
|
17310da0f8 | ||
|
|
33e2179b65 | ||
|
|
032f54dd1a | ||
|
|
9fa85a5831 | ||
|
|
016ed12c11 | ||
|
|
d26b2a694d | ||
|
|
9b35793608 | ||
|
|
9cc344f8cc | ||
|
|
5a75e14a8a | ||
|
|
f5e14c9d70 | ||
|
|
237270a27e | ||
|
|
f5ccd943f1 | ||
|
|
53f5513476 | ||
|
|
e599e47e84 | ||
|
|
52986c5c07 | ||
|
|
d4ff877fdd | ||
|
|
d66fac5662 | ||
|
|
a158f5ab9d | ||
|
|
67b5353861 | ||
|
|
4dd58a94f3 | ||
|
|
1821be87e9 | ||
|
|
1154f871f1 | ||
|
|
c22e8cfc01 | ||
|
|
61ee071f43 | ||
|
|
2c3a696b78 | ||
|
|
03bbb340f8 | ||
|
|
869c8a4ead | ||
|
|
65b6b142bd | ||
|
|
f3b1f89bae | ||
|
|
3126676ffb | ||
|
|
eb9e8c9dfc | ||
|
|
ac7f1035e1 | ||
|
|
3108f5bf0d | ||
|
|
c108f11c01 | ||
|
|
f92129dcdb | ||
|
|
09e9254f35 | ||
|
|
7c722def0f | ||
|
|
227c8a96c8 | ||
|
|
9fe1d8462a | ||
|
|
5ba13a9500 | ||
|
|
d018bd4892 | ||
|
|
0d0b7f8af2 | ||
|
|
4660bc58fc | ||
|
|
223e1b1cd4 | ||
|
|
0fc8a0f840 | ||
|
|
2768878618 | ||
|
|
ffb408f440 | ||
|
|
ac08dec2c3 | ||
|
|
d88a75b666 | ||
|
|
cf49c274a6 | ||
|
|
1a956cce9a | ||
|
|
d9008cd302 | ||
|
|
be63eb8cef | ||
|
|
2ab12f54ff | ||
|
|
6a3d110d3a | ||
|
|
e71409b7c8 | ||
|
|
0a67ca53d4 | ||
|
|
b65db49868 | ||
|
|
3e4a7ba97c | ||
|
|
2c4e8cbb4a | ||
|
|
a3085cb44a | ||
|
|
5a81073cd8 | ||
|
|
c028771ad0 | ||
|
|
70cbaeb423 | ||
|
|
d5a9d32778 | ||
|
|
bfc5f01e1e | ||
|
|
d3c95e030b | ||
|
|
45136de664 | ||
|
|
4998eb3061 |
48
.travis.yml
48
.travis.yml
@@ -2,19 +2,15 @@
|
||||
# from Dolibarr GitHub repository.
|
||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||
|
||||
# We use dist: precise to have php 5.3 available
|
||||
dist: precise
|
||||
sudo: required
|
||||
|
||||
language: php
|
||||
|
||||
php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- nightly
|
||||
# Start on every boot
|
||||
services:
|
||||
- memcached
|
||||
|
||||
addons:
|
||||
mariadb: '10.0'
|
||||
@@ -33,10 +29,16 @@ addons:
|
||||
- libapache2-mod-fastcgi
|
||||
# We need pgloader for import mysql database into pgsql
|
||||
- pgloader
|
||||
|
||||
# Start on every boot
|
||||
services:
|
||||
- memcached
|
||||
|
||||
php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
#- hhvm only with dist: trusty
|
||||
- nightly
|
||||
|
||||
env:
|
||||
global:
|
||||
@@ -57,11 +59,22 @@ env:
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: 7.1
|
||||
- php: hhvm
|
||||
- php: nightly
|
||||
#- env: DB=postgresql
|
||||
# TODO
|
||||
#- env: DB=sqlite
|
||||
# We exclude some combinations not usefull to save Travis CPU
|
||||
exclude:
|
||||
- php: '5.4'
|
||||
env: DB=postgresql
|
||||
- php: '5.5'
|
||||
env: DB=postgresql
|
||||
- php: '5.6'
|
||||
env: DB=postgresql
|
||||
- php: '7.0'
|
||||
env: DB=postgresql
|
||||
- php: hhvm
|
||||
env: DB=postgresql
|
||||
- php: nightly
|
||||
env: DB=postgresql
|
||||
|
||||
notifications:
|
||||
email:
|
||||
@@ -305,6 +318,9 @@ script:
|
||||
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||
php upgrade2.php 5.0.0 6.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
||||
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
||||
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
|
||||
82
ChangeLog
82
ChangeLog
@@ -2,6 +2,83 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
|
||||
|
||||
FIX: #7148
|
||||
FIX: #7288
|
||||
FIX: #7366 renaming table with pgsql
|
||||
FIX: #7435 Can't add payment term
|
||||
FIX: #7461
|
||||
FIX: #7464
|
||||
FIX: #7471
|
||||
FIX: #7473 Mass update of vat rates and other bugs on localtax
|
||||
FIX: #7475
|
||||
FIX: #7486 Empty value for multicurrency rate must be forbidden
|
||||
FIX: #7490
|
||||
FIX: #7505
|
||||
FIX: #7510 Bug: extrafield content disappear when generate pdf within intervention
|
||||
FIX: #7514
|
||||
FIX: #7531 #7537
|
||||
FIX: #7541
|
||||
FIX: #7546
|
||||
FIX: #7550
|
||||
FIX: #7554
|
||||
FIX: #7567
|
||||
FIX: Accountancy export model for Agiris Isacompta
|
||||
FIX: Allow create shipping if STOCK_SUPPORTS_SERVICES option is enabled
|
||||
FIX: Bad preview on scroping when special file names
|
||||
FIX: Generation of invoice from bulk action "Bill Orders"
|
||||
FIX: Implementation of a Luracast recommandation for the REST api server (#7370)
|
||||
FIX: Missing space in request
|
||||
FIX: Only modified values must be modified
|
||||
FIX: replenish if line test GETPOST on line 0
|
||||
FIX: Stripe not working on live mode
|
||||
FIX: wrong basePath in the swagger view
|
||||
FIX: Implementation of a Luracast recommandation for the REST api server
|
||||
|
||||
***** ChangeLog for 6.0.1 compared to 6.0.* *****
|
||||
|
||||
FIX: #7000 Dashboard link for late pending payment supplier invoices do not work
|
||||
FIX: #7325 Default VAT rate when editing template invoices is 0%
|
||||
FIX: #7330
|
||||
FIX: #7359
|
||||
FIX: #7367
|
||||
FIX: #7368
|
||||
FIX: #7391
|
||||
FIX: #7420
|
||||
FIX: Add some missing attributes in Adherent:makeSubstitution (type, phone…
|
||||
FIX: Bad const name
|
||||
FIX: Bad link to unpayed suppliers invoices
|
||||
FIX: Better protection to no send email when we change limit
|
||||
FIX: Calculation in the activity box
|
||||
FIX: Clean bad parameters when inserting line of template invoice
|
||||
FIX: dateSelector was not taken into account
|
||||
FIX: hidden option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN
|
||||
FIX: journalization for bank journal should not rely on a label.
|
||||
FIX: menu enty when url is external link
|
||||
FIX: missing supplier qty and supplier discount in available fields for product export.
|
||||
FIX: multicompany better accuracy in rounding and with revenue stamp.
|
||||
FIX: Must use pdf format page as default for merging PDF.
|
||||
FIX: PDF output was sharing 2 different currencies in same total
|
||||
FIX: Position of signature on strato template
|
||||
FIX: Protection to avoid to apply credit note discount > remain to pay
|
||||
FIX: Remove warning when using log into syslog
|
||||
FIX: Responsive
|
||||
FIX: Security fixes (filter onload js, less verbose error message in
|
||||
FIX: SEPA recording payment must save one payment in bank per customer
|
||||
FIX: Several problem with the last event box on project/tasks
|
||||
FIX: Sign of amount in origin currency on credit note created from lines
|
||||
FIX: Some page of admin were not responsive
|
||||
FIX: SQL injection
|
||||
FIX: time.php crashed without project id in param
|
||||
FIX: transfer of line extrafields from order to invoice
|
||||
FIX: Upgrade missing on field
|
||||
FIX: View of timespent for another user
|
||||
FIX: ODT generation
|
||||
FIX: CVE-2017-9840, CVE-2017-14238, CVE-2017-14239, CVE-2017-14240, CVE-2017-14241,
|
||||
CVE-2017-14242
|
||||
|
||||
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
||||
|
||||
NEW: Add experimental BlockeLog module (to log business events in a non reversible log file).
|
||||
@@ -9,7 +86,7 @@ NEW: Add a payment module for Stripe.
|
||||
NEW: Add module "Product variant" (like red, blue for the product shoes)
|
||||
NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC)
|
||||
NEW: Add a tracking id into mass emailing.
|
||||
NEW: Tax system more compatible with the new tax roollout in India (IGST / CGST / SGST).
|
||||
NEW: Tax system more compatible with the new tax rollout in India (IGST / CGST / SGST).
|
||||
NEW: Add calculation function for Loan schedule
|
||||
NEW: Add "depends on" and "required by" into module informations
|
||||
NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO
|
||||
@@ -152,6 +229,9 @@ Following changes may create regression for some external modules, but were nece
|
||||
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
|
||||
hook specifications so you must return output into "resprint".
|
||||
|
||||
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
|
||||
FIX: Removed a bad symbolic link into custom directory.
|
||||
FIX: Renaming a resource ref rename also the directory of attached files.
|
||||
|
||||
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
|
||||
FIX: #7075 : bad path for document
|
||||
|
||||
@@ -334,7 +334,7 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
|
||||
}
|
||||
foreach my $target (sort keys %CHOOSEDPUBLISH) {
|
||||
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
|
||||
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
||||
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; }
|
||||
if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
||||
$nboftargetok++;
|
||||
}
|
||||
@@ -366,7 +366,9 @@ if ($nboftargetok) {
|
||||
}
|
||||
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).'.. --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 "\n";
|
||||
if (! $ret)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# \file build/makepack-dolibarrmodule.pl
|
||||
# \brief Package builder (tgz, zip, rpm, deb, exe)
|
||||
# \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
# \contributor (c)2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
use Cwd;
|
||||
@@ -134,7 +135,15 @@ foreach my $PROJECT (@PROJECTLIST) {
|
||||
# Get version $MAJOR, $MINOR and $BUILD
|
||||
print "Version detected for module ".$PROJECT.": ";
|
||||
$result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
|
||||
if (! $result) { die "Error: Can't open descriptor file ".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n"; }
|
||||
$custom=false;
|
||||
if (! $result) {
|
||||
$result=open(IN,"<".$SOURCE."/htdocs/custom/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
|
||||
if (! $result) {
|
||||
die "Error: Can't open descriptor file ".$SOURCE."/htdocs/(or /htdocs/custom/)".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n";
|
||||
}else{
|
||||
$custom = true;
|
||||
}
|
||||
}
|
||||
while(<IN>)
|
||||
{
|
||||
if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; }
|
||||
@@ -294,8 +303,11 @@ foreach my $PROJECT (@PROJECTLIST) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
|
||||
if($custom){
|
||||
$ret=`cp -r $BUILDROOT/$PROJECTLC/htdocs/custom/* $BUILDROOT/$PROJECTLC/htdocs/.`;
|
||||
}
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/Thumbs.db $BUILDROOT/$PROJECTLC/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/*/Thumbs.db`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/CVS* $BUILDROOT/$PROJECTLC/*/CVS* $BUILDROOT/$PROJECTLC/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/*/CVS*`;
|
||||
|
||||
@@ -163,6 +163,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
%_datadir/dolibarr/htdocs/commande
|
||||
%_datadir/dolibarr/htdocs/compta
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -419,7 +419,7 @@ class AccountancyExport
|
||||
|
||||
|
||||
/**
|
||||
* Export format : Agiris
|
||||
* Export format : Agiris Isacompta
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
@@ -433,30 +433,23 @@ class AccountancyExport
|
||||
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
|
||||
print $line->id . $this->separator;
|
||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
||||
print $line->piece_num . $this->separator;
|
||||
print $line->label_operation . $this->separator;
|
||||
print $date . $this->separator;
|
||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
||||
print $line->label_operation . $this->separator;
|
||||
|
||||
if (empty($line->subledger_account)) {
|
||||
print length_accountg($line->numero_compte) . $this->separator;
|
||||
} else {
|
||||
// FIXME Because the subledger_account is already an accounting account, does we really need
|
||||
// to concat 4011 or 401 to it ?
|
||||
if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') {
|
||||
print '411' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
|
||||
}
|
||||
if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') {
|
||||
print '401' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
|
||||
}
|
||||
print length_accounta($line->subledger_account) . $this->separator;
|
||||
}
|
||||
|
||||
print length_accounta($line->subledger_account) . $this->separator;
|
||||
print $line->doc_ref . $this->separator;
|
||||
print price($line->debit) . $this->separator;
|
||||
print price($line->credit) . $this->separator;
|
||||
print price($line->montant).$this->separator;
|
||||
print $line->sens.$this->separator;
|
||||
print $line->code_journal . $this->separator;
|
||||
print $line->code_journal;
|
||||
print $this->end_line;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,8 +213,8 @@ for($i = 1; $i <= 12; $i ++) {
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
@@ -240,8 +240,20 @@ if ($resql) {
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
@@ -269,8 +281,8 @@ for($i = 1; $i <= 12; $i ++) {
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
@@ -296,7 +308,20 @@ if ($resql) {
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
@@ -363,7 +388,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@@ -94,7 +94,7 @@ if ($action == 'validatehistory') {
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
@@ -139,7 +139,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.=")";
|
||||
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
@@ -194,8 +194,8 @@ for($i = 1; $i <= 12; $i ++) {
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
@@ -217,9 +217,21 @@ if ($resql) {
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
@@ -247,8 +259,8 @@ for($i = 1; $i <= 12; $i ++) {
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
@@ -270,9 +282,21 @@ if ($resql) {
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
@@ -292,9 +316,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
{
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
@@ -302,7 +326,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("TotalExpenseReport") . "' AS label,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
@@ -314,12 +338,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
|
||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
@@ -328,7 +352,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
|
||||
@@ -104,12 +104,15 @@ $idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop,";
|
||||
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop";
|
||||
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop_company,";
|
||||
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop_user,";
|
||||
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
|
||||
$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
||||
@@ -147,6 +150,7 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
//print $sql;
|
||||
|
||||
// Variables
|
||||
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
||||
@@ -172,13 +176,31 @@ if ($result) {
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Set accountancy code (for bank and thirdparty)
|
||||
$lineisapurchase = -1;
|
||||
$lineisasale = -1;
|
||||
// Old method to detect if it's a sale or purchase
|
||||
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase=1;
|
||||
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale=1;
|
||||
// Try a more reliable method to detect if record is a supplier payment or a customer payment
|
||||
if ($lineisapurchase < 0)
|
||||
{
|
||||
if ($obj->typeop_payment_supplier == 'payment_supplier') $lineisapurchase = 1;
|
||||
}
|
||||
if ($lineisasale < 0)
|
||||
{
|
||||
if ($obj->typeop_payment == 'payment') $lineisasale = 1;
|
||||
}
|
||||
//var_dump($obj->type_payment); var_dump($obj->type_payment_supplier);
|
||||
//var_dump($lineisapurchase); //var_dump($lineisasale);
|
||||
|
||||
// Set accountancy code for bank
|
||||
$compta_bank = $obj->account_number;
|
||||
|
||||
// Set accountancy code for thirdparty
|
||||
$compta_soc = 'NotDefined';
|
||||
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)')
|
||||
if ($lineisapurchase > 0)
|
||||
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
|
||||
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)')
|
||||
if ($lineisasale > 0)
|
||||
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
||||
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
@@ -187,6 +209,7 @@ if ($result) {
|
||||
'code_compta' => $compta_soc,
|
||||
);
|
||||
|
||||
// Set accountancy code for user
|
||||
$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
|
||||
|
||||
$tabuser[$obj->rowid] = array (
|
||||
@@ -202,6 +225,7 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
|
||||
$tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
|
||||
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
||||
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
|
||||
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
||||
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
||||
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
||||
@@ -214,7 +238,7 @@ if ($result) {
|
||||
//var_dump($tabpay);
|
||||
|
||||
// By default
|
||||
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or old record with no links in bank_url.
|
||||
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
|
||||
$tabtype[$obj->rowid] = 'unknown';
|
||||
|
||||
// get_url may return -1 which is not traversable
|
||||
@@ -604,6 +628,8 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Export
|
||||
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
@@ -737,6 +763,22 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
|
||||
// Test that setup is complete
|
||||
$sql='SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL';
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
if ($obj->nb > 0)
|
||||
{
|
||||
print img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>');
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|
||||
@@ -797,8 +839,10 @@ if (empty($action) || $action == 'view') {
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt )
|
||||
{
|
||||
//var_dump($tabpay[$key]);
|
||||
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Bank bank.rowid=".$key."--></td>";
|
||||
print "<td></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
// Ledger account
|
||||
@@ -819,11 +863,14 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
else print $accounttoshow;*/
|
||||
print "</td>";
|
||||
if ($val['soclib'] == '') {
|
||||
print "<td>" . $langs->trans("Bank") . " - " . $reflabel . "</td>";
|
||||
} else {
|
||||
print "<td>" . $langs->trans("Bank") . " - " . $val['soclib'] . "</td>";
|
||||
print "<td>";
|
||||
//var_dump($tabpay[$key]);
|
||||
print $langs->trans("Bank");
|
||||
print ' '.$val['bank_account_ref'];
|
||||
if (! empty($val['soclib'])) {
|
||||
print " - " . $val['soclib'];
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>" . $val["type_payment"] . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
@@ -834,14 +881,15 @@ if (empty($action) || $action == 'view') {
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($k != 'type') {
|
||||
print '<!-- Thirdparty bank.rowid='.$key.' -->';
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Thirdparty bank.rowid=".$key." --></td>";
|
||||
print "<td></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
// Ledger account
|
||||
print "<td>";
|
||||
$account_ledger = $k;
|
||||
|
||||
// Try to force general ledger account depending on type
|
||||
if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
@@ -878,7 +926,11 @@ if (empty($action) || $action == 'view') {
|
||||
{
|
||||
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
/*var_dump($tabpay[$key]);
|
||||
var_dump($tabtype[$key]);
|
||||
var_dump($tabbq[$key]);*/
|
||||
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown").'</span>';
|
||||
}
|
||||
else print $accounttoshowsubledger;
|
||||
}
|
||||
@@ -893,8 +945,9 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
} else {
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '<!-- Wait bank.rowid='.$key.' -->';
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Wait bank.rowid=".$key." --></td>";
|
||||
print "<td></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
// Ledger account
|
||||
@@ -936,7 +989,7 @@ $db->close();
|
||||
* Return source for doc_ref of a bank transaction
|
||||
*
|
||||
* @param string $val Array of val
|
||||
* @param string $typerecord Type of record
|
||||
* @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...)
|
||||
* @return string|unknown
|
||||
*/
|
||||
function getSourceDocRef($val, $typerecord)
|
||||
|
||||
@@ -190,8 +190,8 @@ for($i = 1; $i <= 12; $i ++) {
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
@@ -213,8 +213,20 @@ if ($resql) {
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
@@ -244,8 +256,8 @@ for($i = 1; $i <= 12; $i ++) {
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
@@ -267,9 +279,21 @@ if ($resql) {
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
|
||||
@@ -68,6 +68,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
||||
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
||||
$sql.= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
|
||||
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
|
||||
$sql.= " ORDER BY d.rowid ASC";
|
||||
@@ -123,7 +124,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
{
|
||||
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
|
||||
if ($nb <= 0) $nb=1; // Protection to avoid empty page
|
||||
|
||||
|
||||
for($j=0;$j<$nb;$j++)
|
||||
{
|
||||
$arrayofmembers[]=array(
|
||||
|
||||
@@ -199,6 +199,9 @@ class Adherent extends CommonObject
|
||||
$infos.= $langs->transnoentities("Town").": ".$this->town."\n";
|
||||
$infos.= $langs->transnoentities("Country").": ".$this->country."\n";
|
||||
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
|
||||
$infos.= $langs->transnoentities("PhonePro").": ".$this->phone."\n";
|
||||
$infos.= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n";
|
||||
$infos.= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n";
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
||||
@@ -243,6 +246,11 @@ class Adherent extends CommonObject
|
||||
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
||||
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
||||
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
||||
'%TYPE%'=>$msgishtml?dol_htmlentitiesbr($this->type):$this->type,
|
||||
'%PHONE_PRO%'=>$msgishtml?dol_htmlentitiesbr($this->phone):$this->phone,
|
||||
'%PHONE_PERSO%'=>$msgishtml?dol_htmlentitiesbr($this->phone_perso):$this->phone_perso,
|
||||
'%PHONE_MOBILE%'=>$msgishtml?dol_htmlentitiesbr($this->phone_mobile):$this->phone_mobile,
|
||||
// For backward compatibility
|
||||
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
|
||||
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
||||
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
||||
|
||||
@@ -249,8 +249,9 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
|
||||
@@ -390,13 +390,13 @@ if ($rowid > 0)
|
||||
}
|
||||
if ($status != '')
|
||||
{
|
||||
$sql.= " AND d.statut IN (".$status.")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
$sql.= " AND d.statut IN (".$db->escape($status).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
}
|
||||
if ($action == 'search')
|
||||
{
|
||||
if (GETPOST('search'))
|
||||
{
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search'));
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
||||
}
|
||||
}
|
||||
if (! empty($search_lastname))
|
||||
|
||||
@@ -373,11 +373,12 @@ $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AG
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_FILTER_STATUS
|
||||
// TODO Remove to use the default generic feature
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2);
|
||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
|
||||
@@ -49,7 +49,7 @@ $error=0;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
||||
|| ($action == 'updateedit') )
|
||||
{
|
||||
$tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0);
|
||||
@@ -63,19 +63,19 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS",$_POST["address"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN",$_POST["town"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP",$_POST["zipcode"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE",$_POST["state_id"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["barcode"],'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
$varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
|
||||
if ($_FILES[$varforimage]["tmp_name"])
|
||||
{
|
||||
@@ -100,8 +100,8 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
if ($isimage > 0)
|
||||
{
|
||||
// Create thumbs
|
||||
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
|
||||
|
||||
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
|
||||
|
||||
// Create small thumb, Used on logon for example
|
||||
$imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
|
||||
@@ -143,27 +143,27 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS",$_POST["MAIN_INFO_SOCIETE_MANAGERS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_PROFID5",$_POST["MAIN_INFO_PROFID5"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT",$_POST["object"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object",'nohtml'),'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "FACTURE_TVAOPTION",$_POST["optiontva"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("fiscalmonthstart",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "FACTURE_TVAOPTION", GETPOST("optiontva",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
// Local taxes
|
||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", GETPOST("optionlocaltax1",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", GETPOST("optionlocaltax2",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
if($_POST["optionlocaltax1"]=="localtax1on")
|
||||
{
|
||||
@@ -173,9 +173,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", $_POST["clt1"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1",'alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
if($_POST["optionlocaltax2"]=="localtax2on")
|
||||
{
|
||||
@@ -185,9 +185,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", $_POST["clt2"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2",'alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if ($action != 'updateedit' && ! $error)
|
||||
@@ -207,7 +207,7 @@ if ($action == 'addthumb') // Regenerate thumbs
|
||||
if ($isimage > 0)
|
||||
{
|
||||
// Create thumbs
|
||||
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
|
||||
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
|
||||
|
||||
// Create small thumb. Used on logon for example
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
|
||||
@@ -309,72 +309,72 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
|
||||
// Name
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM:$_POST["nom"]) . '" autofocus="autofocus"></td></tr>'."\n";
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
|
||||
|
||||
// Addresse
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:$_POST["address"]) . '</textarea></td></tr>'."\n";
|
||||
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS: GETPOST("address",'nohtml')) . '</textarea></td></tr>'."\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP:$_POST["zipcode"]) . '"></td></tr>'."\n";
|
||||
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP: GETPOST("zipcode",'alpha')) . '"></td></tr>'."\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
|
||||
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN:$_POST["town"]) . '"></td></tr>'."\n";
|
||||
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN: GETPOST("town",'nohtml')) . '"></td></tr>'."\n";
|
||||
|
||||
// Country
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
|
||||
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
|
||||
print $form->select_country($mysoc->country_id,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
|
||||
$formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE,$mysoc->country_code,'state_id');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
|
||||
print $form->selectCurrency($conf->currency,"currency");
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
|
||||
print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_SOCIETE_TEL . '"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
|
||||
print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_SOCIETE_FAX . '"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_SOCIETE_MAIL . '"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Web
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
|
||||
print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_SOCIETE_WEB . '"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Barcode
|
||||
if (! empty($conf->barcode->enabled)) {
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
|
||||
print '<input name="barcode" id="barcode" class="minwidth150" value="'. $conf->global->MAIN_INFO_SOCIETE_GENCOD . '"></td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Logo
|
||||
|
||||
|
||||
print '<tr'.dol_bc($var,'hideonsmartphone').'><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<input type="file" class="flat class=minwidth200" name="logo" id="logo">';
|
||||
@@ -392,9 +392,9 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '</td></tr>';
|
||||
|
||||
// Note
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '').'</textarea></td></tr>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note','none') ? GETPOST('note','none') : $conf->global->MAIN_INFO_SOCIETE_NOTE).'</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -409,17 +409,17 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
$langs->load("companies");
|
||||
|
||||
// Managing Director(s)
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="' . $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '"></td></tr>';
|
||||
|
||||
// Capital
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
|
||||
print '<input name="capital" id="capital" class="minwidth100" value="' . $conf->global->MAIN_INFO_CAPITAL . '"></td></tr>';
|
||||
|
||||
// Juridical Status
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
|
||||
if ($mysoc->country_code) {
|
||||
print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
|
||||
@@ -431,7 +431,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
// ProfID1
|
||||
if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1",$mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@@ -447,7 +447,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
// ProfId2
|
||||
if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2",$mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@@ -463,7 +463,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
// ProfId3
|
||||
if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3",$mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@@ -479,7 +479,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
// ProfId4
|
||||
if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4",$mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@@ -495,7 +495,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
// ProfId5
|
||||
if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5",$mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@@ -511,7 +511,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
// ProfId6
|
||||
if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6",$mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@@ -525,13 +525,13 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
}
|
||||
|
||||
// TVA Intra
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
|
||||
print '<input name="tva" id="intra_vat" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Object of the company
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
@@ -546,7 +546,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="fiscalmonthstart">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . '</td></tr>';
|
||||
|
||||
@@ -561,7 +561,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"use_vat\" value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
@@ -570,7 +570,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"no_vat\" value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
@@ -593,7 +593,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '<td>'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
@@ -616,7 +616,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
@@ -637,7 +637,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
@@ -657,7 +657,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax2\" id=\"nolt2\" value=\"localtax2off\"".((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed",$mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
@@ -693,22 +693,22 @@ else
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("CompanyName").'</td><td>';
|
||||
if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) print $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyName")).'</font>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CompanyZip").'</td><td>' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CompanyTown").'</td><td>' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CompanyCountry").'</td><td>';
|
||||
if ($mysoc->country_code)
|
||||
{
|
||||
@@ -719,13 +719,13 @@ else
|
||||
else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("State").'</td><td>';
|
||||
if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) print getState($conf->global->MAIN_INFO_SOCIETE_STATE);
|
||||
else print ' ';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CompanyCurrency").'</td><td>';
|
||||
print currency_name($conf->currency,1);
|
||||
print ' ('.$conf->currency;
|
||||
@@ -733,28 +733,28 @@ else
|
||||
print ')';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Phone").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Mail").'</td><td>' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '</td></tr>';
|
||||
|
||||
// Web
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Web").'</td><td>' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '</td></tr>';
|
||||
|
||||
// Barcode
|
||||
if (! empty($conf->barcode->enabled))
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Gencod").'</td><td>' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '</td></tr>';
|
||||
}
|
||||
|
||||
// Logo
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Logo").'</td><td>';
|
||||
|
||||
$tagtd='tagtd ';
|
||||
@@ -780,7 +780,7 @@ else
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td class="tdtop">'.$langs->trans("Note").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -796,17 +796,17 @@ else
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Managing Director(s)
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ManagingDirectors").'</td><td>';
|
||||
print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '</td></tr>';
|
||||
|
||||
// Capital
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Capital").'</td><td>';
|
||||
print $conf->global->MAIN_INFO_CAPITAL . '</td></tr>';
|
||||
|
||||
// Juridical Status
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("JuridicalStatus").'</td><td>';
|
||||
print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
|
||||
print '</td></tr>';
|
||||
@@ -814,7 +814,7 @@ else
|
||||
// ProfId1
|
||||
if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId1",$mysoc->country_code).'</td><td>';
|
||||
if (! empty($conf->global->MAIN_INFO_SIREN))
|
||||
{
|
||||
@@ -830,7 +830,7 @@ else
|
||||
// ProfId2
|
||||
if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId2",$mysoc->country_code).'</td><td>';
|
||||
if (! empty($conf->global->MAIN_INFO_SIRET))
|
||||
{
|
||||
@@ -846,7 +846,7 @@ else
|
||||
// ProfId3
|
||||
if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId3",$mysoc->country_code).'</td><td>';
|
||||
if (! empty($conf->global->MAIN_INFO_APE))
|
||||
{
|
||||
@@ -862,7 +862,7 @@ else
|
||||
// ProfId4
|
||||
if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId4",$mysoc->country_code).'</td><td>';
|
||||
if (! empty($conf->global->MAIN_INFO_RCS))
|
||||
{
|
||||
@@ -878,7 +878,7 @@ else
|
||||
// ProfId5
|
||||
if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId5",$mysoc->country_code).'</td><td>';
|
||||
if (! empty($conf->global->MAIN_INFO_PROFID5))
|
||||
{
|
||||
@@ -894,7 +894,7 @@ else
|
||||
// ProfId6
|
||||
if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId6",$mysoc->country_code).'</td><td>';
|
||||
if (! empty($conf->global->MAIN_INFO_PROFID6))
|
||||
{
|
||||
@@ -908,7 +908,7 @@ else
|
||||
}
|
||||
|
||||
// VAT
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VATIntra").'</td>';
|
||||
print '<td>';
|
||||
if (! empty($conf->global->MAIN_INFO_TVAINTRA))
|
||||
@@ -944,8 +944,8 @@ else
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td class="tdtop">'.$langs->trans("CompanyObject").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -960,7 +960,7 @@ else
|
||||
print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("FiscalMonthStart").'</td><td>';
|
||||
$monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1;
|
||||
print dol_print_date(dol_mktime(12,0,0,$monthstart,1,2000,1),'%B','gm') . '</td></tr>';
|
||||
@@ -977,7 +977,7 @@ else
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"use_vat\" disabled value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
@@ -986,7 +986,7 @@ else
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"no_vat\" disabled value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
@@ -1011,7 +1011,7 @@ else
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" disabled value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
@@ -1039,7 +1039,7 @@ else
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" disabled value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
@@ -1061,7 +1061,7 @@ else
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" disabled value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
@@ -1090,7 +1090,7 @@ else
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax2\" id=\"nolt2\" disabled value=\"localtax2off\"".((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed",$mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
|
||||
@@ -243,6 +243,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" id="action" name="action" value="">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
// Page
|
||||
@@ -301,13 +302,13 @@ print '<input type="text" class="flat minwidth200 maxwidthonsmartphone" name="de
|
||||
print '</td>'."\n";
|
||||
// Field
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidth100" name="defaultkey" value="">';
|
||||
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultkey" value="">';
|
||||
print '</td>';
|
||||
// Value
|
||||
if ($mode != 'focus')
|
||||
{
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="defaultvalue" value="">';
|
||||
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultvalue" value="">';
|
||||
print '</td>';
|
||||
}
|
||||
// Limit to superadmin
|
||||
@@ -409,6 +410,7 @@ else
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ $actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
|
||||
|
||||
$listoffset=GETPOST('listoffset');
|
||||
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
|
||||
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000; // To avoid too long dictionaries
|
||||
$active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@@ -600,7 +600,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
if ($value == 'color' && empty($_POST['color'])) continue;
|
||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position'
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory
|
||||
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
||||
)
|
||||
@@ -715,7 +716,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||
{
|
||||
$sql.="'".(int) $db->escape($_POST['position'])."'";
|
||||
}
|
||||
elseif ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
@@ -764,7 +769,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||
{
|
||||
$sql.="'".(int) $db->escape($_POST['position'])."'";
|
||||
}
|
||||
elseif ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
@@ -990,6 +999,7 @@ if ($id)
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Line for title
|
||||
@@ -1118,7 +1128,7 @@ if ($id)
|
||||
}
|
||||
|
||||
if ($id == 4) print '<td></td>';
|
||||
print '<td colspan="3" align="right">';
|
||||
print '<td colspan="3" align="center">';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
@@ -1130,11 +1140,7 @@ if ($id)
|
||||
if ($id == 4) $colspan++;
|
||||
|
||||
print '</table>';
|
||||
|
||||
/*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
|
||||
{
|
||||
print '* '.$langs->trans("LabelUsedByDefault").'.<br>';
|
||||
}*/
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
@@ -1154,11 +1160,13 @@ if ($id)
|
||||
$i = 0;
|
||||
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
if ($num > $listlimit || $page)
|
||||
{
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||
print '<div class="clearboth"></div>';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Title line with search boxes
|
||||
@@ -1580,6 +1588,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
@@ -1595,6 +1604,8 @@ else
|
||||
*/
|
||||
|
||||
$lastlineisempty=false;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td>'.$langs->trans("Module").'</td>';
|
||||
@@ -1647,6 +1658,7 @@ else
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
@@ -1836,6 +1848,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($fieldlist[$field]=='sortorder') $fieldlist[$field]='position';
|
||||
|
||||
$classtd=''; $class='';
|
||||
if ($fieldlist[$field]=='code') $classtd='width100';
|
||||
if ($fieldlist[$field]=='affect') $class='maxwidth50';
|
||||
|
||||
@@ -221,9 +221,38 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') {
|
||||
$val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '',
|
||||
$conf->entity);
|
||||
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') {
|
||||
$val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '',
|
||||
$conf->entity);
|
||||
|
||||
if (!$res > 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -576,6 +605,40 @@ print '<input type="submit" class="button" value="' . $langs->trans("Modify") .
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
// Use duration
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $langs->trans("UseDurationOnFichinter");
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"' . ($conf->global->FICHINTER_WITHOUT_DURATION?' checked':'') . '>';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
// use date without hour
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $langs->trans("UseDateWithoutHourOnFichinter");
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"' . ($conf->global->FICHINTER_DATE_WITHOUT_HOUR?' checked':'') . '>';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
@@ -70,13 +70,13 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
|
||||
|
||||
print $langs->trans("SetupDescription1").' ';
|
||||
print $langs->trans("AreaForAdminOnly").' ';
|
||||
print $langs->trans("SetupDescription2", $langs->trans("MenuCompanySetup"), $langs->trans("Modules"))."<br><br>";
|
||||
print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"))."<br><br>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Show info setup company
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||
print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'), $langs->trans("Setup"), $langs->trans("MenuCompanySetup"));
|
||||
print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
|
||||
if (! empty($setupcompanynotcomplete))
|
||||
{
|
||||
$langs->load("errors");
|
||||
@@ -88,7 +88,7 @@ print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Show info setup module
|
||||
print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->trans("Setup"), $langs->trans("Modules"));
|
||||
print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||
{
|
||||
$langs->load("errors");
|
||||
|
||||
@@ -465,6 +465,7 @@ print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Form to add a new line
|
||||
@@ -581,13 +582,13 @@ if ($action != 'edit')
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$colspan=count($fieldlist)+1;
|
||||
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
@@ -596,6 +597,7 @@ print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// List of available record in database
|
||||
@@ -840,6 +842,7 @@ else {
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@@ -83,27 +83,27 @@ if ($action == 'update')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$menu = new Menubase($db);
|
||||
$result=$menu->fetch($_POST['menuId']);
|
||||
$result=$menu->fetch(GETPOST('menuId', 'int'));
|
||||
if ($result > 0)
|
||||
{
|
||||
$menu->titre=$_POST['titre'];
|
||||
$menu->leftmenu=$_POST['leftmenu'];
|
||||
$menu->url=$_POST['url'];
|
||||
$menu->langs=$_POST['langs'];
|
||||
$menu->position=$_POST['position'];
|
||||
$menu->enabled=$_POST['enabled'];
|
||||
$menu->perms=$_POST['perms'];
|
||||
$menu->target=$_POST['target'];
|
||||
$menu->user=$_POST['user'];
|
||||
if (is_numeric($_POST['menuIdParent']))
|
||||
$menu->titre=GETPOST('titre', 'alpha');
|
||||
$menu->leftmenu=GETPOST('leftmenu', 'alpha');
|
||||
$menu->url=GETPOST('url','alpha');
|
||||
$menu->langs=GETPOST('langs','alpha');
|
||||
$menu->position=GETPOST('position','int');
|
||||
$menu->enabled=GETPOST('enabled','alpha');
|
||||
$menu->perms=GETPOST('perms','alpha');
|
||||
$menu->target=GETPOST('target','alpha');
|
||||
$menu->user=GETPOST('user','alpha');
|
||||
if (is_numeric(GETPOST('menuIdParent','alpha')))
|
||||
{
|
||||
$menu->fk_menu=$_POST['menuIdParent'];
|
||||
$menu->fk_menu=GETPOST('menuIdParent','alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_POST['type'] == 'top') $menu->fk_menu=0;
|
||||
if (GETPOST('type','alpha') == 'top') $menu->fk_menu=0;
|
||||
else $menu->fk_menu=-1;
|
||||
$menu->fk_mainmenu=$mainmenu;
|
||||
$menu->fk_leftmenu=$leftmenu;
|
||||
@@ -123,7 +123,6 @@ if ($action == 'update')
|
||||
{
|
||||
setEventMessages($menu->error, $menu->errors, 'errors');
|
||||
}
|
||||
$_GET["menuId"] = $_POST['menuId'];
|
||||
$action = "edit";
|
||||
}
|
||||
else
|
||||
@@ -148,9 +147,9 @@ if ($action == 'add')
|
||||
}
|
||||
|
||||
$leftmenu=''; $mainmenu='';
|
||||
if (! empty($_POST['menuId']) && ! is_numeric($_POST['menuId']))
|
||||
if (GETPOST('menuId','int') && ! is_numeric(GETPOST('menuId','int')))
|
||||
{
|
||||
$tmp=explode('&',$_POST['menuId']);
|
||||
$tmp=explode('&',GETPOST('menuId','int'));
|
||||
foreach($tmp as $s)
|
||||
{
|
||||
if (preg_match('/fk_mainmenu=/',$s))
|
||||
@@ -197,7 +196,7 @@ if ($action == 'add')
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
if (! $error && empty($_POST['menuId']) && $_POST['type'] == 'left')
|
||||
if (! $error && ! $_POST['menuId'] && $_POST['type'] == 'left')
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
|
||||
$action = 'create';
|
||||
@@ -207,23 +206,23 @@ if ($action == 'add')
|
||||
if (! $error)
|
||||
{
|
||||
$menu = new Menubase($db);
|
||||
$menu->menu_handler=preg_replace('/_menu$/','',$_POST['menu_handler']);
|
||||
$menu->type=$_POST['type'];
|
||||
$menu->titre=$_POST['titre'];
|
||||
$menu->url=$_POST['url'];
|
||||
$menu->langs=$_POST['langs'];
|
||||
$menu->position=$_POST['position'];
|
||||
$menu->enabled=$_POST['enabled'];
|
||||
$menu->perms=$_POST['perms'];
|
||||
$menu->target=$_POST['target'];
|
||||
$menu->user=$_POST['user'];
|
||||
if (is_numeric($_POST['menuId']))
|
||||
$menu->menu_handler=preg_replace('/_menu$/','',GETPOST('menu_handler','aZ09'));
|
||||
$menu->type=GETPOST('type','alpha');
|
||||
$menu->titre=GETPOST('titre','alpha');
|
||||
$menu->url=GETPOST('url','alpha');
|
||||
$menu->langs=GETPOST('langs','alpha');
|
||||
$menu->position=GETPOST('position','int');
|
||||
$menu->enabled=GETPOST('enabled','alpha');
|
||||
$menu->perms=GETPOST('perms','alpha');
|
||||
$menu->target=GETPOST('target','alpha');
|
||||
$menu->user=GETPOST('user','alpha');
|
||||
if (is_numeric(GETPOST('menuId','int')))
|
||||
{
|
||||
$menu->fk_menu=$_POST['menuId'];
|
||||
$menu->fk_menu=GETPOST('menuId','int');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_POST['type'] == 'top') $menu->fk_menu=0;
|
||||
if (GETPOST('type','alpha') == 'top') $menu->fk_menu=0;
|
||||
else $menu->fk_menu=-1;
|
||||
$menu->fk_mainmenu=$mainmenu;
|
||||
$menu->fk_leftmenu=$leftmenu;
|
||||
@@ -232,7 +231,7 @@ if ($action == 'add')
|
||||
$result=$menu->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$_POST['menu_handler']);
|
||||
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".GETPOST('menu_handler','aZ09'));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -305,17 +304,17 @@ if ($action == 'create')
|
||||
</script>';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewMenu"),'','title_setup');
|
||||
|
||||
print '<form action="./edit.php?action=add&menuId='.$_GET['menuId'].'" method="post" name="formmenucreate">';
|
||||
|
||||
print '<form action="./edit.php?action=add&menuId='.GETPOST('menuId', 'int').'" method="post" name="formmenucreate">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Id
|
||||
$parent_rowid = $_GET['menuId'];
|
||||
if ($_GET['menuId'])
|
||||
$parent_rowid = GETPOST('menuId', 'int');
|
||||
if (GETPOST('menuId', 'int'))
|
||||
{
|
||||
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int');
|
||||
$res = $db->query($sql);
|
||||
@@ -375,40 +374,40 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
|
||||
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>';
|
||||
}
|
||||
print '<td>'.$langs->trans('DetailMenuIdParent');
|
||||
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
|
||||
print '</td></tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$_POST["titre"].'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
|
||||
// URL
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.$_POST["url"].'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||
|
||||
// Langs
|
||||
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
||||
|
||||
// Position
|
||||
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
||||
|
||||
// Target
|
||||
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
|
||||
print '<option value=""'.($menu->target==""?' selected':'').'>'.$langs->trans('').'</option>';
|
||||
print '<option value=""'.($menu->target==""?' selected':'').'> </option>';
|
||||
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
|
||||
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
|
||||
|
||||
// Enabled
|
||||
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.$_POST["enabled"].'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.GETPOST("enabled",'alpha').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
|
||||
|
||||
// Perms
|
||||
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.$_POST["perms"].'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.GETPOST('perms','alpha').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Boutons
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
@@ -426,14 +425,14 @@ elseif ($action == 'edit')
|
||||
print '<form action="./edit.php?action=update" method="POST" name="formmenuedit">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
|
||||
print '<input type="hidden" name="menuId" value="'.$_GET['menuId'].'">';
|
||||
print '<input type="hidden" name="menuId" value="'.GETPOST('menuId', 'int').'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$menu = new Menubase($db);
|
||||
$result=$menu->fetch($_GET['menuId']);
|
||||
$result=$menu->fetch(GETPOST('menuId', 'int'));
|
||||
//var_dump($menu);
|
||||
|
||||
// Id
|
||||
@@ -472,20 +471,20 @@ elseif ($action == 'edit')
|
||||
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$menu->titre.'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
|
||||
// Url
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||
|
||||
// Langs
|
||||
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$menu->langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
||||
|
||||
// Position
|
||||
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
||||
|
||||
// Target
|
||||
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
|
||||
print '<option value=""'.($menu->target==""?' selected':'').'>'.$langs->trans('').'</option>';
|
||||
print '<option value=""'.($menu->target==""?' selected':'').'> </option>';
|
||||
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
|
||||
print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
|
||||
|
||||
@@ -502,7 +501,7 @@ elseif ($action == 'edit')
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Bouton
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
|
||||
@@ -843,115 +843,111 @@ if ($mode == 'marketplace')
|
||||
|
||||
if ($mode == 'deploy')
|
||||
{
|
||||
dol_fiche_head($head, $mode, '', -1);
|
||||
dol_fiche_head($head, $mode, '', -1);
|
||||
|
||||
$dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
|
||||
$allowonlineinstall=true;
|
||||
$allowfromweb=1;
|
||||
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
|
||||
|
||||
$allowonlineinstall=true;
|
||||
$allowfromweb=1;
|
||||
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
|
||||
$fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
|
||||
$message='';
|
||||
if (! empty($allowonlineinstall))
|
||||
{
|
||||
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
|
||||
{
|
||||
$message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
|
||||
$allowfromweb=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($dirins_ok)
|
||||
{
|
||||
if (! is_writable(dol_osencode($dirins)))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
|
||||
$allowfromweb=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||
$allowfromweb=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
|
||||
$allowfromweb=0;
|
||||
}
|
||||
|
||||
$fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
|
||||
$message='';
|
||||
if (! empty($allowonlineinstall))
|
||||
{
|
||||
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
|
||||
{
|
||||
$message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
|
||||
$allowfromweb=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($dirins_ok)
|
||||
{
|
||||
if (! is_writable(dol_osencode($dirins)))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
|
||||
$allowfromweb=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($allowfromweb < 1)
|
||||
{
|
||||
print $langs->trans("SomethingMakeInstallFromWebNotPossible");
|
||||
print $message;
|
||||
//print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||
$allowfromweb=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
|
||||
$allowfromweb=0;
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
if ($allowfromweb < 1)
|
||||
{
|
||||
print $langs->trans("SomethingMakeInstallFromWebNotPossible");
|
||||
print $message;
|
||||
//print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
|
||||
print '<br>';
|
||||
}
|
||||
if ($allowfromweb >= 0)
|
||||
{
|
||||
if ($allowfromweb == 1)
|
||||
{
|
||||
//print $langs->trans("ThisIsProcessToFollow").'<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
|
||||
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
|
||||
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
if ($allowfromweb == 1)
|
||||
{
|
||||
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
|
||||
|
||||
if ($allowfromweb >= 0)
|
||||
{
|
||||
if ($allowfromweb == 1)
|
||||
{
|
||||
//print $langs->trans("ThisIsProcessToFollow").'<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
|
||||
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
|
||||
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
if ($allowfromweb == 1)
|
||||
{
|
||||
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
|
||||
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
||||
print '<input type="hidden" name="action" value="install">';
|
||||
print '<input type="hidden" name="mode" value="deploy">';
|
||||
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
|
||||
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
||||
print '<input type="hidden" name="action" value="install">';
|
||||
print '<input type="hidden" name="mode" value="deploy">';
|
||||
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
|
||||
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
|
||||
print '</form>';
|
||||
print '<div class="center"><div class="logo_setup"></div></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
|
||||
print $langs->trans("SetupIsReadyForUse").'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
if (! empty($result['return']))
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print '<div class="center"><div class="logo_setup"></div></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
|
||||
print $langs->trans("SetupIsReadyForUse").'<br>';
|
||||
}
|
||||
}
|
||||
foreach($result['return'] as $value)
|
||||
{
|
||||
echo $value.'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! empty($result['return']))
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
foreach($result['return'] as $value)
|
||||
{
|
||||
echo $value.'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@@ -78,34 +78,54 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
||||
|
||||
if ($action == 'add_currency')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$langs->loadCacheCurrencies('');
|
||||
|
||||
$code = GETPOST('code', 'alpha');
|
||||
$rate = GETPOST('rate', 'alpha');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
$currency = new MultiCurrency($db);
|
||||
$currency->code = $code;
|
||||
$currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code;
|
||||
|
||||
if ($currency->create($user) > 0)
|
||||
if (empty($rate))
|
||||
{
|
||||
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
|
||||
else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
if ($currency->create($user) > 0)
|
||||
{
|
||||
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
|
||||
else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors');
|
||||
}
|
||||
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors');
|
||||
}
|
||||
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors');
|
||||
}
|
||||
elseif ($action == 'update_currency')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$submit = GETPOST('submit', 'alpha');
|
||||
|
||||
if ($submit == $langs->trans('Modify'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$rate = GETPOST('rate', 'float');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
$currency = new MultiCurrency($db);
|
||||
|
||||
if ($currency->fetch($fk_multicurrency) > 0)
|
||||
if (empty($rate))
|
||||
{
|
||||
$currency->updateRate($rate);
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
if ($currency->fetch($fk_multicurrency) > 0)
|
||||
{
|
||||
$currency->updateRate($rate);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($submit == $langs->trans('Delete'))
|
||||
@@ -235,7 +255,7 @@ print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
{
|
||||
@@ -279,7 +299,6 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
@@ -325,8 +344,7 @@ print '</td></form></tr>';
|
||||
|
||||
foreach ($TCurrency as &$currency)
|
||||
{
|
||||
if($currency->code == $conf->currency) continue;
|
||||
|
||||
if ($currency->code == $conf->currency) continue;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012-2105 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2107 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
|
||||
@@ -56,7 +56,7 @@ if ($cancel) {
|
||||
if ($action == 'update')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity);
|
||||
|
||||
|
||||
dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", $_POST["MAIN_PDF_MARGIN_LEFT"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", $_POST["MAIN_PDF_MARGIN_RIGHT"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"],'chaine',0,'',$conf->entity);
|
||||
@@ -74,7 +74,11 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);
|
||||
|
||||
|
||||
|
||||
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'',$conf->entity);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
}
|
||||
@@ -130,7 +134,8 @@ if ($action == 'edit') // Edit
|
||||
|
||||
// Misc options
|
||||
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'<br>';
|
||||
$var=true;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
@@ -138,7 +143,7 @@ if ($action == 'edit') // Edit
|
||||
if (empty($selected)) $selected=dol_getDefaultFormat();
|
||||
|
||||
// Show pdf format
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
|
||||
print $formadmin->select_paper_format($selected,'MAIN_PDF_FORMAT');
|
||||
print '</td></tr>';
|
||||
@@ -155,26 +160,28 @@ if ($action == 'edit') // Edit
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
|
||||
print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_BOTTOM" value="'.(empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Addresses
|
||||
print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'<br>';
|
||||
$var=true;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Hide VAT Intra on address
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
|
||||
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)
|
||||
{
|
||||
$pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
|
||||
@@ -192,7 +199,7 @@ if ($action == 'edit') // Edit
|
||||
}
|
||||
|
||||
// Show prof id 2 in address into pdf
|
||||
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
|
||||
@@ -210,7 +217,7 @@ if ($action == 'edit') // Edit
|
||||
}
|
||||
|
||||
// Show prof id 3 in address into pdf
|
||||
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
|
||||
@@ -228,7 +235,7 @@ if ($action == 'edit') // Edit
|
||||
}
|
||||
|
||||
// Show prof id 4 in address into pdf
|
||||
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
|
||||
@@ -246,51 +253,88 @@ if ($action == 'edit') // Edit
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Localtaxes
|
||||
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
|
||||
{
|
||||
$locales ='';
|
||||
$text='';
|
||||
|
||||
if ($mysoc->useLocalTax(1))
|
||||
{
|
||||
$locales = $langs->transcountry("LT1",$mysoc->country_code);
|
||||
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
|
||||
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1);
|
||||
$text .= '</td></tr>';
|
||||
}
|
||||
|
||||
if ($mysoc->useLocalTax(2))
|
||||
{
|
||||
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
|
||||
|
||||
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
|
||||
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
|
||||
$text.= '</td></tr>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
|
||||
|
||||
print '<table summary="more" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print $text;
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
}
|
||||
|
||||
// Other
|
||||
print load_fiche_titre($langs->trans("Other"),'','').'<br>';
|
||||
$var=true;
|
||||
print '<table summary="more" class="noborder" width="100%">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Hide any PDF informations
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Desc
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Ref
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Place customer adress to the ISO location
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
|
||||
print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION',(! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
|
||||
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||
@@ -303,17 +347,16 @@ if ($action == 'edit') // Edit
|
||||
}
|
||||
else // Show
|
||||
{
|
||||
$var=true;
|
||||
|
||||
// Misc options
|
||||
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
|
||||
|
||||
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Show pdf format
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
|
||||
|
||||
$pdfformatlabel='';
|
||||
@@ -352,24 +395,26 @@ else // Show
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
|
||||
print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM;
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Hide Intra VAT on address
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td colspan="2">';
|
||||
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);
|
||||
@@ -387,7 +432,7 @@ else // Show
|
||||
}
|
||||
|
||||
// Show prof id 2 in address into pdf
|
||||
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
|
||||
@@ -405,7 +450,7 @@ else // Show
|
||||
}
|
||||
|
||||
// Show prof id 3 in address into pdf
|
||||
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
|
||||
@@ -423,7 +468,7 @@ else // Show
|
||||
}
|
||||
|
||||
// Show prof id 4 in address into pdf
|
||||
|
||||
|
||||
if (! $noCountryCode)
|
||||
{
|
||||
$pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
|
||||
@@ -441,18 +486,52 @@ else // Show
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Localtaxes
|
||||
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
|
||||
{
|
||||
$locales ='';
|
||||
$text='';
|
||||
|
||||
if ($mysoc->useLocalTax(1))
|
||||
{
|
||||
$locales = $langs->transcountry("LT1",$mysoc->country_code);
|
||||
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
|
||||
$text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX,1);
|
||||
$text .= '</td></tr>';
|
||||
}
|
||||
|
||||
if ($mysoc->useLocalTax(2))
|
||||
{
|
||||
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
|
||||
|
||||
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
|
||||
$text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX,1);
|
||||
$text.= '</td></tr>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
|
||||
|
||||
print '<table summary="more" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print $text;
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
}
|
||||
|
||||
// Other
|
||||
print load_fiche_titre($langs->trans("Other"),'','');
|
||||
$var=true;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
|
||||
// Encrypt and protect PDF
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$text = $langs->trans("ProtectAndEncryptPdfFiles");
|
||||
@@ -480,48 +559,51 @@ else // Show
|
||||
print '</tr>';
|
||||
|
||||
// Hide any PDF informations
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Desc
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Ref
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
|
||||
print $arraydetailsforpdffoot[$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS];
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Library
|
||||
*/
|
||||
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("Library"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
@@ -529,10 +611,9 @@ else // Show
|
||||
print '<td>'.$langs->trans("Value").'</td>'."\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$var=false;
|
||||
if (! empty($dolibarr_pdf_force_fpdf))
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>dolibarr_pdf_force_fpdf</td>'."\n";
|
||||
print '<td>';
|
||||
@@ -541,7 +622,7 @@ else // Show
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("LibraryToBuildPDF").'</td>'."\n";
|
||||
print '<td>';
|
||||
@@ -580,6 +661,7 @@ else // Show
|
||||
print '</tr>'."\n";
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
if (! empty($dolibarr_pdf_force_fpdf))
|
||||
{
|
||||
|
||||
@@ -130,6 +130,7 @@ dol_fiche_head($head, 'file', $langs->trans("Security"), -1);
|
||||
// Upload options
|
||||
$var=false;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("Parameters").'</td>';
|
||||
@@ -192,6 +193,7 @@ print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ print load_fiche_titre($langs->trans("FileCheckDolibarr"),'','title_setup');
|
||||
print $langs->trans("FileCheckDesc").'<br><br>';
|
||||
|
||||
// Version
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
|
||||
@@ -63,6 +64,7 @@ if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) {
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@@ -133,7 +135,7 @@ if (GETPOST('target') == 'local')
|
||||
if (GETPOST('target') == 'remote')
|
||||
{
|
||||
$xmlarray = getURLContent($xmlremote);
|
||||
|
||||
|
||||
// Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
|
||||
if (! $xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404')
|
||||
{
|
||||
@@ -147,20 +149,21 @@ if (GETPOST('target') == 'remote')
|
||||
setEventMessages($errormsg, null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($xml)
|
||||
{
|
||||
$checksumconcat = array();
|
||||
$file_list = array();
|
||||
$out = '';
|
||||
|
||||
|
||||
// Forced constants
|
||||
if (is_object($xml->dolibarr_constants[0]))
|
||||
{
|
||||
$out.=load_fiche_titre($langs->trans("ForcedConstants"));
|
||||
|
||||
|
||||
$out.='<div class="div-table-responsive-no-min">';
|
||||
$out.='<table class="noborder">';
|
||||
$out.='<tr class="liste_titre">';
|
||||
$out.='<td>#</td>';
|
||||
@@ -175,13 +178,13 @@ if ($xml)
|
||||
$constname=$constant['name'];
|
||||
$constvalue=(string) $constant;
|
||||
$constvalue = (empty($constvalue)?'0':$constvalue);
|
||||
// Value found
|
||||
// Value found
|
||||
$value='';
|
||||
if ($constname && $conf->global->$constname != '') $value=$conf->global->$constname;
|
||||
$valueforchecksum=(empty($value)?'0':$value);
|
||||
|
||||
|
||||
$checksumconcat[]=$valueforchecksum;
|
||||
|
||||
|
||||
$i++;
|
||||
$out.='<tr class="oddeven">';
|
||||
$out.='<td>'.$i.'</td>' . "\n";
|
||||
@@ -196,10 +199,11 @@ if ($xml)
|
||||
$out.='<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
$out.='</table>';
|
||||
|
||||
$out.='</div>';
|
||||
|
||||
$out.='<br>';
|
||||
}
|
||||
|
||||
|
||||
// Scan htdocs
|
||||
if (is_object($xml->dolibarr_htdocs_dir[0]))
|
||||
{
|
||||
@@ -223,10 +227,11 @@ if ($xml)
|
||||
$file_list['added'][]=array('filename'=>$tmprelativefilename, 'md5'=>$md5newfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Files missings
|
||||
$out.=load_fiche_titre($langs->trans("FilesMissing"));
|
||||
|
||||
|
||||
$out.='<div class="div-table-responsive-no-min">';
|
||||
$out.='<table class="noborder">';
|
||||
$out.='<tr class="liste_titre">';
|
||||
$out.='<td>#</td>';
|
||||
@@ -247,18 +252,20 @@ if ($xml)
|
||||
$out.="</tr>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$out.='<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
}
|
||||
$out.='</table>';
|
||||
$out.='</div>';
|
||||
|
||||
$out.='<br>';
|
||||
|
||||
// Files modified
|
||||
$out.=load_fiche_titre($langs->trans("FilesModified"));
|
||||
|
||||
|
||||
$totalsize=0;
|
||||
$out.='<div class="div-table-responsive-no-min">';
|
||||
$out.='<table class="noborder">';
|
||||
$out.='<tr class="liste_titre">';
|
||||
$out.='<td>#</td>';
|
||||
@@ -295,18 +302,20 @@ if ($xml)
|
||||
$out.='<td align="right"></td>' . "\n";
|
||||
$out.="</tr>\n";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$out.='<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
$out.='</table>';
|
||||
|
||||
$out.='</div>';
|
||||
|
||||
$out.='<br>';
|
||||
|
||||
|
||||
// Files added
|
||||
$out.=load_fiche_titre($langs->trans("FilesAdded"));
|
||||
|
||||
|
||||
$totalsize = 0;
|
||||
$out.='<div class="div-table-responsive-no-min">';
|
||||
$out.='<table class="noborder">';
|
||||
$out.='<tr class="liste_titre">';
|
||||
$out.='<td>#</td>';
|
||||
@@ -348,8 +357,9 @@ if ($xml)
|
||||
$out.='<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
$out.='</table>';
|
||||
|
||||
|
||||
$out.='</div>';
|
||||
|
||||
|
||||
// Show warning
|
||||
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
|
||||
{
|
||||
@@ -358,7 +368,7 @@ if ($xml)
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -374,9 +384,9 @@ if ($xml)
|
||||
$file_list = array();
|
||||
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list
|
||||
}*/
|
||||
|
||||
|
||||
asort($checksumconcat); // Sort list of checksum
|
||||
|
||||
|
||||
asort($checksumconcat); // Sort list of checksum
|
||||
//var_dump($checksumconcat);
|
||||
$checksumget = md5(join(',',$checksumconcat));
|
||||
$checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum);
|
||||
@@ -397,10 +407,10 @@ if ($xml)
|
||||
{
|
||||
print '<span class="error">'.$checksumget.'</span>';
|
||||
}
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Output detail
|
||||
print $out;
|
||||
}
|
||||
@@ -434,7 +444,7 @@ function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathre
|
||||
{
|
||||
$filename = $path.$file['name'];
|
||||
$file_list['insignature'][] = $filename;
|
||||
|
||||
|
||||
//if (preg_match('#'.$exclude.'#', $filename)) continue;
|
||||
|
||||
if (!file_exists($pathref.'/'.$filename))
|
||||
|
||||
@@ -40,26 +40,27 @@ if (!$user->admin) accessforbidden();
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
llxHeader('', $langs->trans("InfoWebServer"));
|
||||
|
||||
print load_fiche_titre($langs->trans("InfoWebServer"),'','title_setup');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\"><td>".$langs->trans("Parameter")."</td><td>".$langs->trans("Value")."</td></tr>\n";
|
||||
print "<tr $bc[0]><td width=\"240\">".$langs->trans("Version")."</td><td>".$_SERVER["SERVER_SOFTWARE"]."</td></tr>\n";
|
||||
print "<tr $bc[1]><td>".$langs->trans("VirtualServerName")."</td><td>" . $_SERVER["SERVER_NAME"] . "</td></tr>\n";
|
||||
print "<tr $bc[0]><td width=\"240\">".$langs->trans("IP")."</td><td>".$_SERVER["SERVER_ADDR"]."</td></tr>\n";
|
||||
print "<tr $bc[1]><td>".$langs->trans("Port")."</td><td>" . $_SERVER["SERVER_PORT"] . "</td></tr>\n";
|
||||
print "<tr $bc[0]><td width=\"240\">".$langs->trans("DocumentRootServer")."</td><td>".$_SERVER["DOCUMENT_ROOT"]."</td></tr>\n";
|
||||
print "<tr $bc[1]><td>".$langs->trans("DataRootServer")."</td><td>" . DOL_DATA_ROOT . "</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter")."</td><td>".$langs->trans("Value")."</td></tr>\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Version")."</td><td>".$_SERVER["SERVER_SOFTWARE"]."</td></tr>\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VirtualServerName")."</td><td>" . $_SERVER["SERVER_NAME"] . "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("IP")."</td><td>".$_SERVER["SERVER_ADDR"]."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Port")."</td><td>" . $_SERVER["SERVER_PORT"] . "</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("DocumentRootServer")."</td><td>".$_SERVER["DOCUMENT_ROOT"]."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("DataRootServer")."</td><td>" . DOL_DATA_ROOT . "</td></tr>\n";
|
||||
$labeluser=dol_getwebuser('user');
|
||||
$labelgroup=dol_getwebuser('group');
|
||||
if ($labeluser && $labelgroup)
|
||||
{
|
||||
print "<tr $bc[0]><td>".$langs->trans("WebUserGroup")."</td><td>".$labeluser.'/'.$labelgroup."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("WebUserGroup")."</td><td>".$labeluser.'/'.$labelgroup."</td></tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@@ -465,13 +465,17 @@ if (! empty($_SESSION["commandbackuplastdone"]))
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div> <!-- end div center button -->
|
||||
|
||||
<?php
|
||||
print '</td></tr></table>';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div> <!-- end div fichehalfleft -->
|
||||
|
||||
<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">
|
||||
<div class="ficheaddleft">
|
||||
|
||||
@@ -481,6 +485,7 @@ $result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/
|
||||
print '<br>';
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ if ($action == 'delete')
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
$wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración';
|
||||
@@ -233,6 +234,7 @@ if ($mode == 'overwrite')
|
||||
print '<input type="hidden" id="action" name="action" value="">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder);
|
||||
@@ -319,8 +321,8 @@ if ($mode == 'overwrite')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
}
|
||||
|
||||
@@ -391,6 +393,7 @@ if ($mode == 'searchkey')
|
||||
print '<input type="hidden" id="action" name="action" value="search">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'</td>';
|
||||
@@ -465,7 +468,7 @@ if ($mode == 'searchkey')
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@@ -128,7 +128,7 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
|
||||
|
||||
// Show message
|
||||
$message='';
|
||||
$url=$urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&userpassword=<strong>thepassword</strong>[&reset=1]';
|
||||
$url=$urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
|
||||
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
|
||||
$message.=img_picto('','object_globe.png').' '.$url;
|
||||
print $message;
|
||||
|
||||
@@ -48,7 +48,7 @@ class DolibarrApi
|
||||
*/
|
||||
function __construct($db, $cachedir='', $refreshCache=false)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $dolibarr_main_url_root;
|
||||
|
||||
if (empty($cachedir)) $cachedir = $conf->api->dir_temp;
|
||||
Defaults::$cacheDirectory = $cachedir;
|
||||
@@ -57,6 +57,13 @@ class DolibarrApi
|
||||
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
|
||||
$this->r = new Restler($production_mode, $refreshCache);
|
||||
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
|
||||
$urlwithouturlrootautodetect=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim(DOL_MAIN_URL_ROOT));
|
||||
$urlwithrootautodetect=$urlwithouturlroot.DOL_URL_ROOT; // This is to use local domain autodetected by dolibarr from url
|
||||
|
||||
$this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect);
|
||||
$this->r->setAPIVersion(1);
|
||||
}
|
||||
|
||||
@@ -129,6 +136,9 @@ class DolibarrApi
|
||||
unset($object->table_element_line);
|
||||
unset($object->picto);
|
||||
|
||||
unset($object->skip_update_total);
|
||||
unset($object->context);
|
||||
|
||||
// Remove the $oldcopy property because it is not supported by the JSON
|
||||
// encoder. The following error is generated when trying to serialize
|
||||
// it: "Error encoding/decoding JSON: Type is not supported"
|
||||
|
||||
@@ -1540,17 +1540,31 @@ class Categorie extends CommonObject
|
||||
dol_mkdir($dir);
|
||||
}
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$originImage = $dir . $file['name'];
|
||||
if (file_exists($dir)) {
|
||||
if (is_array($file['name']) && count($file['name']) > 0) {
|
||||
$nbfile = count($file['name']);
|
||||
for ($i = 0; $i <= $nbfile; $i ++) {
|
||||
|
||||
// Cree fichier en taille origine
|
||||
dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
|
||||
$originImage = $dir . $file['name'][$i];
|
||||
|
||||
if (file_exists($originImage))
|
||||
{
|
||||
// Create thumbs
|
||||
$this->addThumbs($originImage);
|
||||
// Cree fichier en taille origine
|
||||
dol_move_uploaded_file($file['tmp_name'][$i], $originImage, 1, 0, 0);
|
||||
|
||||
if (file_exists($originImage)) {
|
||||
// Create thumbs
|
||||
$this->addThumbs($originImage);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$originImage = $dir . $file['name'];
|
||||
|
||||
// Cree fichier en taille origine
|
||||
dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
|
||||
|
||||
if (file_exists($originImage)) {
|
||||
// Create thumbs
|
||||
$this->addThumbs($originImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired titlefieldcreate"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired titlefieldcreate"':'').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||
|
||||
// Full day
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked':'').'></td></tr>';
|
||||
|
||||
@@ -860,9 +860,10 @@ class ActionComm extends CommonObject
|
||||
* @param string $filter Other filter
|
||||
* @param string $sortfield Sort on this field
|
||||
* @param string $sortorder ASC or DESC
|
||||
* @param string $limit Limit number of answers
|
||||
* @return array or string Error string if KO, array with actions if OK
|
||||
*/
|
||||
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='', $sortorder='')
|
||||
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='datep', $sortorder='DESC', $limit=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -879,6 +880,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
if (! empty($filter)) $sql.= $filter;
|
||||
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
|
||||
if ($limit) $sql.=$db->plimit($limit);
|
||||
|
||||
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@@ -330,25 +330,27 @@ if ($id > 0)
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Compte bancaire par défaut
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('PaymentBankAccount');
|
||||
print '<td>';
|
||||
if (($action != 'editbankaccount') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount')
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1);
|
||||
// Compte bancaire par défaut
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('PaymentBankAccount');
|
||||
print '<td>';
|
||||
if (($action != 'editbankaccount') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount')
|
||||
{
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Relative discounts (Discounts-Drawbacks-Rebates)
|
||||
print '<tr><td class="nowrap">';
|
||||
|
||||
@@ -640,16 +640,16 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
$sqlwhere[]=$this->transformToSQL('t.firstname',$arrayquery['contact_firstname']);
|
||||
}
|
||||
if (!empty($arrayquery['contact_country']) && count($arrayquery['contact_country'])) {
|
||||
$sqlwhere[]= " (t.fk_pays IN (".implode(',',$arrayquery['contact_country'])."))";
|
||||
$sqlwhere[]= " (t.fk_pays IN (".$this->db->escape(implode(',',$arrayquery['contact_country']))."))";
|
||||
}
|
||||
if (!empty($arrayquery['contact_status']) && count($arrayquery['contact_status'])>0) {
|
||||
$sqlwhere[]= " (t.statut IN (".implode(',',$arrayquery['contact_status'])."))";
|
||||
$sqlwhere[]= " (t.statut IN (".$this->db->escape(implode(',',$arrayquery['contact_status']))."))";
|
||||
}
|
||||
if (!empty($arrayquery['contact_civility']) && count($arrayquery['contact_civility'])>0) {
|
||||
$sqlwhere[]= " (t.civility IN ('".implode("','",$arrayquery['contact_civility'])."'))";
|
||||
$sqlwhere[]= " (t.civility IN ('".$this->db->escape(implode("','",$arrayquery['contact_civility']))."'))";
|
||||
}
|
||||
if ($arrayquery['contact_no_email']!='') {
|
||||
$sqlwhere[]= " (t.no_email='".$arrayquery['contact_no_email']."')";
|
||||
$sqlwhere[]= " (t.no_email='".$this->db->escape($arrayquery['contact_no_email'])."')";
|
||||
}
|
||||
if ($arrayquery['contact_update_st_dt']!='') {
|
||||
$sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')";
|
||||
@@ -658,7 +658,7 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
$sqlwhere[]= " (t.datec >= '".$this->db->idate($arrayquery['contact_create_st_dt'])."' AND t.datec <= '".$this->db->idate($arrayquery['contact_create_end_dt'])."')";
|
||||
}
|
||||
if (!empty($arrayquery['contact_categ']) && count($arrayquery['contact_categ'])>0) {
|
||||
$sqlwhere[]= " (contactcateg.fk_categorie IN (".implode(",",$arrayquery['contact_categ'])."))";
|
||||
$sqlwhere[]= " (contactcateg.fk_categorie IN (".$this->db->escape(implode(",",$arrayquery['contact_categ']))."))";
|
||||
}
|
||||
|
||||
//Standard Extrafield feature
|
||||
|
||||
@@ -239,21 +239,25 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function postLine($id, $request_data = NULL) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
function postLine($id, $request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (! $result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->propal->addline(
|
||||
if (! DolibarrApi::_checkAccessToResource('propal',$this->propal->id))
|
||||
{
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$updateRes = $this->propal->addline(
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
@@ -278,7 +282,7 @@ class Proposals extends DolibarrApi
|
||||
$request_data->fk_unit,
|
||||
$this->element,
|
||||
$request_data->id,
|
||||
$request_data->pu_ht_devise,
|
||||
$request_data->multicurrency_subprice,
|
||||
$request_data->fk_remise_except
|
||||
);
|
||||
|
||||
@@ -300,42 +304,52 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function putLine($id, $lineid, $request_data = NULL) {
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
function putLine($id, $lineid, $request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if($result <= 0) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->propal->updateline(
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$propalline = new PropaleLigne($this->db);
|
||||
$result = $propalline->fetch($lineid);
|
||||
if ($result <= 0) {
|
||||
throw new RestException(404, 'Proposal line not found');
|
||||
}
|
||||
|
||||
$updateRes = $this->propal->updateline(
|
||||
$lineid,
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->remise_percent,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
'HT',
|
||||
$request_data->info_bits,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->product_type,
|
||||
$request_data->fk_parent_line,
|
||||
0,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->special_code,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit
|
||||
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
|
||||
isset($request_data->qty)?$request_data->qty:$propalline->qty,
|
||||
isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent,
|
||||
isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx,
|
||||
isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
|
||||
isset($request_data->desc)?$request_data->desc:$propalline->desc,
|
||||
'HT',
|
||||
isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits,
|
||||
isset($request_data->special_code)?$request_data->special_code:$propalline->special_code,
|
||||
isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
|
||||
0,
|
||||
isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice,
|
||||
isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht,
|
||||
isset($request_data->label)?$request_data->label:$propalline->label,
|
||||
isset($request_data->product_type)?$request_data->product_type:$propalline->product_type,
|
||||
isset($request_data->date_start)?$request_data->date_start:$propalline->date_start,
|
||||
isset($request_data->date_end)?$request_data->date_end:$propalline->date_end,
|
||||
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
|
||||
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
@@ -508,4 +522,23 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
return $propal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
function _cleanObjectDatas($object) {
|
||||
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
unset($object->name);
|
||||
unset($object->lastname);
|
||||
unset($object->firstname);
|
||||
unset($object->civility_id);
|
||||
unset($object->address);
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,6 +639,7 @@ class Propal extends CommonObject
|
||||
$pa_ht=price2num($pa_ht);
|
||||
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
|
||||
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
|
||||
if (empty($type)) $type=0;
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT)
|
||||
{
|
||||
@@ -1404,7 +1405,7 @@ class Propal extends CommonObject
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
|
||||
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
|
||||
$sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,';
|
||||
$sql.= ' d.fk_unit,';
|
||||
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,';
|
||||
@@ -1443,6 +1444,8 @@ class Propal extends CommonObject
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
$line->localtax1_tx = $objp->localtax1_tx;
|
||||
$line->localtax2_tx = $objp->localtax2_tx;
|
||||
$line->localtax1_type = $objp->localtax1_type;
|
||||
$line->localtax2_type = $objp->localtax2_type;
|
||||
$line->subprice = $objp->subprice;
|
||||
$line->fk_remise_except = $objp->fk_remise_except;
|
||||
$line->remise_percent = $objp->remise_percent;
|
||||
@@ -3366,8 +3369,8 @@ class Propal extends CommonObject
|
||||
$this->lines = array();
|
||||
|
||||
$sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,';
|
||||
$sql.= ' pt.qty, pt.vat_src_code, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
|
||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
|
||||
$sql.= ' pt.qty, pt.vat_src_code, pt.tva_tx, pt.localtax1_tx, pt.localtax2_tx, pt.localtax1_type, pt.localtax2_type, pt.remise_percent, pt.subprice, pt.info_bits,';
|
||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.total_localtax1, pt.total_localtax2, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code,';
|
||||
$sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,';
|
||||
$sql.= ' pt.fk_unit,';
|
||||
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.description as product_desc, p.tobatch as product_tobatch,';
|
||||
@@ -3411,11 +3414,17 @@ class Propal extends CommonObject
|
||||
|
||||
$this->lines[$i]->vat_src_code = $obj->vat_src_code;
|
||||
$this->lines[$i]->tva_tx = $obj->tva_tx;
|
||||
$this->lines[$i]->localtax1_tx = $obj->localtax1_tx;
|
||||
$this->lines[$i]->localtax2_tx = $obj->localtax2_tx;
|
||||
$this->lines[$i]->localtax1_type = $obj->localtax1_type;
|
||||
$this->lines[$i]->localtax2_type = $obj->localtax2_type;
|
||||
$this->lines[$i]->info_bits = $obj->info_bits;
|
||||
$this->lines[$i]->total_ht = $obj->total_ht;
|
||||
$this->lines[$i]->total_tva = $obj->total_tva;
|
||||
$this->lines[$i]->total_ttc = $obj->total_ttc;
|
||||
$this->lines[$i]->fk_fournprice = $obj->fk_fournprice;
|
||||
$this->lines[$i]->total_localtax1 = $obj->total_localtax1;
|
||||
$this->lines[$i]->total_localtax2 = $obj->total_localtax2;
|
||||
$this->lines[$i]->fk_fournprice = $obj->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht);
|
||||
$this->lines[$i]->pa_ht = $marginInfos[0];
|
||||
$this->lines[$i]->marge_tx = $marginInfos[1];
|
||||
@@ -3645,59 +3654,66 @@ class PropaleLigne extends CommonObjectLine
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $objp->rowid;
|
||||
$this->rowid = $objp->rowid; // deprecated
|
||||
$this->fk_propal = $objp->fk_propal;
|
||||
$this->fk_parent_line = $objp->fk_parent_line;
|
||||
$this->label = $objp->custom_label;
|
||||
$this->desc = $objp->description;
|
||||
$this->qty = $objp->qty;
|
||||
$this->price = $objp->price; // deprecated
|
||||
$this->subprice = $objp->subprice;
|
||||
$this->vat_src_code = $objp->vat_src_code;
|
||||
$this->tva_tx = $objp->tva_tx;
|
||||
$this->remise = $objp->remise; // deprecated
|
||||
$this->remise_percent = $objp->remise_percent;
|
||||
$this->fk_remise_except = $objp->fk_remise_except;
|
||||
$this->fk_product = $objp->fk_product;
|
||||
$this->info_bits = $objp->info_bits;
|
||||
if ($objp)
|
||||
{
|
||||
$this->id = $objp->rowid;
|
||||
$this->rowid = $objp->rowid; // deprecated
|
||||
$this->fk_propal = $objp->fk_propal;
|
||||
$this->fk_parent_line = $objp->fk_parent_line;
|
||||
$this->label = $objp->custom_label;
|
||||
$this->desc = $objp->description;
|
||||
$this->qty = $objp->qty;
|
||||
$this->price = $objp->price; // deprecated
|
||||
$this->subprice = $objp->subprice;
|
||||
$this->vat_src_code = $objp->vat_src_code;
|
||||
$this->tva_tx = $objp->tva_tx;
|
||||
$this->remise = $objp->remise; // deprecated
|
||||
$this->remise_percent = $objp->remise_percent;
|
||||
$this->fk_remise_except = $objp->fk_remise_except;
|
||||
$this->fk_product = $objp->fk_product;
|
||||
$this->info_bits = $objp->info_bits;
|
||||
|
||||
$this->total_ht = $objp->total_ht;
|
||||
$this->total_tva = $objp->total_tva;
|
||||
$this->total_ttc = $objp->total_ttc;
|
||||
$this->total_ht = $objp->total_ht;
|
||||
$this->total_tva = $objp->total_tva;
|
||||
$this->total_ttc = $objp->total_ttc;
|
||||
|
||||
$this->fk_fournprice = $objp->fk_fournprice;
|
||||
$this->fk_fournprice = $objp->fk_fournprice;
|
||||
|
||||
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
|
||||
$this->pa_ht = $marginInfos[0];
|
||||
$this->marge_tx = $marginInfos[1];
|
||||
$this->marque_tx = $marginInfos[2];
|
||||
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
|
||||
$this->pa_ht = $marginInfos[0];
|
||||
$this->marge_tx = $marginInfos[1];
|
||||
$this->marque_tx = $marginInfos[2];
|
||||
|
||||
$this->special_code = $objp->special_code;
|
||||
$this->product_type = $objp->product_type;
|
||||
$this->rang = $objp->rang;
|
||||
$this->special_code = $objp->special_code;
|
||||
$this->product_type = $objp->product_type;
|
||||
$this->rang = $objp->rang;
|
||||
|
||||
$this->ref = $objp->product_ref; // deprecated
|
||||
$this->product_ref = $objp->product_ref;
|
||||
$this->libelle = $objp->product_label; // deprecated
|
||||
$this->product_label = $objp->product_label;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
$this->ref = $objp->product_ref; // deprecated
|
||||
$this->product_ref = $objp->product_ref;
|
||||
$this->libelle = $objp->product_label; // deprecated
|
||||
$this->product_label = $objp->product_label;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
|
||||
// Multicurrency
|
||||
$this->fk_multicurrency = $objp->fk_multicurrency;
|
||||
$this->multicurrency_code = $objp->multicurrency_code;
|
||||
$this->multicurrency_subprice = $objp->multicurrency_subprice;
|
||||
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||
// Multicurrency
|
||||
$this->fk_multicurrency = $objp->fk_multicurrency;
|
||||
$this->multicurrency_code = $objp->multicurrency_code;
|
||||
$this->multicurrency_subprice = $objp->multicurrency_subprice;
|
||||
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||
|
||||
$this->db->free($result);
|
||||
$this->db->free($result);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -45,7 +45,6 @@ $ref = GETPOST('ref','alpha');
|
||||
$socid='';
|
||||
if (! empty($user->societe_id))
|
||||
{
|
||||
$action='';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
$result = restrictedArea($user, 'propal', $id);
|
||||
|
||||
@@ -320,8 +320,9 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ dol_mkdir($dir);
|
||||
|
||||
|
||||
$stats = new PropaleStats($db, $socid, ($userid>0?$userid:0), $mode);
|
||||
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND p.fk_statut IN ('.$object_status.')';
|
||||
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND p.fk_statut IN ('.$db->escape($object_status).')';
|
||||
|
||||
// Build graphic number of object
|
||||
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
@@ -299,7 +299,7 @@ foreach ($data as $val)
|
||||
while (! empty($year) && $oldyear > $year+1)
|
||||
{ // If we have empty year
|
||||
$oldyear--;
|
||||
|
||||
|
||||
print '<tr class="oddeven" height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
|
||||
print '<td align="right">0</td>';
|
||||
|
||||
@@ -125,7 +125,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
||||
if ($res > 0 && $newid1 > 0 && $newid2 > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id.($backtopage?'&backtopage='.urlencode($backtopage):'')); // To avoid pb whith back
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -275,13 +275,13 @@ if ($socid > 0)
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("AmountHT").'</td>';
|
||||
@@ -293,7 +293,7 @@ if ($socid > 0)
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
|
||||
print '<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST('desc').'"></td></tr>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ if ($socid > 0)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
|
||||
if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
|
||||
@@ -408,14 +408,14 @@ if ($socid > 0)
|
||||
if ($user->rights->societe->creer || $user->rights->facture->creer)
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.'">'.img_split($langs->trans("SplitDiscount")).'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid)
|
||||
{
|
||||
$showconfirminfo['rowid']=$obj->rowid;
|
||||
@@ -427,7 +427,7 @@ if ($socid > 0)
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table>";
|
||||
|
||||
@@ -441,7 +441,7 @@ if ($socid > 0)
|
||||
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
|
||||
);
|
||||
$langs->load("dict");
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'], $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage?'&backtopage='.urlencode($backtopage):''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -590,7 +590,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -398,6 +398,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Now we create same links to contact than the ones found on origin object
|
||||
/* Useless, already into the create
|
||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||
{
|
||||
$originforcontact = $object->origin;
|
||||
@@ -420,7 +421,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Hooks
|
||||
$parameters = array('objFrom' => $srcobject);
|
||||
@@ -1477,7 +1478,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||
// reload page to retrieve customer informations
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
||||
{
|
||||
@@ -2496,7 +2497,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
$numshipping = $object->nb_expedition();
|
||||
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfProductsLines() > 0) {
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
||||
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) {
|
||||
if ($user->rights->expedition->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/expedition/shipment.php?id=' . $object->id . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
|
||||
@@ -920,7 +920,8 @@ class Commande extends CommonOrder
|
||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||
{
|
||||
$originforcontact = 'commande';
|
||||
$originidforcontact = $value->id;
|
||||
if (is_object($value)) $originidforcontact = $value->id;
|
||||
else $originidforcontact = $value;
|
||||
break; // We take first one
|
||||
}
|
||||
}
|
||||
@@ -2233,7 +2234,7 @@ class Commande extends CommonOrder
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null');
|
||||
$sql.= " SET date_commande = ".($date ? "'".$this->db->idate($date)."'" : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
@@ -44,7 +44,6 @@ $ref = GETPOST('ref');
|
||||
// Security check
|
||||
if ($user->societe_id)
|
||||
{
|
||||
$action='';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
$result=restrictedArea($user,'commande',$id,'');
|
||||
|
||||
@@ -208,7 +208,7 @@ if (empty($reshook))
|
||||
// TODO Move this into mass action include
|
||||
if ($massaction == 'confirm_createbills') {
|
||||
|
||||
$orders = GETPOST('toselect');
|
||||
$orders = GETPOST('toselect','array');
|
||||
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
||||
$validate_invoices = GETPOST('valdate_invoices', 'int');
|
||||
|
||||
@@ -219,13 +219,13 @@ if (empty($reshook))
|
||||
|
||||
$db->begin();
|
||||
|
||||
foreach($orders as $id_order) {
|
||||
|
||||
foreach($orders as $id_order)
|
||||
{
|
||||
$cmd = new Commande($db);
|
||||
if($cmd->fetch($id_order) <= 0) continue;
|
||||
if ($cmd->fetch($id_order) <= 0) continue;
|
||||
|
||||
$object = new Facture($db);
|
||||
if(!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
|
||||
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
|
||||
else {
|
||||
|
||||
$object->socid = $cmd->socid;
|
||||
@@ -247,12 +247,10 @@ if (empty($reshook))
|
||||
$res = $object->create($user);
|
||||
|
||||
if($res > 0) $nb_bills_created++;
|
||||
|
||||
}
|
||||
|
||||
if($object->id > 0) {
|
||||
|
||||
$db->begin();
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||
$sql.= "fk_source";
|
||||
$sql.= ", sourcetype";
|
||||
@@ -265,115 +263,113 @@ if (empty($reshook))
|
||||
$sql.= ", '".$object->element."'";
|
||||
$sql.= ")";
|
||||
|
||||
if ($db->query($sql))
|
||||
if (! $db->query($sql))
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$error++;
|
||||
}
|
||||
|
||||
$lines = $cmd->lines;
|
||||
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
|
||||
if (! $error)
|
||||
{
|
||||
$cmd->fetch_lines();
|
||||
$lines = $cmd->lines;
|
||||
$lines = $cmd->lines;
|
||||
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
|
||||
{
|
||||
$cmd->fetch_lines();
|
||||
$lines = $cmd->lines;
|
||||
}
|
||||
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
if ($lines[$i]->subprice < 0)
|
||||
{
|
||||
// Negative line, we create a discount line
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$discount->fk_soc=$object->socid;
|
||||
$discount->amount_ht=abs($lines[$i]->total_ht);
|
||||
$discount->amount_tva=abs($lines[$i]->total_tva);
|
||||
$discount->amount_ttc=abs($lines[$i]->total_ttc);
|
||||
$discount->tva_tx=$lines[$i]->tva_tx;
|
||||
$discount->fk_user=$user->id;
|
||||
$discount->description=$desc;
|
||||
$discountid=$discount->create($user);
|
||||
if ($discountid > 0)
|
||||
{
|
||||
$result=$object->insert_discount($discountid);
|
||||
//$result=$discount->link_to_invoice($lineid,$id);
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Positive line
|
||||
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
||||
// Date start
|
||||
$date_start=false;
|
||||
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
|
||||
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
||||
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
||||
//Date end
|
||||
$date_end=false;
|
||||
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
|
||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
$lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$product_type,
|
||||
$ii,
|
||||
$lines[$i]->special_code,
|
||||
$object->origin,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line,
|
||||
$lines[$i]->fk_fournprice,
|
||||
$lines[$i]->pa_ht,
|
||||
$lines[$i]->label
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
$lineid=$result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lineid=0;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0 && $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
if ($lines[$i]->subprice < 0)
|
||||
{
|
||||
// Negative line, we create a discount line
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$discount->fk_soc=$object->socid;
|
||||
$discount->amount_ht=abs($lines[$i]->total_ht);
|
||||
$discount->amount_tva=abs($lines[$i]->total_tva);
|
||||
$discount->amount_ttc=abs($lines[$i]->total_ttc);
|
||||
$discount->tva_tx=$lines[$i]->tva_tx;
|
||||
$discount->fk_user=$user->id;
|
||||
$discount->description=$desc;
|
||||
$discountid=$discount->create($user);
|
||||
if ($discountid > 0)
|
||||
{
|
||||
$result=$object->insert_discount($discountid);
|
||||
//$result=$discount->link_to_invoice($lineid,$id);
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Positive line
|
||||
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
||||
// Date start
|
||||
$date_start=false;
|
||||
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
|
||||
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
||||
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
||||
//Date end
|
||||
$date_end=false;
|
||||
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
|
||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
$lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$product_type,
|
||||
$ii,
|
||||
$lines[$i]->special_code,
|
||||
$object->origin,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line,
|
||||
$lines[$i]->fk_fournprice,
|
||||
$lines[$i]->pa_ht,
|
||||
$lines[$i]->label
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
$lineid=$result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lineid=0;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0 && $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
||||
@@ -386,27 +382,29 @@ if (empty($reshook))
|
||||
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
|
||||
$toselect = array();
|
||||
|
||||
if(!empty($validate_invoices)) {
|
||||
|
||||
if (! $error && $validate_invoices)
|
||||
{
|
||||
$massaction = $action = 'builddoc';
|
||||
foreach($TAllFact as &$object)
|
||||
{
|
||||
$result = $object->validate($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
break;
|
||||
}
|
||||
|
||||
foreach($TAllFact as &$object) {
|
||||
$object->validate($user);
|
||||
$toselect[] = $object->id; // For builddoc action
|
||||
$id = $object->id; // For builddoc action
|
||||
|
||||
// Fac builddoc
|
||||
$donotredirect = 1;
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
}
|
||||
|
||||
$objectclass='Facture';
|
||||
$objectlabel='Invoice';
|
||||
$permtoread = $user->rights->facture->lire;
|
||||
$permtodelete = $user->rights->facture->supprimer;
|
||||
$uploaddir = $conf->facture->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
$massaction = $action = 'confirm_createbills';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@@ -546,8 +544,9 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
|
||||
@@ -88,11 +88,11 @@ dol_mkdir($dir);
|
||||
$stats = new CommandeStats($db, $socid, $mode, ($userid>0?$userid:0));
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')';
|
||||
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND c.fk_statut IN ('.$db->escape($object_status).')';
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')';
|
||||
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND c.fk_statut IN ('.$db->escape($object_status).')';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -508,8 +508,9 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
|
||||
@@ -165,8 +165,9 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
@@ -514,7 +515,7 @@ foreach ($accounts as $key=>$type)
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch('',$acc->fk_accountancy_journal);
|
||||
$accountingjournal->fetch($acc->fk_accountancy_journal);
|
||||
print $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -378,7 +378,9 @@ if (empty($reshook))
|
||||
|
||||
else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
|
||||
{
|
||||
// POST[remise_id] ou POST[remise_id_for_payment]
|
||||
// POST[remise_id] or POST[remise_id_for_payment]
|
||||
|
||||
// We use the credit to reduce amount of invoice
|
||||
if (! empty($_POST["remise_id"])) {
|
||||
$ret = $object->fetch($id);
|
||||
if ($ret > 0) {
|
||||
@@ -390,14 +392,28 @@ if (empty($reshook))
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
if (! empty($_POST["remise_id_for_payment"])) {
|
||||
// We use the credit to reduce remain to pay
|
||||
if (! empty($_POST["remise_id_for_payment"]))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$discount->fetch($_POST["remise_id_for_payment"]);
|
||||
|
||||
$result = $discount->link_to_invoice(0, $id);
|
||||
if ($result < 0) {
|
||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||
//var_dump($object->getRemainToPay(0));
|
||||
//var_dump($discount->amount_ttc);exit;
|
||||
if ($discount->amount_ttc > $object->getRemainToPay(0))
|
||||
{
|
||||
// TODO Split the discount in 2 automatically
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result = $discount->link_to_invoice(0, $id);
|
||||
if ($result < 0) {
|
||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -841,13 +857,18 @@ if (empty($reshook))
|
||||
$line->fk_facture = $object->id;
|
||||
$line->fk_parent_line = $fk_parent_line;
|
||||
|
||||
$line->subprice =-$line->subprice; // invert price for object
|
||||
$line->subprice = -$line->subprice; // invert price for object
|
||||
$line->pa_ht = $line->pa_ht; // we choosed to have buy/cost price always positive, so no revert of sign here
|
||||
$line->total_ht=-$line->total_ht;
|
||||
$line->total_tva=-$line->total_tva;
|
||||
$line->total_ttc=-$line->total_ttc;
|
||||
$line->total_localtax1=-$line->total_localtax1;
|
||||
$line->total_localtax2=-$line->total_localtax2;
|
||||
$line->total_ht = -$line->total_ht;
|
||||
$line->total_tva = -$line->total_tva;
|
||||
$line->total_ttc = -$line->total_ttc;
|
||||
$line->total_localtax1 = -$line->total_localtax1;
|
||||
$line->total_localtax2 = -$line->total_localtax2;
|
||||
|
||||
$line->multicurrency_subprice = -$line->multicurrency_subprice;
|
||||
$line->multicurrency_total_ht = -$line->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
|
||||
|
||||
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
||||
|
||||
@@ -1249,6 +1270,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Now we create same links to contact than the ones found on origin object
|
||||
/* Useless, already into the create
|
||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||
{
|
||||
$originforcontact = $object->origin;
|
||||
@@ -1271,7 +1293,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Hooks
|
||||
$parameters = array('objFrom' => $srcobject);
|
||||
@@ -1334,6 +1356,7 @@ if (empty($reshook))
|
||||
{
|
||||
$line->origin = $object->origin;
|
||||
$line->origin_id = $line->id;
|
||||
$line->fetch_optionals($line->id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1355,7 +1378,21 @@ if (empty($reshook))
|
||||
|
||||
$object->situation_counter = $object->situation_counter + 1;
|
||||
$id = $object->createFromCurrent($user);
|
||||
if ($id <= 0) $mesg = $object->error;
|
||||
if ($id <= 0)
|
||||
{
|
||||
$mesg = $object->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$nextSituationInvoice = new Facture($db);
|
||||
$nextSituationInvoice->fetch($id);
|
||||
// create extrafields with data from create form
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $nextSituationInvoice);
|
||||
if ($ret > 0) {
|
||||
$nextSituationInvoice->insertExtraFields();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3155,12 +3192,21 @@ else if ($id > 0 || ! empty($ref))
|
||||
$facthatreplace->fetch($objectidnext);
|
||||
print ' (' . $langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)) . ')';
|
||||
}
|
||||
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, $object->id);
|
||||
if ($result > 0){
|
||||
print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(), $discount->getNomUrl(1, 'discount')).'<br>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Relative and absolute discounts
|
||||
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
|
||||
$addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditGlobalDiscounts") . '</a>';
|
||||
$addcreditnote = '<a href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $soc->id . '&type=2&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("AddCreditNote") . '</a>';
|
||||
$viewabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '</a>';
|
||||
|
||||
print '<!-- Discounts --><tr><td>' . $langs->trans('Discounts');
|
||||
print '</td><td>';
|
||||
@@ -3170,7 +3216,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
// print ' ('.$addrelativediscount.')';
|
||||
|
||||
// Is there commercial discount or down payment available ?
|
||||
// Is there is commercial discount or down payment available ?
|
||||
if ($absolute_discount > 0) {
|
||||
print '. ';
|
||||
if ($object->statut > 0 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
|
||||
@@ -3195,7 +3241,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
} else {
|
||||
if ($absolute_creditnote > 0) // If not, link will be added later
|
||||
{
|
||||
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||
print ' (' . $addabsolutediscount . ')<br>';
|
||||
else
|
||||
print '. ';
|
||||
@@ -3206,7 +3252,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($absolute_creditnote > 0)
|
||||
{
|
||||
// If validated, we show link "add credit note to payment"
|
||||
if ($object->statut != 1 || $object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
if ($object->statut != Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT) {
|
||||
$text = $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency));
|
||||
print $form->textwithpicto($text, $langs->trans("CreditNoteDepositUse"));
|
||||
@@ -3217,13 +3263,13 @@ else if ($id > 0 || ! empty($ref))
|
||||
// There is credit notes discounts available
|
||||
if (! $absolute_discount) print '<br>';
|
||||
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer);
|
||||
$more=' ('.$addcreditnote.')';
|
||||
$more=' ('.$addcreditnote. (($addcreditnote && $viewabsolutediscount) ? ' - ' : '') . $viewabsolutediscount . ')';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher
|
||||
}
|
||||
}
|
||||
if (! $absolute_discount && ! $absolute_creditnote) {
|
||||
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||
print ' (' . $addabsolutediscount . ')<br>';
|
||||
else
|
||||
print '. ';
|
||||
|
||||
@@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Classe de gestion des factures recurrentes/Modeles
|
||||
* Class to manage invoice templates
|
||||
*/
|
||||
class FactureRec extends CommonInvoice
|
||||
{
|
||||
@@ -43,7 +43,7 @@ class FactureRec extends CommonInvoice
|
||||
public $table_element_line='facturedet_rec';
|
||||
public $fk_element='fk_facture';
|
||||
public $picto='bill';
|
||||
|
||||
|
||||
var $entity;
|
||||
var $number;
|
||||
var $date;
|
||||
@@ -58,7 +58,10 @@ class FactureRec extends CommonInvoice
|
||||
var $date_when;
|
||||
var $nb_gen_done;
|
||||
var $nb_gen_max;
|
||||
|
||||
|
||||
var $frequency;
|
||||
var $unit_frequency;
|
||||
|
||||
var $rang;
|
||||
var $special_code;
|
||||
|
||||
@@ -91,20 +94,20 @@ class FactureRec extends CommonInvoice
|
||||
// Clean parameters
|
||||
$this->titre=trim($this->titre);
|
||||
$this->usenewprice=empty($this->usenewprice)?0:$this->usenewprice;
|
||||
|
||||
|
||||
// No frequency defined then no next date to execution
|
||||
if (empty($this->frequency))
|
||||
if (empty($this->frequency))
|
||||
{
|
||||
$this->frequency=0;
|
||||
$this->date_when=NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->frequency=abs($this->frequency);
|
||||
$this->nb_gen_done=0;
|
||||
$this->nb_gen_max=empty($this->nb_gen_max)?0:$this->nb_gen_max;
|
||||
$this->auto_validate=empty($this->auto_validate)?0:$this->auto_validate;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Charge facture modele
|
||||
@@ -197,7 +200,7 @@ class FactureRec extends CommonInvoice
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add object linked
|
||||
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||
{
|
||||
@@ -210,7 +213,7 @@ class FactureRec extends CommonInvoice
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error)
|
||||
{
|
||||
@@ -268,7 +271,7 @@ class FactureRec extends CommonInvoice
|
||||
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
*/
|
||||
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@@ -361,8 +364,8 @@ class FactureRec extends CommonInvoice
|
||||
{
|
||||
return $this->fetch_lines();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Recupere les lignes de factures predefinies dans this->lines
|
||||
*
|
||||
@@ -386,7 +389,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rang';
|
||||
|
||||
|
||||
dol_syslog('FactureRec::fetch_lines', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@@ -431,7 +434,7 @@ class FactureRec extends CommonInvoice
|
||||
$line->special_code = $objp->special_code;
|
||||
$line->fk_unit = $objp->fk_unit;
|
||||
$line->fk_contract_line = $objp->fk_contract_line;
|
||||
|
||||
|
||||
// Ne plus utiliser
|
||||
$line->price = $objp->price;
|
||||
$line->remise = $objp->remise;
|
||||
@@ -463,12 +466,12 @@ class FactureRec extends CommonInvoice
|
||||
function delete($user, $notrigger=0, $idwarehouse=-1)
|
||||
{
|
||||
$rowid=$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
|
||||
|
||||
|
||||
$error=0;
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$rowid;
|
||||
dol_syslog($sql);
|
||||
if ($this->db->query($sql))
|
||||
@@ -481,7 +484,7 @@ class FactureRec extends CommonInvoice
|
||||
$res = $this->deleteObjectLinked();
|
||||
if ($res < 0) $error=-3;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$error=-1;
|
||||
@@ -492,7 +495,7 @@ class FactureRec extends CommonInvoice
|
||||
$this->error=$this->db->lasterror();
|
||||
$error=-2;
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
@@ -531,7 +534,7 @@ class FactureRec extends CommonInvoice
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
|
||||
$facid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
@@ -557,11 +560,14 @@ class FactureRec extends CommonInvoice
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
$qty=price2num($qty);
|
||||
if (! $info_bits) $info_bits=0;
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$txtva = price2num($txtva);
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
if (empty($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
@@ -584,7 +590,7 @@ class FactureRec extends CommonInvoice
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1=$tabprice[9];
|
||||
$total_localtax2=$tabprice[10];
|
||||
|
||||
|
||||
$product_type=$type;
|
||||
if ($fk_product)
|
||||
{
|
||||
@@ -685,12 +691,12 @@ class FactureRec extends CommonInvoice
|
||||
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
|
||||
$facid=$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
@@ -715,7 +721,7 @@ class FactureRec extends CommonInvoice
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
@@ -724,7 +730,7 @@ class FactureRec extends CommonInvoice
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
@@ -736,7 +742,7 @@ class FactureRec extends CommonInvoice
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1=$tabprice[9];
|
||||
$total_localtax2=$tabprice[10];
|
||||
|
||||
|
||||
$product_type=$type;
|
||||
if ($fk_product)
|
||||
{
|
||||
@@ -744,7 +750,7 @@ class FactureRec extends CommonInvoice
|
||||
$result=$product->fetch($fk_product);
|
||||
$product_type=$product->type;
|
||||
}
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET ";
|
||||
$sql.= "fk_facture = '".$facid."'";
|
||||
$sql.= ", label=".(! empty($label)?"'".$this->db->escape($label)."'":"null");
|
||||
@@ -784,12 +790,12 @@ class FactureRec extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the next date of
|
||||
*
|
||||
* Return the next date of
|
||||
*
|
||||
* @return timestamp false if KO, timestamp if OK
|
||||
*/
|
||||
function getNextDate()
|
||||
@@ -797,27 +803,27 @@ class FactureRec extends CommonInvoice
|
||||
if (empty($this->date_when)) return false;
|
||||
return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create all recurrents invoices (for all entities if multicompany is used).
|
||||
* A result may also be provided into this->output.
|
||||
*
|
||||
* WARNING: This method change context $conf->entity to be in correct context for each recurring invoice found.
|
||||
*
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*
|
||||
* WARNING: This method change context $conf->entity to be in correct context for each recurring invoice found.
|
||||
*
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
function createRecurringInvoices()
|
||||
{
|
||||
global $conf, $langs, $db, $user;
|
||||
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
|
||||
$nb_create=0;
|
||||
|
||||
|
||||
$now = dol_now();
|
||||
$tmparray=dol_getdate($now);
|
||||
$today = dol_mktime(23,59,59,$tmparray['mon'],$tmparray['mday'],$tmparray['year']); // Today is last second of current day
|
||||
|
||||
|
||||
dol_syslog("createRecurringInvoices");
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_rec';
|
||||
$sql.= ' WHERE frequency > 0'; // A recurring invoice is an invoice with a frequency
|
||||
@@ -825,30 +831,30 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';
|
||||
$sql.= $db->order('entity', 'ASC');
|
||||
//print $sql;exit;
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i=0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
if ($num) $this->output.=$langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n";
|
||||
else $this->output.=$langs->trans("NoQualifiedRecurringInvoiceTemplateFound");
|
||||
|
||||
|
||||
$saventity = $conf->entity;
|
||||
|
||||
|
||||
while ($i < $num) // Loop on each template invoice
|
||||
{
|
||||
$line = $db->fetch_object($resql);
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$facturerec = new FactureRec($db);
|
||||
$facturerec->fetch($line->rowid);
|
||||
|
||||
|
||||
// Set entity context
|
||||
$conf->entity = $facturerec->entity;
|
||||
|
||||
|
||||
dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref.", entity=".$facturerec->entity);
|
||||
|
||||
$error=0;
|
||||
@@ -856,12 +862,12 @@ class FactureRec extends CommonInvoice
|
||||
$facture = new Facture($db);
|
||||
$facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
|
||||
$facture->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
|
||||
|
||||
|
||||
$facture->type = self::TYPE_STANDARD;
|
||||
$facture->brouillon = 1;
|
||||
$facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
|
||||
$facture->socid = $facturerec->socid;
|
||||
|
||||
|
||||
$invoiceidgenerated = $facture->create($user);
|
||||
if ($invoiceidgenerated <= 0)
|
||||
{
|
||||
@@ -894,16 +900,16 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$conf->entity = $saventity; // Restore entity context
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
|
||||
$this->output=trim($this->output);
|
||||
|
||||
|
||||
return $error?$error:0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
@@ -920,13 +926,13 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowInvoice").': '.$this->ref;
|
||||
|
||||
|
||||
$url = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id;
|
||||
|
||||
|
||||
if ($short) return $url;
|
||||
|
||||
|
||||
$picto='bill';
|
||||
|
||||
|
||||
$link = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
@@ -958,7 +964,7 @@ class FactureRec extends CommonInvoice
|
||||
// Load array of products prodids
|
||||
$num_prods = 0;
|
||||
$prodids = array();
|
||||
|
||||
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
$sql.= " WHERE entity IN (".getEntity('product').")";
|
||||
@@ -1071,7 +1077,7 @@ class FactureRec extends CommonInvoice
|
||||
$this->lines[$xnbp]=$line;
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
|
||||
$this->usenewprice = 1;
|
||||
}
|
||||
|
||||
@@ -1091,7 +1097,7 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update frequency and unit
|
||||
*
|
||||
@@ -1115,12 +1121,12 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null');
|
||||
if (!empty($unit))
|
||||
if (!empty($unit))
|
||||
{
|
||||
$sql.= ', unit_frequency = \''.$this->db->escape($unit).'\'';
|
||||
}
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@@ -1134,7 +1140,7 @@ class FactureRec extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the next date of execution
|
||||
*
|
||||
@@ -1167,7 +1173,7 @@ class FactureRec extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the maximum period
|
||||
*
|
||||
@@ -1181,9 +1187,9 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::setMaxPeriod was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (empty($nb)) $nb=0;
|
||||
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET nb_gen_max = '.$nb;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
@@ -1200,7 +1206,7 @@ class FactureRec extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the auto validate invoice
|
||||
*
|
||||
@@ -1214,7 +1220,7 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::setAutoValidate was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET auto_validate = '.$validate;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
@@ -1241,7 +1247,7 @@ class FactureRec extends CommonInvoice
|
||||
*/
|
||||
class FactureLigneRec extends CommonInvoiceLine
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Delete line in database
|
||||
*
|
||||
@@ -1250,11 +1256,11 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
function delete()
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Call trigger
|
||||
/*$result=$this->call_trigger('LINEBILLREC_DELETE',$user);
|
||||
if ($result < 0)
|
||||
@@ -1263,8 +1269,8 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
return -1;
|
||||
}*/
|
||||
// End call triggers
|
||||
|
||||
|
||||
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE rowid = ".($this->rowid > 0 ? $this->rowid : $this->id);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if ($this->db->query($sql) )
|
||||
@@ -1279,5 +1285,5 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -430,7 +430,6 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", ".(double) $this->multicurrency_tx;
|
||||
$sql.=")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -440,7 +439,6 @@ class Facture extends CommonInvoice
|
||||
$this->ref='(PROV'.$this->id.')';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) $error++;
|
||||
|
||||
@@ -489,7 +487,8 @@ class Facture extends CommonInvoice
|
||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||
{
|
||||
$originforcontact = 'commande';
|
||||
$originidforcontact = $value->id;
|
||||
if (is_object($value)) $originidforcontact = $value->id;
|
||||
else $originidforcontact = $value;
|
||||
break; // We take first one
|
||||
}
|
||||
}
|
||||
@@ -748,12 +747,12 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Charge facture source
|
||||
$facture=new Facture($this->db);
|
||||
|
||||
|
||||
$this->fetch_optionals();
|
||||
if(!empty($this->array_options)){
|
||||
$facture->array_options = $this->array_options;
|
||||
}
|
||||
|
||||
|
||||
foreach($this->lines as &$line){
|
||||
$line->fetch_optionals();//fetch extrafields
|
||||
}
|
||||
@@ -1569,7 +1568,7 @@ class Facture extends CommonInvoice
|
||||
$facligne->desc=$remise->description; // Description ligne
|
||||
$facligne->vat_src_code=$remise->vat_src_code;
|
||||
$facligne->tva_tx=$remise->tva_tx;
|
||||
$facligne->subprice=-$remise->amount_ht;
|
||||
$facligne->subprice = -$remise->amount_ht;
|
||||
$facligne->fk_product=0; // Id produit predefini
|
||||
$facligne->qty=1;
|
||||
$facligne->remise_percent=0;
|
||||
@@ -1592,6 +1591,11 @@ class Facture extends CommonInvoice
|
||||
$facligne->total_tva = -$remise->amount_tva;
|
||||
$facligne->total_ttc = -$remise->amount_ttc;
|
||||
|
||||
$facligne->multicurrency_subprice = -$remise->multicurrency_subprice;
|
||||
$facligne->multicurrency_total_ht = -$remise->multicurrency_total_ht;
|
||||
$facligne->multicurrency_total_tva = -$remise->multicurrency_total_tva;
|
||||
$facligne->multicurrency_total_ttc = -$remise->multicurrency_total_ttc;
|
||||
|
||||
$lineid=$facligne->insert();
|
||||
if ($lineid > 0)
|
||||
{
|
||||
@@ -2047,6 +2051,10 @@ class Facture extends CommonInvoice
|
||||
$error=0;
|
||||
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
|
||||
|
||||
// Force to have object complete for checks
|
||||
$this->fetch_thirdparty();
|
||||
$this->fetch_lines();
|
||||
|
||||
// Check parameters
|
||||
if (! $this->brouillon)
|
||||
{
|
||||
@@ -2064,9 +2072,6 @@ class Facture extends CommonInvoice
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$this->fetch_thirdparty();
|
||||
$this->fetch_lines();
|
||||
|
||||
// Check parameters
|
||||
if ($this->type == self::TYPE_REPLACEMENT) // si facture de remplacement
|
||||
{
|
||||
@@ -3829,6 +3834,9 @@ class Facture extends CommonInvoice
|
||||
$line->total_ht=-100;
|
||||
$line->total_ttc=-119.6;
|
||||
$line->total_tva=-19.6;
|
||||
$line->multicurrency_total_ht=-200;
|
||||
$line->multicurrency_total_ttc=-239.2;
|
||||
$line->multicurrency_total_tva=-39.2;
|
||||
}
|
||||
else if ($xnbp == 2) // UP is negative (free line)
|
||||
{
|
||||
@@ -3837,6 +3845,9 @@ class Facture extends CommonInvoice
|
||||
$line->total_ttc=-119.6;
|
||||
$line->total_tva=-19.6;
|
||||
$line->remise_percent=0;
|
||||
$line->multicurrency_total_ht=-200;
|
||||
$line->multicurrency_total_ttc=-239.2;
|
||||
$line->multicurrency_total_tva=-39.2;
|
||||
}
|
||||
else if ($xnbp == 3) // Discount is 50% (product line)
|
||||
{
|
||||
@@ -3845,6 +3856,9 @@ class Facture extends CommonInvoice
|
||||
$line->total_ht=50;
|
||||
$line->total_ttc=59.8;
|
||||
$line->total_tva=9.8;
|
||||
$line->multicurrency_total_ht=100;
|
||||
$line->multicurrency_total_ttc=119.6;
|
||||
$line->multicurrency_total_tva=19.6;
|
||||
$line->remise_percent=50;
|
||||
}
|
||||
else // (product line)
|
||||
@@ -3854,15 +3868,22 @@ class Facture extends CommonInvoice
|
||||
$line->total_ht=100;
|
||||
$line->total_ttc=119.6;
|
||||
$line->total_tva=19.6;
|
||||
$line->remise_percent=00;
|
||||
$line->multicurrency_total_ht=200;
|
||||
$line->multicurrency_total_ttc=239.2;
|
||||
$line->multicurrency_total_tva=39.2;
|
||||
$line->remise_percent=0;
|
||||
}
|
||||
|
||||
$this->lines[$xnbp]=$line;
|
||||
$xnbp++;
|
||||
|
||||
|
||||
$this->total_ht += $line->total_ht;
|
||||
$this->total_tva += $line->total_tva;
|
||||
$this->total_ttc += $line->total_ttc;
|
||||
$this->multicurrency_total_ht += $line->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva += $line->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc += $line->multicurrency_total_ttc;
|
||||
}
|
||||
$this->revenuestamp = 0;
|
||||
|
||||
@@ -3878,6 +3899,9 @@ class Facture extends CommonInvoice
|
||||
$line->total_ht=0;
|
||||
$line->total_ttc=0; // 90 * 1.196
|
||||
$line->total_tva=0;
|
||||
$line->multicurrency_total_ht=0;
|
||||
$line->multicurrency_total_ttc=0;
|
||||
$line->multicurrency_total_tva=0;
|
||||
$prodid = mt_rand(1, $num_prods);
|
||||
$line->fk_product=$prodids[$prodid];
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ $confirm=GETPOST('confirm', 'alpha');
|
||||
// Security check
|
||||
if ($user->societe_id)
|
||||
{
|
||||
$action='';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
$result=restrictedArea($user,'facture',$id,'');
|
||||
@@ -72,9 +71,11 @@ if ($object->fetch($id))
|
||||
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
@@ -100,7 +101,7 @@ if ($id > 0 || ! empty($ref))
|
||||
dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, 'bill');
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
@@ -109,11 +110,11 @@ if ($id > 0 || ! empty($ref))
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Invoice content
|
||||
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
@@ -154,14 +155,14 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
|
||||
@@ -1082,7 +1082,7 @@ if ($action == 'create')
|
||||
$disableedit=1;
|
||||
$disablemove=1;
|
||||
$disableremove=1;
|
||||
$ret = $object->printObjectLines('', $mysoc, $soc, $lineid, 0); // No date selector for template invoice
|
||||
$ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
@@ -1493,7 +1493,7 @@ else
|
||||
{
|
||||
//$disableedit=1;
|
||||
//$disablemove=1;
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice
|
||||
$ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
|
||||
}
|
||||
|
||||
// Form to add new line
|
||||
@@ -1504,7 +1504,7 @@ else
|
||||
$var = true;
|
||||
|
||||
// Add free products/services
|
||||
$object->formAddObjectLine(0, $mysoc, $soc); // No date selector for template invoice
|
||||
$object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@@ -95,8 +95,10 @@ $month_lim = GETPOST('month_lim','int');
|
||||
$year_lim = GETPOST('year_lim','int');
|
||||
|
||||
$option = GETPOST('option');
|
||||
if ($option == 'late') $filter = 'paye:0';
|
||||
$filtre = GETPOST('filtre');
|
||||
if ($option == 'late') {
|
||||
$search_status = '1';
|
||||
}
|
||||
$filtre = GETPOST('filtre','alpha');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@@ -386,7 +388,7 @@ if ($search_user > 0)
|
||||
$sql.= ' WHERE f.fk_soc = s.rowid';
|
||||
$sql.= ' AND f.entity IN ('.getEntity('facture').')';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
|
||||
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category);
|
||||
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
|
||||
if ($userid)
|
||||
{
|
||||
@@ -399,7 +401,7 @@ if ($filtre)
|
||||
foreach ($aFilter as $filter)
|
||||
{
|
||||
$filt = explode(':', $filter);
|
||||
$sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]);
|
||||
$sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1]));
|
||||
}
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
|
||||
@@ -433,7 +435,7 @@ if ($search_status != '' && $search_status >= 0)
|
||||
if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed)
|
||||
if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned
|
||||
}
|
||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode;
|
||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
@@ -461,7 +463,6 @@ else if ($year_lim > 0)
|
||||
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($year_lim,12,false))."'";
|
||||
}
|
||||
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||
if ($filter == 'paye:0') $sql.= " AND f.fk_statut = 1";
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
{
|
||||
@@ -474,8 +475,9 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
|
||||
@@ -84,11 +84,11 @@ dol_mkdir($dir);
|
||||
$stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0));
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')';
|
||||
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')';
|
||||
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
||||
}
|
||||
|
||||
// Build graphic number of object
|
||||
@@ -299,7 +299,7 @@ foreach ($data as $val)
|
||||
while ($year && $oldyear > $year+1)
|
||||
{ // If we have empty year
|
||||
$oldyear--;
|
||||
|
||||
|
||||
print '<tr class="oddeven" height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
|
||||
print '<td align="right">0</td>';
|
||||
@@ -310,7 +310,7 @@ foreach ($data as $val)
|
||||
print '<td align="right"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven" height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
|
||||
print '<td align="right">'.$val['nb'].'</td>';
|
||||
|
||||
@@ -585,11 +585,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyremaindertopay.'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>';
|
||||
print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
|
||||
print '<td align="right">'.$alreadypayedlabel.'</td>';
|
||||
print '<td align="right">'.$remaindertopay.'</td>';
|
||||
print '<td align="right">'.$langs->trans('PaymentAmount').'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -659,6 +659,29 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '<td align="right">';
|
||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
|
||||
// Add remind multicurrency amount
|
||||
$namef = 'multicurrency_amount_'.$objp->facid;
|
||||
$nameRemain = 'multicurrency_remain_'.$objp->facid;
|
||||
|
||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency)
|
||||
{
|
||||
if ($action != 'add_paiement')
|
||||
{
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
|
||||
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
|
||||
print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
|
||||
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
||||
}
|
||||
}
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Price
|
||||
@@ -695,33 +718,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
// Multicurrency Price
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<td align="right">';
|
||||
|
||||
// Add remind multicurrency amount
|
||||
$namef = 'multicurrency_amount_'.$objp->facid;
|
||||
$nameRemain = 'multicurrency_remain_'.$objp->facid;
|
||||
|
||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency)
|
||||
{
|
||||
if ($action != 'add_paiement')
|
||||
{
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
|
||||
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
|
||||
print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
|
||||
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
||||
}
|
||||
}
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Warning
|
||||
print '<td align="center" width="16">';
|
||||
//print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."<br>";
|
||||
@@ -754,6 +750,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
|
||||
print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>';
|
||||
print '<td align="right"><b>'.price($sign * $totalrecu);
|
||||
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
|
||||
@@ -761,7 +758,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '</b></td>';
|
||||
print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
|
||||
print '<td align="right" id="result" style="font-weight: bold;"></td>'; // Autofilled
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ class RemiseCheque extends CommonObject
|
||||
if ($user->rights->banque->cheque)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET date_bordereau = ".($date ? $this->db->idate($date) : 'null');
|
||||
$sql.= " SET date_bordereau = ".($date ? "'".$this->db->idate($date)."'" : 'null');
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("RemiseCheque::set_date", LOG_DEBUG);
|
||||
|
||||
@@ -488,12 +488,12 @@ class Paiement extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Add a record into bank for payment with links between this bank record and invoices of payment.
|
||||
* Add a record into bank for payment + links between this bank record and sources of payment.
|
||||
* All payment properties (this->amount, this->amounts, ...) must have been set first like after a call to create().
|
||||
*
|
||||
* @param User $user Object of user making payment
|
||||
* @param string $mode 'payment', 'payment_supplier'
|
||||
* @param string $label Label to use in bank record
|
||||
* @param string $label Label to use in bank record. Note: If label is '(WithdrawalPayment)', a third entry 'widthdraw' is added into bank_url.
|
||||
* @param int $accountid Id of bank account to do link with
|
||||
* @param string $emetteur_nom Name of transmitter
|
||||
* @param string $emetteur_banque Name of bank
|
||||
@@ -577,10 +577,11 @@ class Paiement extends CommonObject
|
||||
}
|
||||
|
||||
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
|
||||
if (! $error && $label != '(WithdrawalPayment)')
|
||||
//if (! $error && $label != '(WithdrawalPayment)')
|
||||
if (! $error)
|
||||
{
|
||||
$linkaddedforthirdparty=array();
|
||||
foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of.
|
||||
foreach ($this->amounts as $key => $value) // We should have invoices always for same third party but we loop in case of.
|
||||
{
|
||||
if ($mode == 'payment')
|
||||
{
|
||||
|
||||
@@ -51,6 +51,9 @@ if (! $sortfield) $sortfield="p.datec";
|
||||
// Get supervariables
|
||||
$statut = GETPOST('statut','int');
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
|
||||
$bon=new BonPrelevement($db,"");
|
||||
|
||||
|
||||
/*
|
||||
@@ -60,6 +63,7 @@ $search_ref = GETPOST('search_ref','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_ref="";
|
||||
$search_amount="";
|
||||
}
|
||||
|
||||
|
||||
@@ -69,13 +73,12 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
$bon=new BonPrelevement($db,"");
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
|
||||
$sql.= ", p.datec";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($search_ref) $sql.=natural_search("p.ref", $search_ref);
|
||||
if ($search_amount) $sql.=natural_search("p.amount", $search_amount, 1);
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
@@ -97,6 +100,8 @@ if ($result)
|
||||
|
||||
$urladd= "&statut=".$statut;
|
||||
|
||||
$selectedfields='';
|
||||
|
||||
// Lines of title fields
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@@ -116,7 +121,9 @@ if ($result)
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. $db->escape($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. dol_escape_htmltag($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'. dol_escape_htmltag($search_amount).'"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
@@ -125,9 +132,11 @@ if ($result)
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
|
||||
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
|
||||
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"","","",'align="center"');
|
||||
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"p.amount","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"","","",'align="right"',$sortfield,$sortorder);
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
@@ -136,15 +145,18 @@ if ($result)
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
print $bon->LibStatut($obj->statut,2);
|
||||
print " ";
|
||||
|
||||
print '<a href="card.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>\n";
|
||||
|
||||
print '<td align="right">';
|
||||
print $bon->LibStatut($obj->statut, 3);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right"></td>'."\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/compta/prelevement/card.php
|
||||
* \ingroup prelevement
|
||||
* \brief Fiche prelevement
|
||||
* \brief Card of a direct debit
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
@@ -45,20 +45,24 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
// Get supervariables
|
||||
$action = GETPOST('action','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$socid = GETPOST('socid','int');
|
||||
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (! $sortfield) $sortfield='pl.fk_soc';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
$object = new BonPrelevement($db,"");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -66,10 +70,9 @@ if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
if ( $action == 'confirm_delete' )
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$res=$bon->delete();
|
||||
$res=$object->delete();
|
||||
if ($res > 0)
|
||||
{
|
||||
header("Location: index.php");
|
||||
@@ -77,16 +80,16 @@ if ( $action == 'confirm_delete' )
|
||||
}
|
||||
}
|
||||
|
||||
// Seems to no be used and replaced with $action == 'infocredit
|
||||
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$res=$bon->set_credite();
|
||||
$res=$object->set_credite();
|
||||
if ($res >= 0)
|
||||
{
|
||||
header("Location: card.php?id=".$id);
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,19 +97,18 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||
|
||||
/*
|
||||
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref)
|
||||
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
|
||||
{
|
||||
$dir = $conf->prelevement->dir_output.'/receipts';
|
||||
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
|
||||
{
|
||||
$bon->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
$object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
}
|
||||
|
||||
header("Location: card.php?id=".$id);
|
||||
@@ -118,7 +120,7 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
||||
$mesg='BadFile';
|
||||
}*/
|
||||
|
||||
$error = $bon->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
$error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
|
||||
if ($error)
|
||||
{
|
||||
@@ -127,13 +129,13 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
||||
}
|
||||
}
|
||||
|
||||
// Set direct debit order to credited, create payment and close invoices
|
||||
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||
|
||||
$error = $bon->set_infocredit($user, $dt);
|
||||
$error = $object->set_infocredit($user, $dt);
|
||||
|
||||
if ($error)
|
||||
{
|
||||
@@ -143,61 +145,66 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$bon = new BonPrelevement($db,"");
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
|
||||
if ($id > 0)
|
||||
if ($id > 0 || $ref)
|
||||
{
|
||||
$bon->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), '', 'payment');
|
||||
$head = prelevement_prepare_head($object);
|
||||
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
if (GETPOST('error','alpha')!='')
|
||||
{
|
||||
print '<div class="error">'.$bon->getErrorString(GETPOST('error','alpha')).'</div>';
|
||||
print '<div class="error">'.$object->getErrorString(GETPOST('error','alpha')).'</div>';
|
||||
}
|
||||
|
||||
/*if ($action == 'credite')
|
||||
{
|
||||
print $form->formconfirm("card.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
|
||||
print $form->formconfirm("card.php?id=".$object->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
|
||||
|
||||
}*/
|
||||
|
||||
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
|
||||
// Status
|
||||
/*
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td>'.$bon->getLibStatut(1).'</td>';
|
||||
print '<td>'.$object->getLibStatut(1).'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
if($bon->date_trans <> 0)
|
||||
if($object->date_trans <> 0)
|
||||
{
|
||||
$muser = new User($db);
|
||||
$muser->fetch($bon->user_trans);
|
||||
$muser->fetch($object->user_trans);
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($bon->date_trans,'day');
|
||||
print dol_print_date($object->date_trans,'day');
|
||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $bon->methodes_trans[$bon->method_trans];
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
}
|
||||
if($bon->date_credit <> 0)
|
||||
if($object->date_credit <> 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print dol_print_date($bon->date_credit,'day');
|
||||
print dol_print_date($object->date_credit,'day');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -205,19 +212,36 @@ if ($id > 0)
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%"><tr><td class="titlefield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("BankToReceiveWithdraw");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($acc->id > 0)
|
||||
print $acc->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref.'.xml';
|
||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted')
|
||||
if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted')
|
||||
{
|
||||
print '<form method="post" name="userfile" action="card.php?id='.$bon->id.'" enctype="multipart/form-data">';
|
||||
print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="infotrans">';
|
||||
print '<table class="border" width="100%">';
|
||||
@@ -227,7 +251,7 @@ if ($id > 0)
|
||||
print $form->select_date('','','','','',"userfile",1,1);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $form->selectarray("methode",$bon->methodes_trans);
|
||||
print $form->selectarray("methode",$object->methodes_trans);
|
||||
print '</td></tr>';
|
||||
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
|
||||
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
|
||||
@@ -238,9 +262,9 @@ if ($id > 0)
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
if (! empty($bon->date_trans) && $bon->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited')
|
||||
if (! empty($object->date_trans) && $object->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited')
|
||||
{
|
||||
print '<form name="infocredit" method="post" action="card.php?id='.$bon->id.'">';
|
||||
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="infocredit">';
|
||||
print '<table class="border" width="100%">';
|
||||
@@ -261,17 +285,17 @@ if ($id > 0)
|
||||
{
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send)
|
||||
if (empty($object->date_trans) && $user->rights->prelevement->bons->send)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"card.php?action=settransmitted&id=".$bon->id."\">".$langs->trans("SetToStatusSent")."</a>";
|
||||
print "<a class=\"butAction\" href=\"card.php?action=settransmitted&id=".$object->id."\">".$langs->trans("SetToStatusSent")."</a>";
|
||||
}
|
||||
|
||||
if (! empty($bon->date_trans) && $bon->date_credit == 0)
|
||||
if (! empty($object->date_trans) && $object->date_credit == 0)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$bon->id."\">".$langs->trans("ClassCredited")."</a>";
|
||||
print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$object->id."\">".$langs->trans("ClassCredited")."</a>";
|
||||
}
|
||||
|
||||
print "<a class=\"butActionDelete\" href=\"card.php?action=confirm_delete&id=".$bon->id."\">".$langs->trans("Delete")."</a>";
|
||||
print "<a class=\"butActionDelete\" href=\"card.php?action=confirm_delete&id=".$object->id."\">".$langs->trans("Delete")."</a>";
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
@@ -293,7 +317,16 @@ if ($id > 0)
|
||||
$sql.= " AND pl.fk_soc = s.rowid";
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
@@ -304,8 +337,9 @@ if ($id > 0)
|
||||
|
||||
$urladd = "&id=".$id;
|
||||
|
||||
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
|
||||
print"\n<!-- debut table -->\n";
|
||||
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Lines",$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
|
||||
@@ -363,12 +397,17 @@ if ($id > 0)
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.price($total)."</td>\n";
|
||||
print '<td align="right">';
|
||||
if ($total != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
|
||||
print price($total);
|
||||
print "</td>\n";
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -38,6 +38,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
*/
|
||||
class BonPrelevement extends CommonObject
|
||||
{
|
||||
public $element='widthdraw';
|
||||
public $table_element='prelevement_bons';
|
||||
public $picto = 'payment';
|
||||
|
||||
var $date_echeance;
|
||||
var $raison_sociale;
|
||||
var $reference_remise;
|
||||
@@ -263,10 +267,11 @@ class BonPrelevement extends CommonObject
|
||||
/**
|
||||
* Get object and lines from database
|
||||
*
|
||||
* @param int $rowid id of object to load
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Ref of direct debit
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function fetch($rowid)
|
||||
function fetch($rowid, $ref='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -278,8 +283,9 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= ", p.fk_user_credit";
|
||||
$sql.= ", p.statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE p.rowid = ".$rowid;
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($rowid > 0) $sql.= " AND p.rowid = ".$rowid;
|
||||
else $sql.= " AND p.ref = '".$this->db->escape($ref)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
@@ -321,7 +327,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set credite and set status of linked invoices
|
||||
* Set credite and set status of linked invoices. Still used ??
|
||||
*
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
@@ -345,7 +351,7 @@ class BonPrelevement extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
if (! $error)
|
||||
{
|
||||
$facs = array();
|
||||
$facs = $this->getListInvoices();
|
||||
@@ -361,9 +367,8 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
$sql.= " SET statut = 2";
|
||||
$sql.= " WHERE fk_prelevement_bons = ".$this->id;
|
||||
@@ -378,7 +383,7 @@ class BonPrelevement extends CommonObject
|
||||
/*
|
||||
* End of procedure
|
||||
*/
|
||||
if ($error == 0)
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
@@ -399,10 +404,10 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set withdrawal to credited status
|
||||
* Set direct debit order to "credited" status.
|
||||
*
|
||||
* @param User $user id of user
|
||||
* @param int $date date of action
|
||||
* @param User $user Id of user
|
||||
* @param int $date date of action
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function set_infocredit($user, $date)
|
||||
@@ -436,49 +441,60 @@ class BonPrelevement extends CommonObject
|
||||
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
|
||||
$facs = array();
|
||||
$amounts = array();
|
||||
$amountsperthirdparty = array();
|
||||
|
||||
$facs = $this->getListInvoices(1);
|
||||
|
||||
// Loop on each invoice. $facs=array(0=>id, 1=>amount requested)
|
||||
$num=count($facs);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$fac = new Facture($this->db);
|
||||
$fac->fetch($facs[$i][0]);
|
||||
$amounts[$fac->id] = $facs[$i][1];
|
||||
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
|
||||
|
||||
$totalpaye = $fac->getSommePaiement();
|
||||
$totalcreditnotes = $fac->getSumCreditNotesUsed();
|
||||
$totaldeposits = $fac->getSumDepositsUsed();
|
||||
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
|
||||
|
||||
if ($alreadypayed + $facs[$i][1] >= $fac->total_ttc) {
|
||||
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
|
||||
$result = $fac->set_paid($user);
|
||||
}
|
||||
}
|
||||
|
||||
$paiement = new Paiement($this->db);
|
||||
$paiement->datepaye = $date ;
|
||||
$paiement->amounts = $amounts;
|
||||
$paiement->paiementid = 3; //
|
||||
$paiement->num_paiement = $this->ref ;
|
||||
$paiement->id_prelevement = $this->id ;
|
||||
// Make one payment per customer
|
||||
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts)
|
||||
{
|
||||
$paiement = new Paiement($this->db);
|
||||
$paiement->datepaye = $date;
|
||||
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
|
||||
$paiement->paiementid = 3; //
|
||||
$paiement->num_paiement = $this->ref; // Set ref of direct debit note
|
||||
$paiement->id_prelevement = $this->id;
|
||||
|
||||
$paiement_id = $paiement->create($user);
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::set_credite AddPayment Error");
|
||||
$error++;
|
||||
$paiement_id = $paiement->create($user);
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::set_infocredit AddPayment Error");
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$paiement->addPaymentToBank($user,'payment','(WithdrawalPayment)',$bankaccount,'','');
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error");
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
//var_dump($paiement->amounts);
|
||||
//var_dump($thirdpartyid);
|
||||
//var_dump($cursoramounts);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$paiement->addPaymentToBank($user,'payment','(WithdrawalPayment)',$bankaccount,'','');
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::set_credite AddPaymentToBank Error");
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// Update withdrawal line
|
||||
|
||||
// Update withdrawal line
|
||||
// TODO: Translate to ligneprelevement.class.php
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
$sql.= " SET statut = 2";
|
||||
@@ -486,7 +502,7 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
dol_syslog(get_class($this)."::set_credite Update lines Error");
|
||||
dol_syslog(get_class($this)."::set_infocredit Update lines Error");
|
||||
$error++;
|
||||
}
|
||||
|
||||
@@ -937,6 +953,7 @@ class BonPrelevement extends CommonObject
|
||||
{
|
||||
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
||||
$this->id = $prev_id;
|
||||
$this->ref = $ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -951,14 +968,14 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create withdrawal receipt
|
||||
*/
|
||||
if (!$error)
|
||||
{
|
||||
if (count($factures_prev) > 0)
|
||||
/*
|
||||
* Create withdrawal receipt in database
|
||||
*/
|
||||
if (count($factures_prev) > 0)
|
||||
{
|
||||
foreach ($factures_prev as $fac)
|
||||
foreach ($factures_prev as $fac) // Add a link in database for each invoice
|
||||
{
|
||||
// Fetch invoice
|
||||
$fact = new Facture($this->db);
|
||||
@@ -998,7 +1015,6 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1006,11 +1022,12 @@ class BonPrelevement extends CommonObject
|
||||
if (!$error)
|
||||
{
|
||||
/*
|
||||
* Withdraw receipt
|
||||
* Create direct debit order in a XML file
|
||||
*/
|
||||
|
||||
dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG);
|
||||
|
||||
|
||||
if (count($factures_prev) > 0)
|
||||
{
|
||||
$this->date_echeance = $datetimeprev;
|
||||
@@ -1034,11 +1051,12 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
$this->factures = $factures_prev_id;
|
||||
|
||||
// Generation of SEPA file
|
||||
// Generation of SEPA file $this->filename
|
||||
$this->generate();
|
||||
}
|
||||
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
|
||||
}
|
||||
//var_dump($factures_prev);exit;
|
||||
|
||||
/*
|
||||
* Update total
|
||||
@@ -1289,8 +1307,9 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= " AND soc.rowid = f.fk_soc";
|
||||
$sql.= " AND rib.fk_soc = f.fk_soc";
|
||||
$sql.= " AND rib.default_rib = 1";
|
||||
//print $sql;
|
||||
|
||||
//echo $sql;
|
||||
// Define $fileDebiteurSection. One section DrctDbtTxInf per invoice.
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1302,27 +1321,26 @@ class BonPrelevement extends CommonObject
|
||||
$this->total = $this->total + $obj->somme;
|
||||
$i++;
|
||||
}
|
||||
$nbtotalDrctDbtTxInf = $i;
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf);
|
||||
fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
/*
|
||||
* section Emetteur(sepa Emetteur bloc lines)
|
||||
*/
|
||||
// Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all DrctDbtTxInf
|
||||
if ($result != -2)
|
||||
{
|
||||
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf);
|
||||
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs($this->file, 'ERREUR EMETTEUR'.$CrLf);
|
||||
fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company
|
||||
}
|
||||
|
||||
/**
|
||||
* SECTION CREATION FICHIER SEPA
|
||||
* SECTION CREATION SEPA FILE
|
||||
*/
|
||||
// SEPA File Header
|
||||
fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
|
||||
@@ -1819,11 +1837,11 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return status label for a status
|
||||
* Return status label for a status
|
||||
*
|
||||
* @param int $statut id statut
|
||||
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
|
||||
* @return string Label
|
||||
* @param int $statut id statut
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
function LibStatut($statut,$mode=0)
|
||||
{
|
||||
@@ -1846,8 +1864,25 @@ class BonPrelevement extends CommonObject
|
||||
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
|
||||
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
|
||||
}
|
||||
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
|
||||
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
|
||||
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]);
|
||||
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3').' '.$langs->trans($this->labelstatut[$statut]);
|
||||
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6').' '.$langs->trans($this->labelstatut[$statut]);
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
|
||||
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
|
||||
if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
|
||||
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
|
||||
|
||||
@@ -67,7 +67,7 @@ if ($action == 'create')
|
||||
{
|
||||
setEventMessages($bprev->error, $bprev->errors, 'errors');
|
||||
}
|
||||
if ($result == 0)
|
||||
elseif ($result == 0)
|
||||
{
|
||||
$mesg='';
|
||||
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed");
|
||||
@@ -78,6 +78,10 @@ if ($action == 'create')
|
||||
$mesg.=$val."<br>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
// Get supervariables
|
||||
$prev_id = GETPOST('id','int');
|
||||
$socid = GETPOST('socid','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@@ -55,6 +56,9 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='p.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
$object = new BonPrelevement($db,"");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -65,39 +69,41 @@ $thirdpartytmp = new Societe($db);
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
if ($prev_id)
|
||||
if ($prev_id > 0 || $ref)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
if ($bon->fetch($prev_id) == 0)
|
||||
if ($object->fetch($prev_id, $ref) == 0)
|
||||
{
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), '', 'payment');
|
||||
$head = prelevement_prepare_head($object);
|
||||
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans('Status').'</td><td>'.$bon->getLibStatut(1).'</td></tr>';
|
||||
//print '<tr><td>'.$langs->trans('Status').'</td><td>'.$object->getLibStatut(1).'</td></tr>';
|
||||
|
||||
if($bon->date_trans <> 0)
|
||||
if($object->date_trans <> 0)
|
||||
{
|
||||
$muser = new User($db);
|
||||
$muser->fetch($bon->user_trans);
|
||||
$muser->fetch($object->user_trans);
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($bon->date_trans,'day');
|
||||
print dol_print_date($object->date_trans,'day');
|
||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $bon->methodes_trans[$bon->method_trans];
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
}
|
||||
if($bon->date_credit <> 0)
|
||||
if($object->date_credit <> 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print dol_print_date($bon->date_credit,'day');
|
||||
print dol_print_date($object->date_credit,'day');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -105,12 +111,29 @@ if ($prev_id)
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%"><tr><td class="titlefield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("BankToReceiveWithdraw");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($acc->id > 0)
|
||||
print $acc->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref.'.xml';
|
||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
@@ -122,9 +145,9 @@ if ($prev_id)
|
||||
|
||||
|
||||
// List of invoices
|
||||
$sql = "SELECT pf.rowid";
|
||||
$sql.= ",f.rowid as facid, f.facnumber as ref, f.total_ttc";
|
||||
$sql.= ", s.rowid as socid, s.nom as name, pl.statut";
|
||||
$sql = "SELECT pf.rowid,";
|
||||
$sql.= " f.rowid as facid, f.facnumber as ref, f.total_ttc,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
@@ -137,7 +160,6 @@ $sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($prev_id) $sql.= " AND p.rowid=".$prev_id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
@@ -172,21 +194,22 @@ if ($result)
|
||||
|
||||
$massactionbutton='';
|
||||
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("Invoices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("AmountInvoice",$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("AmountRequested",$_SERVER["PHP_SELF"],"pl.amount_requested","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("StatusDebitCredit",$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
$var=false;
|
||||
|
||||
$total = 0;
|
||||
$totalinvoices = 0;
|
||||
$totalamount_requested = 0;
|
||||
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
@@ -208,9 +231,12 @@ if ($result)
|
||||
print $thirdpartytmp->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
|
||||
// Amount
|
||||
// Amount of invoice
|
||||
print '<td align="right">'.price($obj->total_ttc)."</td>\n";
|
||||
|
||||
// Amount requested
|
||||
print '<td align="right">'.price($obj->amount_requested)."</td>\n";
|
||||
|
||||
// Status of requests
|
||||
print '<td align="center">';
|
||||
|
||||
@@ -233,7 +259,8 @@ if ($result)
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total += $obj->total_ttc;
|
||||
$totalinvoices += $obj->total_ttc;
|
||||
$totalamount_requested += $obj->amount_requested;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@@ -243,13 +270,21 @@ if ($result)
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.price($total)."</td>\n";
|
||||
print '<td align="right">';
|
||||
//if ($totalinvoices != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices"); // It is normal to have total that differs. For an amount of invoice of 100, request to pay may be 50 only.
|
||||
if ($totalamount_requested != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
|
||||
print "</td>\n";
|
||||
print '<td align="right">';
|
||||
print price($totalamount_requested);
|
||||
print "</td>\n";
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -41,49 +41,69 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
// Get supervariables
|
||||
$prev_id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$object = new BonPrelevement($db,"");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
if ($prev_id)
|
||||
if ($prev_id > 0 || $ref)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
if ($bon->fetch($prev_id) == 0)
|
||||
if ($object->fetch($prev_id, $ref) == 0)
|
||||
{
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), '', 'payment');
|
||||
$head = prelevement_prepare_head($object);
|
||||
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
|
||||
// Status
|
||||
/*
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td>'.$bon->getLibStatut(1).'</td>';
|
||||
print '<td>'.$object->getLibStatut(1).'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
if($bon->date_trans <> 0)
|
||||
if($object->date_trans <> 0)
|
||||
{
|
||||
$muser = new User($db);
|
||||
$muser->fetch($bon->user_trans);
|
||||
$muser->fetch($object->user_trans);
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($bon->date_trans,'day');
|
||||
print dol_print_date($object->date_trans,'day');
|
||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $bon->methodes_trans[$bon->method_trans];
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
}
|
||||
if($bon->date_credit <> 0)
|
||||
if($object->date_credit <> 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print dol_print_date($bon->date_credit,'day');
|
||||
print dol_print_date($object->date_credit,'day');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -91,12 +111,29 @@ if ($prev_id)
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%"><tr><td class="titlefield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("BankToReceiveWithdraw");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($acc->id > 0)
|
||||
print $acc->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref.'.xml';
|
||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
@@ -109,7 +146,7 @@ if ($prev_id)
|
||||
$rej = new RejetPrelevement($db, $user);
|
||||
|
||||
/*
|
||||
* Liste des factures
|
||||
* List errors
|
||||
*/
|
||||
$sql = "SELECT pl.rowid, pl.amount, pl.statut";
|
||||
$sql.= " , s.rowid as socid, s.nom as name";
|
||||
@@ -127,12 +164,25 @@ $sql.= " AND pr.fk_prelevement_lignes = pl.rowid";
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY pl.amount DESC";
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print_barre_liste($langs->trans("Rejects"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Line").'</td><td>'.$langs->trans("ThirdParty").'</td><td align="right">'.$langs->trans("Amount").'</td>';
|
||||
@@ -146,32 +196,32 @@ if ($resql)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
print img_picto('', 'statut'.$obj->statut).' ';
|
||||
print substr('000000'.$obj->rowid, -6);
|
||||
print '</a></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
|
||||
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td>'.$rej->motifs[$obj->motif].'</td>';
|
||||
|
||||
|
||||
print '<td align="center">'.yn($obj->afacturer).'</td>';
|
||||
print '<td align="center">'.$obj->fk_facture.'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$total += $obj->amount;
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<tr class="liste_total"><td> </td>';
|
||||
@@ -181,6 +231,8 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -38,7 +38,21 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
// Get supervariables
|
||||
$prev_id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
$object = new BonPrelevement($db,"");
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -48,40 +62,44 @@ llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
if ($prev_id)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
if ($bon->fetch($prev_id) == 0)
|
||||
if ($object->fetch($prev_id) == 0)
|
||||
{
|
||||
$head = prelevement_prepare_head($bon);
|
||||
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), '', 'payment');
|
||||
$head = prelevement_prepare_head($object);
|
||||
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
|
||||
// Status
|
||||
/*
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td>'.$bon->getLibStatut(1).'</td>';
|
||||
print '<td>'.$object->getLibStatut(1).'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
if($bon->date_trans <> 0)
|
||||
if($object->date_trans <> 0)
|
||||
{
|
||||
$muser = new User($db);
|
||||
$muser->fetch($bon->user_trans);
|
||||
$muser->fetch($object->user_trans);
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($bon->date_trans,'day');
|
||||
print dol_print_date($object->date_trans,'day');
|
||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $bon->methodes_trans[$bon->method_trans];
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
}
|
||||
if($bon->date_credit <> 0)
|
||||
if($object->date_credit <> 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print dol_print_date($bon->date_credit,'day');
|
||||
print dol_print_date($object->date_credit,'day');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -89,12 +107,29 @@ if ($prev_id)
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%"><tr><td class="titlefield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$acc = new Account($db);
|
||||
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("BankToReceiveWithdraw");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($acc->id > 0)
|
||||
print $acc->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
||||
$relativepath = 'receipts/'.$bon->ref.'.xml';
|
||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
@@ -121,7 +156,7 @@ if ($prev_id)
|
||||
$i = 0;
|
||||
|
||||
print load_fiche_titre($langs->trans("StatisticsByLineStatus"),'','');
|
||||
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -139,12 +174,12 @@ if ($prev_id)
|
||||
print price($row[0]);
|
||||
|
||||
print '</td><td align="right">';
|
||||
if ($bon->amount) print round($row[0]/$bon->amount*100,2)." %";
|
||||
if ($object->amount) print round($row[0]/$object->amount*100,2)." %";
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -320,8 +320,9 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
@@ -641,7 +642,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre("DateCreationShort",$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
|
||||
@@ -728,7 +728,7 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
// Selectionne les lignes contrat liees a aucun produit
|
||||
$sql = "SELECT d.rowid, d.fk_contrat, d.statut, d.qty, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.rowid, d.remise_percent, d.subprice,";
|
||||
$sql = "SELECT d.rowid, d.fk_contrat, d.statut, d.qty, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.rowid, d.remise_percent, d.subprice,";
|
||||
$sql.= " d.total_ht,";
|
||||
$sql.= " d.total_tva,";
|
||||
$sql.= " d.total_localtax1,";
|
||||
@@ -766,6 +766,8 @@ class Contrat extends CommonObject
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
$line->localtax1_tx = $objp->localtax1_tx;
|
||||
$line->localtax2_tx = $objp->localtax2_tx;
|
||||
$line->localtax1_type = $objp->localtax1_type;
|
||||
$line->localtax2_type = $objp->localtax2_type;
|
||||
$line->subprice = $objp->subprice;
|
||||
$line->remise_percent = $objp->remise_percent;
|
||||
$line->price_ht = $objp->price_ht;
|
||||
@@ -872,7 +874,7 @@ class Contrat extends CommonObject
|
||||
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
|
||||
$sql.= " ref, entity, note_private, note_public, ref_customer, ref_supplier, ref_ext)";
|
||||
$sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id;
|
||||
$sql.= ", '".$this->db->idate($this->date_contrat)."'";
|
||||
$sql.= ", ".(dol_strlen($this->date_contrat)!=0 ? "'".$this->db->idate($this->date_contrat)."'" : "NULL");
|
||||
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
|
||||
$sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL");
|
||||
$sql.= ",".($this->fk_project>0?$this->fk_project:"NULL");
|
||||
@@ -2628,6 +2630,8 @@ class ContratLigne extends CommonObjectLine
|
||||
$sql.= " t.vat_src_code,";
|
||||
$sql.= " t.localtax1_tx,";
|
||||
$sql.= " t.localtax2_tx,";
|
||||
$sql.= " t.localtax1_type,";
|
||||
$sql.= " t.localtax2_type,";
|
||||
$sql.= " t.qty,";
|
||||
$sql.= " t.remise_percent,";
|
||||
$sql.= " t.remise,";
|
||||
@@ -2681,6 +2685,8 @@ class ContratLigne extends CommonObjectLine
|
||||
$this->vat_src_code = $obj->vat_src_code;
|
||||
$this->localtax1_tx = $obj->localtax1_tx;
|
||||
$this->localtax2_tx = $obj->localtax2_tx;
|
||||
$this->localtax1_type = $obj->localtax1_type;
|
||||
$this->localtax2_type = $obj->localtax2_type;
|
||||
$this->qty = $obj->qty;
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->remise = $obj->remise;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@@ -255,8 +255,9 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
@@ -270,11 +271,8 @@ $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.re
|
||||
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql.= " typent.code,";
|
||||
$sql.= " state.code_departement, state.nom";
|
||||
// Add where from extra fields
|
||||
foreach ($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$sql .= ', ef.'.$key;
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@@ -115,6 +115,11 @@ $companystatic=new Societe($db);
|
||||
$arrayfields=array(
|
||||
'c.ref'=>array('label'=>$langs->trans("Contract"), 'checked'=>1, 'position'=>80),
|
||||
'p.description'=>array('label'=>$langs->trans("Service"), 'checked'=>1, 'position'=>80),
|
||||
'cd.qty'=>array('label'=>$langs->trans("Qty"), 'checked'=>0, 'position'=>100),
|
||||
'cd.total_ht'=>array('label'=>$langs->trans("TotalHT"), 'checked'=>0, 'position'=>100),
|
||||
'cd.total_tva'=>array('label'=>$langs->trans("TotalVAT"), 'checked'=>0, 'position'=>100),
|
||||
'cd.tva_tx'=>array('label'=>$langs->trans("VAT"), 'checked'=>0, 'position'=>100),
|
||||
'cd.subprice'=>array('label'=>$langs->trans("PriceUHT"), 'checked'=>0, 'position'=>100),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>100),
|
||||
'cd.date_ouverture_prevue'=>array('label'=>$langs->trans("DateStartPlannedShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode == "0")),
|
||||
'cd.date_ouverture'=>array('label'=>$langs->trans("DateStartRealShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode > 0)),
|
||||
@@ -199,7 +204,11 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk
|
||||
$sql.= " cd.date_ouverture_prevue,";
|
||||
$sql.= " cd.date_ouverture,";
|
||||
$sql.= " cd.date_fin_validite,";
|
||||
$sql.= " cd.date_cloture,";
|
||||
$sql.= " cd.qty,";
|
||||
$sql.= " cd.total_ht,";
|
||||
$sql.= " cd.total_tva,";
|
||||
$sql.= " cd.tva_tx,";
|
||||
$sql.= " cd.subprice,";
|
||||
//$sql.= " cd.date_c as date_creation,";
|
||||
$sql.= " cd.tms as date_update";
|
||||
// Add fields from extrafields
|
||||
@@ -362,6 +371,11 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],"c.ref","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.description']['checked'])) print_liste_field_titre($arrayfields['p.description']['label'],$_SERVER["PHP_SELF"],"p.description","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.qty']['checked'])) print_liste_field_titre($arrayfields['cd.qty']['label'],$_SERVER["PHP_SELF"],"cd.qty","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.total_ht']['checked'])) print_liste_field_titre($arrayfields['cd.total_ht']['label'],$_SERVER["PHP_SELF"],"cd.total_ht","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.total_tva']['checked'])) print_liste_field_titre($arrayfields['cd.total_tva']['label'],$_SERVER["PHP_SELF"],"cd.total_tva","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.tva_tx']['checked'])) print_liste_field_titre($arrayfields['cd.tva_tx']['label'],$_SERVER["PHP_SELF"],"cd.tva_tx","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.subprice']['checked'])) print_liste_field_titre($arrayfields['cd.subprice']['label'],$_SERVER["PHP_SELF"],"cd.subprice","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'],$_SERVER["PHP_SELF"],"cd.date_ouverture_prevue","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.date_ouverture']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture']['label'],$_SERVER["PHP_SELF"],"cd.date_ouverture","",$param,'align="center"',$sortfield,$sortorder);
|
||||
@@ -407,6 +421,32 @@ if (! empty($arrayfields['p.description']['checked']))
|
||||
print '<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// detail lines
|
||||
if (! empty($arrayfields['cd.qty']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_ht']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.subprice']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Third party
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
@@ -414,6 +454,8 @@ if (! empty($arrayfields['s.nom']['checked']))
|
||||
print '<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
@@ -557,6 +599,38 @@ while ($i < min($num,$limit))
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['cd.qty']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $obj->qty;
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_ht']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print price($obj->total_ht);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print price($obj->total_tva);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print price2num($obj->tva_tx).'%';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.subprice']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print price($obj->subprice);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
|
||||
@@ -91,10 +91,13 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("FileGenerated"), null);
|
||||
if (empty($donotredirect)) // This is se when include is done by bulk action "Bill Orders"
|
||||
{
|
||||
setEventMessages($langs->trans("FileGenerated"), null);
|
||||
|
||||
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
|
||||
exit;
|
||||
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
*
|
||||
* $elementype must be defined.
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
$maxsizestring=255;
|
||||
$maxsizeint=10;
|
||||
$mesg=array();
|
||||
|
||||
$extrasize=GETPOST('size','int');
|
||||
$type=GETPOST('type','alpha');
|
||||
|
||||
@@ -30,9 +30,9 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
if ($object->id)
|
||||
{
|
||||
if (! empty($upload_dirold) && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask'));
|
||||
$result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'));
|
||||
else
|
||||
dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask'));
|
||||
$result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'));
|
||||
}
|
||||
}
|
||||
elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
@@ -57,7 +57,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
if ($object->id)
|
||||
{
|
||||
$urlfile = GETPOST('urlfile', 'alpha'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
if (GETPOST('section')) $file = $upload_dir . "/" . $urlfile; // For a delete of GED module urlfile contains full path from upload_dir
|
||||
if (GETPOST('section', 'alpha')) $file = $upload_dir . "/" . $urlfile; // For a delete of GED module urlfile contains full path from upload_dir
|
||||
else // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
|
||||
{
|
||||
$urlfile=basename($urlfile);
|
||||
@@ -116,7 +116,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
exit;
|
||||
}
|
||||
}
|
||||
elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha'))
|
||||
elseif ($action == 'confirm_updateline' && GETPOST('save','alpha') && GETPOST('link', 'alpha'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||
$langs->load('link');
|
||||
@@ -150,8 +150,8 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave'))
|
||||
//var_dump($upload_dir);exit;
|
||||
if (! empty($upload_dir))
|
||||
{
|
||||
$filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom'));
|
||||
$filenameto=dol_sanitizeFileName(GETPOST('renamefileto'));
|
||||
$filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom','alpha'));
|
||||
$filenameto=dol_sanitizeFileName(GETPOST('renamefileto','alpha'));
|
||||
|
||||
// Security:
|
||||
// Disallow file with some extensions. We rename them.
|
||||
@@ -176,7 +176,7 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave'))
|
||||
|
||||
setEventMessages($langs->trans("FileRenamed"), null);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
|
||||
setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors');
|
||||
|
||||
@@ -51,7 +51,7 @@ if (! $error && count($toselect) > $maxformassaction)
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error && $massaction == 'confirm_presend' && GETPOST('modelselected')) // If we change the template, we must not send email, but keep on send email form
|
||||
if (! $error && $massaction == 'confirm_presend' && ! GETPOST('sendmail')) // If we do not choose button send (for example when we change template or limit), we must not send email, but keep on send email form
|
||||
{
|
||||
$massaction='presend';
|
||||
}
|
||||
@@ -407,6 +407,12 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
|
||||
if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search'))
|
||||
{
|
||||
if (empty($diroutputmassaction))
|
||||
{
|
||||
dol_print_error(null, 'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
@@ -429,7 +435,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
}
|
||||
|
||||
$arrayofinclusion=array();
|
||||
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/');
|
||||
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote($tmppdf.'.pdf','/').'$';
|
||||
$listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
|
||||
|
||||
// build list of files with full path
|
||||
@@ -457,22 +463,23 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
if(!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) {
|
||||
if(!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT))
|
||||
{
|
||||
// Create output dir if not exists
|
||||
dol_mkdir($diroutputmassaction);
|
||||
dol_mkdir($diroutputmassaction);
|
||||
|
||||
// Defined name of merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
// Defined name of merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
|
||||
// Save merged file
|
||||
if ($filter=='paye:0')
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
// Save merged file
|
||||
if (in_array($object->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED)
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
|
||||
if (count($files)>0)
|
||||
{
|
||||
@@ -502,11 +509,17 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
}
|
||||
else {
|
||||
// Create empty PDF
|
||||
$pdf=pdf_getInstance();
|
||||
$formatarray=pdf_getFormat();
|
||||
$page_largeur = $formatarray['width'];
|
||||
$page_hauteur = $formatarray['height'];
|
||||
$format = array($page_largeur,$page_hauteur);
|
||||
|
||||
$pdf=pdf_getInstance($format);
|
||||
|
||||
if (class_exists('TCPDF'))
|
||||
{
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
|
||||
@@ -515,15 +528,15 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
// Add all others
|
||||
foreach($files as $file)
|
||||
{
|
||||
// Charge un document PDF depuis un fichier.
|
||||
$pagecount = $pdf->setSourceFile($file);
|
||||
for ($i = 1; $i <= $pagecount; $i++)
|
||||
{
|
||||
$tplidx = $pdf->importPage($i);
|
||||
$s = $pdf->getTemplatesize($tplidx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
// Charge un document PDF depuis un fichier.
|
||||
$pagecount = $pdf->setSourceFile($file);
|
||||
for ($i = 1; $i <= $pagecount; $i++)
|
||||
{
|
||||
$tplidx = $pdf->importPage($i);
|
||||
$s = $pdf->getTemplatesize($tplidx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
}
|
||||
|
||||
// Create output dir if not exists
|
||||
@@ -534,20 +547,20 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
|
||||
// Save merged file
|
||||
if ($filter=='paye:0')
|
||||
if (in_array($object->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED)
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
if ($pagecount)
|
||||
{
|
||||
$now=dol_now();
|
||||
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
$now=dol_now();
|
||||
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$langs->load("exports");
|
||||
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
||||
|
||||
@@ -351,7 +351,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
'__EMAIL__' => $sendto,
|
||||
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'',
|
||||
'__REF__' => (is_object($object)?$object->ref:''),
|
||||
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'')
|
||||
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:'')
|
||||
/* not available on all object
|
||||
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''),
|
||||
'__LASTNAME__'=>(is_object($object)?$object->lastname:''),
|
||||
|
||||
@@ -77,7 +77,6 @@ class box_activity extends ModeleBoxes
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$totalMnt = 0;
|
||||
$totalnb = 0;
|
||||
$line = 0;
|
||||
$cachetime = 3600;
|
||||
@@ -95,8 +94,6 @@ class box_activity extends ModeleBoxes
|
||||
// compute the year limit to show
|
||||
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofperiod, "m");
|
||||
|
||||
$cumuldata = array();
|
||||
|
||||
|
||||
// list the summary of the propals
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
@@ -146,11 +143,10 @@ class box_activity extends ModeleBoxes
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data))
|
||||
{
|
||||
$j=0;
|
||||
while ($line < count($cumuldata))
|
||||
while ($j < count($data))
|
||||
{
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
@@ -176,7 +172,6 @@ class box_activity extends ModeleBoxes
|
||||
'td' => 'class="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||
);
|
||||
$totalMnt += $data[$j]->Mnttot;
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
|
||||
@@ -231,10 +226,9 @@ class box_activity extends ModeleBoxes
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
while ($line < count($cumuldata)) {
|
||||
while ($j < count($data)) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut,
|
||||
@@ -259,7 +253,6 @@ class box_activity extends ModeleBoxes
|
||||
'td' => 'class="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||
);
|
||||
$totalMnt += $data[$j]->Mnttot;
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
|
||||
@@ -290,11 +283,11 @@ class box_activity extends ModeleBoxes
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ")";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " WHERE f.entity IN (".getEntity('facture').')';
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1";
|
||||
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND f.paye=1";
|
||||
$sql.= " GROUP BY f.fk_statut";
|
||||
$sql.= " ORDER BY f.fk_statut DESC";
|
||||
|
||||
@@ -317,10 +310,9 @@ class box_activity extends ModeleBoxes
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
while ($line < count($cumuldata)) {
|
||||
while ($j < count($data)) {
|
||||
$billurl="search_status=2&paye=1&year=".$data[$j]->annee;
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
@@ -347,10 +339,8 @@ class box_activity extends ModeleBoxes
|
||||
);
|
||||
|
||||
// We add only for the current year
|
||||
if ($data[$j]->annee == date("Y")) {
|
||||
$totalnb += $data[$j]->nb;
|
||||
$totalMnt += $data[$j]->Mnttot;
|
||||
}
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
|
||||
@@ -371,12 +361,13 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
|
||||
$data = array();
|
||||
if ($refresh) {
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " WHERE f.entity IN (".getEntity('facture').')';
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND paye=0";
|
||||
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND f.paye=0";
|
||||
$sql.= " GROUP BY f.fk_statut";
|
||||
$sql.= " ORDER BY f.fk_statut DESC";
|
||||
|
||||
@@ -399,11 +390,11 @@ class box_activity extends ModeleBoxes
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
$alreadypaid=-1;
|
||||
|
||||
while ($line < count($cumuldata)) {
|
||||
$j=0;
|
||||
while ($j < count($data)) {
|
||||
$billurl="search_status=".$data[$j]->fk_statut."&paye=0";
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
@@ -428,10 +419,9 @@ class box_activity extends ModeleBoxes
|
||||
'td' => 'class="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||
);
|
||||
$totalMnt += $objp->Mnttot;
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
|
||||
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3, $alreadypaid),
|
||||
);
|
||||
$line++;
|
||||
$j++;
|
||||
@@ -441,11 +431,6 @@ class box_activity extends ModeleBoxes
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||
);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => '',
|
||||
'maxlength'=>500, 'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2017 Nicolas Zabouri <info@inovea-conseil.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
|
||||
@@ -91,7 +92,7 @@ class box_services_contracts extends ModeleBoxes
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= "INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= ")";
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
|
||||
@@ -42,6 +42,7 @@ class CSMSFile
|
||||
var $priority;
|
||||
var $class;
|
||||
var $message;
|
||||
var $nostop;
|
||||
|
||||
|
||||
/**
|
||||
@@ -81,6 +82,7 @@ class CSMSFile
|
||||
$this->priority=$priority;
|
||||
$this->class=$class;
|
||||
$this->message=$msg;
|
||||
$this->nostop=false;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +109,7 @@ class CSMSFile
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_ALL_SMS))
|
||||
{
|
||||
|
||||
// Action according to choosed sending method
|
||||
if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') // Backward compatibility @deprecated
|
||||
{
|
||||
@@ -118,6 +121,7 @@ class CSMSFile
|
||||
$sms->deferred=$this->deferred;
|
||||
$sms->priority=$this->priority;
|
||||
$sms->class=$this->class;
|
||||
$sms->nostop=$this->nostop;
|
||||
|
||||
$res=$sms->SmsSend();
|
||||
if ($res <= 0)
|
||||
@@ -129,7 +133,7 @@ class CSMSFile
|
||||
{
|
||||
dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG);
|
||||
//var_dump($res); // 1973128
|
||||
$this->dump_sms_result($res);
|
||||
if (! empty($conf->global->MAIN_SMS_DEBUG)) $this->dump_sms_result($res);
|
||||
}
|
||||
}
|
||||
else if (! empty($conf->global->MAIN_SMS_SENDMODE)) // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module'
|
||||
@@ -147,6 +151,7 @@ class CSMSFile
|
||||
$sms->priority=$this->priority;
|
||||
$sms->class=$this->class;
|
||||
$sms->message=$this->message;
|
||||
$sms->nostop=$this->nostop;
|
||||
|
||||
$res=$sms->SmsSend();
|
||||
$this->error = $sms->error;
|
||||
@@ -159,7 +164,7 @@ class CSMSFile
|
||||
{
|
||||
dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG);
|
||||
//var_dump($res); // 1973128
|
||||
$this->dump_sms_result($res);
|
||||
if (! empty($conf->global->MAIN_SMS_DEBUG)) $this->dump_sms_result($res);
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
@@ -207,6 +212,7 @@ class CSMSFile
|
||||
fputs($fp, "Priority: ".$this->priority."\n");
|
||||
fputs($fp, "Class: ".$this->class."\n");
|
||||
fputs($fp, "Deferred: ".$this->deferred."\n");
|
||||
fputs($fp, "DisableStop: ".$this->nostop."\n");
|
||||
fputs($fp, "Message:\n".$this->message);
|
||||
|
||||
fclose($fp);
|
||||
|
||||
@@ -51,7 +51,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
const TYPE_DEPOSIT = 3;
|
||||
|
||||
/**
|
||||
* Proforma invoice.
|
||||
* Proforma invoice.
|
||||
* @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice !
|
||||
*/
|
||||
const TYPE_PROFORMA = 4;
|
||||
@@ -89,7 +89,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
*/
|
||||
const STATUS_ABANDONED = 3;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return remain amount to pay. Property ->id and ->total_ttc must be set.
|
||||
* This does not include open direct debit requests.
|
||||
@@ -141,7 +141,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return amount (with tax) of all deposits invoices used by invoice.
|
||||
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
|
||||
@@ -154,11 +154,11 @@ abstract class CommonInvoice extends CommonObject
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
|
||||
|
||||
$discountstatic=new DiscountAbsolute($this->db);
|
||||
$result=$discountstatic->getSumDepositsUsed($this, $multicurrency);
|
||||
if ($result >= 0)
|
||||
@@ -185,9 +185,9 @@ abstract class CommonInvoice extends CommonObject
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
|
||||
|
||||
$discountstatic=new DiscountAbsolute($this->db);
|
||||
$result=$discountstatic->getSumCreditNotesUsed($this, $multicurrency);
|
||||
if ($result >= 0)
|
||||
@@ -200,7 +200,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie tableau des ids de facture avoir issus de la facture
|
||||
*
|
||||
@@ -309,7 +309,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
* @param int $paye Status field paye
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, -1 otherwise)
|
||||
* @param int $type Type invoice
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
@@ -418,7 +418,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'),'statut0');
|
||||
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5');
|
||||
if (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7');
|
||||
if ($alreadypaid <= 0)
|
||||
if ($alreadypaid <= 0)
|
||||
{
|
||||
if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'),'statut1');
|
||||
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1');
|
||||
@@ -497,13 +497,13 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
elseif($cdr_type == 2 && !empty($cdr_nbjour)) // Application de la règle, le N du mois courant ou suivant
|
||||
{
|
||||
|
||||
|
||||
$date_piece = dol_mktime(0,0,0,date('m', $this->date),date('d', $this->date),date('Y', $this->date)); // Sans les heures minutes et secondes
|
||||
$date_lim_current = dol_mktime(0,0,0,date('m', $this->date),$cdr_nbjour,date('Y', $this->date)); // Sans les heures minutes et secondes
|
||||
$date_lim_next = strtotime(date('Y-m-d', $date_lim_current).' +1month');
|
||||
|
||||
|
||||
$diff = $date_piece - $date_lim_current;
|
||||
|
||||
|
||||
if($diff < 0) $datelim = $date_lim_current;
|
||||
else $datelim = $date_lim_next;
|
||||
|
||||
|
||||
@@ -1562,22 +1562,22 @@ abstract class CommonObject
|
||||
|
||||
switch ($this->element) {
|
||||
case 'propal':
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, ($line->description?$line->description:$line->desc), 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'commande':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, ($line->description?$line->description:$line->desc), $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'facture':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, ($line->description?$line->description:$line->desc), $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'supplier_proposal':
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->ref_fourn, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, ($line->description?$line->description:$line->desc), 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->ref_fourn, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'order_supplier':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, ($line->description?$line->description:$line->desc), $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'invoice_supplier':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->qty, 0, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, ($line->description?$line->description:$line->desc), $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->qty, 0, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
default:
|
||||
dol_syslog(get_class($this).'::setMulticurrencyRate no updateline defined', LOG_DEBUG);
|
||||
@@ -2263,6 +2263,8 @@ abstract class CommonObject
|
||||
|
||||
$error=0;
|
||||
|
||||
$multicurrency_tx = !empty($this->multicurrency_tx) ? $this->multicurrency_tx : 1;
|
||||
|
||||
// Define constants to find lines to sum
|
||||
$fieldtva='total_tva';
|
||||
$fieldlocaltax1='total_localtax1';
|
||||
@@ -2315,7 +2317,6 @@ abstract class CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// Note: There is no check on detail line and no check on total, if $forcedroundingmode = 'none'
|
||||
$multicurrency_tx = !empty($this->multicurrency_tx) ? $this->multicurrency_tx : 1;
|
||||
if ($forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto'
|
||||
{
|
||||
$localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
|
||||
@@ -2333,11 +2334,14 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$this->total_ht += $obj->total_ht; // The only field visible at end of line detail
|
||||
$this->total_ht += $obj->total_ht; // The field visible at end of line detail
|
||||
$this->total_tva += $obj->total_tva;
|
||||
$this->total_localtax1 += $obj->total_localtax1;
|
||||
$this->total_localtax2 += $obj->total_localtax2;
|
||||
$this->total_ttc += $obj->total_ttc;
|
||||
$this->multicurrency_total_ht += $obj->multicurrency_total_ht; // The field visible at end of line detail
|
||||
$this->multicurrency_total_tva += $obj->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc += $obj->multicurrency_total_ttc;
|
||||
|
||||
if (! isset($total_ht_by_vats[$obj->vatrate])) $total_ht_by_vats[$obj->vatrate]=0;
|
||||
if (! isset($total_tva_by_vats[$obj->vatrate])) $total_tva_by_vats[$obj->vatrate]=0;
|
||||
@@ -2346,7 +2350,7 @@ abstract class CommonObject
|
||||
$total_tva_by_vats[$obj->vatrate] += $obj->total_tva;
|
||||
$total_ttc_by_vats[$obj->vatrate] += $obj->total_ttc;
|
||||
|
||||
if ($forcedroundingmode == '1') // Check if we need adjustement onto line for vat
|
||||
if ($forcedroundingmode == '1') // Check if we need adjustement onto line for vat. TODO This works on the company currency but not on multicurrency
|
||||
{
|
||||
$tmpvat=price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1);
|
||||
$diff=price2num($total_tva_by_vats[$obj->vatrate]-$tmpvat, 'MT', 1);
|
||||
@@ -2370,26 +2374,25 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
// Add revenue stamp to total
|
||||
$this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
|
||||
$this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
|
||||
$this->multicurrency_total_ttc += isset($this->revenuestamp)?($this->revenuestamp * $multicurrency_tx):0;
|
||||
|
||||
// Situations totals
|
||||
if ($this->situation_cycle_ref && $this->situation_counter > 1) {
|
||||
if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) {
|
||||
$prev_sits = $this->get_prev_sits();
|
||||
|
||||
foreach ($prev_sits as $sit) {
|
||||
foreach ($prev_sits as $sit) { // $sit is an object Facture loaded with a fetch.
|
||||
$this->total_ht -= $sit->total_ht;
|
||||
$this->total_tva -= $sit->total_tva;
|
||||
$this->total_localtax1 -= $sit->total_localtax1;
|
||||
$this->total_localtax2 -= $sit->total_localtax2;
|
||||
$this->total_ttc -= $sit->total_ttc;
|
||||
$this->multicurrency_total_ht -= $sit->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva -= $sit->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc -= $sit->multicurrency_total_ttc;
|
||||
}
|
||||
}
|
||||
|
||||
// Multicurrency
|
||||
$this->multicurrency_total_ht += $this->total_ht * $multicurrency_tx;
|
||||
$this->multicurrency_total_tva += $this->total_tva * $multicurrency_tx;
|
||||
$this->multicurrency_total_ttc += $this->total_ttc * $multicurrency_tx;
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Now update global field total_ht, total_ttc and tva
|
||||
@@ -2403,7 +2406,7 @@ abstract class CommonObject
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva';
|
||||
if ($this->element == 'propal') $fieldttc='total';
|
||||
if ($this->element == 'expensereport') $fieldtva='total_tva';
|
||||
if ($this->element == 'supplier_proposal') $fieldttc='total';
|
||||
if ($this->element == 'supplier_proposal') $fieldttc='total';
|
||||
|
||||
if (empty($nodatabaseupdate))
|
||||
{
|
||||
@@ -4139,7 +4142,7 @@ abstract class CommonObject
|
||||
*
|
||||
* @param int $rowid Id of line. Use the id of object if not defined. Deprecated. Function must be called without parameters.
|
||||
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters.
|
||||
* @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded
|
||||
* @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded
|
||||
*/
|
||||
function fetch_optionals($rowid=null,$optionsArray=null)
|
||||
{
|
||||
@@ -4173,7 +4176,7 @@ abstract class CommonObject
|
||||
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
|
||||
|
||||
// Request to get complementary values
|
||||
if (count($optionsArray) > 0)
|
||||
if (is_array($optionsArray) && count($optionsArray) > 0)
|
||||
{
|
||||
$sql = "SELECT rowid";
|
||||
foreach ($optionsArray as $name => $label)
|
||||
@@ -4294,7 +4297,7 @@ abstract class CommonObject
|
||||
}
|
||||
elseif ($value=='')
|
||||
{
|
||||
$this->array_options[$key] = null;
|
||||
$new_array_options[$key] = null;
|
||||
}
|
||||
break;
|
||||
/*case 'select': // Not required, we chosed value='0' for undefined values
|
||||
@@ -4304,13 +4307,13 @@ abstract class CommonObject
|
||||
}
|
||||
break;*/
|
||||
case 'price':
|
||||
$this->array_options[$key] = price2num($this->array_options[$key]);
|
||||
$new_array_options[$key] = price2num($this->array_options[$key]);
|
||||
break;
|
||||
case 'date':
|
||||
$this->array_options[$key]=$this->db->idate($this->array_options[$key]);
|
||||
$new_array_options[$key] = $this->db->idate($this->array_options[$key]);
|
||||
break;
|
||||
case 'datetime':
|
||||
$this->array_options[$key]=$this->db->idate($this->array_options[$key]);
|
||||
$new_array_options[$key] = $this->db->idate($this->array_options[$key]);
|
||||
break;
|
||||
case 'link':
|
||||
$param_list=array_keys($attributeParam ['options']);
|
||||
@@ -4326,7 +4329,7 @@ abstract class CommonObject
|
||||
if (is_numeric($value)) $res=$object->fetch($value);
|
||||
else $res=$object->fetch('',$value);
|
||||
|
||||
if ($res > 0) $this->array_options[$key]=$object->id;
|
||||
if ($res > 0) $new_array_options[$key]=$object->id;
|
||||
else
|
||||
{
|
||||
$this->error="Ref '".$value."' for object '".$object->element."' not found";
|
||||
@@ -4366,9 +4369,9 @@ abstract class CommonObject
|
||||
// Add field o fattribut
|
||||
if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate)
|
||||
{
|
||||
if ($this->array_options[$key] != '')
|
||||
if ($new_array_options[$key] != '')
|
||||
{
|
||||
$sql.=",'".$this->db->escape($this->array_options[$key])."'";
|
||||
$sql.=",'".$this->db->escape($new_array_options[$key])."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4556,12 +4559,16 @@ abstract class CommonObject
|
||||
{
|
||||
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
|
||||
}
|
||||
// Convert date into timestamp format
|
||||
// Convert date into timestamp format (value in memory must be a timestamp)
|
||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
||||
{
|
||||
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
|
||||
}
|
||||
|
||||
// Convert float submited string into real php numeric (value in memory must be a php numeric)
|
||||
if (in_array($extrafields->attribute_type[$key],array('price','double')))
|
||||
{
|
||||
$value = isset($_POST["options_".$key])?price2num($_POST["options_".$key]):$this->array_options['options_'.$key];
|
||||
}
|
||||
if($extrafields->attribute_required[$key])
|
||||
$label = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$label.'</span>';
|
||||
|
||||
@@ -5023,7 +5030,7 @@ abstract class CommonObject
|
||||
|
||||
if (!$notrigger) {
|
||||
// Call triggers
|
||||
$result=$this->call_trigger(strtoupper(get_class(self)).'_CREATE',$user);
|
||||
$result=$this->call_trigger(strtoupper(get_class($this)).'_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
@@ -5185,7 +5192,7 @@ abstract class CommonObject
|
||||
|
||||
if (! $error && ! $notrigger) {
|
||||
// Call triggers
|
||||
$result=$this->call_trigger(strtoupper(get_class(self)).'_MODIFY',$user);
|
||||
$result=$this->call_trigger(strtoupper(get_class($this)).'_MODIFY',$user);
|
||||
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
|
||||
// End call triggers
|
||||
}
|
||||
@@ -5216,7 +5223,7 @@ abstract class CommonObject
|
||||
if (! $error) {
|
||||
if (! $notrigger) {
|
||||
// Call triggers
|
||||
$result=$this->call_trigger(strtoupper(get_class(self)).'_DELETE', $user);
|
||||
$result=$this->call_trigger(strtoupper(get_class($this)).'_DELETE', $user);
|
||||
if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
@@ -83,11 +83,12 @@ class Conf
|
||||
$this->file = new stdClass();
|
||||
$this->db = new stdClass();
|
||||
$this->global = new stdClass();
|
||||
$this->mycompany = new stdClass();
|
||||
$this->admin = new stdClass();
|
||||
$this->mycompany = new stdClass();
|
||||
$this->admin = new stdClass();
|
||||
$this->user = new stdClass();
|
||||
$this->syslog = new stdClass();
|
||||
$this->browser = new stdClass();
|
||||
$this->medias = new stdClass();
|
||||
$this->multicompany = new stdClass();
|
||||
|
||||
//! Charset for HTML output and for storing data in memory
|
||||
@@ -96,7 +97,7 @@ class Conf
|
||||
// First level object
|
||||
// TODO Remove this part.
|
||||
$this->expedition_bon = new stdClass();
|
||||
$this->livraison_bon = new stdClass();
|
||||
$this->livraison_bon = new stdClass();
|
||||
$this->fournisseur = new stdClass();
|
||||
$this->product = new stdClass();
|
||||
$this->service = new stdClass();
|
||||
@@ -106,12 +107,12 @@ class Conf
|
||||
$this->propal = new stdClass();
|
||||
$this->facture = new stdClass();
|
||||
$this->contrat = new stdClass();
|
||||
$this->usergroup = new stdClass();
|
||||
$this->usergroup = new stdClass();
|
||||
$this->adherent = new stdClass();
|
||||
$this->bank = new stdClass();
|
||||
$this->notification = new stdClass();
|
||||
$this->mailing = new stdClass();
|
||||
$this->expensereport = new stdClass();
|
||||
$this->expensereport = new stdClass();
|
||||
}
|
||||
|
||||
|
||||
@@ -322,6 +323,10 @@ class Conf
|
||||
$this->propal->dir_output=$rootfordata."/propale";
|
||||
$this->propal->dir_temp=$rootfordata."/propale/temp";
|
||||
|
||||
// For medias storage
|
||||
$this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
|
||||
$this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp");
|
||||
|
||||
// Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
|
||||
|
||||
// Sous module bons d'expedition
|
||||
|
||||
@@ -64,7 +64,7 @@ class DiscountAbsolute
|
||||
* @param int $fk_facture_source fk_facture_source
|
||||
* @return int <0 if KO, =0 if not found, >0 if OK
|
||||
*/
|
||||
function fetch($rowid,$fk_facture_source=0)
|
||||
function fetch($rowid, $fk_facture_source=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -78,6 +78,7 @@ class DiscountAbsolute
|
||||
$sql = "SELECT sr.rowid, sr.fk_soc,";
|
||||
$sql.= " sr.fk_user,";
|
||||
$sql.= " sr.amount_ht, sr.amount_tva, sr.amount_ttc, sr.tva_tx,";
|
||||
$sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,";
|
||||
$sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.description,";
|
||||
$sql.= " sr.datec,";
|
||||
$sql.= " f.facnumber as ref_facture_source";
|
||||
@@ -97,9 +98,15 @@ class DiscountAbsolute
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
|
||||
$this->amount_ht = $obj->amount_ht;
|
||||
$this->amount_tva = $obj->amount_tva;
|
||||
$this->amount_ttc = $obj->amount_ttc;
|
||||
|
||||
$this->multicurrency_amount_ht = $obj->multicurrency_amount_ht;
|
||||
$this->multicurrency_amount_tva = $obj->multicurrency_amount_tva;
|
||||
$this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc;
|
||||
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
$this->fk_user = $obj->fk_user;
|
||||
$this->fk_facture_line = $obj->fk_facture_line;
|
||||
@@ -386,7 +393,7 @@ class DiscountAbsolute
|
||||
function getSumDepositsUsed($invoice, $multicurrency=0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG);
|
||||
|
||||
|
||||
if ($invoice->element == 'facture' || $invoice->element == 'invoice')
|
||||
{
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
@@ -407,7 +414,7 @@ class DiscountAbsolute
|
||||
dol_print_error($this->error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -432,7 +439,7 @@ class DiscountAbsolute
|
||||
function getSumCreditNotesUsed($invoice, $multicurrency=0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG);
|
||||
|
||||
|
||||
if ($invoice->element == 'facture' || $invoice->element == 'invoice')
|
||||
{
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
@@ -453,7 +460,7 @@ class DiscountAbsolute
|
||||
dol_print_error($this->error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <forian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.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
|
||||
@@ -737,7 +738,7 @@ class ExtraFields
|
||||
* Return HTML string to put an input field into a page
|
||||
*
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Preselected value to show (for date type it must be in timestamp format)
|
||||
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
|
||||
* @param string $moreparam To add more parametes on html input tag
|
||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
@@ -770,24 +771,24 @@ class ExtraFields
|
||||
|
||||
if (empty($showsize))
|
||||
{
|
||||
if ($type == 'date')
|
||||
if ($type == 'date')
|
||||
{
|
||||
//$showsize=10;
|
||||
$showsize = 'minwidth100imp';
|
||||
}
|
||||
elseif ($type == 'datetime')
|
||||
elseif ($type == 'datetime')
|
||||
{
|
||||
//$showsize=19;
|
||||
$showsize = 'minwidth200imp';
|
||||
}
|
||||
elseif (in_array($type,array('int','double')))
|
||||
elseif (in_array($type,array('int','double','price')))
|
||||
{
|
||||
//$showsize=10;
|
||||
$showsize = 'minwidth100imp';
|
||||
$showsize = 'maxwidth75';
|
||||
}
|
||||
elseif ($type == 'url')
|
||||
{
|
||||
$showsize='minwidth400imp';
|
||||
$showsize='minwidth400';
|
||||
}
|
||||
elseif ($type == 'boolean')
|
||||
{
|
||||
@@ -797,16 +798,16 @@ class ExtraFields
|
||||
{
|
||||
if (round($size) < 12)
|
||||
{
|
||||
$showsize = 'minwidth100imp';
|
||||
$showsize = 'minwidth100';
|
||||
}
|
||||
else if (round($size) <= 48)
|
||||
{
|
||||
$showsize = 'minwidth200imp';
|
||||
$showsize = 'minwidth200';
|
||||
}
|
||||
else
|
||||
{
|
||||
//$showsize=48;
|
||||
$showsize = 'minwidth400imp';
|
||||
$showsize = 'minwidth400';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -832,7 +833,7 @@ class ExtraFields
|
||||
{
|
||||
$tmp=explode(',',$size);
|
||||
$newsize=$tmp[0];
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" " maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'varchar')
|
||||
{
|
||||
@@ -860,11 +861,14 @@ class ExtraFields
|
||||
}
|
||||
elseif ($type == 'price')
|
||||
{
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.price2num($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||
$value=price($value);
|
||||
}
|
||||
$out.='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
}
|
||||
elseif ($type == 'double')
|
||||
{
|
||||
if (!empty($value)) {
|
||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||
$value=price($value);
|
||||
}
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||
@@ -1062,13 +1066,13 @@ class ExtraFields
|
||||
$form = new Form($db);
|
||||
|
||||
$value_arr=explode(',',$value);
|
||||
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, $param['options'], $value_arr, '', 0, '', 0, '100%');
|
||||
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
|
||||
|
||||
}
|
||||
elseif ($type == 'radio')
|
||||
{
|
||||
$out='';
|
||||
foreach ($param['options'] as $keyopt=>$val )
|
||||
foreach ($param['options'] as $keyopt => $val)
|
||||
{
|
||||
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
|
||||
$out.=' value="'.$keyopt.'"';
|
||||
|
||||
@@ -1918,7 +1918,7 @@ class Form
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
if (count($warehouseStatusArray))
|
||||
{
|
||||
$sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.implode(',',$warehouseStatusArray).'))';
|
||||
$sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.$this->db->escape(implode(',',$warehouseStatusArray)).'))';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
|
||||
@@ -3274,7 +3274,7 @@ class Form
|
||||
|
||||
$return= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
|
||||
$sql = 'SELECT rowid, label from '.MAIN_DB_PREFIX.'c_units';
|
||||
$sql = 'SELECT rowid, label, code from '.MAIN_DB_PREFIX.'c_units';
|
||||
$sql.= ' WHERE active > 0';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -4296,7 +4296,7 @@ class Form
|
||||
*/
|
||||
function select_currency($selected='',$htmlname='currency_id')
|
||||
{
|
||||
print $this->selectcurrency($selected,$htmlname);
|
||||
print $this->selectCurrency($selected,$htmlname);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4306,35 +4306,40 @@ class Form
|
||||
* @param string $htmlname name of HTML select list
|
||||
* @return string
|
||||
*/
|
||||
function selectCurrency($selected='',$htmlname='currency_id')
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
function selectCurrency($selected='',$htmlname='currency_id')
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
$langs->loadCacheCurrencies('');
|
||||
$langs->loadCacheCurrencies('');
|
||||
|
||||
$out='';
|
||||
$out='';
|
||||
|
||||
if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite
|
||||
if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite
|
||||
|
||||
$out.= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
foreach ($langs->cache_currencies as $code_iso => $currency)
|
||||
{
|
||||
if ($selected && $selected == $code_iso)
|
||||
{
|
||||
$out.= '<option value="'.$code_iso.'" selected>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<option value="'.$code_iso.'">';
|
||||
}
|
||||
$out.= $currency['label'];
|
||||
$out.= ' ('.$langs->getCurrencySymbol($code_iso).')';
|
||||
$out.= '</option>';
|
||||
}
|
||||
$out.= '</select>';
|
||||
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
return $out;
|
||||
}
|
||||
$out.= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
foreach ($langs->cache_currencies as $code_iso => $currency)
|
||||
{
|
||||
if ($selected && $selected == $code_iso)
|
||||
{
|
||||
$out.= '<option value="'.$code_iso.'" selected>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<option value="'.$code_iso.'">';
|
||||
}
|
||||
$out.= $currency['label'];
|
||||
$out.= ' ('.$langs->getCurrencySymbol($code_iso).')';
|
||||
$out.= '</option>';
|
||||
}
|
||||
$out.= '</select>';
|
||||
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
|
||||
// Make select dynamic
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of currencies in user language
|
||||
@@ -5495,6 +5500,8 @@ class Form
|
||||
print '<br><!-- showLinkedObjectBlock -->';
|
||||
print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder allwidth">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -5588,6 +5595,7 @@ class Form
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
return $nbofdifferenttypes;
|
||||
}
|
||||
@@ -5632,8 +5640,8 @@ class Form
|
||||
'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
|
||||
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
|
||||
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
|
||||
'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
|
||||
'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')')
|
||||
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
|
||||
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -155,16 +155,18 @@ class FormActions
|
||||
* @param int $socid socid of user
|
||||
* @param int $forceshowtitle Show title even if there is no actions to show
|
||||
* @param string $morecss More css on table
|
||||
* @param int $max Max number of record
|
||||
* @param string $moreparambacktopage More param for the backtopage
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function showactions($object,$typeelement,$socid=0,$forceshowtitle=0,$morecss='listactions')
|
||||
function showactions($object, $typeelement, $socid=0, $forceshowtitle=0, $morecss='listactions', $max=0, $moreparambacktopage='')
|
||||
{
|
||||
global $langs,$conf,$user;
|
||||
global $bc;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement);
|
||||
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', '', '', ($max?($max+1):0));
|
||||
if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions');
|
||||
|
||||
$num = count($listofactions);
|
||||
@@ -177,12 +179,15 @@ class FormActions
|
||||
elseif ($typeelement == 'supplier_proposal') $title=$langs->trans('ActionsOnSupplierProposal');
|
||||
elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
||||
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title=$langs->trans('ActionsOnOrder');
|
||||
elseif ($typeelement == 'project') $title=$langs->trans('ActionsOnProject');
|
||||
elseif ($typeelement == 'shipping') $title=$langs->trans('ActionsOnShipping');
|
||||
elseif ($typeelement == 'fichinter') $title=$langs->trans('ActionsOnFicheInter');
|
||||
else $title=$langs->trans("Actions");
|
||||
elseif ($typeelement == 'project') $title=$langs->trans('LatestLinkedEvents', $max?$max:'');
|
||||
elseif ($typeelement == 'task') $title=$langs->trans('LatestLinkedEvents', $max?$max:'');
|
||||
else $title=$langs->trans("Actions");
|
||||
|
||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.'&socid='.$object->socid.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id).'">';
|
||||
$urlbacktopage=$_SERVER['PHP_SELF'].'?id='.$object->id.($moreparambacktopage?'&'.$moreparambacktopage:'');
|
||||
|
||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.'&socid='.$object->socid.'&projectid='.$object->fk_project.'&backtopage='.urlencode($urlbacktopage).'">';
|
||||
$buttontoaddnewevent.= $langs->trans("AddEvent");
|
||||
$buttontoaddnewevent.= '</a>';
|
||||
print load_fiche_titre($title, $buttontoaddnewevent, '');
|
||||
@@ -197,7 +202,7 @@ class FormActions
|
||||
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Action', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', $page, $param, 'align="center"');
|
||||
print_liste_field_titre('By', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"');
|
||||
print '</tr>';
|
||||
@@ -205,8 +210,11 @@ class FormActions
|
||||
|
||||
$userstatic = new User($this->db);
|
||||
|
||||
$cursorevent = 0;
|
||||
foreach($listofactions as $action)
|
||||
{
|
||||
if ($max && $cursorevent >= $max) break;
|
||||
|
||||
$ref=$action->getNomUrl(1,-1);
|
||||
$label=$action->getNomUrl(0,38);
|
||||
|
||||
@@ -226,7 +234,7 @@ class FormActions
|
||||
}
|
||||
print $action->type;
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($action->datep,'dayhour');
|
||||
print '<td align="center">'.dol_print_date($action->datep,'dayhour');
|
||||
if ($action->datef)
|
||||
{
|
||||
$tmpa=dol_getdate($action->datep);
|
||||
@@ -254,7 +262,15 @@ class FormActions
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$cursorevent++;
|
||||
}
|
||||
|
||||
if ($max && $num > $max)
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="6">'.$langs->trans("More").'...</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ function limitChars(textarea, limit, infodiv)
|
||||
{
|
||||
if ($this->withfromreadonly)
|
||||
{
|
||||
print '<tr><td class="'.$morecss.'">'.$langs->trans("SmsFrom");
|
||||
print '<tr><td class="titlefield '.$morecss.'">'.$langs->trans("SmsFrom");
|
||||
print '<input type="hidden" name="fromsms" value="'.$this->fromsms.'">';
|
||||
print "</td><td>";
|
||||
if ($this->fromtype == 'user')
|
||||
@@ -223,7 +223,7 @@ function limitChars(textarea, limit, infodiv)
|
||||
|
||||
if (is_array($resultsender) && count($resultsender) > 0)
|
||||
{
|
||||
print '<select name="fromsms" id="valid" class="flat">';
|
||||
print '<select name="fromsms" id="fromsms" class="flat">';
|
||||
foreach($resultsender as $obj)
|
||||
{
|
||||
print '<option value="'.$obj->number.'">'.$obj->number.'</option>';
|
||||
@@ -244,7 +244,7 @@ function limitChars(textarea, limit, infodiv)
|
||||
// To (target)
|
||||
if ($this->withto || is_array($this->withto))
|
||||
{
|
||||
print '<tr><td width="180">';
|
||||
print '<tr><td>';
|
||||
//$moretext=$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients");
|
||||
$moretext='';
|
||||
print $form->textwithpicto($langs->trans("SmsTo"),$moretext);
|
||||
@@ -285,7 +285,7 @@ function limitChars(textarea, limit, infodiv)
|
||||
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
|
||||
|
||||
print "<tr>";
|
||||
print "<td width=\"180\" valign=\"top\">".$langs->trans("SmsText")."</td>";
|
||||
print '<td class="tdtop">'.$langs->trans("SmsText")."</td>";
|
||||
print "<td>";
|
||||
if ($this->withbodyreadonly)
|
||||
{
|
||||
@@ -306,7 +306,7 @@ function limitChars(textarea, limit, infodiv)
|
||||
<td> <input name="deferred" id="deferred" size="4" value="0"></td></tr>
|
||||
|
||||
<tr><td>'.$langs->trans("Priority").' :</td><td>
|
||||
<select name="priority" id="valid" class="flat">
|
||||
<select name="priority" id="priority" class="flat">
|
||||
<option value="0">high</option>
|
||||
<option value="1">medium</option>
|
||||
<option value="2" selected>low</option>
|
||||
@@ -314,11 +314,17 @@ function limitChars(textarea, limit, infodiv)
|
||||
</select></td></tr>
|
||||
|
||||
<tr><td>'.$langs->trans("Type").' :</td><td>
|
||||
<select name="class" id="valid" class="flat">
|
||||
<select name="class" id="class" class="flat">
|
||||
<option value="0">Flash</option>
|
||||
<option value="1" selected>Standard</option>
|
||||
<option value="2">SIM</option>
|
||||
<option value="3">ToolKit</option>
|
||||
</select></td></tr>
|
||||
|
||||
<tr><td>'.$langs->trans("DisableStopIfSupported").' :</td><td>
|
||||
<select name="disablestop" id="disablestop" class="flat">
|
||||
<option value="0" selected>No</option>
|
||||
<option value="1" selected>Yes</option>
|
||||
</select></td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@@ -142,7 +142,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("Status");
|
||||
print ' </td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
|
||||
$formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2, 'minwidth100');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@@ -1446,7 +1446,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
}
|
||||
|
||||
// Status
|
||||
$out.='<td class="nowrap" align="center">'.$actionstatic->LibStatut($histo[$key]['percent'],3,1,$histo[$key]['datestart']).'</td>';
|
||||
$out.='<td class="nowrap" align="center">'.$actionstatic->LibStatut($histo[$key]['percent'],3,0,$histo[$key]['datestart']).'</td>';
|
||||
|
||||
// Actions
|
||||
$out.='<td></td>';
|
||||
|
||||
@@ -115,26 +115,28 @@ function getServerTimeZoneInt($refgmtdate='now')
|
||||
*/
|
||||
function dol_time_plus_duree($time, $duration_value, $duration_unit)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($duration_value == 0) return $time;
|
||||
if ($duration_unit == 'h') return $time + (3600*$duration_value);
|
||||
if ($duration_unit == 'w') return $time + (3600*24*7*$duration_value);
|
||||
|
||||
|
||||
$deltastring='P';
|
||||
|
||||
|
||||
if ($duration_value > 0){ $deltastring.=abs($duration_value); $sub= false; }
|
||||
if ($duration_value < 0){ $deltastring.=abs($duration_value); $sub= true; }
|
||||
if ($duration_unit == 'd') { $deltastring.="D"; }
|
||||
if ($duration_unit == 'm') { $deltastring.="M"; }
|
||||
if ($duration_unit == 'y') { $deltastring.="Y"; }
|
||||
|
||||
|
||||
$date = new DateTime();
|
||||
$date->setTimezone(new DateTimeZone('UTC'));
|
||||
if (! empty($conf->global->MAIN_DATE_IN_MEMORY_ARE_GMT)) $date->setTimezone(new DateTimeZone('UTC'));
|
||||
$date->setTimestamp($time);
|
||||
$interval = new DateInterval($deltastring);
|
||||
|
||||
|
||||
if($sub) $date->sub($interval);
|
||||
else $date->add( $interval );
|
||||
|
||||
|
||||
return $date->getTimestamp();
|
||||
}
|
||||
|
||||
|
||||
@@ -1386,19 +1386,17 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
||||
$destfull=$upload_dir . "/" . $TFile['name'][$i];
|
||||
$destfile=$TFile['name'][$i];
|
||||
|
||||
$savingdocmask = dol_sanitizeFileName($savingdocmask);
|
||||
|
||||
if ($savingdocmask)
|
||||
{
|
||||
$destfull=$upload_dir . "/" . preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask);
|
||||
$destfile=preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask);
|
||||
}
|
||||
|
||||
// lowercase extension
|
||||
// dol_sanitizeFileName the file name and lowercase extension
|
||||
$info = pathinfo($destfull);
|
||||
$destfull = $info['dirname'].'/'.$info['filename'].'.'.strtolower($info['extension']);
|
||||
$destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].'.'.strtolower($info['extension']));
|
||||
$info = pathinfo($destfile);
|
||||
$destfile = $info['filename'].'.'.strtolower($info['extension']);
|
||||
$destfile = dol_sanitizeFileName($info['filename'].'.'.strtolower($info['extension']));
|
||||
|
||||
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
|
||||
|
||||
@@ -1559,7 +1557,7 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an image file into anoher format.
|
||||
* Convert an image file into another format.
|
||||
* This need Imagick php extension.
|
||||
*
|
||||
* @param string $fileinput Input file name
|
||||
@@ -1567,14 +1565,19 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=
|
||||
* @param string $fileoutput Output filename
|
||||
* @return int <0 if KO, 0=Nothing done, >0 if OK
|
||||
*/
|
||||
function dol_convert_file($fileinput,$ext='png',$fileoutput='')
|
||||
function dol_convert_file($fileinput, $ext='png', $fileoutput='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (class_exists('Imagick'))
|
||||
{
|
||||
$image=new Imagick();
|
||||
$ret = $image->readImage($fileinput);
|
||||
try {
|
||||
$ret = $image->readImage($fileinput);
|
||||
} catch(Exception $e) {
|
||||
dol_syslog("Failed to read image using Imagick. Try to install package 'apt-get install ghostscript'.", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
if ($ret)
|
||||
{
|
||||
$ret = $image->setImageFormat($ext);
|
||||
@@ -1875,7 +1878,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
if ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
|
||||
$original_file=$conf->medias->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
|
||||
elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root))
|
||||
|
||||
@@ -680,7 +680,7 @@ function dol_size($size,$type='')
|
||||
*/
|
||||
function dol_sanitizeFileName($str,$newstr='_',$unaccent=1)
|
||||
{
|
||||
$filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"','°');
|
||||
$filesystem_forbidden_chars = array('<','>','/','\\','?','*','|','"','°');
|
||||
return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars);
|
||||
}
|
||||
|
||||
@@ -3251,7 +3251,12 @@ function dol_print_error($db='',$error='',$errors=null)
|
||||
}
|
||||
|
||||
if (empty($dolibarr_main_prod)) print $out;
|
||||
else define("MAIN_CORE_ERROR", 1);
|
||||
else
|
||||
{
|
||||
print $langs->trans("DolibarrHasDetectedError").'. ';
|
||||
print $langs->trans("YouCanSetOptionDolibarrMainProdToZero");
|
||||
define("MAIN_CORE_ERROR", 1);
|
||||
}
|
||||
//else print 'Sorry, an error occured but the parameter $dolibarr_main_prod is defined in conf file so no message is reported to your browser. Please read the log file for error message.';
|
||||
dol_syslog("Error ".$syslog, LOG_ERR);
|
||||
}
|
||||
@@ -3679,7 +3684,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
|
||||
* @param string $rate Rate value to format ('19.6', '19,6', '19.6%', '19,6%', '19.6 (CODEX)', ...)
|
||||
* @param boolean $addpercent Add a percent % sign in output
|
||||
* @param int $info_bits Miscellaneous information on vat (0=Default, 1=French NPR vat)
|
||||
* @param int $usestarfornpr 1=Use '*' for NPR vat rate intead of MAIN_LABEL_MENTION_NPR
|
||||
* @param int $usestarfornpr -1=Never show, 0 or 1=Use '*' for NPR vat rates
|
||||
* @return string String with formated amounts ('19,6' or '19,6%' or '8.5% (NPR)' or '8.5% *' or '19,6 (CODEX)')
|
||||
*/
|
||||
function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
|
||||
@@ -3706,10 +3711,10 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
|
||||
if (! preg_match('/\//', $rate)) $ret=price($rate,0,'',0,0).($addpercent?'%':'');
|
||||
else
|
||||
{
|
||||
// TODO Split on / and output with a price2num to have clean numbers with ton of 000.
|
||||
// TODO Split on / and output with a price2num to have clean numbers without ton of 000.
|
||||
$ret=$rate.($addpercent?'%':'');
|
||||
}
|
||||
if ($info_bits & 1) $ret.=' *';
|
||||
if (($info_bits & 1) && $usestarfornpr >= 0) $ret.=' *';
|
||||
$ret.=$morelabel;
|
||||
return $ret;
|
||||
}
|
||||
@@ -6185,7 +6190,7 @@ function dol_getmypid()
|
||||
* like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2
|
||||
* or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2
|
||||
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
|
||||
* If param $mode is 2, can contains a list of id separated by comma like "1,3,4"
|
||||
* If param $mode is 2, can contains a list of int id separated by comma like "1,3,4"
|
||||
* @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4')
|
||||
* @param integer $nofirstand 1=Do not output the first 'AND'
|
||||
* @return string $res The statement to append to the SQL query
|
||||
@@ -6194,6 +6199,8 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||
{
|
||||
global $db,$langs;
|
||||
|
||||
$value=trim($value);
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$value=preg_replace('/\*/','%',$value); // Replace * with %
|
||||
@@ -6254,29 +6261,39 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||
$i3 = 0;
|
||||
foreach($tmpcrits as $tmpcrit)
|
||||
{
|
||||
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '') . $field . " LIKE '";
|
||||
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '');
|
||||
|
||||
if (preg_match('/\.(id|rowid)$/', $field)) // Special cas for rowid that is sometimes a ref so used as a search field
|
||||
{
|
||||
$newres .= $field . " = " . (is_numeric(trim($tmpcrit))?trim($tmpcrit):'0');
|
||||
}
|
||||
else
|
||||
{
|
||||
$newres .= $field . " LIKE '";
|
||||
|
||||
$tmpcrit=trim($tmpcrit);
|
||||
$tmpcrit2=$tmpcrit;
|
||||
$tmpbefore='%'; $tmpafter='%';
|
||||
if (preg_match('/^[\^\$]/', $tmpcrit))
|
||||
{
|
||||
$tmpbefore='';
|
||||
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
|
||||
}
|
||||
if (preg_match('/[\^\$]$/', $tmpcrit))
|
||||
{
|
||||
$tmpafter='';
|
||||
$tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
|
||||
}
|
||||
$newres .= $tmpbefore;
|
||||
$newres .= $db->escape($tmpcrit2);
|
||||
$newres .= $tmpafter;
|
||||
$newres .= "'";
|
||||
if ($tmpcrit2 == '')
|
||||
{
|
||||
$newres .= ' OR ' . $field . " IS NULL";
|
||||
}
|
||||
}
|
||||
|
||||
$tmpcrit=trim($tmpcrit);
|
||||
$tmpcrit2=$tmpcrit;
|
||||
$tmpbefore='%'; $tmpafter='%';
|
||||
if (preg_match('/^[\^\$]/', $tmpcrit))
|
||||
{
|
||||
$tmpbefore='';
|
||||
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
|
||||
}
|
||||
if (preg_match('/[\^\$]$/', $tmpcrit))
|
||||
{
|
||||
$tmpafter='';
|
||||
$tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
|
||||
}
|
||||
$newres .= $tmpbefore;
|
||||
$newres .= $db->escape($tmpcrit2);
|
||||
$newres .= $tmpafter;
|
||||
$newres .= "'";
|
||||
if ($tmpcrit2 == '')
|
||||
{
|
||||
$newres .= ' OR ' . $field . " IS NULL";
|
||||
}
|
||||
$i3++;
|
||||
}
|
||||
$i2++; // a criteria was added to string
|
||||
|
||||
@@ -1780,6 +1780,11 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
|
||||
$module='ficheinter';
|
||||
$subelement='fichinter';
|
||||
}
|
||||
if ($objecttype == 'task') {
|
||||
$classpath = 'projet/class';
|
||||
$module='projet';
|
||||
$subelement='task';
|
||||
}
|
||||
|
||||
//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
|
||||
|
||||
@@ -2212,3 +2217,4 @@ function getModuleDirForApiClass($module)
|
||||
|
||||
return $moduledirforclass;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,12 +42,11 @@ if (! function_exists('json_encode'))
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
* @deprecated PHP >= 5.3 supports native json_encode
|
||||
* @see json_encode()
|
||||
*/
|
||||
function dol_json_encode($elements)
|
||||
{
|
||||
dol_syslog('dol_json_encode() is deprecated. Please update your code to use native json_encode().', LOG_WARNING);
|
||||
dol_syslog("For better performance, enable the native json in your PHP", LOG_WARNING);
|
||||
|
||||
$num=0;
|
||||
if (is_object($elements)) // Count number of properties for an object
|
||||
@@ -226,12 +225,11 @@ if (! function_exists('json_decode'))
|
||||
* @param string $json Json encoded to PHP Object or Array
|
||||
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
|
||||
* @return mixed Object or Array or false on error
|
||||
* @deprecated PHP >= 5.3 supports native json_decode
|
||||
* @see json_decode()
|
||||
*/
|
||||
function dol_json_decode($json, $assoc=false)
|
||||
{
|
||||
dol_syslog('dol_json_decode() is deprecated. Please update your code to use native json_decode().', LOG_WARNING);
|
||||
dol_syslog("For better performance, enable the native json in your PHP", LOG_WARNING);
|
||||
|
||||
$comment = false;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
@@ -1491,25 +1491,26 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
$tmpresult='';
|
||||
|
||||
$tmpresult.=vatrate($object->lines[$i]->tva_tx, 1, $object->lines[$i]->info_bits, 1);
|
||||
if (empty($conf->PDF_MAIN_HIDE_SECOND_TAX))
|
||||
$tmpresult.=vatrate($object->lines[$i]->tva_tx, 0, $object->lines[$i]->info_bits, -1);
|
||||
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX))
|
||||
{
|
||||
if ($object->lines[$i]->localtax1_tx != 0)
|
||||
if ($object->lines[$i]->total_localtax1 != 0)
|
||||
{
|
||||
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
|
||||
else $tmpresult='';
|
||||
$tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx),1);
|
||||
$tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx), 0);
|
||||
}
|
||||
}
|
||||
if (empty($conf->PDF_MAIN_HIDE_THIRD_TAX))
|
||||
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX))
|
||||
{
|
||||
if ($object->lines[$i]->localtax2_tx != 0)
|
||||
if ($object->lines[$i]->total_localtax2 != 0)
|
||||
{
|
||||
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
|
||||
else $tmpresult='';
|
||||
$tmpresult.=vatrate(abs($object->lines[$i]->localtax2_tx),1);
|
||||
$tmpresult.=vatrate(abs($object->lines[$i]->localtax2_tx), 0);
|
||||
}
|
||||
}
|
||||
$tmpresult.= '%';
|
||||
|
||||
$result.=$tmpresult;
|
||||
}
|
||||
@@ -1820,6 +1821,8 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||
*/
|
||||
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
|
||||
{
|
||||
if (empty($hookmanager)) global $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
|
||||
* @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
|
||||
* @param double $multicurrency_tx Currency rate (1 by default)
|
||||
* @param double $pu_ht_devise Amount in currency
|
||||
* @return array [
|
||||
* @param double $pu_devise Amount in currency
|
||||
* @return array [
|
||||
* 0=total_ht,
|
||||
* 1=total_vat, (main vat only)
|
||||
* 2=total_ttc, (total_ht + main vat + local taxes)
|
||||
@@ -65,15 +65,16 @@
|
||||
* 10=total_tax2 for total_ht,
|
||||
* 11=pu_tax1 for pu_ht, !! should not be used
|
||||
* 12=pu_tax2 for pu_ht, !! should not be used
|
||||
* 13=!! should not be used
|
||||
* 13=?? !! should not be used
|
||||
* 14=total_tax1 for total_ht_without_discount,
|
||||
* 15=total_tax2 for total_ht_without_discount]
|
||||
* 15=total_tax2 for total_ht_without_discount,
|
||||
*
|
||||
* 16=multicurrency_total_ht
|
||||
* 17=multicurrency_total_tva
|
||||
* 18=multicurrency_total_ttc
|
||||
* 19=multicurrency_pu_ht
|
||||
*/
|
||||
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1, $pu_ht_devise=0)
|
||||
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1, $pu_devise=0)
|
||||
{
|
||||
global $conf,$mysoc,$db;
|
||||
|
||||
@@ -101,10 +102,10 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
//dol_syslog("Price.lib::calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$ice_base_type.' type='.$type.' progress='.$progress);
|
||||
|
||||
$countryid=$seller->country_id;
|
||||
|
||||
|
||||
if (is_numeric($uselocaltax1_rate)) $uselocaltax1_rate=(float) $uselocaltax1_rate;
|
||||
if (is_numeric($uselocaltax2_rate)) $uselocaltax2_rate=(float) $uselocaltax2_rate;
|
||||
|
||||
|
||||
if ($uselocaltax1_rate < 0) $uselocaltax1_rate=$seller->localtax1_assuj;
|
||||
if ($uselocaltax2_rate < 0) $uselocaltax2_rate=$seller->localtax2_assuj;
|
||||
|
||||
@@ -143,14 +144,15 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// pu calculation from pu_devise if pu empty
|
||||
if(empty($pu) && !empty($pu_ht_devise)) {
|
||||
$pu = $pu_ht_devise / $multicurrency_tx;
|
||||
} else {
|
||||
$pu_ht_devise = $pu * $multicurrency_tx;
|
||||
if(empty($pu) && !empty($pu_devise)) {
|
||||
$pu = $pu_devise / $multicurrency_tx;
|
||||
}
|
||||
|
||||
if(empty($pu_devise) && !empty($multicurrency_tx)) {
|
||||
$pu_devise = $pu * $multicurrency_tx;
|
||||
}
|
||||
|
||||
// initialize total (may be HT or TTC depending on price_base_type)
|
||||
$tot_sans_remise = $pu * $qty * $progress / 100;
|
||||
$tot_avec_remise_ligne = $tot_sans_remise * (1 - ($remise_percent_ligne / 100));
|
||||
@@ -338,13 +340,47 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
$result[10]=round($result[10]/$conf->global->MAIN_ROUNDING_RULE_TOT, 0)*$conf->global->MAIN_ROUNDING_RULE_TOT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Multicurrency
|
||||
$result[16] = price2num($result[0] * $multicurrency_tx, 'MT');
|
||||
$result[17] = price2num($result[1] * $multicurrency_tx, 'MT');
|
||||
$result[18] = price2num($result[2] * $multicurrency_tx, 'MT');
|
||||
$result[19] = price2num($pu_ht_devise, 'MU');
|
||||
|
||||
if ($multicurrency_tx != 1)
|
||||
{
|
||||
// Recal function using the multicurrency price as reference price. We must set param $multicurrency_tx to 1 to avoid infinite loop.
|
||||
$newresult = calcul_price_total($qty, $pu_devise, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller, $localtaxes_array, $progress, 1, 0);
|
||||
|
||||
$result[16] = $newresult[0];
|
||||
$result[17] = $newresult[1];
|
||||
$result[18] = $newresult[2];
|
||||
$result[19] = $newresult[3];
|
||||
$result[20] = $newresult[4];
|
||||
$result[21] = $newresult[5];
|
||||
$result[22] = $newresult[6];
|
||||
$result[23] = $newresult[7];
|
||||
$result[24] = $newresult[8];
|
||||
$result[25] = $newresult[9];
|
||||
$result[26] = $newresult[10];
|
||||
/*
|
||||
$result[16] = price2num($result[0] * $multicurrency_tx, 'MT');
|
||||
$result[17] = price2num($result[1] * $multicurrency_tx, 'MT');
|
||||
$result[18] = price2num($result[2] * $multicurrency_tx, 'MT');
|
||||
$result[19] = price2num($pu_devise, 'MU');
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
$result[16] = $result[0];
|
||||
$result[17] = $result[1];
|
||||
$result[18] = $result[2];
|
||||
$result[19] = $result[3];
|
||||
$result[20] = $result[4];
|
||||
$result[21] = $result[5];
|
||||
$result[22] = $result[6];
|
||||
$result[23] = $result[7];
|
||||
$result[24] = $result[8];
|
||||
$result[25] = $result[9];
|
||||
$result[26] = $result[10];
|
||||
}
|
||||
|
||||
//var_dump($result);
|
||||
// initialize result array
|
||||
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];
|
||||
|
||||
|
||||
@@ -640,12 +640,6 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||
print "</td>";
|
||||
|
||||
// Ref
|
||||
print '<td>';
|
||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
||||
print $taskstatic->getNomUrl(1,'withproject');
|
||||
print '</td>';
|
||||
|
||||
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
|
||||
{
|
||||
// Thirdparty
|
||||
@@ -656,6 +650,12 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
print '<td>';
|
||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
||||
print $taskstatic->getNomUrl(1, 'withproject', 'time');
|
||||
print '</td>';
|
||||
|
||||
// Label task
|
||||
print "<td>";
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
@@ -663,7 +663,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
$taskstatic->ref=$lines[$i]->label;
|
||||
$taskstatic->date_start=$lines[$i]->date_start;
|
||||
$taskstatic->date_end=$lines[$i]->date_end;
|
||||
print $taskstatic->getNomUrl(0,'withproject');
|
||||
print $taskstatic->getNomUrl(0, 'withproject', 'time');
|
||||
//print "<br>";
|
||||
//for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
||||
|
||||
@@ -288,16 +288,16 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3603__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
|
||||
-- Project - Categories
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3200__+MAX_llx_menu__, '/categories/card.php?action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
|
||||
-- Tools
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__);
|
||||
|
||||
@@ -266,7 +266,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
{
|
||||
// url = url from host, shorturl = relative path into dolibarr sources
|
||||
$url = $shorturl = $newTabMenu[$i]['url'];
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) // Do not change url content for external links
|
||||
{
|
||||
$tmp=explode('?',$newTabMenu[$i]['url'],2);
|
||||
$url = $shorturl = $tmp[0];
|
||||
@@ -301,7 +301,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
foreach($menu->liste as $menkey => $menuval)
|
||||
{
|
||||
if (empty($noout)) print_start_menu_entry($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
|
||||
if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
|
||||
if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], (($menuval['url']!='#' && !preg_match('/^(http:\/\/|https:\/\/)/i', $menuval['url'])) ? DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
|
||||
if (empty($noout)) print_end_menu_entry($menuval['enabled']);
|
||||
}
|
||||
|
||||
@@ -1426,8 +1426,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate",$langs->trans("MenuMembersNotUpToDate"),2,$user->rights->adherent->lire);
|
||||
$newmenu->add("/adherents/list.php?leftmenu=members&statut=0",$langs->trans("MenuMembersResiliated"),2,$user->rights->adherent->lire);
|
||||
$newmenu->add("/adherents/stats/index.php?leftmenu=members",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire);
|
||||
if (! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="export") $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export);
|
||||
if (! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu=='none' || $leftmenu=="members" || $leftmenu=="export")) $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export);
|
||||
$newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export);
|
||||
|
||||
$newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire);
|
||||
$newmenu->add("/adherents/list.php?leftmenu=members&statut=-1,1&mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user